CalculusWithJuliaNotes.jl/quarto/0e7f54ed/precalc/rational_functions.html
2022-08-11 13:15:19 -04:00

2363 lines
161 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
<meta charset="utf-8">
<meta name="generator" content="quarto-1.0.32">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>Calculus with Julia - 14&nbsp; Rational functions</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>
<script src="../site_libs/quarto-nav/quarto-nav.js"></script>
<script src="../site_libs/quarto-nav/headroom.min.js"></script>
<script src="../site_libs/clipboard/clipboard.min.js"></script>
<script src="../site_libs/quarto-search/autocomplete.umd.js"></script>
<script src="../site_libs/quarto-search/fuse.min.js"></script>
<script src="../site_libs/quarto-search/quarto-search.js"></script>
<meta name="quarto:offset" content="../">
<link href="../precalc/exp_log_functions.html" rel="next">
<link href="../precalc/polynomials_package.html" rel="prev">
<script src="../site_libs/quarto-html/quarto.js"></script>
<script src="../site_libs/quarto-html/popper.min.js"></script>
<script src="../site_libs/quarto-html/tippy.umd.min.js"></script>
<script src="../site_libs/quarto-html/anchor.min.js"></script>
<link href="../site_libs/quarto-html/tippy.css" rel="stylesheet">
<link href="../site_libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
<script src="../site_libs/bootstrap/bootstrap.min.js"></script>
<link href="../site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
<link href="../site_libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
<script id="quarto-search-options" type="application/json">{
"location": "navbar",
"copy-button": false,
"collapse-after": 3,
"panel-placement": "end",
"type": "overlay",
"limit": 20,
"language": {
"search-no-results-text": "No results",
"search-matching-documents-text": "matching documents",
"search-copy-link-title": "Copy link to search",
"search-hide-matches-text": "Hide additional matches",
"search-more-match-text": "more match in this document",
"search-more-matches-text": "more matches in this document",
"search-clear-button-title": "Clear",
"search-detached-cancel-button-title": "Cancel",
"search-submit-button-title": "Submit"
}
}</script>
<script async="" src="https://hypothes.is/embed.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" integrity="sha512-c3Nl8+7g4LMSTdrm621y7kf9v3SDPnhxLNhcjFJbKECVnmZHTdo+IRO05sNLTH/D3vA6u1X32ehoLC7WFVdheg==" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" integrity="sha512-bLT0Qm9VnAYZDflyKcBaQ2gg0hSYNQrJ8RilYldYQ1FxQYoCLtUjuuRuZo+fjqhx/qtq/1itJ0C2ejDxltZVFg==" crossorigin="anonymous"></script>
<script type="application/javascript">define('jquery', [],function() {return window.jQuery;})</script>
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js" type="text/javascript"></script>
</head>
<body class="nav-sidebar floating nav-fixed">
<div id="quarto-search-results"></div>
<header id="quarto-header" class="headroom fixed-top">
<nav class="navbar navbar-expand-lg navbar-dark ">
<div class="navbar-container container-fluid">
<a class="navbar-brand" href="../index.html">
<img src="../logo.png" alt="">
<span class="navbar-title">Calculus with Julia</span>
</a>
<div id="quarto-search" class="" title="Search"></div>
</div> <!-- /container-fluid -->
</nav>
<nav class="quarto-secondary-nav" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
<div class="container-fluid d-flex justify-content-between">
<h1 class="quarto-secondary-nav-title"><span class="chapter-number">14</span>&nbsp; <span class="chapter-title">Rational functions</span></h1>
<button type="button" class="quarto-btn-toggle btn" aria-label="Show secondary navigation">
<i class="bi bi-chevron-right"></i>
</button>
</div>
</nav>
</header>
<!-- content -->
<div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar">
<!-- sidebar -->
<nav id="quarto-sidebar" class="sidebar collapse sidebar-navigation floating overflow-auto">
<div class="mt-2 flex-shrink-0 align-items-center">
<div class="sidebar-search">
<div id="quarto-search" class="" title="Search"></div>
</div>
</div>
<div class="sidebar-menu-container">
<ul class="list-unstyled mt-1">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../index.html" class="sidebar-item-text sidebar-link">Preface</a>
</div>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" aria-expanded="true">Precalculus Concepts</a>
<a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" aria-expanded="true">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-1" class="collapse list-unstyled sidebar-section depth1 show">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/calculator.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">From calculator to computer</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/variables.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">2</span>&nbsp; <span class="chapter-title">Variables</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/numbers_types.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">3</span>&nbsp; <span class="chapter-title">Number systems</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/logical_expressions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">4</span>&nbsp; <span class="chapter-title">Inequalities, Logical expressions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/vectors.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">5</span>&nbsp; <span class="chapter-title">Vectors</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/ranges.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">6</span>&nbsp; <span class="chapter-title">Ranges and Sets</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/functions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">7</span>&nbsp; <span class="chapter-title">Functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/plotting.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">8</span>&nbsp; <span class="chapter-title">The Graph of a Function</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/transformations.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">9</span>&nbsp; <span class="chapter-title">Function manipulations</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/inversefunctions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">10</span>&nbsp; <span class="chapter-title">The Inverse of a Function</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/polynomial.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">11</span>&nbsp; <span class="chapter-title">Polynomials</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/polynomial_roots.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Roots of a polynomial</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/polynomials_package.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">The Polynomials package</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/rational_functions.html" class="sidebar-item-text sidebar-link active"><span class="chapter-number">14</span>&nbsp; <span class="chapter-title">Rational functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/exp_log_functions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">15</span>&nbsp; <span class="chapter-title">Exponential and logarithmic functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/trig_functions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">16</span>&nbsp; <span class="chapter-title">Trigonometric functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/julia_overview.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">17</span>&nbsp; <span class="chapter-title">Overview of Julia commands</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-2" aria-expanded="false">Limits</a>
<a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-2" aria-expanded="false">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-2" class="collapse list-unstyled sidebar-section depth1 ">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../limits/limits.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">18</span>&nbsp; <span class="chapter-title">Limits</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../limits/limits_extensions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">19</span>&nbsp; <span class="chapter-title">Limits, issues, extensions of the concept</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../limits/continuity.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">20</span>&nbsp; <span class="chapter-title">Continuity</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../limits/intermediate_value_theorem.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">21</span>&nbsp; <span class="chapter-title">Implications of continuity</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-3" aria-expanded="false">Derivatives</a>
<a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-3" aria-expanded="false">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-3" class="collapse list-unstyled sidebar-section depth1 ">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/derivatives.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">22</span>&nbsp; <span class="chapter-title">Derivatives</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/numeric_derivatives.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">23</span>&nbsp; <span class="chapter-title">Numeric derivatives</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/symbolic_derivatives.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">24</span>&nbsp; <span class="chapter-title">Symbolic derivatives</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/mean_value_theorem.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">25</span>&nbsp; <span class="chapter-title">The mean value theorem for differentiable functions.</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/optimization.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">26</span>&nbsp; <span class="chapter-title">Optimization</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/first_second_derivatives.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">27</span>&nbsp; <span class="chapter-title">The first and second derivatives</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/curve_sketching.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">28</span>&nbsp; <span class="chapter-title">Curve Sketching</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/linearization.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">29</span>&nbsp; <span class="chapter-title">Linearization</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/newtons_method.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">30</span>&nbsp; <span class="chapter-title">Newtons method</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/more_zeros.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">31</span>&nbsp; <span class="chapter-title">Derivative-free alternatives to Newtons method</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/lhospitals_rule.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">32</span>&nbsp; <span class="chapter-title">LHospitals Rule</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/implicit_differentiation.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">33</span>&nbsp; <span class="chapter-title">Implicit Differentiation</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/related_rates.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">34</span>&nbsp; <span class="chapter-title">Related rates</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/taylor_series_polynomials.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">35</span>&nbsp; <span class="chapter-title">Taylor Polynomials and other Approximating Polynomials</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-4" aria-expanded="false">Integrals</a>
<a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-4" aria-expanded="false">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-4" class="collapse list-unstyled sidebar-section depth1 ">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/area.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">36</span>&nbsp; <span class="chapter-title">Area under a curve</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/ftc.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">37</span>&nbsp; <span class="chapter-title">Fundamental Theorem or Calculus</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/substitution.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">38</span>&nbsp; <span class="chapter-title">Substitution</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/integration_by_parts.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">39</span>&nbsp; <span class="chapter-title">Integration By Parts</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/partial_fractions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">40</span>&nbsp; <span class="chapter-title">Partial Fractions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/improper_integrals.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">41</span>&nbsp; <span class="chapter-title">Improper Integrals</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/mean_value_theorem.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">42</span>&nbsp; <span class="chapter-title">Mean value theorem for integrals</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/area_between_curves.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">43</span>&nbsp; <span class="chapter-title">Area between two curves</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/center_of_mass.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">44</span>&nbsp; <span class="chapter-title">Center of Mass</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/volumes_slice.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">45</span>&nbsp; <span class="chapter-title">Volumes by slicing</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/arc_length.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">46</span>&nbsp; <span class="chapter-title">Arc length</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/surface_area.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">47</span>&nbsp; <span class="chapter-title">Surface Area</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-5" aria-expanded="false">ODEs</a>
<a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-5" aria-expanded="false">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-5" class="collapse list-unstyled sidebar-section depth1 ">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../ODEs/odes.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">48</span>&nbsp; <span class="chapter-title">ODEs</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../ODEs/euler.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">49</span>&nbsp; <span class="chapter-title">Eulers method</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../ODEs/solve.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">50</span>&nbsp; <span class="chapter-title">The problem-algorithm-solve interface</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../ODEs/differential_equations.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">51</span>&nbsp; <span class="chapter-title">The <code>DifferentialEquations</code> suite</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-6" aria-expanded="false">Differential vector calculus</a>
<a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-6" aria-expanded="false">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-6" class="collapse list-unstyled sidebar-section depth1 ">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../differentiable_vector_calculus/polar_coordinates.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">52</span>&nbsp; <span class="chapter-title">Polar Coordinates and Curves</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../differentiable_vector_calculus/vectors.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">53</span>&nbsp; <span class="chapter-title">Vectors and matrices</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../differentiable_vector_calculus/vector_valued_functions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">54</span>&nbsp; <span class="chapter-title">Vector-valued functions, <span class="math inline">\(f:R \rightarrow R^n\)</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../differentiable_vector_calculus/scalar_functions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">55</span>&nbsp; <span class="chapter-title">Scalar functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../differentiable_vector_calculus/scalar_functions_applications.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">56</span>&nbsp; <span class="chapter-title">Applications with scalar functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../differentiable_vector_calculus/vector_fields.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">57</span>&nbsp; <span class="chapter-title">Functions <span class="math inline">\(R^n \rightarrow R^m\)</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../differentiable_vector_calculus/plots_plotting.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">58</span>&nbsp; <span class="chapter-title">2D and 3D plots in Julia with Plots</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-7" aria-expanded="false">Integral vector calculus</a>
<a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-7" aria-expanded="false">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-7" class="collapse list-unstyled sidebar-section depth1 ">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integral_vector_calculus/double_triple_integrals.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">59</span>&nbsp; <span class="chapter-title">Multi-dimensional integrals</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integral_vector_calculus/line_integrals.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">60</span>&nbsp; <span class="chapter-title">Line and Surface Integrals</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integral_vector_calculus/div_grad_curl.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">61</span>&nbsp; <span class="chapter-title">The Gradient, Divergence, and Curl</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integral_vector_calculus/stokes_theorem.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">62</span>&nbsp; <span class="chapter-title">Greens Theorem, Stokes Theorem, and the Divergence Theorem</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integral_vector_calculus/review.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">63</span>&nbsp; <span class="chapter-title">Quick Review of Vector Calculus</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-8" aria-expanded="false">Alternatives</a>
<a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-8" aria-expanded="false">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-8" class="collapse list-unstyled sidebar-section depth1 ">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../alternatives/plotly_plotting.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">64</span>&nbsp; <span class="chapter-title">JavaScript based plotting libraries</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../alternatives/makie_plotting.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">65</span>&nbsp; <span class="chapter-title">Calculus plots with Makie</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-9" aria-expanded="false">Appendices</a>
<a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-9" aria-expanded="false">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-9" class="collapse list-unstyled sidebar-section depth1 ">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../misc/getting_started_with_julia.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">66</span>&nbsp; <span class="chapter-title">Getting started with Julia</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../misc/julia_interfaces.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">67</span>&nbsp; <span class="chapter-title">Julia interfaces</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../misc/calculus_with_julia.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">68</span>&nbsp; <span class="chapter-title">The <code>CalculusWithJulia</code> package</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../misc/unicode.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">69</span>&nbsp; <span class="chapter-title">Usages of Unicode symbols</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../misc/quick_notes.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">70</span>&nbsp; <span class="chapter-title">Quick introduction to Calculus with Julia</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../references.html" class="sidebar-item-text sidebar-link">References</a>
</div>
</li>
</ul>
</div>
</nav>
<!-- margin-sidebar -->
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
<nav id="TOC" role="doc-toc">
<h2 id="toc-title">Table of contents</h2>
<ul>
<li><a href="#rational-functions" id="toc-rational-functions" class="nav-link active" data-scroll-target="#rational-functions"> <span class="header-section-number">14.1</span> Rational functions</a></li>
<li><a href="#asymptotes" id="toc-asymptotes" class="nav-link" data-scroll-target="#asymptotes"> <span class="header-section-number">14.2</span> Asymptotes</a>
<ul class="collapse">
<li><a href="#behaviour-as-x-rightarrow-infty-or-x-rightarrow--infty." id="toc-behaviour-as-x-rightarrow-infty-or-x-rightarrow--infty." class="nav-link" data-scroll-target="#behaviour-as-x-rightarrow-infty-or-x-rightarrow--infty."> <span class="header-section-number">14.2.1</span> Behaviour as <span class="math inline">\(x \rightarrow \infty\)</span> or <span class="math inline">\(x \rightarrow -\infty\)</span>.</a></li>
<li><a href="#examples" id="toc-examples" class="nav-link" data-scroll-target="#examples"> <span class="header-section-number">14.2.2</span> Examples</a></li>
<li><a href="#vertical-asymptotes" id="toc-vertical-asymptotes" class="nav-link" data-scroll-target="#vertical-asymptotes"> <span class="header-section-number">14.2.3</span> Vertical asymptotes</a></li>
<li><a href="#sign-charts" id="toc-sign-charts" class="nav-link" data-scroll-target="#sign-charts"> <span class="header-section-number">14.2.4</span> Sign charts</a></li>
</ul></li>
<li><a href="#pade-approximate" id="toc-pade-approximate" class="nav-link" data-scroll-target="#pade-approximate"> <span class="header-section-number">14.3</span> Pade approximate</a></li>
<li><a href="#the-polynomials-package-for-rational-functions" id="toc-the-polynomials-package-for-rational-functions" class="nav-link" data-scroll-target="#the-polynomials-package-for-rational-functions"> <span class="header-section-number">14.4</span> The <code>Polynomials</code> package for rational functions</a>
<ul class="collapse">
<li><a href="#the-realpolynomialroots-package." id="toc-the-realpolynomialroots-package." class="nav-link" data-scroll-target="#the-realpolynomialroots-package."> <span class="header-section-number">14.4.1</span> The <code>RealPolynomialRoots</code> package.</a></li>
</ul></li>
<li><a href="#questions" id="toc-questions" class="nav-link" data-scroll-target="#questions"> <span class="header-section-number">14.5</span> Questions</a></li>
</ul>
<div class="toc-actions"><div><i class="bi bi-github"></i></div><div class="action-links"><p><a href="https://github.com/jverzani/CalculusWithJuliaNotes.jl/edit/main/quarto/precalc/rational_functions.qmd" class="toc-action">Edit this page</a></p><p><a href="https://github.com/jverzani/CalculusWithJuliaNotes.jl/issues/new" class="toc-action">Report an issue</a></p></div></div></nav>
</div>
<!-- main -->
<main class="content" id="quarto-document-content">
<header id="title-block-header" class="quarto-title-block default">
<div class="quarto-title">
<h1 class="title d-none d-lg-block"><span class="chapter-number">14</span>&nbsp; <span class="chapter-title">Rational functions</span></h1>
</div>
<div class="quarto-title-meta">
</div>
</header>
<p>This section uses the following add-on packages:</p>
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="im">using</span> <span class="bu">CalculusWithJulia</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="im">using</span> <span class="bu">SymPy</span></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="im">using</span> <span class="bu">Plots</span></span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> <span class="bu">Polynomials</span></span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a><span class="im">using</span> <span class="bu">RealPolynomialRoots</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<p>The <code>Polynomials</code> package is “imported” to avoid naming collisions with <code>SymPy</code>; names will need to be qualified.</p>
<hr>
<p>A rational expression is the ratio of two polynomial expressions. Such expressions arise in many modeling situations. As many facts are known about polynomial expressions, much can be determined about rational expressions. This section covers some additional details that arise when graphing such expressions.</p>
<section id="rational-functions" class="level2" data-number="14.1">
<h2 data-number="14.1" class="anchored" data-anchor-id="rational-functions"><span class="header-section-number">14.1</span> Rational functions</h2>
<p>The rational numbers are simply ratios of integers, of the form <span class="math inline">\(p/q\)</span> for non-zero <span class="math inline">\(q\)</span>. A rational function is a ratio of <em>polynomial</em> <em>functions</em> of the form <span class="math inline">\(p(x)/q(x)\)</span>, again <span class="math inline">\(q\)</span> is non-zero, but may have zeros.</p>
<p>We know that polynomials have nice behaviors due to the following facts:</p>
<ul>
<li>Behaviors at <span class="math inline">\(-\infty\)</span>, <span class="math inline">\(\infty\)</span> are known just from the leading term.</li>
<li>There are possible wiggles up and down, the exact behavior depends on intermediate terms, but there can be no more than <span class="math inline">\(n-1\)</span> wiggles.</li>
<li>The number of real zeros is no more than <span class="math inline">\(n\)</span>, the degree of the polynomial.</li>
</ul>
<p>Rational functions are not quite so nice:</p>
<ul>
<li>behavior at <span class="math inline">\(-\infty\)</span> and <span class="math inline">\(\infty\)</span> can be like a polynomial of any degree, including constants</li>
<li>behaviour at any value x can blow up due to division by <span class="math inline">\(0\)</span> - rational functions, unlike polynomials, need not be always defined</li>
<li>The function may or may not cross zero, even if the range includes every other point, as the graph of <span class="math inline">\(f(x) =1/x\)</span> will show.</li>
</ul>
<p>Here, as with our discussion on polynomials, we are interested for now in just a few properties:</p>
<ul>
<li>What happens to <span class="math inline">\(f(x)\)</span> when <span class="math inline">\(x\)</span> gets really big or really small (towards <span class="math inline">\(\infty\)</span> or <span class="math inline">\(-\infty\)</span>)?</li>
<li>What happens near the values where <span class="math inline">\(q(x) = 0\)</span>?</li>
<li>When is <span class="math inline">\(f(x) = 0\)</span>?</li>
</ul>
<p>These questions can often be answered with a graph, but with rational functions we will see that care must be taken to produce a useful graph.</p>
<p>For example, consider this graph generated from a simple rational function:</p>
<p><span class="math display">\[
f(x) = \frac{(x-1)^2 \cdot (x-2)}{(x+3) \cdot (x-3)}.
\]</span></p>
<div class="cell" data-execution_count="4">
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="fu">f</span>(x) <span class="op">=</span> (x<span class="op">-</span><span class="fl">1</span>)<span class="op">^</span><span class="fl">2</span> <span class="op">*</span> (x<span class="op">-</span><span class="fl">2</span>) <span class="op">/</span> ((x<span class="op">+</span><span class="fl">3</span>)<span class="fu">*</span>(x<span class="op">-</span><span class="fl">3</span>) )</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(f, <span class="op">-</span><span class="fl">10</span>, <span class="fl">10</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="5">
<p><img src="rational_functions_files/figure-html/cell-5-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>We would be hard pressed to answer any of the three questions above from the graph, though, on inspection, we might think the strange spikes have something to do with <span class="math inline">\(x\)</span> values where <span class="math inline">\(q(x)=0\)</span>.</p>
<p>The question of big or small <span class="math inline">\(x\)</span> is not answered well with this graph, as the spikes dominate the scale of the <span class="math inline">\(y\)</span>-axis. Setting a much larger viewing window illuminates this question:</p>
<div class="cell" data-execution_count="5">
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(f, <span class="op">-</span><span class="fl">100</span>, <span class="fl">100</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="6">
<p><img src="rational_functions_files/figure-html/cell-6-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>We can see from this, that the function eventually looks like a slanted straight line. The <em>eventual</em> shape of the graph is something that can be determined just from the two leading terms.</p>
<p>The spikes havent vanished completely. It is just that with only a few hundred points to make the graph, there arent any values near enough to the problem to make a large spike. The spikes happen because the function has a <em>vertical asymptote</em> at these values. Though not quite right, it is reasonable to think of the graph being made by selecting a few hundred points in the specified domain, computing the corresponding <span class="math inline">\(y\)</span> values, plotting the pairs, and finally connecting the points with straight line segments. Near a vertical asymptote the function values can be arbitrarily large in absolute values, though at the vertical asymptote the function is undefined. This graph doesnt show such detail.</p>
<p>The spikes will be related to the points where <span class="math inline">\(q(x) = 0\)</span>, though not necessarily all of them not all such points will produce a vertical asymptote.</p>
<p>Where the function crosses <span class="math inline">\(0\)</span> is very hard to tell from these two graphs. As well, other finer features, such as local peaks or valleys, when present, can be hard to identify as the <span class="math inline">\(y\)</span>-scale is set to accommodate the asymptotes. Working around the asymptotes requires some extra effort. Strategies are discussed herein.</p>
</section>
<section id="asymptotes" class="level2" data-number="14.2">
<h2 data-number="14.2" class="anchored" data-anchor-id="asymptotes"><span class="header-section-number">14.2</span> Asymptotes</h2>
<p>Formally, an <a href="http://en.wikipedia.org/wiki/Asymptote">asymptote</a> of a curve is a line such that the distance between the curve and the line approaches <span class="math inline">\(0\)</span> as they tend to infinity. Tending to infinity can happen as <span class="math inline">\(x \rightarrow \pm \infty\)</span> <em>or</em> <span class="math inline">\(y \rightarrow \pm \infty\)</span>, the former being related to <em>horizontal asymptotes</em> or <em>slant asymptotes</em>, the latter being related to <em>vertical asymptotes</em>.</p>
<section id="behaviour-as-x-rightarrow-infty-or-x-rightarrow--infty." class="level3" data-number="14.2.1">
<h3 data-number="14.2.1" class="anchored" data-anchor-id="behaviour-as-x-rightarrow-infty-or-x-rightarrow--infty."><span class="header-section-number">14.2.1</span> Behaviour as <span class="math inline">\(x \rightarrow \infty\)</span> or <span class="math inline">\(x \rightarrow -\infty\)</span>.</h3>
<p>Lets look more closely at our example rational function using symbolic math.</p>
<p>In particular, lets rewrite the expression in terms of its numerator and denominator:</p>
<div class="cell" data-execution_count="6">
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="pp">@syms</span> x<span class="op">::</span><span class="dt">real</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a>num <span class="op">=</span> (x<span class="op">-</span><span class="fl">1</span>)<span class="op">^</span><span class="fl">2</span> <span class="op">*</span> (x<span class="op">-</span><span class="fl">2</span>)</span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a>den <span class="op">=</span> (x<span class="op">+</span><span class="fl">3</span>) <span class="op">*</span> (x<span class="op">-</span><span class="fl">3</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="7">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
\left(x - 3\right) \left(x + 3\right)
\]
</span>
</div>
</div>
<p>Euclids <a href="https://en.wikipedia.org/wiki/Polynomial_greatest_common_divisor#Euclidean_division">division</a> algorithm can be used for polynomials <span class="math inline">\(a(x)\)</span> and <span class="math inline">\(b(x)\)</span> to produce <span class="math inline">\(q(x)\)</span> and <span class="math inline">\(r(x)\)</span> with <span class="math inline">\(a = b\cdot q + r\)</span> <em>and</em> the degree of <span class="math inline">\(r(x)\)</span> is less than the degree of <span class="math inline">\(b(x)\)</span>. This is in direct analogy to the division algorithm of integers, only there the value of the remainder, <span class="math inline">\(r(x)\)</span>, satisfies <span class="math inline">\(0 \leq r &lt; b\)</span>. Given <span class="math inline">\(q(x)\)</span> and <span class="math inline">\(r(x)\)</span> as above, we can reexpress the rational function</p>
<p><span class="math display">\[
\frac{a(x)}{b(x)} = q(x) + \frac{r(x)}{b(x)}.
\]</span></p>
<p>The rational expression on the right-hand side has larger degree in the denominator.</p>
<p>The division algorithm is implemented in <code>Julia</code> generically through the <code>divrem</code> method:</p>
<div class="cell" data-execution_count="7">
<div class="sourceCode cell-code" id="cb5"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a>q, r <span class="op">=</span> <span class="fu">divrem</span>(num, den)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="8">
<pre><code>(x - 4, 14*x - 38)</code></pre>
</div>
</div>
<p>This yields the decomposition of <code>num/den</code>:</p>
<div class="cell" data-execution_count="8">
<div class="sourceCode cell-code" id="cb7"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a>q <span class="op">+</span> r<span class="op">/</span>den</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="9">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
x - 4 + \frac{14 x - 38}{\left(x - 3\right) \left(x + 3\right)}
\]
</span>
</div>
</div>
<p>A similar result can be found using the <code>apart</code> function, which can be easier to use if the expression is not given in terms of a separate numerator and denominator.</p>
<div class="cell" data-execution_count="9">
<div class="sourceCode cell-code" id="cb8"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="fu">g</span>(x) <span class="op">=</span> (x<span class="op">-</span><span class="fl">1</span>)<span class="op">^</span><span class="fl">2</span> <span class="op">*</span> (x<span class="op">-</span><span class="fl">2</span>) <span class="op">/</span> ((x<span class="op">+</span><span class="fl">3</span>)<span class="fu">*</span>(x<span class="op">-</span><span class="fl">3</span>)) <span class="co"># as a function</span></span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a>h <span class="op">=</span> <span class="fu">g</span>(x) <span class="co"># a symbolic expression</span></span>
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a><span class="fu">apart</span>(h)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="10">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
x - 4 + \frac{40}{3 \left(x + 3\right)} + \frac{2}{3 \left(x - 3\right)}
\]
</span>
</div>
</div>
<p>This decomposition breaks the rational expression into two pieces: <span class="math inline">\(x-4\)</span> and <span class="math inline">\(40/(3x+9) + 2/(3x-9)\)</span>. The first piece would have a graph that is the line with slope <span class="math inline">\(1\)</span> and <span class="math inline">\(y\)</span>-intercept <span class="math inline">\(4\)</span>. As <span class="math inline">\(x\)</span> goes to <span class="math inline">\(\infty\)</span>, the second piece will clearly go towards <span class="math inline">\(0,\)</span> as this simple graph shows:</p>
<div class="cell" data-execution_count="10">
<div class="sourceCode cell-code" id="cb9"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(<span class="fu">apart</span>(h) <span class="op">-</span> (x <span class="op">-</span> <span class="fl">4</span>), <span class="fl">10</span>, <span class="fl">100</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="11">
<p><img src="rational_functions_files/figure-html/cell-11-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>Similarly, a plot over <span class="math inline">\([-100, -10]\)</span> would show decay towards <span class="math inline">\(0\)</span>, though in that case from below. Combining these two facts then, it is now no surprise that the graph of the rational function <span class="math inline">\(f(x)\)</span> should approach a straight line, in this case <span class="math inline">\(y=x-4\)</span> as <span class="math inline">\(x \rightarrow \pm \infty\)</span>.</p>
<p>We can easily do most of this analysis without needing a computer or algebra. First, we should know the four eventual shapes of a polynomial, that the graph of <span class="math inline">\(y=mx\)</span> is a line with slope <span class="math inline">\(m\)</span>, the graph of <span class="math inline">\(y = c\)</span> is a constant line at height <span class="math inline">\(c\)</span>, and the graph of <span class="math inline">\(y=c/x^m\)</span>, <span class="math inline">\(m &gt; 0\)</span> will decay towards <span class="math inline">\(0\)</span> as <span class="math inline">\(x \rightarrow \pm\infty\)</span>. The latter should be clear, as <span class="math inline">\(x^m\)</span> gets big, so its reciprocal goes towards <span class="math inline">\(0\)</span>.</p>
<p>The factored form, as <span class="math inline">\(p\)</span> is presented, is a bit hard to work with, rather we use the expanded form, which we get through the <code>cancel</code> function</p>
<div class="cell" data-execution_count="11">
<div class="sourceCode cell-code" id="cb10"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cancel</span>(h)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="12">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
\frac{x^{3} - 4 x^{2} + 5 x - 2}{x^{2} - 9}
\]
</span>
</div>
</div>
<p>We can see that the numerator is of degree <span class="math inline">\(3\)</span> and the denominator of degree <span class="math inline">\(2\)</span>. The leading terms are <span class="math inline">\(x^3\)</span> and <span class="math inline">\(x^2\)</span>, respectively. If we were to pull those out we would get:</p>
<p><span class="math display">\[
\frac{x^3 \cdot (1 - 4/x + 5/x^2 - 2/x^3)}{x^2 \cdot (1 - 9/x^2)}.
\]</span></p>
<p>The terms <span class="math inline">\((1 - 4/x + 5/x^2 - 2/x^3)\)</span> and <span class="math inline">\((1 - 9/x^2)\)</span> go towards <span class="math inline">\(1\)</span> as <span class="math inline">\(x \rightarrow \pm \infty\)</span>, as each term with <span class="math inline">\(x\)</span> goes towards <span class="math inline">\(0\)</span>. So the dominant terms comes from the ratio of the leading terms, <span class="math inline">\(x^3\)</span> and <span class="math inline">\(x^2\)</span>. This ratio is <span class="math inline">\(x\)</span>, so their will be an asymptote around a line with slope <span class="math inline">\(1\)</span>. (The fact that the asymptote is <span class="math inline">\(y=x-4\)</span> takes a bit more work, as a division step is needed.)</p>
<p>Just by looking at the ratio of the two leading terms, the behaviour as <span class="math inline">\(x \rightarrow \pm \infty\)</span> can be discerned. If this ratio is of:</p>
<ul>
<li>the form <span class="math inline">\(c x^m\)</span> with <span class="math inline">\(m &gt; 1\)</span> then the shape will follow the polynomial growth of of the monomial <span class="math inline">\(c x^m\)</span>.</li>
<li>the form <span class="math inline">\(c x^m\)</span> with <span class="math inline">\(m=1\)</span> then there will be a line with slope <span class="math inline">\(c\)</span> as a <em>slant asymptote</em>.</li>
<li>the form <span class="math inline">\(cx^0\)</span> with <span class="math inline">\(m=0\)</span> (or just <span class="math inline">\(c\)</span>) then there will be a <em>horizontal asymptote</em> <span class="math inline">\(y=c\)</span>.</li>
<li>the form <span class="math inline">\(c/x^{m}\)</span> with <span class="math inline">\(m &gt; 0\)</span> then there will be a horizontal asymptote <span class="math inline">\(y=0\)</span>, or the <span class="math inline">\(y\)</span> axis.</li>
</ul>
<p>To expand on the first points where the degree of the numerator is greater than that of the denominator, we have from the division algorithm that if <span class="math inline">\(a(x)\)</span> is the numerator and <span class="math inline">\(b(x)\)</span> the denominator, then <span class="math inline">\(a(x)/b(x) = q(x) + r(x)/b(x)\)</span> where the degree of <span class="math inline">\(b(x)\)</span> is greater than the degree of <span class="math inline">\(r(x)\)</span>, so the right-most term will have a horizontal asymptote of <span class="math inline">\(0\)</span>. This says that the graph will eventually approach the graph of <span class="math inline">\(q(x)\)</span>, giving more detail than just saying it follows the shape of the leading term of <span class="math inline">\(q(x)\)</span>, at the expense of the work required to find <span class="math inline">\(q(x)\)</span>.</p>
</section>
<section id="examples" class="level3" data-number="14.2.2">
<h3 data-number="14.2.2" class="anchored" data-anchor-id="examples"><span class="header-section-number">14.2.2</span> Examples</h3>
<p>Consider the rational expression</p>
<p><span class="math display">\[
\frac{17x^5 - 300x^4 - 1/2}{x^5 - 2x^4 + 3x^3 - 4x^2 + 5}.
\]</span></p>
<p>The leading term of the numerator is <span class="math inline">\(17x^5\)</span> and the leading term of the denominator is <span class="math inline">\(x^5\)</span>. The ratio is <span class="math inline">\(17\)</span> (or <span class="math inline">\(17x^0 = 17x^{5-5}\)</span>). As such, we would have a horizontal asymptote <span class="math inline">\(y=17\)</span>.</p>
<hr>
<p>If we consider instead this rational expression:</p>
<p><span class="math display">\[
\frac{x^5 - 2x^4 + 3x^3 - 4x^2 + 5}{5x^4 + 4x^3 + 3x^2 + 2x + 1}
\]</span></p>
<p>Then we can see that the ratio of the leading terms is <span class="math inline">\(x^5 / (5x^4) = (1/5)x\)</span>. We expect a slant asymptote with slope <span class="math inline">\(1/5\)</span>, though we would need to divide to see the exact intercept. This is found with, say:</p>
<div class="cell" data-hold="true" data-execution_count="12">
<div class="sourceCode cell-code" id="cb11"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a>p <span class="op">=</span> (x<span class="op">^</span><span class="fl">5</span> <span class="op">-</span> <span class="fl">2</span>x<span class="op">^</span><span class="fl">4</span> <span class="op">+</span> <span class="fl">3</span>x<span class="op">^</span><span class="fl">3</span> <span class="op">-</span> <span class="fl">4</span>x<span class="op">^</span><span class="fl">2</span> <span class="op">+</span> <span class="fl">5</span>) <span class="op">/</span> (<span class="fl">5</span>x<span class="op">^</span><span class="fl">4</span> <span class="op">+</span> <span class="fl">4</span>x<span class="op">^</span><span class="fl">3</span> <span class="op">+</span> <span class="fl">3</span>x<span class="op">^</span><span class="fl">2</span> <span class="op">+</span> <span class="fl">2</span>x <span class="op">+</span> <span class="fl">1</span>)</span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a>quo, rem <span class="op">=</span> <span class="fu">divrem</span>(<span class="fu">numerator</span>(p), <span class="fu">denominator</span>(p)) <span class="co"># or apart(p)</span></span>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a>quo</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="13">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
\frac{x}{5} - \frac{14}{25}
\]
</span>
</div>
</div>
<hr>
<p>The rational function</p>
<p><span class="math display">\[
\frac{5x^3 + 6x^2 + 2}{x-1}
\]</span></p>
<p>has decomposition <span class="math inline">\(5x^2 + 11x + 11 + 13/(x-1)\)</span>:</p>
<div class="cell" data-execution_count="13">
<div class="sourceCode cell-code" id="cb12"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a>top <span class="op">=</span> <span class="fl">5</span>x<span class="op">^</span><span class="fl">3</span> <span class="op">+</span> <span class="fl">6</span>x<span class="op">^</span><span class="fl">2</span> <span class="op">+</span><span class="fl">2</span></span>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a>bottom <span class="op">=</span> x<span class="op">-</span><span class="fl">1</span></span>
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a>quo, rem <span class="op">=</span> <span class="fu">divrem</span>(top, bottom)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="14">
<pre><code>(5*x^2 + 11*x + 11, 13)</code></pre>
</div>
</div>
<p>The graph of has nothing in common with the graph of the quotient for small <span class="math inline">\(x\)</span></p>
<div class="cell" data-execution_count="14">
<div class="sourceCode cell-code" id="cb14"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(top<span class="op">/</span>bottom, <span class="op">-</span><span class="fl">3</span>, <span class="fl">3</span>)</span>
<span id="cb14-2"><a href="#cb14-2" aria-hidden="true" tabindex="-1"></a><span class="fu">plot!</span>(quo, <span class="op">-</span><span class="fl">3</span>, <span class="fl">3</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="15">
<p><img src="rational_functions_files/figure-html/cell-15-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>But the graphs do match for large <span class="math inline">\(x\)</span>:</p>
<div class="cell" data-execution_count="15">
<div class="sourceCode cell-code" id="cb15"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(top<span class="op">/</span>bottom, <span class="fl">5</span>, <span class="fl">10</span>)</span>
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a><span class="fu">plot!</span>(quo, <span class="fl">5</span>, <span class="fl">10</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="16">
<p><img src="rational_functions_files/figure-html/cell-16-output-1.svg" class="img-fluid"></p>
</div>
</div>
<hr>
<p>Finally, consider this rational expression in factored form:</p>
<p><span class="math display">\[
\frac{(x-2)^3\cdot(x-4)\cdot(x-3)}{(x-5)^4 \cdot (x-6)^2}.
\]</span></p>
<p>By looking at the powers we can see that the leading term of the numerator will the <span class="math inline">\(x^5\)</span> and the leading term of the denominator <span class="math inline">\(x^6\)</span>. The ratio is <span class="math inline">\(1/x^1\)</span>. As such, we expect the <span class="math inline">\(y\)</span>-axis as a horizontal asymptote:</p>
<section id="partial-fractions" class="level4">
<h4 class="anchored" data-anchor-id="partial-fractions">Partial fractions</h4>
<p>The <code>apart</code> function was useful to express a rational function in terms of a polynomial plus additional rational functions whose horizontal asymptotes are <span class="math inline">\(0\)</span>. This function computes the partial fraction <a href="https://en.wikipedia.org/wiki/Partial_fraction_decomposition">decomposition</a> of a rational function. Outside of the initial polynomial, this decomposition is a reexpression of a rational function into a sum of rational functions, where the denominators are <em>irreducible</em>, or unable to be further factored (non-trivially) and the numerators have lower degree than the denominator. Hence the horizontal asymptotes of <span class="math inline">\(0\)</span>.</p>
<p>To see another example we have:</p>
<div class="cell" data-hold="true" data-execution_count="16">
<div class="sourceCode cell-code" id="cb16"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a>p <span class="op">=</span> (x<span class="op">-</span><span class="fl">1</span>)<span class="fu">*</span>(x<span class="op">-</span><span class="fl">2</span>)</span>
<span id="cb16-2"><a href="#cb16-2" aria-hidden="true" tabindex="-1"></a>q <span class="op">=</span> (x<span class="op">-</span><span class="fl">3</span>)<span class="op">^</span><span class="fl">3</span> <span class="op">*</span> (x<span class="op">^</span><span class="fl">2</span> <span class="op">-</span> x <span class="op">-</span> <span class="fl">1</span>)</span>
<span id="cb16-3"><a href="#cb16-3" aria-hidden="true" tabindex="-1"></a><span class="fu">apart</span>(p<span class="op">/</span>q)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="17">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
\frac{2 x - 1}{25 \left(x^{2} - x - 1\right)} - \frac{2}{25 \left(x - 3\right)} + \frac{1}{5 \left(x - 3\right)^{2}} + \frac{2}{5 \left(x - 3\right)^{3}}
\]
</span>
</div>
</div>
<p>The denominator, <span class="math inline">\(q\)</span>, has factors <span class="math inline">\(x-3\)</span> and <span class="math inline">\(x^2 - x - 1\)</span>, each irreducible. The answer is expressed in terms of a sum of rational functions each with a denominator coming from one of these factors, possibly with a power.</p>
</section>
</section>
<section id="vertical-asymptotes" class="level3" data-number="14.2.3">
<h3 data-number="14.2.3" class="anchored" data-anchor-id="vertical-asymptotes"><span class="header-section-number">14.2.3</span> Vertical asymptotes</h3>
<p>As just discussed, the graph of <span class="math inline">\(1/x\)</span> will have a horizontal asymptote. However it will also show a spike at <span class="math inline">\(0\)</span>:</p>
<div class="cell" data-execution_count="17">
<div class="sourceCode cell-code" id="cb17"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(<span class="fl">1</span><span class="op">/</span>x, <span class="op">-</span><span class="fl">1</span>, <span class="fl">1</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="18">
<p><img src="rational_functions_files/figure-html/cell-18-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>Again, this spike is an artifact of the plotting algorithm. The <span class="math inline">\(y\)</span> values for <span class="math inline">\(x\)</span>-values just smaller than <span class="math inline">\(0\)</span> are large negative values and the <span class="math inline">\(x\)</span> values just larger than <span class="math inline">\(0\)</span> produce large, positive <span class="math inline">\(y\)</span> values.</p>
<p>The two points with <span class="math inline">\(x\)</span> components closest to <span class="math inline">\(0\)</span> are connected with a line, though that is misleading. Here we deliberately use far fewer points to plot <span class="math inline">\(1/x\)</span> to show how this happens:</p>
<div class="cell" data-hold="true" data-execution_count="18">
<div class="sourceCode cell-code" id="cb18"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a><span class="fu">f</span>(x) <span class="op">=</span> <span class="fl">1</span><span class="op">/</span>x</span>
<span id="cb18-2"><a href="#cb18-2" aria-hidden="true" tabindex="-1"></a>xs <span class="op">=</span> <span class="fu">range</span>(<span class="op">-</span><span class="fl">1</span>, <span class="fl">1</span>, length<span class="op">=</span><span class="fl">12</span>)</span>
<span id="cb18-3"><a href="#cb18-3" aria-hidden="true" tabindex="-1"></a>ys <span class="op">=</span> <span class="fu">f</span>.(xs)</span>
<span id="cb18-4"><a href="#cb18-4" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(xs, ys)</span>
<span id="cb18-5"><a href="#cb18-5" aria-hidden="true" tabindex="-1"></a><span class="fu">scatter!</span>(xs, ys)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="19">
<p><img src="rational_functions_files/figure-html/cell-19-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>The line <span class="math inline">\(x = 0\)</span> is a <em>vertical asymptote</em> for the graph of <span class="math inline">\(1/x\)</span>. As <span class="math inline">\(x\)</span> values get close to <span class="math inline">\(0\)</span> from the right, the <span class="math inline">\(y\)</span> values go towards <span class="math inline">\(\infty\)</span> and as the <span class="math inline">\(x\)</span> values get close to <span class="math inline">\(0\)</span> on the left, the <span class="math inline">\(y\)</span> values go towards <span class="math inline">\(-\infty\)</span>.</p>
<p>This has everything to do with the fact that <span class="math inline">\(0\)</span> is a root of the denominator.</p>
<p>For a rational function <span class="math inline">\(p(x)/q(x)\)</span>, the roots of <span class="math inline">\(q(x)\)</span> may or may not lead to vertical asymptotes. For a root <span class="math inline">\(c\)</span> if <span class="math inline">\(p(c)\)</span> is not zero then the line <span class="math inline">\(x=c\)</span> will be a vertical asymptote. If <span class="math inline">\(c\)</span> is a root of both <span class="math inline">\(p(x)\)</span> and <span class="math inline">\(q(x)\)</span>, then we can rewrite the expression as:</p>
<p><span class="math display">\[
\frac{p(x)}{q(x)} = \frac{(x-c)^m r(x)}{(x-c)^n s(x)},
\]</span></p>
<p>where both <span class="math inline">\(r(c)\)</span> and <span class="math inline">\(s(c)\)</span> are non zero. Knowing <span class="math inline">\(m\)</span> and <span class="math inline">\(n\)</span> (the multiplicities of the root <span class="math inline">\(c\)</span>) allows the following to be said:</p>
<ul>
<li>If <span class="math inline">\(m &lt; n\)</span> then <span class="math inline">\(x=c\)</span> will be a vertical asymptote.</li>
<li>If <span class="math inline">\(m \geq n\)</span> then <span class="math inline">\(x=c\)</span> will not be vertical asymptote. (The value <span class="math inline">\(c\)</span> will be known as a removable singularity). In this case, the graph of <span class="math inline">\(p(x)/q(x)\)</span> and the graph of <span class="math inline">\((x-c)^{m-n}r(x)/s(x)\)</span> will differ, though very slightly, as the latter will include a value for <span class="math inline">\(x=c\)</span>, whereas <span class="math inline">\(x=c\)</span> is not in the domain of <span class="math inline">\(p(x)/q(x)\)</span>.</li>
</ul>
<p>Finding the multiplicity may or may not be hard, but there is a very kludgy quick check that is often correct. With <code>Julia</code>, if you have a rational function that has <code>f(c)</code> evaluate to <code>Inf</code> or <code>-Inf</code> then there will be a vertical asymptote. If the expression evaluates to <code>NaN</code>, more analysis is needed. (The value of <code>0/0</code> is <code>NaN</code>, where as <code>1/0</code> is <code>Inf</code>.)</p>
<p>For example, the function <span class="math inline">\(f(x) = ((x-1)^2 \cdot (x-2)) / ((x+3) \cdot(x-3))\)</span> has vertical asymptotes at <span class="math inline">\(-3\)</span> and <span class="math inline">\(3\)</span>, as its graph illustrated. Without the graph we could see this as well:</p>
<div class="cell" data-hold="true" data-execution_count="19">
<div class="sourceCode cell-code" id="cb19"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a><span class="fu">f</span>(x) <span class="op">=</span> (x<span class="op">-</span><span class="fl">1</span>)<span class="op">^</span><span class="fl">2</span> <span class="op">*</span> (x<span class="op">-</span><span class="fl">2</span>) <span class="op">/</span> ((x<span class="op">+</span><span class="fl">3</span>)<span class="fu">*</span>(x<span class="op">-</span><span class="fl">3</span>) )</span>
<span id="cb19-2"><a href="#cb19-2" aria-hidden="true" tabindex="-1"></a><span class="fu">f</span>(<span class="fl">3</span>), <span class="fu">f</span>(<span class="op">-</span><span class="fl">3</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="20">
<pre><code>(Inf, -Inf)</code></pre>
</div>
</div>
<section id="graphing-with-vertical-asymptotes" class="level4">
<h4 class="anchored" data-anchor-id="graphing-with-vertical-asymptotes">Graphing with vertical asymptotes</h4>
<p>As seen in several graphs, the basic plotting algorithm does a poor job with vertical asymptotes. For example, it may erroneously connect their values with a steep vertical line, or the <span class="math inline">\(y\)</span>-axis scale can get so large as to make reading the rest of the graph impossible. There are some tricks to work around this.</p>
<p>Consider again the function <span class="math inline">\(f(x) = ((x-1)^2 \cdot (x-2)) / ((x+3) \cdot(x-3))\)</span>. Without much work, we can see that <span class="math inline">\(x=3\)</span> and <span class="math inline">\(x=-3\)</span> will be vertical asymptotes and there will be a slant asymptote with slope <span class="math inline">\(1\)</span>. How to graph this?</p>
<p>We can avoid the vertical asymptotes in our viewing window. For example we could look at the area between the vertical asymptotes, by plotting over <span class="math inline">\((-2.9, 2.9)\)</span>, say:</p>
<div class="cell" data-execution_count="20">
<div class="sourceCode cell-code" id="cb21"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a><span class="fu">𝒇</span>(x) <span class="op">=</span> (x<span class="op">-</span><span class="fl">1</span>)<span class="op">^</span><span class="fl">2</span> <span class="op">*</span> (x<span class="op">-</span><span class="fl">2</span>) <span class="op">/</span> ((x<span class="op">+</span><span class="fl">3</span>)<span class="fu">*</span>(x<span class="op">-</span><span class="fl">3</span>) )</span>
<span id="cb21-2"><a href="#cb21-2" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(𝒇, <span class="op">-</span><span class="fl">2.9</span>, <span class="fl">2.9</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="21">
<p><img src="rational_functions_files/figure-html/cell-21-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>This backs off by <span class="math inline">\(\delta = 0.1\)</span>. As we have that <span class="math inline">\(3 - 2.9\)</span> is <span class="math inline">\(\delta\)</span> and <span class="math inline">\(1/\delta\)</span> is 10, the <span class="math inline">\(y\)</span> axis wont get too large, and indeed it doesnt.</p>
<p>This graph doesnt show well the two zeros at <span class="math inline">\(x=1\)</span> and <span class="math inline">\(x=2\)</span>, for that a narrower viewing window is needed. By successively panning throughout the interesting part of the graph, we can get a view of the function.</p>
<p>We can also clip the <code>y</code> axis. The <code>plot</code> function can be passed an argument <code>ylims=(lo, hi)</code> to limit which values are plotted. With this, we can have:</p>
<div class="cell" data-hold="true" data-execution_count="21">
<div class="sourceCode cell-code" id="cb22"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb22-1"><a href="#cb22-1" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(𝒇, <span class="op">-</span><span class="fl">5</span>, <span class="fl">5</span>, ylims<span class="op">=</span>(<span class="op">-</span><span class="fl">20</span>, <span class="fl">20</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="22">
<p><img src="rational_functions_files/figure-html/cell-22-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>This isnt ideal, as the large values are still computed, just the viewing window is clipped. This leaves the vertical asymptotes still effecting the graph.</p>
<p>There is another way, we could ask <code>Julia</code> to not plot <span class="math inline">\(y\)</span> values that get too large. This is not a big request. If instead of the value of <code>f(x)</code> - when it is large - -we use <code>NaN</code> instead, then the connect-the-dots algorithm will skip those values.</p>
<p>This was discussed in an earlier section where the <code>rangeclamp</code> function was introduced to replace large values of <code>f(x)</code> (in absolute values) with <code>NaN</code>.</p>
<div class="cell" data-execution_count="22">
<div class="sourceCode cell-code" id="cb23"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(<span class="fu">rangeclamp</span>(𝒇, <span class="fl">30</span>), <span class="op">-</span><span class="fl">25</span>, <span class="fl">25</span>) <span class="co"># rangeclamp is in the CalculusWithJulia package</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="23">
<p><img src="rational_functions_files/figure-html/cell-23-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>We can see the general shape of <span class="math inline">\(3\)</span> curves broken up by the vertical asymptotes. The two on the side heading off towards the line <span class="math inline">\(x-4\)</span> and the one in the middle. We still cant see the precise location of the zeros, but that wouldnt be the case with most graphs that show asymptotic behaviors. However, we can clearly tell where to “zoom in” were those of interest.</p>
</section>
</section>
<section id="sign-charts" class="level3" data-number="14.2.4">
<h3 data-number="14.2.4" class="anchored" data-anchor-id="sign-charts"><span class="header-section-number">14.2.4</span> Sign charts</h3>
<p>When sketching graphs of rational functions by hand, it is useful to use sign charts. A sign chart of a function indicates when the function is positive, negative, <span class="math inline">\(0\)</span>, or undefined. It typically is represented along the lines of this one for <span class="math inline">\(f(x) = x^3 - x\)</span>:</p>
<pre class="{verbatim}"><code> - 0 + 0 - 0 +
&lt; ----- -1 ----- 0 ----- 1 ----- &gt;</code></pre>
<p>The usual recipe for construction follows these steps:</p>
<ul>
<li>Identify when the function is <span class="math inline">\(0\)</span> or undefined. Place those values on a number line.</li>
<li>Identify “test points” within each implied interval (these are <span class="math inline">\((-\infty, -1)\)</span>, <span class="math inline">\((-1,0)\)</span>, <span class="math inline">\((0,1)\)</span>, and <span class="math inline">\((1, \infty)\)</span> in the example) and check for the sign of <span class="math inline">\(f(x)\)</span> at these test points. Write in <code>-</code>, <code>+</code>, <code>0</code>, or <code>*</code>, as appropriate. The value comes from the fact that “continuous” functions may only change sign when they cross <span class="math inline">\(0\)</span> or are undefined.</li>
</ul>
<p>With the computer, where it is convenient to draw a graph, it might be better to emphasize the sign on the graph of the function. The <code>sign_chart</code> function from <code>CalculusWithJulia</code> does this by numerically identifying points where the function is <span class="math inline">\(0\)</span> or <span class="math inline">\(\infty\)</span> and indicating the sign as <span class="math inline">\(x\)</span> crosses over these points.</p>
<div class="cell" data-execution_count="23">
<div class="cell-output cell-output-display" data-execution_count="24">
<pre><code>sign_chart (generic function with 1 method)</code></pre>
</div>
</div>
<div class="cell" data-hold="true" data-execution_count="24">
<div class="sourceCode cell-code" id="cb26"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb26-1"><a href="#cb26-1" aria-hidden="true" tabindex="-1"></a><span class="fu">f</span>(x) <span class="op">=</span> x<span class="op">^</span><span class="fl">3</span> <span class="op">-</span> x</span>
<span id="cb26-2"><a href="#cb26-2" aria-hidden="true" tabindex="-1"></a><span class="fu">sign_chart</span>(f, <span class="op">-</span><span class="fl">3</span><span class="op">/</span><span class="fl">2</span>, <span class="fl">3</span><span class="op">/</span><span class="fl">2</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="25">
<pre><code>3-element Vector{NamedTuple{(:∞0, :sign_change), Tuple{Float64, String}}}:
(∞0 = -1.0, sign_change = "- → +")
(∞0 = 0.0, sign_change = "+ → -")
(∞0 = 1.0, sign_change = "- → +")</code></pre>
</div>
</div>
</section>
</section>
<section id="pade-approximate" class="level2" data-number="14.3">
<h2 data-number="14.3" class="anchored" data-anchor-id="pade-approximate"><span class="header-section-number">14.3</span> Pade approximate</h2>
<p>One area where rational functions are employed is in approximating functions. Later, the Taylor polynomial will be seen to be a polynomial that approximates well a function (where “well” will be described later). The Pade approximation is similar, though uses a rational function for the form <span class="math inline">\(p(x)/q(x)\)</span>, where <span class="math inline">\(q(0)=1\)</span> is customary.</p>
<p>Some example approximations are</p>
<p><span class="math display">\[
\sin(x) \approx \frac{x - 7/60 \cdot x^3}{1 + 1/20 \cdot x^2}
\]</span></p>
<p>and</p>
<p><span class="math display">\[
\tan(x) \approx \frac{x - 1/15 \cdot x^3}{1 - 2/5 \cdot x^2}
\]</span></p>
<p>We can look graphically at these approximations:</p>
<div class="cell" data-execution_count="25">
<div class="sourceCode cell-code" id="cb28"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb28-1"><a href="#cb28-1" aria-hidden="true" tabindex="-1"></a><span class="fu">sin_p</span>(x) <span class="op">=</span> (x <span class="op">-</span> (<span class="fl">7</span><span class="op">/</span><span class="fl">60</span>)<span class="op">*</span>x<span class="op">^</span><span class="fl">3</span>) <span class="op">/</span> (<span class="fl">1</span> <span class="op">+</span> (<span class="fl">1</span><span class="op">/</span><span class="fl">20</span>)<span class="op">*</span>x<span class="op">^</span><span class="fl">2</span>)</span>
<span id="cb28-2"><a href="#cb28-2" aria-hidden="true" tabindex="-1"></a><span class="fu">tan_p</span>(x) <span class="op">=</span> (x <span class="op">-</span> (<span class="fl">1</span><span class="op">/</span><span class="fl">15</span>)<span class="op">*</span>x<span class="op">^</span><span class="fl">3</span>) <span class="op">/</span> (<span class="fl">1</span> <span class="op">-</span> (<span class="fl">2</span><span class="op">/</span><span class="fl">5</span>)<span class="op">*</span>x<span class="op">^</span><span class="fl">2</span>)</span>
<span id="cb28-3"><a href="#cb28-3" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(sin, <span class="op">-</span><span class="cn">pi</span>, <span class="cn">pi</span>)</span>
<span id="cb28-4"><a href="#cb28-4" aria-hidden="true" tabindex="-1"></a><span class="fu">plot!</span>(sin_p, <span class="op">-</span><span class="cn">pi</span>, <span class="cn">pi</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="26">
<p><img src="rational_functions_files/figure-html/cell-26-output-1.svg" class="img-fluid"></p>
</div>
</div>
<div class="cell" data-execution_count="26">
<div class="sourceCode cell-code" id="cb29"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb29-1"><a href="#cb29-1" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(tan, <span class="op">-</span><span class="cn">pi</span><span class="op">/</span><span class="fl">2</span> <span class="op">+</span> <span class="fl">0.2</span>, <span class="cn">pi</span><span class="op">/</span><span class="fl">2</span> <span class="op">-</span> <span class="fl">0.2</span>)</span>
<span id="cb29-2"><a href="#cb29-2" aria-hidden="true" tabindex="-1"></a><span class="fu">plot!</span>(tan_p, <span class="op">-</span><span class="cn">pi</span><span class="op">/</span><span class="fl">2</span> <span class="op">+</span> <span class="fl">0.2</span>, <span class="cn">pi</span><span class="op">/</span><span class="fl">2</span> <span class="op">-</span> <span class="fl">0.2</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="27">
<p><img src="rational_functions_files/figure-html/cell-27-output-1.svg" class="img-fluid"></p>
</div>
</div>
</section>
<section id="the-polynomials-package-for-rational-functions" class="level2" data-number="14.4">
<h2 data-number="14.4" class="anchored" data-anchor-id="the-polynomials-package-for-rational-functions"><span class="header-section-number">14.4</span> The <code>Polynomials</code> package for rational functions</h2>
<p>In the following, we import some functions from the <code>Polynomials</code> package. We avoided loading the entire namespace, as there are conflicts with <code>SymPy</code>. Here we import some useful functions and the <code>Polynomial</code> constructor:</p>
<div class="sourceCode cell-code" id="cb30"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb30-1"><a href="#cb30-1" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> <span class="bu">Polynomials</span>: Polynomial, variable, lowest_terms, fromroots, coeffs</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<p>The <code>Polynomials</code> package has support for rational functions. The <code>//</code> operator can be used to create rational expressions:</p>
<div class="cell" data-execution_count="28">
<div class="sourceCode cell-code" id="cb31"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb31-1"><a href="#cb31-1" aria-hidden="true" tabindex="-1"></a>𝒙 <span class="op">=</span> <span class="fu">variable</span>()</span>
<span id="cb31-2"><a href="#cb31-2" aria-hidden="true" tabindex="-1"></a>𝒑 <span class="op">=</span> (𝒙<span class="op">-</span><span class="fl">1</span>)<span class="fu">*</span>(𝒙<span class="op">-</span><span class="fl">2</span>)<span class="op">^</span><span class="fl">2</span></span>
<span id="cb31-3"><a href="#cb31-3" aria-hidden="true" tabindex="-1"></a>𝒒 <span class="op">=</span> (𝒙<span class="op">-</span><span class="fl">2</span>)<span class="fu">*</span>(𝒙<span class="op">-</span><span class="fl">3</span>)</span>
<span id="cb31-4"><a href="#cb31-4" aria-hidden="true" tabindex="-1"></a>𝒑𝒒 <span class="op">=</span> 𝒑 <span class="op">//</span> 𝒒</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="29">
<pre><code>(-4 + 8*x - 5*x^2 + x^3) // (6 - 5*x + x^2)</code></pre>
</div>
</div>
<p>A rational expression is a formal object; a rational function the viewpoint that this object will be evaluated by substituting values for the indeterminate. Rational expressions made within <code>Polynomials</code> are evaluated just like functions:</p>
<div class="cell" data-execution_count="29">
<div class="sourceCode cell-code" id="cb33"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb33-1"><a href="#cb33-1" aria-hidden="true" tabindex="-1"></a><span class="fu">𝒑𝒒</span>(<span class="fl">4</span>) <span class="co"># p(4)/q(4)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="30">
<pre><code>6.0</code></pre>
</div>
</div>
<p>The rational expressions are not in lowest terms unless requested through the <code>lowest_terms</code> method:</p>
<div class="cell" data-execution_count="30">
<div class="sourceCode cell-code" id="cb35"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb35-1"><a href="#cb35-1" aria-hidden="true" tabindex="-1"></a><span class="fu">lowest_terms</span>(𝒑𝒒)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="31">
<pre><code>(1.999999999999998 - 2.9999999999999982*x + 0.9999999999999996*x^2) // (-2.9999999999999973 + 1.0*x)</code></pre>
</div>
</div>
<p>For polynomials as simple as these, this computation is not a problem, but there is the very real possibility that the lowest term computation may be incorrect. Unlike <code>SymPy</code> which factors symbolically, <code>lowest_terms</code> uses a numeric algorithm and does not, as would be done by hand or with <code>SymPy</code>, factor the polynomial and then cancel common factors.</p>
<p>The distinction between the two expressions is sometimes made; the initial expression is not defined at <span class="math inline">\(x=2\)</span>; the reduced one is, so the two are not identical when viewed as functions of the variable <span class="math inline">\(x\)</span>.</p>
<p>Rational expressions include polynomial expressions, just as the rational numbers include the integers. The identification there is to divide by <span class="math inline">\(1\)</span>, thinking of <span class="math inline">\(3\)</span> as <span class="math inline">\(3/1\)</span>. In <code>Julia</code>, we would just use</p>
<div class="cell" data-execution_count="31">
<div class="sourceCode cell-code" id="cb37"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb37-1"><a href="#cb37-1" aria-hidden="true" tabindex="-1"></a><span class="fl">3</span><span class="op">//</span><span class="fl">1</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="32">
<pre><code>3//1</code></pre>
</div>
</div>
<p>The integer can be recovered from the rational number using <code>numerator</code>:</p>
<div class="cell" data-execution_count="32">
<div class="sourceCode cell-code" id="cb39"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb39-1"><a href="#cb39-1" aria-hidden="true" tabindex="-1"></a><span class="fu">numerator</span>(<span class="fl">3</span><span class="op">//</span><span class="fl">1</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="33">
<pre><code>3</code></pre>
</div>
</div>
<p>Similarly, we can divide a polynomial by the polynomial <span class="math inline">\(1\)</span>, which in <code>Julia</code> is returned by <code>one(p)</code>, to produce a rational expression:</p>
<div class="cell" data-execution_count="33">
<div class="sourceCode cell-code" id="cb41"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb41-1"><a href="#cb41-1" aria-hidden="true" tabindex="-1"></a>pp <span class="op">=</span> 𝒑 <span class="op">//</span> <span class="fu">one</span>(𝒑)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="34">
<pre><code>(-4 + 8*x - 5*x^2 + x^3) // (1)</code></pre>
</div>
</div>
<p>And as with rational numbers, <code>p</code> is recovered by <code>numerator</code>:</p>
<div class="cell" data-execution_count="34">
<div class="sourceCode cell-code" id="cb43"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb43-1"><a href="#cb43-1" aria-hidden="true" tabindex="-1"></a><span class="fu">numerator</span>(pp)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="35">
-4 + 8∙x - 5∙x<sup>2</sup> + x<sup>3</sup>
</div>
</div>
<p>One difference is the rational number <code>3//1</code> also represents other expressions, say <code>6/2</code> or <code>12/4</code>, as <code>Julia</code>s rational numbers are presented in lowest terms, unlike the rational expressions in <code>Polynomials</code>.</p>
<p>Rational functions also have a plot recipe defined for them that attempts to ensure the basic features are identifiable. As previously discussed, a plot of a rational function can require some effort to avoid the values associated to vertical asymptotes taking up too many of the available vertical pixels in a graph.</p>
<p>For the polynomial <code>pq</code> above, we have from observation that <span class="math inline">\(1\)</span> and <span class="math inline">\(2\)</span> will be zeros and <span class="math inline">\(x=3\)</span> a vertical asymptote. We also can identify a slant asymptote with slope <span class="math inline">\(1\)</span>. These are hinted at in this graph:</p>
<div class="cell" data-execution_count="35">
<div class="sourceCode cell-code" id="cb44"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb44-1"><a href="#cb44-1" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(𝒑𝒒)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="36">
<p><img src="rational_functions_files/figure-html/cell-36-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>To better see the zeros, a plot over a narrower interval, say <span class="math inline">\([0,2.5]\)</span>, would be encouraged; to better see the slant asymptote, a plot over a wider interval, say <span class="math inline">\([-10,10]\)</span>, would be encouraged.</p>
<p>For one more example of the default plot recipe, we redo the graphing of the rational expression we earlier plotted with <code>rangeclamp</code>:</p>
<div class="cell" data-hold="true" data-execution_count="36">
<div class="sourceCode cell-code" id="cb45"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb45-1"><a href="#cb45-1" aria-hidden="true" tabindex="-1"></a>p,q <span class="op">=</span> <span class="fu">fromroots</span>([<span class="fl">1</span>,<span class="fl">1</span>,<span class="fl">2</span>]), <span class="fu">fromroots</span>([<span class="op">-</span><span class="fl">3</span>,<span class="fl">3</span>])</span>
<span id="cb45-2"><a href="#cb45-2" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(p<span class="op">//</span>q)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="37">
<p><img src="rational_functions_files/figure-html/cell-37-output-1.svg" class="img-fluid"></p>
</div>
</div>
<section id="example-transformations-of-polynomials-real-roots" class="level5">
<h5 class="anchored" data-anchor-id="example-transformations-of-polynomials-real-roots">Example: transformations of polynomials; real roots</h5>
<p>We have seen some basic transformations of functions such as shifts and scales. For a polynomial expression we can implement these as follows, taking advantage of polynomial evaluation:</p>
<div class="cell" data-hold="true" data-execution_count="37">
<div class="sourceCode cell-code" id="cb46"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb46-1"><a href="#cb46-1" aria-hidden="true" tabindex="-1"></a>x <span class="op">=</span> <span class="fu">variable</span>()</span>
<span id="cb46-2"><a href="#cb46-2" aria-hidden="true" tabindex="-1"></a>p <span class="op">=</span> <span class="fl">3</span> <span class="op">+</span> <span class="fl">4</span>x <span class="op">+</span> <span class="fl">5</span>x<span class="op">^</span><span class="fl">2</span></span>
<span id="cb46-3"><a href="#cb46-3" aria-hidden="true" tabindex="-1"></a>a <span class="op">=</span> <span class="fl">2</span></span>
<span id="cb46-4"><a href="#cb46-4" aria-hidden="true" tabindex="-1"></a><span class="fu">p</span>(a<span class="op">*</span>x), <span class="fu">p</span>(x<span class="op">+</span>a) <span class="co"># scale, shift</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="38">
<pre><code>(Polynomial(3 + 8*x + 20*x^2), Polynomial(31 + 24*x + 5*x^2))</code></pre>
</div>
</div>
<p>A different polynomial transformation is inversion, or the mapping <span class="math inline">\(x^d \cdot p(1/x)\)</span> where <span class="math inline">\(d\)</span> is the degree of <span class="math inline">\(p\)</span>. This will yield a polynomial, as perhaps this example will convince you:</p>
<div class="cell" data-hold="true" data-execution_count="38">
<div class="sourceCode cell-code" id="cb48"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb48-1"><a href="#cb48-1" aria-hidden="true" tabindex="-1"></a>p <span class="op">=</span> <span class="fu">Polynomial</span>([<span class="fl">1</span>, <span class="fl">2</span>, <span class="fl">3</span>, <span class="fl">4</span>, <span class="fl">5</span>])</span>
<span id="cb48-2"><a href="#cb48-2" aria-hidden="true" tabindex="-1"></a>d <span class="op">=</span> Polynomials.<span class="fu">degree</span>(p) <span class="co"># degree is in SymPy and Polynomials, indicate which</span></span>
<span id="cb48-3"><a href="#cb48-3" aria-hidden="true" tabindex="-1"></a>pp <span class="op">=</span> p <span class="op">//</span> <span class="fu">one</span>(p)</span>
<span id="cb48-4"><a href="#cb48-4" aria-hidden="true" tabindex="-1"></a>x <span class="op">=</span> <span class="fu">variable</span>(pp)</span>
<span id="cb48-5"><a href="#cb48-5" aria-hidden="true" tabindex="-1"></a>q <span class="op">=</span> x<span class="op">^</span>d <span class="op">*</span> <span class="fu">pp</span>(<span class="fl">1</span><span class="op">/</span>x)</span>
<span id="cb48-6"><a href="#cb48-6" aria-hidden="true" tabindex="-1"></a><span class="fu">lowest_terms</span>(q)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="39">
<pre><code>(5.0 + 4.0*x + 3.0*x^2 + 2.0*x^3 + 1.0*x^4) // (1.0)</code></pre>
</div>
</div>
<p>We had to use a rational expression so that division by the variable was possible. The above indicates that the new polynomial, <span class="math inline">\(q\)</span>, is constructed from <span class="math inline">\(p\)</span> by <strong>reversing</strong> the coefficients.</p>
<p>Inversion is like a funhouse mirror, flipping around parts of the polynomial. For example, the interval <span class="math inline">\([1/4,1/2]\)</span> is related to the interval <span class="math inline">\([2,4]\)</span>. Of interest here, is that if <span class="math inline">\(p(x)\)</span> had a root, <span class="math inline">\(r\)</span>, in <span class="math inline">\([1/4,1/2]\)</span> then <span class="math inline">\(q(x) = x^d \cdot p(1/x)\)</span> would have a root in <span class="math inline">\([2,4]\)</span> at <span class="math inline">\(1/r\)</span>.</p>
<p>So these three transformations scale, shift, and inversion can be defined for polynomials.</p>
<p>Combined, the three can be used to create a <a href="https://en.wikipedia.org/wiki/M%C3%B6bius_transformation">Mobius transformation</a>. For two values <span class="math inline">\(a\)</span> and <span class="math inline">\(b\)</span>, consider the polynomial derived from <span class="math inline">\(p\)</span> (again <code>d=degree(p)</code>) by:</p>
<p><span class="math display">\[
q = (x+1)^d \cdot p(\frac{ax + b}{x + 1}).
\]</span></p>
<p>Here is a non-performant implementation as a <code>Julia</code> function:</p>
<div class="cell" data-execution_count="39">
<div class="sourceCode cell-code" id="cb50"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb50-1"><a href="#cb50-1" aria-hidden="true" tabindex="-1"></a><span class="kw">function</span> <span class="fu">mobius_transformation</span>(p, a, b)</span>
<span id="cb50-2"><a href="#cb50-2" aria-hidden="true" tabindex="-1"></a> x <span class="op">=</span> <span class="fu">variable</span>(p)</span>
<span id="cb50-3"><a href="#cb50-3" aria-hidden="true" tabindex="-1"></a> p <span class="op">=</span> <span class="fu">p</span>(x <span class="op">+</span> a) <span class="co"># shift</span></span>
<span id="cb50-4"><a href="#cb50-4" aria-hidden="true" tabindex="-1"></a> p <span class="op">=</span> <span class="fu">p</span>((b<span class="op">-</span>a)<span class="op">*</span>x) <span class="co"># scale</span></span>
<span id="cb50-5"><a href="#cb50-5" aria-hidden="true" tabindex="-1"></a> p <span class="op">=</span> <span class="fu">Polynomial</span>(<span class="fu">reverse</span>(<span class="fu">coeffs</span>(p))) <span class="co"># invert</span></span>
<span id="cb50-6"><a href="#cb50-6" aria-hidden="true" tabindex="-1"></a> p <span class="op">=</span> <span class="fu">p</span>(x <span class="op">+</span> <span class="fl">1</span>) <span class="co"># shift</span></span>
<span id="cb50-7"><a href="#cb50-7" aria-hidden="true" tabindex="-1"></a> p</span>
<span id="cb50-8"><a href="#cb50-8" aria-hidden="true" tabindex="-1"></a><span class="kw">end</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="40">
<pre><code>mobius_transformation (generic function with 1 method)</code></pre>
</div>
</div>
<p>We can verify this does what we want through example with the previously defined <code>p</code>:</p>
<div class="cell" data-execution_count="40">
<div class="sourceCode cell-code" id="cb52"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb52-1"><a href="#cb52-1" aria-hidden="true" tabindex="-1"></a>𝐩 <span class="op">=</span> <span class="fu">Polynomial</span>([<span class="fl">1</span>, <span class="fl">2</span>, <span class="fl">3</span>, <span class="fl">4</span>, <span class="fl">5</span>])</span>
<span id="cb52-2"><a href="#cb52-2" aria-hidden="true" tabindex="-1"></a>𝐪 <span class="op">=</span> <span class="fu">mobius_transformation</span>(𝐩, <span class="fl">4</span>, <span class="fl">6</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="41">
7465 + 20280∙x + 20670∙x<sup>2</sup> + 9368∙x<sup>3</sup> + 1593∙x<sup>4</sup>
</div>
</div>
<p>As contrasted with</p>
<div class="cell" data-hold="true" data-execution_count="41">
<div class="sourceCode cell-code" id="cb53"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb53-1"><a href="#cb53-1" aria-hidden="true" tabindex="-1"></a>a, b <span class="op">=</span> <span class="fl">4</span>, <span class="fl">6</span></span>
<span id="cb53-2"><a href="#cb53-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb53-3"><a href="#cb53-3" aria-hidden="true" tabindex="-1"></a>pq <span class="op">=</span> 𝐩 <span class="op">//</span> <span class="fu">one</span>(𝐩)</span>
<span id="cb53-4"><a href="#cb53-4" aria-hidden="true" tabindex="-1"></a>x <span class="op">=</span> <span class="fu">variable</span>(pq)</span>
<span id="cb53-5"><a href="#cb53-5" aria-hidden="true" tabindex="-1"></a>d <span class="op">=</span> Polynomials.<span class="fu">degree</span>(𝐩)</span>
<span id="cb53-6"><a href="#cb53-6" aria-hidden="true" tabindex="-1"></a><span class="fu">numerator</span>(<span class="fu">lowest_terms</span>( (x <span class="op">+</span> <span class="fl">1</span>)<span class="op">^</span><span class="fl">2</span> <span class="op">*</span> <span class="fu">pq</span>((a<span class="op">*</span>x <span class="op">+</span> b)<span class="op">/</span>(x <span class="op">+</span> <span class="fl">1</span>))))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="42">
7465.000000001552 + 20280.00000000283∙x + 20670.00000000175∙x<sup>2</sup> + 9368.000000000367∙x<sup>3</sup> + 1593.0000000000002∙x<sup>4</sup>
</div>
</div>
<hr>
<p>Now, why is this of any interest?</p>
<p>Mobius transforms are used to map regions into other regions. In this special case, the transform <span class="math inline">\(\phi(x) = (ax + b)/(x + 1)\)</span> takes the interval <span class="math inline">\([0,\infty]\)</span> and sends it to <span class="math inline">\([a,b]\)</span> (<span class="math inline">\(0\)</span> goes to <span class="math inline">\((a\cdot 0 + b)/(0+1) = b\)</span>, whereas <span class="math inline">\(\infty\)</span> goes to <span class="math inline">\(ax/x \rightarrow a\)</span>). Using this, if <span class="math inline">\(p(u) = 0\)</span>, with <span class="math inline">\(q(x) = (x-1)^d p(\phi(x))\)</span>, then setting <span class="math inline">\(u = \phi(x)\)</span> we have <span class="math inline">\(q(x) = (\phi^{-1}(u)+1)^d p(\phi(\phi^{-1}(u))) = (\phi^{-1}(u)+1)^d \cdot p(u) = (\phi^{-1}(u)+1)^d \cdot 0 = 0\)</span>. That is, a zero of <span class="math inline">\(p\)</span> in <span class="math inline">\([a,b]\)</span> will appear as a zero of <span class="math inline">\(q\)</span> in <span class="math inline">\([0,\infty)\)</span> at <span class="math inline">\(\phi^{-1}(u)\)</span>.</p>
<p>The Descartes rule of signs applied to <span class="math inline">\(q\)</span> then will give a bound on the number of possible roots of <span class="math inline">\(p\)</span> in the interval <span class="math inline">\([a,b]\)</span>. In the example we did, the Mobius transform for <span class="math inline">\(a=4, b=6\)</span> is <span class="math inline">\(15 - x - 11x^2 - 3x^3\)</span> with <span class="math inline">\(1\)</span> sign change, so there must be exactly <span class="math inline">\(1\)</span> real root of <span class="math inline">\(p=(x-1)(x-3)(x-5)\)</span> in the interval <span class="math inline">\([4,6]\)</span>, as we can observe from the factored form of <span class="math inline">\(p\)</span>.</p>
<p>Similarly, we can see there are <span class="math inline">\(2\)</span> or <span class="math inline">\(0\)</span> roots for <span class="math inline">\(p\)</span> in the interval <span class="math inline">\([2,6]\)</span> by counting the two sign changes here:</p>
<div class="cell" data-execution_count="42">
<div class="sourceCode cell-code" id="cb54"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb54-1"><a href="#cb54-1" aria-hidden="true" tabindex="-1"></a><span class="fu">mobius_transformation</span>(𝐩, <span class="fl">2</span>,<span class="fl">6</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="43">
7465 + 10700∙x + 5790∙x<sup>2</sup> + 1404∙x<sup>3</sup> + 129∙x<sup>4</sup>
</div>
</div>
<p>This observation, along with a detailed analysis provided by <a href="https://dl.acm.org/doi/10.1145/2930889.2930937">Kobel, Rouillier, and Sagraloff</a> provides a means to find intervals that enclose the real roots of a polynomial.</p>
<p>The basic algorithm, as presented next, is fairly simple to understand, and hints at the bisection algorithm to come. It is due to Akritas and Collins. Suppose you know the only possible positive real roots are between <span class="math inline">\(0\)</span> and <span class="math inline">\(M\)</span> <em>and</em> no roots are repeated. Find the transformed polynomial over <span class="math inline">\([0,M]\)</span>:</p>
<ul>
<li>If there are no sign changes, then there are no roots of <span class="math inline">\(p\)</span> in <span class="math inline">\([0,M]\)</span>.</li>
<li>If there is one sign change, then there is a single root of <span class="math inline">\(p\)</span> in <span class="math inline">\([0,M]\)</span>. The interval <span class="math inline">\([0,M]\)</span> is said to isolate the root (and the actual root can then be found by other means)</li>
<li>If there is more than one sign change, divide the interval in two (<span class="math inline">\([0,M/2]\)</span> and <span class="math inline">\([M/2,M]\)</span>, say) and apply the same consideration to each.</li>
</ul>
<p>Eventually, <strong>mathematically</strong> this will find isolating intervals for each positive real root. (The negative ones can be similarly isolated.)</p>
<p>Applying these steps to <span class="math inline">\(p\)</span> with an initial interval, say <span class="math inline">\([0,9]\)</span>, we would have:</p>
<div class="cell" data-hold="true" data-execution_count="43">
<div class="sourceCode cell-code" id="cb55"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb55-1"><a href="#cb55-1" aria-hidden="true" tabindex="-1"></a>p <span class="op">=</span> <span class="fu">fromroots</span>([<span class="fl">1</span>,<span class="fl">3</span>,<span class="fl">5</span>]) <span class="co"># (x-1)⋅(x-3)⋅(x-5) = -15 + 23*x - 9*x^2 + x^3</span></span>
<span id="cb55-2"><a href="#cb55-2" aria-hidden="true" tabindex="-1"></a><span class="fu">mobius_transformation</span>(p, <span class="fl">0</span>, <span class="fl">9</span>) <span class="co"># 3</span></span>
<span id="cb55-3"><a href="#cb55-3" aria-hidden="true" tabindex="-1"></a><span class="fu">mobius_transformation</span>(p, <span class="fl">0</span>, <span class="fl">9</span><span class="op">//</span><span class="fl">2</span>) <span class="co"># 2</span></span>
<span id="cb55-4"><a href="#cb55-4" aria-hidden="true" tabindex="-1"></a><span class="fu">mobius_transformation</span>(p, <span class="fl">9</span><span class="op">//</span><span class="fl">2</span>, <span class="fl">9</span>) <span class="co"># 1 (and done)</span></span>
<span id="cb55-5"><a href="#cb55-5" aria-hidden="true" tabindex="-1"></a><span class="fu">mobius_transformation</span>(p, <span class="fl">0</span>, <span class="fl">9</span><span class="op">//</span><span class="fl">4</span>) <span class="co"># 1 (and done)</span></span>
<span id="cb55-6"><a href="#cb55-6" aria-hidden="true" tabindex="-1"></a><span class="fu">mobius_transformation</span>(p, <span class="fl">9</span><span class="op">//</span><span class="fl">4</span>, <span class="fl">9</span><span class="op">//</span><span class="fl">2</span>) <span class="co"># 1 (and done)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="44">
-21//8 - 225//16∙x + 81//32∙x<sup>2</sup> + 165//64∙x<sup>3</sup>
</div>
</div>
<p>So the three roots (<span class="math inline">\(1\)</span>, <span class="math inline">\(3\)</span>, <span class="math inline">\(5\)</span>) are isolated by <span class="math inline">\([0, 9/4]\)</span>, <span class="math inline">\([9/4, 9/2]\)</span>, and <span class="math inline">\([9/2, 9]\)</span>.</p>
</section>
<section id="the-realpolynomialroots-package." class="level3" data-number="14.4.1">
<h3 data-number="14.4.1" class="anchored" data-anchor-id="the-realpolynomialroots-package."><span class="header-section-number">14.4.1</span> The <code>RealPolynomialRoots</code> package.</h3>
<p>For square-free polynomials, the <code>RealPolynomialRoots</code> package implements a basic version of the paper of <a href="https://dl.acm.org/doi/10.1145/2930889.2930937">Kobel, Rouillier, and Sagraloff</a> to identify the real roots of a polynomial using the Descartes rule of signs and the Möbius transformations just described.</p>
<p>The <code>ANewDsc</code> function takes a collection of coefficients representing a polynomial and returns isolating intervals for each real root. For example:</p>
<div class="cell" data-execution_count="44">
<div class="sourceCode cell-code" id="cb56"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb56-1"><a href="#cb56-1" aria-hidden="true" tabindex="-1"></a>p₀ <span class="op">=</span> <span class="fu">fromroots</span>([<span class="fl">1</span>,<span class="fl">3</span>,<span class="fl">5</span>])</span>
<span id="cb56-2"><a href="#cb56-2" aria-hidden="true" tabindex="-1"></a>st <span class="op">=</span> <span class="fu">ANewDsc</span>(<span class="fu">coeffs</span>(p₀))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="45">
<pre><code>There were 3 isolating intervals found:
[4.25…, 6.0…]₂₅₆
[2.62…, 4.25…]₂₅₆
[-0.5…, 2.62…]₂₅₆</code></pre>
</div>
</div>
<p>These intervals can be refined to give accurate approximations to the roots:</p>
<div class="cell" data-execution_count="45">
<div class="sourceCode cell-code" id="cb58"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb58-1"><a href="#cb58-1" aria-hidden="true" tabindex="-1"></a><span class="fu">refine_roots</span>(st)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="46">
<pre><code>3-element Vector{BigFloat}:
4.999999999999999999988812639274634601976233507362249045172904058207428900243547
3.000000000000000000006252262937500966174570607240785586677609011021020113396673
1.000000000000000000018681997535084761434897534348173150562760465656642061560433</code></pre>
</div>
</div>
<p>More challenging problems can be readily handled by this package. The following polynomial</p>
<div class="cell" data-execution_count="46">
<div class="sourceCode cell-code" id="cb60"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb60-1"><a href="#cb60-1" aria-hidden="true" tabindex="-1"></a>𝒔 <span class="op">=</span> <span class="fu">Polynomial</span>([<span class="fl">0</span>,<span class="fl">1</span>]) <span class="co"># also just variable(Polynomial{Int})</span></span>
<span id="cb60-2"><a href="#cb60-2" aria-hidden="true" tabindex="-1"></a>𝒖 <span class="op">=</span> <span class="op">-</span><span class="fl">1</span> <span class="op">+</span> <span class="fl">254</span><span class="op">*</span>𝒔 <span class="op">-</span> <span class="fl">16129</span><span class="op">*</span>𝒔<span class="op">^</span><span class="fl">2</span> <span class="op">+</span> 𝒔<span class="op">^</span><span class="fl">15</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="47">
-1 + 254∙x - 16129∙x<sup>2</sup> + x<sup>15</sup>
</div>
</div>
<p>has three real roots, two of which are clustered very close to each other:</p>
<div class="cell" data-execution_count="47">
<div class="sourceCode cell-code" id="cb61"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb61-1"><a href="#cb61-1" aria-hidden="true" tabindex="-1"></a>𝒔𝒕 <span class="op">=</span> <span class="fu">ANewDsc</span>(<span class="fu">coeffs</span>(𝒖))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="48">
<pre><code>There were 3 isolating intervals found:
[1.56…, 3.62…]₅₃
[0.0078740157480314962595…, 0.0078740157480314988277…]₁₃₁
[0.00787401574803149368282…, 0.0078740157480314962595…]₁₃₁</code></pre>
</div>
</div>
<p>and</p>
<div class="cell" data-execution_count="48">
<div class="sourceCode cell-code" id="cb63"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb63-1"><a href="#cb63-1" aria-hidden="true" tabindex="-1"></a><span class="fu">refine_roots</span>(𝒔𝒕)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="49">
<pre><code>3-element Vector{BigFloat}:
2.10577422917648295433232280879150031024324852056247605949961474907154886438575
0.00787401574803149746184924478761025007324703047462819163289637077019245526555863
0.007874015748031494730205602008914819785754607338104103490190741092899528046885136</code></pre>
</div>
</div>
<p>The SymPy package (<code>sympy.real_roots</code>) can accurately identify the three roots but it can take a <strong>very</strong> long time. The <code>Polynomials.roots</code> function from the <code>Polynomials</code> package identifies the cluster as complex valued. Though the implementation in <code>RealPolynomialRoots</code> doesnt handle such large polynomials, the authors of the algorithm have implementations that can quickly solve polynomials with degrees as high as <span class="math inline">\(10,000\)</span>.</p>
</section>
</section>
<section id="questions" class="level2" data-number="14.5">
<h2 data-number="14.5" class="anchored" data-anchor-id="questions"><span class="header-section-number">14.5</span> Questions</h2>
<section id="question" class="level6">
<h6 class="anchored" data-anchor-id="question">Question</h6>
<p>The rational expression <span class="math inline">\((x^3 - 2x + 3) / (x^2 - x + 1)\)</span> would have</p>
<div class="cell" data-hold="true" data-execution_count="49">
<div class="cell-output cell-output-display" data-execution_count="50">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="10243702508085513109" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_10243702508085513109">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_10243702508085513109_1">
<input class="form-check-input" type="radio" name="radio_10243702508085513109" id="radio_10243702508085513109_1" value="1">
<span class="label-body px-1">
A horizontal asymptote \(y=0\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_10243702508085513109_2">
<input class="form-check-input" type="radio" name="radio_10243702508085513109" id="radio_10243702508085513109_2" value="2">
<span class="label-body px-1">
A horizontal asymptote \(y=1\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_10243702508085513109_3">
<input class="form-check-input" type="radio" name="radio_10243702508085513109" id="radio_10243702508085513109_3" value="3">
<span class="label-body px-1">
A slant asymptote with slope \(m=1\)
</span>
</label>
</div>
</div>
</div>
<div id="10243702508085513109_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_10243702508085513109"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 3;
var msgBox = document.getElementById('10243702508085513109_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_10243702508085513109")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_10243702508085513109")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
</section>
<section id="question-1" class="level6">
<h6 class="anchored" data-anchor-id="question-1">Question</h6>
<p>The rational expression <span class="math inline">\((x^2 - x + 1)/ (x^3 - 2x + 3)\)</span> would have</p>
<div class="cell" data-hold="true" data-execution_count="50">
<div class="cell-output cell-output-display" data-execution_count="51">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="7749608050347243583" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_7749608050347243583">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_7749608050347243583_1">
<input class="form-check-input" type="radio" name="radio_7749608050347243583" id="radio_7749608050347243583_1" value="1">
<span class="label-body px-1">
A horizontal asymptote \(y=0\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_7749608050347243583_2">
<input class="form-check-input" type="radio" name="radio_7749608050347243583" id="radio_7749608050347243583_2" value="2">
<span class="label-body px-1">
A horizontal asymptote \(y=1\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_7749608050347243583_3">
<input class="form-check-input" type="radio" name="radio_7749608050347243583" id="radio_7749608050347243583_3" value="3">
<span class="label-body px-1">
A slant asymptote with slope \(m=1\)
</span>
</label>
</div>
</div>
</div>
<div id="7749608050347243583_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_7749608050347243583"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 1;
var msgBox = document.getElementById('7749608050347243583_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_7749608050347243583")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_7749608050347243583")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
</section>
<section id="question-2" class="level6">
<h6 class="anchored" data-anchor-id="question-2">Question</h6>
<p>The rational expression <span class="math inline">\((x^2 - x + 1)/ (x^2 - 3x + 3)\)</span> would have</p>
<div class="cell" data-hold="true" data-execution_count="51">
<div class="cell-output cell-output-display" data-execution_count="52">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="14989252995185607311" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_14989252995185607311">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_14989252995185607311_1">
<input class="form-check-input" type="radio" name="radio_14989252995185607311" id="radio_14989252995185607311_1" value="1">
<span class="label-body px-1">
A horizontal asymptote \(y=0\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_14989252995185607311_2">
<input class="form-check-input" type="radio" name="radio_14989252995185607311" id="radio_14989252995185607311_2" value="2">
<span class="label-body px-1">
A horizontal asymptote \(y=1\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_14989252995185607311_3">
<input class="form-check-input" type="radio" name="radio_14989252995185607311" id="radio_14989252995185607311_3" value="3">
<span class="label-body px-1">
A slant asymptote with slope \(m=1\)
</span>
</label>
</div>
</div>
</div>
<div id="14989252995185607311_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_14989252995185607311"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 2;
var msgBox = document.getElementById('14989252995185607311_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_14989252995185607311")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_14989252995185607311")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
</section>
<section id="question-3" class="level6">
<h6 class="anchored" data-anchor-id="question-3">Question</h6>
<p>The rational expression</p>
<p><span class="math display">\[
\frac{(x-1)\cdot(x-2)\cdot(x-3)}{(x-4)\cdot(x-5)\cdot(x-6)}
\]</span></p>
<p>would have</p>
<div class="cell" data-hold="true" data-execution_count="52">
<div class="cell-output cell-output-display" data-execution_count="53">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="12785086691942139786" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_12785086691942139786">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_12785086691942139786_1">
<input class="form-check-input" type="radio" name="radio_12785086691942139786" id="radio_12785086691942139786_1" value="1">
<span class="label-body px-1">
A horizontal asymptote \(y=1\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_12785086691942139786_2">
<input class="form-check-input" type="radio" name="radio_12785086691942139786" id="radio_12785086691942139786_2" value="2">
<span class="label-body px-1">
A slant asymptote with slope \(m=1\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_12785086691942139786_3">
<input class="form-check-input" type="radio" name="radio_12785086691942139786" id="radio_12785086691942139786_3" value="3">
<span class="label-body px-1">
A horizontal asymptote \(y=0\)
</span>
</label>
</div>
</div>
</div>
<div id="12785086691942139786_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_12785086691942139786"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 1;
var msgBox = document.getElementById('12785086691942139786_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_12785086691942139786")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_12785086691942139786")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
</section>
<section id="question-4" class="level6">
<h6 class="anchored" data-anchor-id="question-4">Question</h6>
<p>The rational expression</p>
<p><span class="math display">\[
\frac{(x-1)\cdot(x-2)\cdot(x-3)}{(x-4)\cdot(x-5)\cdot(x-6)}
\]</span></p>
<p>would have</p>
<div class="cell" data-hold="true" data-execution_count="53">
<div class="cell-output cell-output-display" data-execution_count="54">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="5554417564981793391" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_5554417564981793391">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_5554417564981793391_1">
<input class="form-check-input" type="radio" name="radio_5554417564981793391" id="radio_5554417564981793391_1" value="1">
<span class="label-body px-1">
A vertical asymptote \(x=5\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_5554417564981793391_2">
<input class="form-check-input" type="radio" name="radio_5554417564981793391" id="radio_5554417564981793391_2" value="2">
<span class="label-body px-1">
A slant asymptote with slope \(m=1\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_5554417564981793391_3">
<input class="form-check-input" type="radio" name="radio_5554417564981793391" id="radio_5554417564981793391_3" value="3">
<span class="label-body px-1">
A vertical asymptote \(x=1\)
</span>
</label>
</div>
</div>
</div>
<div id="5554417564981793391_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_5554417564981793391"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 1;
var msgBox = document.getElementById('5554417564981793391_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_5554417564981793391")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_5554417564981793391")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
</section>
<section id="question-5" class="level6">
<h6 class="anchored" data-anchor-id="question-5">Question</h6>
<p>The rational expression</p>
<p><span class="math display">\[
\frac{x^3 - 3x^2 + 2x}{3x^2 - 6x + 2}
\]</span></p>
<p>has a slant asymptote. What is the equation of that line?</p>
<div class="cell" data-hold="true" data-execution_count="54">
<div class="cell-output cell-output-display" data-execution_count="55">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="11880017862869816217" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_11880017862869816217">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_11880017862869816217_1">
<input class="form-check-input" type="radio" name="radio_11880017862869816217" id="radio_11880017862869816217_1" value="1">
<span class="label-body px-1">
\(y = 3x\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_11880017862869816217_2">
<input class="form-check-input" type="radio" name="radio_11880017862869816217" id="radio_11880017862869816217_2" value="2">
<span class="label-body px-1">
\(y = (1/3)x - (1/3)\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_11880017862869816217_3">
<input class="form-check-input" type="radio" name="radio_11880017862869816217" id="radio_11880017862869816217_3" value="3">
<span class="label-body px-1">
\(y = (1/3)x\)
</span>
</label>
</div>
</div>
</div>
<div id="11880017862869816217_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_11880017862869816217"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 2;
var msgBox = document.getElementById('11880017862869816217_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_11880017862869816217")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_11880017862869816217")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
</section>
<section id="question-6" class="level6">
<h6 class="anchored" data-anchor-id="question-6">Question</h6>
<p>Look at the graph of the function <span class="math inline">\(f(x) = ((x-1)\cdot(x-2)) / ((x-3)\cdot(x-4))\)</span></p>
<div class="cell" data-hold="true" data-execution_count="55">
<div class="cell-output cell-output-display" data-execution_count="56">
<p><img src="rational_functions_files/figure-html/cell-56-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>Is the following common conception true: “The graph of a function never crosses its asymptotes.”</p>
<div class="cell" data-hold="true" data-execution_count="56">
<div class="cell-output cell-output-display" data-execution_count="57">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="6214200585659799026" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_6214200585659799026">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_6214200585659799026_1">
<input class="form-check-input" type="radio" name="radio_6214200585659799026" id="radio_6214200585659799026_1" value="1">
<span class="label-body px-1">
Yes, this is true
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_6214200585659799026_2">
<input class="form-check-input" type="radio" name="radio_6214200585659799026" id="radio_6214200585659799026_2" value="2">
<span class="label-body px-1">
No, the graph clearly crosses the drawn asymptote
</span>
</label>
</div>
</div>
</div>
<div id="6214200585659799026_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_6214200585659799026"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 2;
var msgBox = document.getElementById('6214200585659799026_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_6214200585659799026")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_6214200585659799026")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
<p>(The wikipedia page indicates that the term “asymptote” was introduced by Apollonius of Perga in his work on conic sections, but in contrast to its modern meaning, he used it to mean any line that does not intersect the given curve. It can sometimes take a while to change perception.)</p>
</section>
<section id="question-7" class="level6">
<h6 class="anchored" data-anchor-id="question-7">Question</h6>
<p>Consider the two graphs of <span class="math inline">\(f(x) = 1/x\)</span> over <span class="math inline">\([10,20]\)</span> and <span class="math inline">\([100, 200]\)</span>:</p>
<div class="cell" data-hold="true" data-execution_count="57">
<div class="cell-output cell-output-display" data-execution_count="58">
<p><img src="rational_functions_files/figure-html/cell-58-output-1.svg" class="img-fluid"></p>
</div>
</div>
<div class="cell" data-hold="true" data-execution_count="58">
<div class="cell-output cell-output-display" data-execution_count="59">
<p><img src="rational_functions_files/figure-html/cell-59-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>The two shapes are basically identical and do not look like straight lines. How does this reconcile with the fact that <span class="math inline">\(f(x)=1/x\)</span> has a horizontal asymptote <span class="math inline">\(y=0\)</span>?</p>
<div class="cell" data-hold="true" data-execution_count="59">
<div class="cell-output cell-output-display" data-execution_count="60">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="5381304520415865191" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_5381304520415865191">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_5381304520415865191_1">
<input class="form-check-input" type="radio" name="radio_5381304520415865191" id="radio_5381304520415865191_1" value="1">
<span class="label-body px-1">
The graph is always decreasing, hence it will eventually reach \(-\infty\).
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_5381304520415865191_2">
<input class="form-check-input" type="radio" name="radio_5381304520415865191" id="radio_5381304520415865191_2" value="2">
<span class="label-body px-1">
The \(y\)-axis scale shows that indeed the \(y\) values are getting close to \(0\).
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_5381304520415865191_3">
<input class="form-check-input" type="radio" name="radio_5381304520415865191" id="radio_5381304520415865191_3" value="3">
<span class="label-body px-1">
The horizontal asymptote is not a straight line.
</span>
</label>
</div>
</div>
</div>
<div id="5381304520415865191_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_5381304520415865191"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 2;
var msgBox = document.getElementById('5381304520415865191_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_5381304520415865191")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_5381304520415865191")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
</section>
<section id="question-8" class="level6">
<h6 class="anchored" data-anchor-id="question-8">Question</h6>
<p>The amount of drug in a bloodstream after <span class="math inline">\(t\)</span> hours is modeled by the rational function</p>
<p><span class="math display">\[
r(t) = \frac{50t^2}{t^3 + 20}, \quad t \geq 0.
\]</span></p>
<p>What is the amount of the drug after <span class="math inline">\(1\)</span> hour?</p>
<div class="cell" data-execution_count="60">
<div class="cell-output cell-output-display" data-execution_count="61">
<pre><code>r1 (generic function with 1 method)</code></pre>
</div>
</div>
<div class="cell" data-hold="true" data-execution_count="61">
<div class="cell-output cell-output-display" data-execution_count="62">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="46597903079302133" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_46597903079302133">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="46597903079302133" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="46597903079302133_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("46597903079302133").addEventListener("change", function() {
var correct = (Math.abs(this.value - 2.380952380952381) <= 0.001);
var msgBox = document.getElementById('46597903079302133_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_46597903079302133")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_46597903079302133")
if (explanation != null) {
explanation.style.display = "block";
}
}
});
</script>
</div>
</div>
<p>What is the amount of drug in the bloodstream after 24 hours?</p>
<div class="cell" data-hold="true" data-execution_count="62">
<div class="cell-output cell-output-display" data-execution_count="63">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="3350121135024782259" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_3350121135024782259">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="3350121135024782259" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="3350121135024782259_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("3350121135024782259").addEventListener("change", function() {
var correct = (Math.abs(this.value - 2.0803236058942502) <= 0.001);
var msgBox = document.getElementById('3350121135024782259_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_3350121135024782259")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_3350121135024782259")
if (explanation != null) {
explanation.style.display = "block";
}
}
});
</script>
</div>
</div>
<p>What is more accurate: the peak amount is</p>
<div class="cell" data-hold="true" data-execution_count="63">
<div class="cell-output cell-output-display" data-execution_count="64">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="5462518462857892659" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_5462518462857892659">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_5462518462857892659_1">
<input class="form-check-input" type="radio" name="radio_5462518462857892659" id="radio_5462518462857892659_1" value="1">
<span class="label-body px-1">
between \(16\) and \(24\) hours
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_5462518462857892659_2">
<input class="form-check-input" type="radio" name="radio_5462518462857892659" id="radio_5462518462857892659_2" value="2">
<span class="label-body px-1">
between \(8\) and \(16\) hours
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_5462518462857892659_3">
<input class="form-check-input" type="radio" name="radio_5462518462857892659" id="radio_5462518462857892659_3" value="3">
<span class="label-body px-1">
after one day
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_5462518462857892659_4">
<input class="form-check-input" type="radio" name="radio_5462518462857892659" id="radio_5462518462857892659_4" value="4">
<span class="label-body px-1">
between \(0\) and \(8\) hours
</span>
</label>
</div>
</div>
</div>
<div id="5462518462857892659_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_5462518462857892659"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 4;
var msgBox = document.getElementById('5462518462857892659_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_5462518462857892659")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_5462518462857892659")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
<p>This graph has</p>
<div class="cell" data-hold="true" data-execution_count="64">
<div class="cell-output cell-output-display" data-execution_count="65">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="15437115974470728942" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_15437115974470728942">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_15437115974470728942_1">
<input class="form-check-input" type="radio" name="radio_15437115974470728942" id="radio_15437115974470728942_1" value="1">
<span class="label-body px-1">
a horizontal asymptote \(y=20\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_15437115974470728942_2">
<input class="form-check-input" type="radio" name="radio_15437115974470728942" id="radio_15437115974470728942_2" value="2">
<span class="label-body px-1">
a vertical asymptote with \(x = 20^{1/3}\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_15437115974470728942_3">
<input class="form-check-input" type="radio" name="radio_15437115974470728942" id="radio_15437115974470728942_3" value="3">
<span class="label-body px-1">
a horizontal asymptote \(y=0\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_15437115974470728942_4">
<input class="form-check-input" type="radio" name="radio_15437115974470728942" id="radio_15437115974470728942_4" value="4">
<span class="label-body px-1">
a slant asymptote with slope \(50\)
</span>
</label>
</div>
</div>
</div>
<div id="15437115974470728942_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_15437115974470728942"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 3;
var msgBox = document.getElementById('15437115974470728942_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_15437115974470728942")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_15437115974470728942")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
</section>
<section id="question-9" class="level6">
<h6 class="anchored" data-anchor-id="question-9">Question</h6>
<p>The (low-order) Pade approximation for <span class="math inline">\(\sin(x)\)</span> was seen to be <span class="math inline">\((x - 7/60 \cdot x^3)/(1 + 1/20 \cdot x^2)\)</span>. The graph showed that this approximation was fairly close over <span class="math inline">\([-\pi, \pi]\)</span>. Without graphing would you expect the behaviour of the function and its approximation to be similar for <em>large</em> values of <span class="math inline">\(x\)</span>?</p>
<div class="cell" data-hold="true" data-execution_count="65">
<div class="cell-output cell-output-display" data-execution_count="66">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="9255672206255841079" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_9255672206255841079">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_9255672206255841079_1">
<input class="form-check-input" type="radio" name="radio_9255672206255841079" id="radio_9255672206255841079_1" value="1">
<span class="label-body px-1">
Yes
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_9255672206255841079_2">
<input class="form-check-input" type="radio" name="radio_9255672206255841079" id="radio_9255672206255841079_2" value="2">
<span class="label-body px-1">
No
</span>
</label>
</div>
</div>
</div>
<div id="9255672206255841079_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_9255672206255841079"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 2;
var msgBox = document.getElementById('9255672206255841079_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_9255672206255841079")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_9255672206255841079")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
<p>Why?</p>
<div class="cell" data-hold="true" data-execution_count="66">
<div class="cell-output cell-output-display" data-execution_count="67">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="4451239122637335892" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_4451239122637335892">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_4451239122637335892_1">
<input class="form-check-input" type="radio" name="radio_4451239122637335892" id="radio_4451239122637335892_1" value="1">
<span class="label-body px-1">
The \(\sin(x)\) oscillates, but the rational function has a slant asymptote
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_4451239122637335892_2">
<input class="form-check-input" type="radio" name="radio_4451239122637335892" id="radio_4451239122637335892_2" value="2">
<span class="label-body px-1">
The \(\sin(x)\) oscillates, but the rational function has a horizontal asymptote of \(0\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_4451239122637335892_3">
<input class="form-check-input" type="radio" name="radio_4451239122637335892" id="radio_4451239122637335892_3" value="3">
<span class="label-body px-1">
The \(\sin(x)\) oscillates, but the rational function eventually follows \(7/60 \cdot x^3\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_4451239122637335892_4">
<input class="form-check-input" type="radio" name="radio_4451239122637335892" id="radio_4451239122637335892_4" value="4">
<span class="label-body px-1">
The \(\sin(x)\) oscillates, but the rational function has a non-zero horizontal asymptote
</span>
</label>
</div>
</div>
</div>
<div id="4451239122637335892_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_4451239122637335892"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 1;
var msgBox = document.getElementById('4451239122637335892_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_4451239122637335892")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_4451239122637335892")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
</section>
</section>
</main> <!-- /main -->
<script id="quarto-html-after-body" type="application/javascript">
window.document.addEventListener("DOMContentLoaded", function (event) {
const toggleBodyColorMode = (bsSheetEl) => {
const mode = bsSheetEl.getAttribute("data-mode");
const bodyEl = window.document.querySelector("body");
if (mode === "dark") {
bodyEl.classList.add("quarto-dark");
bodyEl.classList.remove("quarto-light");
} else {
bodyEl.classList.add("quarto-light");
bodyEl.classList.remove("quarto-dark");
}
}
const toggleBodyColorPrimary = () => {
const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
if (bsSheetEl) {
toggleBodyColorMode(bsSheetEl);
}
}
toggleBodyColorPrimary();
const icon = "";
const anchorJS = new window.AnchorJS();
anchorJS.options = {
placement: 'right',
icon: icon
};
anchorJS.add('.anchored');
const clipboard = new window.ClipboardJS('.code-copy-button', {
target: function(trigger) {
return trigger.previousElementSibling;
}
});
clipboard.on('success', function(e) {
// button target
const button = e.trigger;
// don't keep focus
button.blur();
// flash "checked"
button.classList.add('code-copy-button-checked');
var currentTitle = button.getAttribute("title");
button.setAttribute("title", "Copied!");
setTimeout(function() {
button.setAttribute("title", currentTitle);
button.classList.remove('code-copy-button-checked');
}, 1000);
// clear code selection
e.clearSelection();
});
function tippyHover(el, contentFn) {
const config = {
allowHTML: true,
content: contentFn,
maxWidth: 500,
delay: 100,
arrow: false,
appendTo: function(el) {
return el.parentElement;
},
interactive: true,
interactiveBorder: 10,
theme: 'quarto',
placement: 'bottom-start'
};
window.tippy(el, config);
}
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
for (var i=0; i<noterefs.length; i++) {
const ref = noterefs[i];
tippyHover(ref, function() {
let href = ref.getAttribute('href');
try { href = new URL(href).hash; } catch {}
const id = href.replace(/^#\/?/, "");
const note = window.document.getElementById(id);
return note.innerHTML;
});
}
var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
for (var i=0; i<bibliorefs.length; i++) {
const ref = bibliorefs[i];
const cites = ref.parentNode.getAttribute('data-cites').split(' ');
tippyHover(ref, function() {
var popup = window.document.createElement('div');
cites.forEach(function(cite) {
var citeDiv = window.document.createElement('div');
citeDiv.classList.add('hanging-indent');
citeDiv.classList.add('csl-entry');
var biblioDiv = window.document.getElementById('ref-' + cite);
if (biblioDiv) {
citeDiv.innerHTML = biblioDiv.innerHTML;
}
popup.appendChild(citeDiv);
});
return popup.innerHTML;
});
}
var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
var filterRegex = new RegExp('/' + window.location.host + '/');
var isInternal = (href) => {
return filterRegex.test(href) || localhostRegex.test(href);
}
// Inspect non-navigation links and adorn them if external
var links = window.document.querySelectorAll('a:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external)');
for (var i=0; i<links.length; i++) {
const link = links[i];
if (!isInternal(link.href)) {
// target, if specified
link.setAttribute("target", "_blank");
}
}
});
</script>
<nav class="page-navigation">
<div class="nav-page nav-page-previous">
<a href="../precalc/polynomials_package.html" class="pagination-link">
<i class="bi bi-arrow-left-short"></i> <span class="nav-page-text"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">The Polynomials package</span></span>
</a>
</div>
<div class="nav-page nav-page-next">
<a href="../precalc/exp_log_functions.html" class="pagination-link">
<span class="nav-page-text"><span class="chapter-number">15</span>&nbsp; <span class="chapter-title">Exponential and logarithmic functions</span></span> <i class="bi bi-arrow-right-short"></i>
</a>
</div>
</nav>
</div> <!-- /content -->
<footer class="footer">
<div class="nav-footer">
<div class="nav-footer-center">Copyright 2022, John Verzani</div>
</div>
</footer>
</body></html>