CalculusWithJuliaNotes.jl/quarto/0e7f54ed/precalc/polynomial.html

2465 lines
457 KiB
HTML
Raw Normal View History

2022-08-11 19:15:19 +02:00
<!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 - 11&nbsp; Polynomials</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/polynomial_roots.html" rel="next">
<link href="../precalc/inversefunctions.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">11</span>&nbsp; <span class="chapter-title">Polynomials</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 active"><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"><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="#linear-polynomials" id="toc-linear-polynomials" class="nav-link active" data-scroll-target="#linear-polynomials"> <span class="header-section-number">11.1</span> Linear polynomials</a></li>
<li><a href="#symbolic-math-in-julia" id="toc-symbolic-math-in-julia" class="nav-link" data-scroll-target="#symbolic-math-in-julia"> <span class="header-section-number">11.2</span> Symbolic math in Julia</a></li>
<li><a href="#substitution-subs-replace" id="toc-substitution-subs-replace" class="nav-link" data-scroll-target="#substitution-subs-replace"> <span class="header-section-number">11.3</span> Substitution: subs, replace</a>
<ul class="collapse">
<li><a href="#conversion-of-symbolic-numbers-to-julia-numbers" id="toc-conversion-of-symbolic-numbers-to-julia-numbers" class="nav-link" data-scroll-target="#conversion-of-symbolic-numbers-to-julia-numbers"> <span class="header-section-number">11.3.1</span> Conversion of symbolic numbers to Julia numbers</a></li>
<li><a href="#converting-symbolic-expressions-into-julia-functions" id="toc-converting-symbolic-expressions-into-julia-functions" class="nav-link" data-scroll-target="#converting-symbolic-expressions-into-julia-functions"> <span class="header-section-number">11.3.2</span> Converting symbolic expressions into Julia functions</a></li>
</ul></li>
<li><a href="#graphical-properties-of-polynomials" id="toc-graphical-properties-of-polynomials" class="nav-link" data-scroll-target="#graphical-properties-of-polynomials"> <span class="header-section-number">11.4</span> Graphical properties of polynomials</a>
<ul class="collapse">
<li><a href="#leading-term-dominates" id="toc-leading-term-dominates" class="nav-link" data-scroll-target="#leading-term-dominates"> <span class="header-section-number">11.4.1</span> Leading term dominates</a></li>
</ul></li>
<li><a href="#factoring-polynomials" id="toc-factoring-polynomials" class="nav-link" data-scroll-target="#factoring-polynomials"> <span class="header-section-number">11.5</span> Factoring polynomials</a>
<ul class="collapse">
<li><a href="#polynomial-functions-and-polynomials." id="toc-polynomial-functions-and-polynomials." class="nav-link" data-scroll-target="#polynomial-functions-and-polynomials."> <span class="header-section-number">11.5.1</span> Polynomial functions and polynomials.</a></li>
</ul></li>
<li><a href="#questions" id="toc-questions" class="nav-link" data-scroll-target="#questions"> <span class="header-section-number">11.6</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/polynomial.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">11</span>&nbsp; <span class="chapter-title">Polynomials</span></h1>
</div>
<div class="quarto-title-meta">
</div>
</header>
<p>In this section we use 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">SymPy</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="im">using</span> <span class="bu">Plots</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<hr>
<p>Polynomials are a particular class of expressions that are simple enough to have many properties that can be analyzed. In particular, the key concepts of calculus: limits, continuity, derivatives, and integrals are all relatively trivial for polynomial functions. However, polynomials are flexible enough that they can be used to approximate a wide variety of functions. Indeed, though we dont pursue this, we mention that <code>Julia</code>s <code>ApproxFun</code> package exploits this to great advantage.</p>
<p>Here we discuss some vocabulary and basic facts related to polynomials and show how the add-on <code>SymPy</code> package can be used to model polynomial expressions within <code>SymPy</code>. <code>SymPy</code> provides a Computer Algebra System (CAS) for <code>Julia</code>. In this case, by leveraging a mature <code>Python</code> package <a href="https://www.sympy.org/">SymPy</a>. Later we will discuss the <code>Polynomials</code> package for polynomials.</p>
<p>For our purposes, a <em>monomial</em> is simply a non-negative integer power of <span class="math inline">\(x\)</span> (or some other indeterminate symbol) possibly multiplied by a scalar constant. For example, <span class="math inline">\(5x^4\)</span> is a monomial, as are constants, such as <span class="math inline">\(-2=-2x^0\)</span> and the symbol itself, as <span class="math inline">\(x = x^1\)</span>. In general, one may consider restrictions on where the constants can come from, and consider more than one symbol, but we wont pursue this here, restricting ourselves to the case of a single variable and real coefficients.</p>
<p>A <em>polynomial</em> is a sum of monomials. After combining terms with same powers, a non-zero polynomial may be written uniquely as:</p>
<p><span class="math display">\[
a_n x^n + a_{n-1}x^{n-1} + \cdots a_1 x + a_0, \quad a_n \neq 0
\]</span></p>
<div class="cell" data-cache="true" data-hold="true" data-execution_count="4">
<div class="cell-output cell-output-display" data-execution_count="5">
<div class="d-flex justify-content-center"> <figure class="figure"> <img src="data:image/gif;base64,R0lGODlhAANAAvcBAAAAAAD/AAEBAQQEBAUFBQgICAqf+QsLCw0NDQ2f+Q+g+RAQEBERERGh+RMTExSi+RZQdBaj+RcXFxgZGRgiJxhMbBmk+hoaGhw9Uhyl+h0dHR8fHx+n+iAuNyEhISGn+iMjIyOp+iQkJCUlJSYmJiap+icnJygoKCmq+ioqKius+i0tLS+t+jExMTGu+jMzMzSv+jU1NTY2Njc3Nzew+jg4ODo6Ojuy+j09PT4+Pj8/Pz+z+kFBQUKw80K0+kNDQ0S1+kZGRkZleEhISEi3+ku4+0xMTE5OTk+6+1FRUVK7+1RUVFS8+1VVVVdXV1e9+1paWlq38Vu++1xcXF7A+19fX2FhYWHB+2JiYmNjY2TB+mZmZmbD+2hoaGnE+2xsbG3F+27A8m9vb3HH+3JycnK/7nTH+XV1dXXI+3h4eHnK+3vL/Hx8fH7M+39/f3/H84DM/IGBgYLO/YPL+ISEhIXN+obG7YbP/IeHh4mJiYrR/IyMjI3S/I6Ojo7S/Y+Pj5KSkpLU/JTV/ZXS+JaWlpbV/JfW/ZmZmZnX/Jubm5vM6pzY/Z2dnZ/Z/KCgoKDa/aOjo6SkpKTY96Tb/aTb/aXb/Kampqjd/Kmpqave/a2tra3f/a7f/K7f/bCwsLHV67Hg/LOzs7Ph/rTi/rbf+Le3t7fi/rjj/rm5ubu7u7vk/rzl/r3l/r6+vr7l/cLCwsLm/cTe7sXFxcXk+MXo/sXo/sbp/sjIyMjp/srq/crq/svLy83r/c7OztDt/tHR0dLt/tLt/tPT09Xr+NbW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CiEZIiDvfpc6SRBzbK7LwCEEJQLAPMZ9EyjBVUCwBYDKcsQOB4UMEEBKFK0SyY8APDHQr04UMCvB+VCZiKutDjy2GSXbTZHJwiArED4kLmyWgW1M8VgezFQFysCXdkvQZ0A//CFQMENFAwAVSAUCwBJFFQLAEYkrbCDhLVskQeEdRFdQsRMQAB6CUVS17iXny366KSXrs8KAEisqqdvk1LQck704pU+YgCAd82tFtT33ztjJtDghR+0uJ0DLd54wg2pCUATFyXDiml0YH7BAJcoFAsBJmQSTIOmd+/99+WatqlAMrZekAgHcK+PEbbnvVpBrOoc+O+EIyQN0QQZHbTSCxnNA/vruQg5CHAzoZUpEgupHefAx8AGOlA8hwCAFQjyrXcBwHUE4RZBnnE39wFgNgN5wQcBBzfB1c9FACDYQEJTPeQpJBkIcMA1vKEBqGFEAwxwmcASwRAnjOuBQAyiEP8rs44RCCANu/hFHOxmQQwOxDSAiI4yZECA9uFuAMLSRz3SkgMw+U4fwEsIIwDQAhvVw1Yn4B7/EPKOFwiAc64YAAlUNxFFFSQblJsCKvbIRxoBYFBDDKQgB+kTYqSAMABwACoQUEAkOVEgv0CAm0AgABl0QQC3u1ISfkCAFTgASICcHxhPeBB81G4AJvjkBpDiOIV8Kw3AkeBF7EgQVyDylrHxIyAJycte+tIl8mBFIkChFADoYCC5OMQuBYIgKFiBEfGoxSGo4b4myIMRVYCChAiyC2USBByHuF1CanGGJlThEM0ZyCE8hhB1JCIR6rsHIw5Bx4i8YAAjYuYh9sn/z33y0CAG09gvB0rQgo5EL7C0yJWY5xuGcW0i5ZgAjAxK0YpaFCKRyARewBGJBRxAWwpd3m8uEZsXIA0iibDBJ0960Za61KUc2wthFvBFiiy0O7Fwwxb88pMqpOES6nupUIfqy3agYg9pYEMkrGURb6QBgUSNqlSnStWqWvWqW
<figcaption class="figure-caption"><div class="markdown"><p>Polynomials of varying even degrees over \([-1,1]\).</p>
</div> </figcaption>
</figure>
</div>
</div>
</div>
<p>The numbers <span class="math inline">\(a_0, a_1, \dots, a_n\)</span> are the <strong>coefficients</strong> of the polynomial in the standard basis. With the identifications that <span class="math inline">\(x=x^1\)</span> and <span class="math inline">\(1 = x^0\)</span>, the monomials above have their power match their coefficients index, e.g., <span class="math inline">\(a_ix^i\)</span>. Outside of the coefficient <span class="math inline">\(a_n\)</span>, the other coefficients may be negative, positive, <em>or</em> <span class="math inline">\(0\)</span>. Except for the zero polynomial, the largest power <span class="math inline">\(n\)</span> is called the <a href="https://en.wikipedia.org/wiki/Degree_of_a_polynomial">degree</a>. The degree of the <a href="http://tinyurl.com/he6eg6s">zero</a> polynomial is typically not defined or defined to be <span class="math inline">\(-1\)</span>, so as to make certain statements easier to express. The term <span class="math inline">\(a_n\)</span> is called the <strong>leading coefficient</strong>. When the leading coefficient is <span class="math inline">\(1\)</span>, the polynomial is called a <strong>monic polynomial</strong>. The monomial <span class="math inline">\(a_n x^n\)</span> is the <strong>leading term</strong>.</p>
<p>For example, the polynomial <span class="math inline">\(-16x^2 - 32x + 100\)</span> has degree <span class="math inline">\(2\)</span>, leading coefficient <span class="math inline">\(-16\)</span> and leading term <span class="math inline">\(-16x^2\)</span>. It is not monic, as the leading coefficient is not <span class="math inline">\(1\)</span>.</p>
<p>Lower degree polynomials have special names: a degree <span class="math inline">\(0\)</span> polynomial (<span class="math inline">\(a_0\)</span>) is a non-zero constant, a degree <span class="math inline">\(1\)</span> polynomial (<span class="math inline">\(a_0+a_1x\)</span>) is called linear, a degree <span class="math inline">\(2\)</span> polynomial is quadratic, and a degree <span class="math inline">\(3\)</span> polynomial is called cubic.</p>
<section id="linear-polynomials" class="level2" data-number="11.1">
<h2 data-number="11.1" class="anchored" data-anchor-id="linear-polynomials"><span class="header-section-number">11.1</span> Linear polynomials</h2>
<p>A special place is reserved for polynomials with degree <span class="math inline">\(1\)</span>. These are linear, as their graphs are straight lines. The general form,</p>
<p><span class="math display">\[
a_1 x + a_0, \quad a_1 \neq 0,
\]</span></p>
<p>is often written as <span class="math inline">\(mx + b\)</span>, which is the <strong>slope-intercept</strong> form. The slope of a line determines how steeply it rises. The value of <span class="math inline">\(m\)</span> can be found from two points through the well-known formula:</p>
<p><span class="math display">\[
m = \frac{y_1 - y_0}{x_1 - x_0} = \frac{\text{rise}}{\text{run}}
\]</span></p>
<div class="cell" data-cache="true" data-hold="true" data-execution_count="5">
<div class="cell-output cell-output-display" data-execution_count="6">
<div class="d-flex justify-content-center"> <figure class="figure"> <img src="data:image/gif;base64,R0lGODlhAANAAvcBAAAAAAD/AAICAgR5wAUFBQcHBwee+gkJCQqe+QsLCwyf+Q4ODhAQEBCh+RMTExOi+RUVFRaj+RgYGBmk+hml+hoaGhul+hwcHBxnlR8fHx+n+iAgICE5RyGn+iIiIiKf7CSp+iYmJieq+ikpKSqr+iqr+ywsLCys+i4uLi+t+zAwMDExMTKu+jMzMzSg4jWg4jWv+zY2NjiMwDix+jk5OTs7Ozuy+j6z+j8/P0G0+kJCQkO1+0ZGRka2+klJSUq3+ky5+01NTU25+05OTk+i1FBlclFRUVFfaFG7+1NTU1RUVFR9l1W8/FZWVldXV1e9+1lfYlpaWlq++11dXV2//F5eXl9fX1/A+2FhYWGkzWPB+2VlZWbD/GhoaGjD+2tra2zF/G7G/G9vb2/G+3Ct03JycnLH+3R0dHXI+3d3d3fK/HnK+3p6enumwXzL+319fX2mwH5+fn9/f3/N/ICAgIDN/YHO/YLO/YODg4XO+4XP/YaGhofQ/YjM9ojQ/YmJiYmnuYnR/YuLi4zR/IzS/Y7T/ZCQkJDT/ZLU/JOTk5WVlZXU+5bP8pbV/ZmZmZnW/Jubm5zY/ZzY/Z3Y/J6enqCgoKHa/aLb/aOjo6PZ+6Pb/afc/KioqKnd/aqqqqve/a2tra3e/a7f/a+vr6/a9bDg/bLh/bOzs7Ph/rTi/ra2trbi/rfj/rm5ubni/Lu7u7vk/r29vb3l/r/m/r/m/sDAwMDg9MLCwsLn/sPn/sXFxcbo/cbo/sjIyMnq/srKysvLy8vl9svr/szMzMzr/s3Nzc3r/s7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HIIcs8sgkl2zyye2cg/LKLLfs8sswu6xyzDTXbPPNOGs8c8489+zzzxq7E5IgKJwjEMADbUAwQlN0oqs73eXazq5T6zrvR4aMUKdA1ZTJzzgHGJ1Q009HjWvVUu96dUeXFJBIJ53Ugt8WvShhxUJk5wq1rmif/632R51sIfgW1NErBg9pCK1Q3rjunTbff9vE+K2O+w251TdNbmvlt/bdeeQ1aV4r57Z6XjroNIlOK+m1mt466jOpPivrtLpeO+wyyS4r7bPa3jvuMekeK++y+l488DAJDyvxsRrfPPIvKf8q87A6Xz30LknvKvWvWt899i1p3yr3rnpfPvgsic8q+a2a3z76K6m/Kvusul8//CrJryr9q9rfP/4p0V+q+Kcq/xUQgCgRIKoImCoDNhCBJ1HgqRiIKgdWEIImkaCpKHgqC3YQgyXRYKk4aCoPlhCEJBHho0hYKhO2EIUjUaGjWPgoF9YQhiKRYaNo6Cgb9hCHIdEho/942CgfFhGIIBGin4jIKCM2EYkfUWKfmOgnJ1YRih6RIp+o2CcrdhGLHdHinrjIJy+WEYwcEaOayLgnM7YRjRtRY5rYqCY31hGOGpEjmuiYJjv2EY8Z0eOZ+IgmPxYSkBgR5JYIeSZDNhKRF1Gklhi5JUdWEpIWkWSWKKklS3YSkxXRJJY4mSVPlhKUFBHllUiJJVO2EpUTUSWSWHklV9YSlhKR5ZFoiSRb9hKXEdGlkXh5JF8WE5gQEWaRiGkkYzYTmQ9RJpGYWSRnVhOaDpFmiqhJJGt2E5sN0SaKuJkib5YTnAwR54nIiSJzthOdeHOa3sz2ucvlam2pk2fj6Hn/OnviCp+x0yfl+Pk6f94KoLkT6OYIejuD2gqhwVPo6Bj6O4fWCqLJk+jqKHo8i9IKo9HT6Ow4+jyPzgqk2RPp7kh6PZPKCqXhU+nwWPo9l8YKpumT6fJoej6bwgqn8dPp9Hj6Pp++Cqj5E+r2iHo/o7oKqQFU6viY+j+ntgqqC
<figcaption class="figure-caption"><div class="markdown"><p>Graphs of y = mx for different values of m</p>
</div> </figcaption>
</figure>
</div>
</div>
</div>
<p>The intercept, <span class="math inline">\(b\)</span>, comes from the fact that when <span class="math inline">\(x=0\)</span> the expression is <span class="math inline">\(b\)</span>. That is the graph of the function <span class="math inline">\(f(x) = mx + b\)</span> will have <span class="math inline">\((0,b)\)</span> as a point on it.</p>
<p>More generally, we have the <strong>point-slope</strong> form of a line, written as a polynomial through</p>
<p><span class="math display">\[
y_0 + m \cdot (x - x_0).
\]</span></p>
<p>The slope is <span class="math inline">\(m\)</span> and the point <span class="math inline">\((x_0, y_0)\)</span>. Again, the line graphing this as a function of <span class="math inline">\(x\)</span> would have the point <span class="math inline">\((x_0,y_0)\)</span> on it and have slope <span class="math inline">\(m\)</span>. This form is more useful in calculus, as the information we have convenient is more likely to be related to a specific value of <span class="math inline">\(x\)</span>, not the special value <span class="math inline">\(x=0\)</span>.</p>
<p>Thinking in terms of transformations, this looks like the function <span class="math inline">\(f(x) = x\)</span> (whose graph is a line with slope <span class="math inline">\(1\)</span>) stretched in the <span class="math inline">\(y\)</span> direction by a factor of <span class="math inline">\(m\)</span> then shifted right by <span class="math inline">\(x_0\)</span> units, and then shifted up by <span class="math inline">\(y_0\)</span> units. When <span class="math inline">\(m&gt;1\)</span>, this means the line grows faster. When <span class="math inline">\(m&lt; 0\)</span>, the line <span class="math inline">\(f(x)=x\)</span> is flipped through the <span class="math inline">\(x\)</span>-axis so would head downwards, not upwards like <span class="math inline">\(f(x) = x\)</span>.</p>
</section>
<section id="symbolic-math-in-julia" class="level2" data-number="11.2">
<h2 data-number="11.2" class="anchored" data-anchor-id="symbolic-math-in-julia"><span class="header-section-number">11.2</span> Symbolic math in Julia</h2>
<p>The indeterminate value <code>x</code> (or some other symbol) in a polynomial, is like a variable in a function and unlike a variable in <code>Julia</code>. Variables in <code>Julia</code> are identifiers, just a means to look up a specific, already determined, value. Rather, the symbol <code>x</code> is not yet determined, it is essentially a place holder for a future value. Although we have seen that <code>Julia</code> makes it very easy to work with mathematical functions, it is not the case that base <code>Julia</code> makes working with expressions of algebraic symbols easy. This makes sense, <code>Julia</code> is primarily designed for technical computing, where numeric approaches rule the day. However, symbolic math can be used from within <code>Julia</code> through add-on packages.</p>
<p>Symbolic math programs include well-known ones like the commercial programs Mathematica and Maple. Mathematica powers the popular <a href="www.wolframalpha.com">WolframAlpha</a> website, which turns “natural” language into the specifics of a programming language. The open-source Sage project is an alternative to these two commercial giants. It includes a wide-range of open-source math projects available within its umbrella framework. (<code>Julia</code> can even be run from within the free service <a href="https://cloud.sagemath.com/projects">cloud.sagemath.com</a>.) A more focused project for symbolic math, is the <a href="www.sympy.org">SymPy</a> Python library. SymPy is also used within Sage. However, SymPy provides a self-contained library that can be used standalone within a Python session. That is great for <code>Julia</code> users, as the <code>PyCall</code> and <code>PythonCall</code> packages glue <code>Julia</code> to Python in a seamless manner. This allows the <code>Julia</code> package <code>SymPy</code> to provide functionality from SymPy within <code>Julia</code>.</p>
<div class="callout-note callout callout-style-default callout-captioned">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-caption-container flex-fill">
Note
</div>
</div>
<div class="callout-body-container callout-body">
<p>When <code>SymPy</code> is installed through the package manger, the underlying <code>Python</code> libraries will also be installed.</p>
</div>
</div>
<div class="callout-note callout callout-style-default callout-captioned">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-caption-container flex-fill">
Note
</div>
</div>
<div class="callout-body-container callout-body">
<p>The <a href="../alternatives/symbolics"><code>Symbolics</code></a> package is a rapidly developing <code>Julia</code>-only packge that provides symbolic math options.</p>
</div>
</div>
<hr>
<p>To use <code>SymPy</code>, we create symbolic objects to be our indeterminate symbols. The <code>symbols</code> function does this. However, we will use the more convenient <code>@syms</code> macro front end for <code>symbols</code>.</p>
<div class="cell" data-execution_count="6">
<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="pp">@syms</span> a, b, c, x<span class="op">::</span><span class="dt">real</span>, zs[<span class="fl">1</span><span class="op">:</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="7">
<pre><code>(a, b, c, x, Sym[zs₁, zs₂, zs₃, zs₄, zs₅, zs₆, zs₇, zs₈, zs₉, zs₁₀])</code></pre>
</div>
</div>
<p>The above shows that multiple symbols can be defined at once. The annotation <code>x::real</code> instructs <code>SymPy</code> to assume the <code>x</code> is real, as otherwise it assumes it is possibly complex. There are many other <a href="http://docs.sympy.org/dev/modules/core.html#module-sympy.core.assumptions">assumptions</a> that can be made. The <code>@syms</code> macro documentation lists them. The <code>zs[1:10]</code> tensor notation creates a container with <span class="math inline">\(10\)</span> different symbols. The <em>macro</em> <code>@syms</code> does not need assignment, as the variable(s) are created behind the scenes by the macro.</p>
<div class="callout-note callout callout-style-default callout-captioned">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-caption-container flex-fill">
Note
</div>
</div>
<div class="callout-body-container callout-body">
<p>Macros in <code>Julia</code> are just transformations of the syntax into other syntax. The <code>@</code> indicates they behave differently than regular function calls.</p>
</div>
</div>
<p>The <code>SymPy</code> package does three basic things:</p>
<ul>
<li>It imports some of the functionality provided by <code>SymPy</code>, including the ability to create symbolic variables.</li>
<li>It overloads many <code>Julia</code> functions to work seamlessly with symbolic expressions. This makes working with polynomials quite natural.</li>
<li>It gives access to a wide range of SymPys functionality through the <code>sympy</code> object.</li>
</ul>
<p>To illustrate, using the just defined <code>x</code>, here is how we can create the polynomial <span class="math inline">\(-16x^2 + 100\)</span>:</p>
<div class="cell" data-execution_count="7">
<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="op">=</span> <span class="op">-</span><span class="fl">16</span>x<span class="op">^</span><span class="fl">2</span> <span class="op">+</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="8">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
100 - 16 x^{2}
\]
</span>
</div>
</div>
<p>That is, the expression is created just as you would create it within a function body. But here the result is still a symbolic object. We have assigned this expression to a variable <code>p</code>, and have not defined it as a function <code>p(x)</code>. Mentally keeping the distinction between symbolic expressions and functions is very important.</p>
<p>The <code>typeof</code> function shows that <code>𝒑</code> is of a symbolic type (<code>Sym</code>):</p>
<div class="cell" data-execution_count="8">
<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><span class="fu">typeof</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="9">
<pre><code>Sym</code></pre>
</div>
</div>
<p>We can mix and match symbolic objects. This command creates an arbitrary quadratic polynomial:</p>
<div class="cell" data-execution_count="9">
<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>quad <span class="op">=</span> a<span class="op">*</span>x<span class="op">^</span><span class="fl">2</span> <span class="op">+</span> b<span class="op">*</span>x <span class="op">+</span> c</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;">
\[
a x^{2} + b x + c
\]
</span>
</div>
</div>
<p>Again, this is entered in a manner nearly identical to how we see such expressions typeset (<span class="math inline">\(ax^2 + bx+c\)</span>), though we must remember to explicitly place the multiplication operator, as the symbols are not numeric literals.</p>
<p>We can apply many of <code>Julia</code>s mathematical functions and the result will still be symbolic:</p>
<div class="cell" data-execution_count="10">
<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">sin</span>(<span class="fu">a*</span>(x <span class="op">-</span> b<span class="op">*</span><span class="cn">pi</span>) <span class="op">+</span> c)</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">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
\sin{\left(a \left(- \pi b + x\right) + c \right)}
\]
</span>
</div>
</div>
<p>Another example, might be the following combination:</p>
<div class="cell" data-execution_count="11">
<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>quad <span class="op">+</span> quad<span class="op">^</span><span class="fl">2</span> <span class="op">-</span> quad<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="12">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
a x^{2} + b x + c - \left(a x^{2} + b x + c\right)^{3} + \left(a x^{2} + b x + c\right)^{2}
\]
</span>
</div>
</div>
<p>One way to create symbolic expressions is simply to call a <code>Julia</code> function with symbolic arguments. The first line in the next example defines a function, the second evaluates it at the symbols <code>x</code>, <code>a</code>, and <code>b</code> resulting in a symbolic expression <code>ex</code>:</p>
<div class="cell" data-execution_count="12">
<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">f</span>(x, m, b) <span class="op">=</span> m<span class="op">*</span>x <span class="op">+</span> b</span>
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a>ex <span class="op">=</span> <span class="fu">f</span>(x, a, b)</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;">
\[
a x + b
\]
</span>
</div>
</div>
</section>
<section id="substitution-subs-replace" class="level2" data-number="11.3">
<h2 data-number="11.3" class="anchored" data-anchor-id="substitution-subs-replace"><span class="header-section-number">11.3</span> Substitution: subs, replace</h2>
<p>Algebraically working with symbolic expressions is straightforward. A different symbolic task is substitution. For example, replacing each instance of <code>x</code> in a polynomial, with, say, <code>(x-1)^2</code>. Substitution requires three things to be specified: an expression to work on, a variable to substitute, and a value to substitute in.</p>
<p>SymPy provides its <code>subs</code> function for this. This function is available in <code>Julia</code>, but it is easier to use notation reminiscent of function evaluation.</p>
<p>To illustrate, to do the task above for the polynomial <span class="math inline">\(-16x^2 + 100\)</span> we could have:</p>
<div class="cell" data-execution_count="13">
<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><span class="fu">𝒑</span>(x <span class="op">=&gt;</span> (x<span class="op">-</span><span class="fl">1</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="14">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
100 - 16 \left(x - 1\right)^{4}
\]
</span>
</div>
</div>
<p>This “call” notation takes pairs (designated by <code>a=&gt;b</code>) where the left-hand side is the variable to substitute for, and the right-hand side the new value. The value to substitute can depend on the variable, as illustrated; be a different variable; or be a numeric value, such as <span class="math inline">\(2\)</span>:</p>
<div class="cell" data-execution_count="14">
<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>𝒚 <span class="op">=</span> <span class="fu">𝒑</span>(x<span class="op">=&gt;</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="15">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
36
\]
</span>
</div>
</div>
<p>The result will always be of a symbolic type, even if the answer is just a number:</p>
<div class="cell" data-execution_count="15">
<div class="sourceCode cell-code" id="cb13"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="fu">typeof</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">
<pre><code>Sym</code></pre>
</div>
</div>
<p>If there is just one free variable in an expression, the pair notation can be dropped:</p>
<div class="cell" data-execution_count="16">
<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">𝒑</span>(<span class="fl">4</span>) <span class="co"># substitutes x=&gt;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="17">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
-156
\]
</span>
</div>
</div>
<section id="example" class="level5">
<h5 class="anchored" data-anchor-id="example">Example</h5>
<p>Suppose we have the polynomial <span class="math inline">\(p = ax^2 + bx +c\)</span>. What would it look like if we shifted right by <span class="math inline">\(E\)</span> units and up by <span class="math inline">\(F\)</span> units?</p>
<div class="cell" data-execution_count="17">
<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><span class="pp">@syms</span> E F</span>
<span id="cb16-2"><a href="#cb16-2" aria-hidden="true" tabindex="-1"></a>p₂ <span class="op">=</span> a<span class="op">*</span>x<span class="op">^</span><span class="fl">2</span> <span class="op">+</span> b<span class="op">*</span>x <span class="op">+</span> c</span>
<span id="cb16-3"><a href="#cb16-3" aria-hidden="true" tabindex="-1"></a><span class="fu">p₂</span>(x <span class="op">=&gt;</span> x<span class="op">-</span>E) <span class="op">+</span> F</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">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
F + a \left(- E + x\right)^{2} + b \left(- E + x\right) + c
\]
</span>
</div>
</div>
<p>And expanded this becomes:</p>
<div class="cell" data-execution_count="18">
<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">expand</span>(<span class="fu">p₂</span>(x <span class="op">=&gt;</span> x<span class="op">-</span>E) <span class="op">+</span> F)</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">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
E^{2} a - 2 E a x - E b + F + a x^{2} + b x + c
\]
</span>
</div>
</div>
</section>
<section id="conversion-of-symbolic-numbers-to-julia-numbers" class="level3" data-number="11.3.1">
<h3 data-number="11.3.1" class="anchored" data-anchor-id="conversion-of-symbolic-numbers-to-julia-numbers"><span class="header-section-number">11.3.1</span> Conversion of symbolic numbers to Julia numbers</h3>
<p>In the above, we substituted <code>2</code> in for <code>x</code> to get <code>y</code>:</p>
<div class="cell" data-hold="true" data-execution_count="19">
<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>p <span class="op">=</span> <span class="op">-</span><span class="fl">16</span>x<span class="op">^</span><span class="fl">2</span> <span class="op">+</span> <span class="fl">100</span></span>
<span id="cb18-2"><a href="#cb18-2" aria-hidden="true" tabindex="-1"></a>y <span class="op">=</span> <span class="fu">p</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="20">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
36
\]
</span>
</div>
</div>
<p>The value, <span class="math inline">\(36\)</span> is still symbolic, but clearly an integer. If we are just looking at the output, we can easily translate from the symbolic value to an integer, as they print similarly. However the conversion to an integer, or another type of number, does not happen automatically. If a number is needed to pass along to another <code>Julia</code> function, it may need to be converted. In general, conversions between different types are handled through various methods of <code>convert</code>. However, with <code>SymPy</code>, the <code>N</code> function will attempt to do the conversion for you:</p>
<div class="cell" data-hold="true" data-execution_count="20">
<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>p <span class="op">=</span> <span class="op">-</span><span class="fl">16</span>x<span class="op">^</span><span class="fl">2</span> <span class="op">+</span> <span class="fl">100</span></span>
<span id="cb19-2"><a href="#cb19-2" aria-hidden="true" tabindex="-1"></a><span class="fu">N</span>(<span class="fu">p</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="21">
<pre><code>36</code></pre>
</div>
</div>
<p>Where <code>convert(T,x)</code> requires a specification of the type to convert <code>x</code> to, <code>N</code> attempts to match the data type used by SymPy to store the number. As such, the output type of <code>N</code> may vary (rational, a BigFloat, a float, etc.) For getting more digits of accuracy, a precision can be passed to <code>N</code>. The following command will take the symbolic value for <span class="math inline">\(\pi\)</span>, <code>PI</code>, and produce about <span class="math inline">\(60\)</span> digits worth as a <code>BigFloat</code> value:</p>
<div class="cell" data-execution_count="21">
<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">N</span>(PI, <span class="fl">60</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">
<pre><code>3.141592653589793238462643383279502884197169399375105820974939</code></pre>
</div>
</div>
<p>Conversion by <code>N</code> will fail if the value to be converted contains free symbols, as would be expected.</p>
</section>
<section id="converting-symbolic-expressions-into-julia-functions" class="level3" data-number="11.3.2">
<h3 data-number="11.3.2" class="anchored" data-anchor-id="converting-symbolic-expressions-into-julia-functions"><span class="header-section-number">11.3.2</span> Converting symbolic expressions into Julia functions</h3>
<p>Evaluating a symbolic expression and returning a numeric value can be done by composing the two just discussed concepts. For example:</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="op">=</span> <span class="fl">200</span> <span class="op">-</span> <span class="fl">16</span>x<span class="op">^</span><span class="fl">2</span></span>
<span id="cb23-2"><a href="#cb23-2" aria-hidden="true" tabindex="-1"></a><span class="fu">N</span>(<span class="fu">𝐩</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="23">
<pre><code>136</code></pre>
</div>
</div>
<p>This approach is direct, but can be slow <em>if</em> many such evaluations were needed (such as with a plot). An alternative is to turn the symbolic expression into a <code>Julia</code> function and then evaluate that as usual.</p>
<p>The <code>lambdify</code> function turns a symbolic expression into a <code>Julia</code> function</p>
<div class="cell" data-hold="true" data-execution_count="23">
<div class="sourceCode cell-code" id="cb25"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb25-1"><a href="#cb25-1" aria-hidden="true" tabindex="-1"></a>pp <span class="op">=</span> <span class="fu">lambdify</span>(𝐩)</span>
<span id="cb25-2"><a href="#cb25-2" aria-hidden="true" tabindex="-1"></a><span class="fu">pp</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="24">
<pre><code>136</code></pre>
</div>
</div>
<p>The <code>lambdify</code> function uses the name of the similar <code>SymPy</code> function which is named after Pythons convention of calling anoynmous function “lambdas.” The use above is straightforward. Only slightly more complicated is the use when there are multiple symbolic values. For example:</p>
<div class="cell" data-hold="true" data-execution_count="24">
<div class="sourceCode cell-code" id="cb27"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb27-1"><a href="#cb27-1" aria-hidden="true" tabindex="-1"></a>p <span class="op">=</span> a<span class="op">*</span>x<span class="op">^</span><span class="fl">2</span> <span class="op">+</span> b</span>
<span id="cb27-2"><a href="#cb27-2" aria-hidden="true" tabindex="-1"></a>pp <span class="op">=</span> <span class="fu">lambdify</span>(p)</span>
<span id="cb27-3"><a href="#cb27-3" aria-hidden="true" tabindex="-1"></a><span class="fu">pp</span>(<span class="fl">1</span>,<span class="fl">2</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="25">
<pre><code>11</code></pre>
</div>
</div>
<p>This evaluation matches <code>a</code> with <code>1</code>, <code>b</code> with<code>2</code>, and <code>x</code> with <code>3</code> as that is the order returned by the function call <code>free_symbols(p)</code>. To adjust that, a second <code>vars</code> argument can be given:</p>
<div class="cell" data-hold="true" data-execution_count="25">
<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>pp <span class="op">=</span> <span class="fu">lambdify</span>(p, (x,a,b))</span>
<span id="cb29-2"><a href="#cb29-2" aria-hidden="true" tabindex="-1"></a><span class="fu">pp</span>(<span class="fl">1</span>,<span class="fl">2</span>,<span class="fl">3</span>) <span class="co"># computes 2*1^2 + 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="26">
<pre><code>5</code></pre>
</div>
</div>
</section>
</section>
<section id="graphical-properties-of-polynomials" class="level2" data-number="11.4">
<h2 data-number="11.4" class="anchored" data-anchor-id="graphical-properties-of-polynomials"><span class="header-section-number">11.4</span> Graphical properties of polynomials</h2>
<p>Consider the graph of the polynomial <code>x^5 - x + 1</code>:</p>
<div class="cell" data-execution_count="26">
<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="fu">plot</span>(x<span class="op">^</span><span class="fl">5</span> <span class="op">-</span> x <span class="op">+</span> <span class="fl">1</span>, <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="27">
<p><img src="polynomial_files/figure-html/cell-27-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>(Plotting symbolic expressions is similar to plotting a function, in that the expression is passed in as the first argument. The expression must have only one free variable, as above, or an error will occur.)</p>
<p>This graph illustrates the key features of polynomial graphs:</p>
<ul>
<li>there may be values for <code>x</code> where the graph crosses the <span class="math inline">\(x\)</span> axis (real roots of the polynomial);</li>
<li>there may be peaks and valleys (local maxima and local minima)</li>
<li>except for constant polynomials, the ultimate behaviour for large values of <span class="math inline">\(\lvert x\rvert\)</span> is either both sides of the graph going to positive infinity, or negative infinity, or as in this graph one to the positive infinity and one to negative infinity. In particular, there is no <em>horizontal asymptote</em>.</li>
</ul>
<p>To investigate this last point, lets consider the case of the monomial <span class="math inline">\(x^n\)</span>. When <span class="math inline">\(n\)</span> is even, the following animation shows that larger values of <span class="math inline">\(n\)</span> have greater growth once outside of <span class="math inline">\([-1,1]\)</span>:</p>
<div class="cell" data-cache="true" data-hold="true" data-execution_count="27">
<div class="cell-output cell-output-display" data-execution_count="28">
<div class="d-flex justify-content-center"> <figure class="figure"> <img src="data:image/gif;base64,R0lGODlhAANAAvcBAAAAAAD/AAEBAQMDAwUFBQgICAoKCgsLCwuf+Q4ODg6H0g+g+RBejhERERFupxGN2RGi+hJUfRJahxNmlxOK0hQUFBWBwxWj+haHzBcXFxek+RlPcBml+hsbGxue7hyDwxym+x4eHh6AvR+n+iB/uSEhISF+tiF+tyIiIiKLzCKo+yN8siQkJCRsmSSp+iV6rSZ+tCcnJydbeid6rCeq+yl2pimr+ioqKix0oSyf5S0tLS6t+jAwMDBwmDKu+jMzMzRtkDaw+jc3Nzhphzo6Ojqx+jug3Tw8PD5kfT6z+j+z+0BAQEFzkkKQv0NDQ0NgcUREREWQvkWh2UW2+kZGRklJSUpaY0q4+ktLS05OTk5mdU65/FFRUVJkb1K7+1NTU1Oj1FRUVFZWV1a9+1hfZFlZWVmdx1tbW1u++11dXV7A/F9fX1+06WCkzmHB/GHB/GJiYmPB+mPC/GSkzGWaumZmZmbD/Gely2mmy2nE/Gtra2zF+25ubm9vb2/G/HJycnPI+3V1dXa333imw3jK+3l5eXt7e33M+35+fn9/f3+qxIHN/YKCgoSEhIbP/IeHh4mJiYrR/Y2NjY6puY7S/JDT/ZKSkpLU/ZWVlZbV/JeXl5iYmJmZmZnX/Zubm5vY/Z2qsp6enqCgoKDZ/aSkpKTb/KTb/aenp6ioqKmpqamrrand/aqqqqurq6ysrKze/K2tra7e/bCwsLDg/bOzs7PU6bTi/rXh/be3t7fj/rjj/rm5ubnk/ru7u7vk/b29vb/m/sDAwMLn/sPDw8Xo/sbo/sfHx8fo/crKysrq/svLy8zr/s3Nzc7r/c7s/tDQ0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AnRwmkTmRvRODACYGWCl8BZt9NFIm8RiJMcQwEJyFqFTAAsGtRJZQawAcIZBtprCkK2AEBTKbAJ1MwARBLHoi0CM3EoQOhVQLRABAPSZEM0M2fwQOqt5/+3ojhHlcbW6SRdu+OGIP6QOCwR0QEAyFjnzinGOGIQKAGUUFAsAYhj0jAEdbCIMgAcdAYCPA91TQAIMO6GrQO0cEEKIi7JFUBUAxEiAAQzfzRxEejdUT255VNTzQwnHwK/IRCfu/PPQG11MYpH0PhHQALxB7UCzzFsQKNkftIqvADiTUAkAmBUwAFCPzWEoABwyEGSj1Q/ANXPTuhDNkdzg/w10yFWiFqKP5YRhZ3+DVEPGFoJUGYRI0YugBCeopD0kBgvWkwg3gPGFdBnmONZ7BAAQYZBkOI0V0ggKQtDXJYKgAAAUekcCdOaPJQjATtXJxCZ2yMNNnGNuOmAIzf82cYQiHiFsBQmeQvRRBgB8YUrGA1xDTDGAEABsaOuioBa3yEW8vEIAREgZRtphgBIYBB4GKIDM/CGqAfoDEAJgBUNMBzGB3IMArBuIw3jBjS0RRFy7Qoi1hPi7Q7WoIf3AVhXkcZHjLeQVBMhAIB/YvC5a8pKYnEk3GsSNc5SgAOSqSAwGZpARzUkg5zDAAdRHkDU8jCGHAIAfxAYALhBEGCDbGGYGsjEOCTKI+yvktw5ZkHqoQ4WgokN+XIWdcrTwkVIcyD7UwUp/xCKSqEMIBDPJzW56syT4sFB5mva0i8DKIMXI2ZvQISpfpu11C/lGAwowzgwIQGjJEtiy1lj/jhAMIBIAescpSAhEQn5nIcXgBS+gAIBFKNROYBuIBUMwC4VaNBwD0VEWDXINhUaICgrF5zIAIDd/6GJGlbCoQuvIvI1+86UwjWlENFSYgYiwcxY5p0EuQYCcxSYLGEoiPBfCi/Z0YDUEuIRBNgYyg0gDaAMoAf2wsDJgKgRvC
<figcaption class="figure-caption"><div class="markdown"><p>Demonstration that \(x^{10}\) grows faster than \(x^8\), ... and \(x^2\) grows faster than \(x^0\) (which is constant).</p>
</div> </figcaption>
</figure>
</div>
</div>
</div>
<p>Of course, this is expected, as, for example, <span class="math inline">\(2^2 &lt; 2^4 &lt; 2^6 &lt; \cdots\)</span>. The general shape of these terms is similar - <span class="math inline">\(U\)</span> shaped, and larger powers dominate the smaller powers as <span class="math inline">\(\lvert x\rvert\)</span> gets big.</p>
<p>For odd powers of <span class="math inline">\(n\)</span>, the graph of the monomial <span class="math inline">\(x^n\)</span> is no longer <span class="math inline">\(U\)</span> shaped, but rather constantly increasing. This graph of <span class="math inline">\(x^5\)</span> is typical:</p>
<div class="cell" data-execution_count="28">
<div class="sourceCode cell-code" id="cb32"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb32-1"><a href="#cb32-1" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(x<span class="op">^</span><span class="fl">5</span>, <span class="op">-</span><span class="fl">2</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="29">
<p><img src="polynomial_files/figure-html/cell-29-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>Again, for larger powers the shape is similar, but the growth is faster.</p>
<section id="leading-term-dominates" class="level3" data-number="11.4.1">
<h3 data-number="11.4.1" class="anchored" data-anchor-id="leading-term-dominates"><span class="header-section-number">11.4.1</span> Leading term dominates</h3>
<p>To see the roots and/or the peaks and valleys of a polynomial requires a judicious choice of viewing window, as ultimately the leading term will dominate the graph. The following animation of the graph of <span class="math inline">\((x-5)(x-3)(x-2)(x-1)\)</span> illustrates. Subsequent images show a widening of the plot window until the graph appears U-shaped.</p>
<div class="cell" data-cache="true" data-hold="true" data-execution_count="29">
<div class="cell-output cell-output-display" data-execution_count="30">
<div class="d-flex justify-content-center"> <figure class="figure"> <img src="data:image/gif;base64,R0lGODlhAANAAvcCAAAAAACb+gD/AAGb+gICAgSd+gUFBQee+ggICAmd+AoKCgqf+g0NDQ2g+g+g+RCh+hCh+hERERGi+hKh+RK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IzQDAEoLtP7qsBYUrcIGzUJAB697mVARBOhNEA5NkwgkAHY7gywGFcRLoAIXODcwAEB7B1FA8/KxJvoJxGJGcMQsBMK/6xnqWwTZzRQetR6BgG9LBzGf/vJhPlOhTyHro8xAYng1DMgPABYsCAQYkD+GmOt4BHmB6v8iQgnRGQwhO2SgEpfIRDhFggAKIJ1BJAg4HBZkVsOSgfVytriBVIEAjnueCcN3EEcAQAYFkRqAOKeQTDntVQToWvwIMr+EkIAAVtEV+RDiBgDQbCCiQIACcPYQSyymaAgpBQFI0MRGOvKR28nUD343ECo6L4cM+ABBHMEqD4ZLhr4AFiS44r2BnPBCGEhaEAEAOjYmpAwPJIjkxFTDG+aQIKmxjkHERhBfiCKP2FIAArq2MADwgCCeWE5CMhECMCrkDwBIAiSnSc1q9sQTH7DTHRCYD0twgTpVzOH6BJYPSKxqi9gTlQzwUgu9/DEfpRwjCg8ynhgQahbmUsFYXJn/SNGVgSiQyGba8jHHgdQRIW0wXkEigQc8EMkGDaWfIjJDECgYc1yLAFib8sEYYhYEmwDwQUNHiodhbQFt1kypSlfqEk7woG8QYFVmjkhBK35PAWV6Vw06mDMhxAABJAjVCCRGwu+RkXWpM0AIQvWBmL1QIYpg1AU+QAACjPBVN
<figcaption class="figure-caption"><div class="markdown"><p>The previous graph is highlighted in red. Ultimately the leading term (\(x^4\) here) dominates the graph.</p>
</div> </figcaption>
</figure>
</div>
</div>
</div>
<p>The leading term in the animation is <span class="math inline">\(x^4\)</span>, of even degree, so the graphic is U-shaped, were the leading term of odd degree the left and right sides would each head off to different signs of infinity.</p>
<p>To illustrate analytically why the leading term dominates, consider the polynomial <span class="math inline">\(2x^5 - x + 1\)</span> and then factor out the largest power, <span class="math inline">\(x^5\)</span>, leaving a product:</p>
<p><span class="math display">\[
x^5 \cdot (2 - \frac{1}{x^4} + \frac{1}{x^5}).
\]</span></p>
<p>For large <span class="math inline">\(\lvert x\rvert\)</span>, the last two terms in the product on the right get close to <span class="math inline">\(0\)</span>, so this expression is <em>basically</em> just <span class="math inline">\(2x^5\)</span> - the leading term.</p>
<hr>
<p>The following graphic illustrates the <span class="math inline">\(4\)</span> basic <em>overall</em> shapes that can result when plotting a polynomials as <span class="math inline">\(x\)</span> grows without bound:</p>
<div class="cell" data-execution_count="30">
<div class="cell-output cell-output-display" data-execution_count="31">
<p><img src="polynomial_files/figure-html/cell-31-output-1.svg" class="img-fluid"></p>
</div>
</div>
<section id="example-1" class="level5">
<h5 class="anchored" data-anchor-id="example-1">Example</h5>
<p>Suppose <span class="math inline">\(p = a_n x^n + \cdots + a_1 x + a_0\)</span> with <span class="math inline">\(a_n &gt; 0\)</span>. Then by the above, eventually for large <span class="math inline">\(x &gt; 0\)</span> we have <span class="math inline">\(p &gt; 0\)</span>, as that is the behaviour of <span class="math inline">\(a_n x^n\)</span>. Were <span class="math inline">\(a_n &lt; 0\)</span>, then eventually for large <span class="math inline">\(x&gt;0\)</span>, <span class="math inline">\(p &lt; 0\)</span>.</p>
<p>Now consider the related polynomial, <span class="math inline">\(q\)</span>, where we multiply <span class="math inline">\(p\)</span> by <span class="math inline">\(x^n\)</span> and substitute in <span class="math inline">\(1/x\)</span> for <span class="math inline">\(x\)</span>. This is the “reversed” polynomial, as we see in this illustration for <span class="math inline">\(n=2\)</span>:</p>
<div class="cell" data-hold="true" data-execution_count="31">
<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>p <span class="op">=</span> a<span class="op">*</span>x<span class="op">^</span><span class="fl">2</span> <span class="op">+</span> b<span class="op">*</span>x <span class="op">+</span> c</span>
<span id="cb33-2"><a href="#cb33-2" aria-hidden="true" tabindex="-1"></a>n <span class="op">=</span> <span class="fl">2</span> <span class="co"># the degree of p</span></span>
<span id="cb33-3"><a href="#cb33-3" aria-hidden="true" tabindex="-1"></a>q <span class="op">=</span> <span class="fu">expand</span>(x<span class="op">^</span>n <span class="op">*</span> <span class="fu">p</span>(x <span class="op">=&gt;</span> <span class="fl">1</span><span class="op">/</span>x))</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">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
a + b x + c x^{2}
\]
</span>
</div>
</div>
<p>In particular, from the reversal, the behavior of <span class="math inline">\(q\)</span> for large <span class="math inline">\(x\)</span> depends on the sign of <span class="math inline">\(a_0\)</span>. As well, due to the <span class="math inline">\(1/x\)</span>, the behaviour of <span class="math inline">\(q\)</span> for large <span class="math inline">\(x&gt;0\)</span> is the same as the behaviour of <span class="math inline">\(p\)</span> for small <em>positive</em> <span class="math inline">\(x\)</span>. In particular if <span class="math inline">\(a_n &gt; 0\)</span> but <span class="math inline">\(a_0 &lt; 0\)</span>, then <code>p</code> is eventually positive and <code>q</code> is eventually negative.</p>
<p>That is, if <span class="math inline">\(p\)</span> has <span class="math inline">\(a_n &gt; 0\)</span> but <span class="math inline">\(a_0 &lt; 0\)</span> then the graph of <span class="math inline">\(p\)</span> must cross the <span class="math inline">\(x\)</span> axis.</p>
<p>This observation is the start of Descartes rule of <a href="http://sepwww.stanford.edu/oldsep/stew/descartes.pdf">signs</a>, which counts the change of signs of the coefficients in <code>p</code> to say something about how many possible crossings there are of the <span class="math inline">\(x\)</span> axis by the graph of the polynomial <span class="math inline">\(p\)</span>.</p>
</section>
</section>
</section>
<section id="factoring-polynomials" class="level2" data-number="11.5">
<h2 data-number="11.5" class="anchored" data-anchor-id="factoring-polynomials"><span class="header-section-number">11.5</span> Factoring polynomials</h2>
<p>Among numerous others, there are two common ways of representing a non-zero polynomial:</p>
<ul>
<li>expanded form, as in <span class="math inline">\(a_n x^n + a_{n-1}x^{n-1} + \cdots a_1 x + a_0, a_n \neq 0\)</span>; or</li>
<li>factored form, as in <span class="math inline">\(a\cdot(x-r_1)\cdot(x-r_2)\cdots(x-r_n), a \neq 0\)</span>.</li>
</ul>
<p>The latter writes <span class="math inline">\(p\)</span> as a product of linear factors, though this is only possible in general if we consider complex roots. With real roots only, then the factors are either linear or quadratic, as will be discussed later.</p>
<p>There are values to each representation. One value of the expanded form is that polynomial addition and scalar multiplication is much easier than in factored form. For example, adding polynomials just requires matching up the monomials of similar powers. For the factored form, polynomial multiplication is much easier than expanded form. For the factored form it is easy to read off <em>roots</em> of the polynomial (values of <span class="math inline">\(x\)</span> where <span class="math inline">\(p\)</span> is <span class="math inline">\(0\)</span>), as a product is <span class="math inline">\(0\)</span> only if a term is <span class="math inline">\(0\)</span>, so any zero must be a zero of a factor. Factored form has other technical advantages. For example, the polynomial <span class="math inline">\((x-1)^{1000}\)</span> can be compactly represented using the factored form, but would require <span class="math inline">\(1001\)</span> coefficients to store in expanded form. (As well, due to floating point differences, the two would evaluate quite differently as one would require over a <span class="math inline">\(1000\)</span> operations to compute, the other just two.)</p>
<p>Translating from factored form to expanded form can be done by carefully following the distributive law of multiplication. For example, with some care it can be shown that:</p>
<p><span class="math display">\[
(x-1) \cdot (x-2) \cdot (x-3) = x^3 - 6x^2 +11x - 6.
\]</span></p>
<p>The <code>SymPy</code> function <code>expand</code> will perform these algebraic manipulations without fuss:</p>
<div class="cell" data-execution_count="32">
<div class="sourceCode cell-code" id="cb34"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb34-1"><a href="#cb34-1" aria-hidden="true" tabindex="-1"></a><span class="fu">expand</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 class="fu">*</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="33">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
x^{3} - 6 x^{2} + 11 x - 6
\]
</span>
</div>
</div>
<p>Factoring a polynomial is several weeks worth of lessons, as there is no one-size-fits-all algorithm to follow. There are some tricks that are taught: for example factoring differences of perfect squares, completing the square, the rational root theorem, <span class="math inline">\(\dots\)</span>. But in general the solution is not automated. The <code>SymPy</code> function <code>factor</code> will find all rational factors (terms like <span class="math inline">\((qx-p)\)</span>), but will leave terms that do not have rational factors alone. For example:</p>
<div class="cell" data-execution_count="33">
<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">factor</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">11</span>x <span class="op">-</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="34">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
\left(x - 3\right) \left(x - 2\right) \left(x - 1\right)
\]
</span>
</div>
</div>
<p>Or</p>
<div class="cell" data-execution_count="34">
<div class="sourceCode cell-code" id="cb36"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb36-1"><a href="#cb36-1" aria-hidden="true" tabindex="-1"></a><span class="fu">factor</span>(x<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">8</span>x<span class="op">^</span><span class="fl">3</span> <span class="op">-</span> <span class="fl">8</span>x<span class="op">^</span><span class="fl">2</span> <span class="op">+</span> <span class="fl">7</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="35">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
\left(x - 3\right) \left(x - 1\right)^{2} \left(x^{2} + 1\right)
\]
</span>
</div>
</div>
<p>But will not factor things that are not hard to see:</p>
<div class="cell" data-execution_count="35">
<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>x<span class="op">^</span><span class="fl">2</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="36">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
x^{2} - 2
\]
</span>
</div>
</div>
<p>The factoring <span class="math inline">\((x-\sqrt{2})\cdot(x + \sqrt{2})\)</span> is not found, as <span class="math inline">\(\sqrt{2}\)</span> is not rational.</p>
<p>(For those, it may be possible to solve to get the roots, which can then be used to produce the factored form.)</p>
<section id="polynomial-functions-and-polynomials." class="level3" data-number="11.5.1">
<h3 data-number="11.5.1" class="anchored" data-anchor-id="polynomial-functions-and-polynomials."><span class="header-section-number">11.5.1</span> Polynomial functions and polynomials.</h3>
<p>Our definition of a polynomial is in terms of algebraic expressions which are easily represented by <code>SymPy</code> objects, but not objects from base <code>Julia</code>. (Later we discuss the <code>Polynomials</code> package for representing polynomials. There is also the <code>AbstractAlbegra</code> package for a more algebraic treatment of polynomials.)</p>
<p>However, <em>polynomial functions</em> are easily represented by <code>Julia</code>, for example,</p>
<div class="cell" data-execution_count="36">
<div class="sourceCode cell-code" id="cb38"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb38-1"><a href="#cb38-1" aria-hidden="true" tabindex="-1"></a><span class="fu">f</span>(x) <span class="op">=</span> <span class="op">-</span><span class="fl">16</span>x<span class="op">^</span><span class="fl">2</span> <span class="op">+</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="37">
<pre><code>f (generic function with 2 methods)</code></pre>
</div>
</div>
<p>The distinction is subtle, the expression is turned into a function just by adding the <code>f(x) =</code> preface. But to <code>Julia</code> there is a big distinction. The function form never does any computation until after a value of <span class="math inline">\(x\)</span> is passed to it. Whereas symbolic expressions can be manipulated quite freely before any numeric values are specified.</p>
<p>It is easy to create a symbolic expression from a function - just evaluate the function on a symbolic value:</p>
<div class="cell" data-execution_count="37">
<div class="sourceCode cell-code" id="cb40"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb40-1"><a href="#cb40-1" aria-hidden="true" tabindex="-1"></a><span class="fu">f</span>(x)</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">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
100 - 16 x^{2}
\]
</span>
</div>
</div>
<p>This is easy - but can also be confusing. The function object is <code>f</code>, the expression is <code>f(x)</code> - the function evaluated on a symbolic object. Moreover, as seen, the symbolic expression can be evaluated using the same syntax as a function call:</p>
<div class="cell" data-execution_count="38">
<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>p <span class="op">=</span> <span class="fu">f</span>(x)</span>
<span id="cb41-2"><a href="#cb41-2" aria-hidden="true" tabindex="-1"></a><span class="fu">p</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="39">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
36
\]
</span>
</div>
</div>
<p>For many uses, the distinction is unnecessary to make, as the many functions will work with any callable expression. One such is <code>plot</code> either <code>plot(f, a, b)</code> or <code>plot(f(x),a, b)</code> will produce the same plot using the <code>Plots</code> package.</p>
</section>
</section>
<section id="questions" class="level2" data-number="11.6">
<h2 data-number="11.6" class="anchored" data-anchor-id="questions"><span class="header-section-number">11.6</span> Questions</h2>
<section id="question" class="level6">
<h6 class="anchored" data-anchor-id="question">Question</h6>
<p>Let <span class="math inline">\(p\)</span> be the polynomial <span class="math inline">\(3x^2 - 2x + 5\)</span>.</p>
<p>What is the degree of <span class="math inline">\(p\)</span>?</p>
<div class="cell" data-hold="true" data-execution_count="39">
<div class="cell-output cell-output-display" data-execution_count="40">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="14227349458571548855" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_14227349458571548855">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="14227349458571548855" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="14227349458571548855_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("14227349458571548855").addEventListener("change", function() {
var correct = (Math.abs(this.value - 2) <= 0);
var msgBox = document.getElementById('14227349458571548855_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_14227349458571548855")
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_14227349458571548855")
if (explanation != null) {
explanation.style.display = "block";
}
}
});
</script>
</div>
</div>
<p>What is the leading coefficient of <span class="math inline">\(p\)</span>?</p>
<div class="cell" data-execution_count="40">
<div class="cell-output cell-output-display" data-execution_count="41">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="17428890841209197184" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_17428890841209197184">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="17428890841209197184" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="17428890841209197184_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("17428890841209197184").addEventListener("change", function() {
var correct = (Math.abs(this.value - 3) <= 0);
var msgBox = document.getElementById('17428890841209197184_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_17428890841209197184")
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_17428890841209197184")
if (explanation != null) {
explanation.style.display = "block";
}
}
});
</script>
</div>
</div>
<p>The graph of <span class="math inline">\(p\)</span> would have what <span class="math inline">\(y\)</span>-intercept?</p>
<div class="cell" data-execution_count="41">
<div class="cell-output cell-output-display" data-execution_count="42">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="14303254114744292916" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_14303254114744292916">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="14303254114744292916" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="14303254114744292916_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("14303254114744292916").addEventListener("change", function() {
var correct = (Math.abs(this.value - 5) <= 0);
var msgBox = document.getElementById('14303254114744292916_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_14303254114744292916")
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_14303254114744292916")
if (explanation != null) {
explanation.style.display = "block";
}
}
});
</script>
</div>
</div>
<p>Is <span class="math inline">\(p\)</span> a monic polynomial?</p>
<div class="cell" data-execution_count="42">
<div class="cell-output cell-output-display" data-execution_count="43">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="9617875952855429725" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_9617875952855429725">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_9617875952855429725_1">
<input class="form-check-input" type="radio" name="radio_9617875952855429725" id="radio_9617875952855429725_1" value="1">
<span class="label-body px-1">
Yes
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_9617875952855429725_2">
<input class="form-check-input" type="radio" name="radio_9617875952855429725" id="radio_9617875952855429725_2" value="2">
<span class="label-body px-1">
No
</span>
</label>
</div>
</div>
</div>
<div id="9617875952855429725_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_9617875952855429725"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 2;
var msgBox = document.getElementById('9617875952855429725_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_9617875952855429725")
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_9617875952855429725")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
<p>Is <span class="math inline">\(p\)</span> a quadratic polynomial?</p>
<div class="cell" data-execution_count="43">
<div class="cell-output cell-output-display" data-execution_count="44">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="6536535233179182058" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_6536535233179182058">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_6536535233179182058_1">
<input class="form-check-input" type="radio" name="radio_6536535233179182058" id="radio_6536535233179182058_1" value="1">
<span class="label-body px-1">
Yes
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_6536535233179182058_2">
<input class="form-check-input" type="radio" name="radio_6536535233179182058" id="radio_6536535233179182058_2" value="2">
<span class="label-body px-1">
No
</span>
</label>
</div>
</div>
</div>
<div id="6536535233179182058_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_6536535233179182058"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 1;
var msgBox = document.getElementById('6536535233179182058_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_6536535233179182058")
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_6536535233179182058")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
<p>The graph of <span class="math inline">\(p\)</span> would be <span class="math inline">\(U\)</span>-shaped?</p>
<div class="cell" data-execution_count="44">
<div class="cell-output cell-output-display" data-execution_count="45">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="4398266763210570906" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_4398266763210570906">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_4398266763210570906_1">
<input class="form-check-input" type="radio" name="radio_4398266763210570906" id="radio_4398266763210570906_1" value="1">
<span class="label-body px-1">
Yes
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_4398266763210570906_2">
<input class="form-check-input" type="radio" name="radio_4398266763210570906" id="radio_4398266763210570906_2" value="2">
<span class="label-body px-1">
No
</span>
</label>
</div>
</div>
</div>
<div id="4398266763210570906_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_4398266763210570906"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 1;
var msgBox = document.getElementById('4398266763210570906_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_4398266763210570906")
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_4398266763210570906")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
<p>What is the leading term of <span class="math inline">\(p\)</span>?</p>
<div class="cell" data-hold="true" data-execution_count="45">
<div class="cell-output cell-output-display" data-execution_count="46">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="4948115528765244722" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_4948115528765244722">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_4948115528765244722_1">
<input class="form-check-input" type="radio" name="radio_4948115528765244722" id="radio_4948115528765244722_1" value="1">
<span class="label-body px-1">
\(3\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_4948115528765244722_2">
<input class="form-check-input" type="radio" name="radio_4948115528765244722" id="radio_4948115528765244722_2" value="2">
<span class="label-body px-1">
\(3x^2\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_4948115528765244722_3">
<input class="form-check-input" type="radio" name="radio_4948115528765244722" id="radio_4948115528765244722_3" value="3">
<span class="label-body px-1">
\(-2x\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_4948115528765244722_4">
<input class="form-check-input" type="radio" name="radio_4948115528765244722" id="radio_4948115528765244722_4" value="4">
<span class="label-body px-1">
\(5\)
</span>
</label>
</div>
</div>
</div>
<div id="4948115528765244722_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_4948115528765244722"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 2;
var msgBox = document.getElementById('4948115528765244722_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_4948115528765244722")
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_4948115528765244722")
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>Let <span class="math inline">\(p = x^3 - 2x^2 +3x - 4\)</span>.</p>
<p>What is <span class="math inline">\(a_2\)</span>, using the standard numbering of coefficient?</p>
<div class="cell" data-execution_count="46">
<div class="cell-output cell-output-display" data-execution_count="47">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="217798504043531981" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_217798504043531981">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="217798504043531981" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="217798504043531981_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("217798504043531981").addEventListener("change", function() {
var correct = (Math.abs(this.value - -2) <= 0);
var msgBox = document.getElementById('217798504043531981_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_217798504043531981")
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_217798504043531981")
if (explanation != null) {
explanation.style.display = "block";
}
}
});
</script>
</div>
</div>
<p>What is <span class="math inline">\(a_n\)</span>?</p>
<div class="cell" data-execution_count="47">
<div class="cell-output cell-output-display" data-execution_count="48">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="16394645662266939214" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_16394645662266939214">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="16394645662266939214" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="16394645662266939214_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("16394645662266939214").addEventListener("change", function() {
var correct = (Math.abs(this.value - 1) <= 0);
var msgBox = document.getElementById('16394645662266939214_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_16394645662266939214")
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_16394645662266939214")
if (explanation != null) {
explanation.style.display = "block";
}
}
});
</script>
</div>
</div>
<p>What is <span class="math inline">\(a_0\)</span>?</p>
<div class="cell" data-execution_count="48">
<div class="cell-output cell-output-display" data-execution_count="49">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="10538694461509438566" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_10538694461509438566">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="10538694461509438566" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="10538694461509438566_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("10538694461509438566").addEventListener("change", function() {
var correct = (Math.abs(this.value - -4) <= 0);
var msgBox = document.getElementById('10538694461509438566_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_10538694461509438566")
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_10538694461509438566")
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 linear polynomial <span class="math inline">\(p = 2x + 3\)</span> is written in which form:</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="2798856811212515174" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_2798856811212515174">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_2798856811212515174_1">
<input class="form-check-input" type="radio" name="radio_2798856811212515174" id="radio_2798856811212515174_1" value="1">
<span class="label-body px-1">
general form
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_2798856811212515174_2">
<input class="form-check-input" type="radio" name="radio_2798856811212515174" id="radio_2798856811212515174_2" value="2">
<span class="label-body px-1">
point-slope form
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_2798856811212515174_3">
<input class="form-check-input" type="radio" name="radio_2798856811212515174" id="radio_2798856811212515174_3" value="3">
<span class="label-body px-1">
slope-intercept form
</span>
</label>
</div>
</div>
</div>
<div id="2798856811212515174_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_2798856811212515174"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 3;
var msgBox = document.getElementById('2798856811212515174_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_2798856811212515174")
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_2798856811212515174")
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 polynomial <code>p</code> is defined in <code>Julia</code> as follows:</p>
<div class="sourceCode cell-code" id="cb42"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb42-1"><a href="#cb42-1" aria-hidden="true" tabindex="-1"></a><span class="pp">@syms</span> x</span>
<span id="cb42-2"><a href="#cb42-2" aria-hidden="true" tabindex="-1"></a>p <span class="op">=</span> <span class="op">-</span><span class="fl">16</span>x<span class="op">^</span><span class="fl">2</span> <span class="op">+</span> <span class="fl">64</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<p>What command will return the value of the polynomial when <span class="math inline">\(x=2\)</span>?</p>
<div class="cell" data-hold="true" data-execution_count="51">
<div class="cell-output cell-output-display" data-execution_count="51">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="9976305713579571914" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_9976305713579571914">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_9976305713579571914_1">
<input class="form-check-input" type="radio" name="radio_9976305713579571914" id="radio_9976305713579571914_1" value="1">
<span class="label-body px-1">
<code>p_2</code>
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_9976305713579571914_2">
<input class="form-check-input" type="radio" name="radio_9976305713579571914" id="radio_9976305713579571914_2" value="2">
<span class="label-body px-1">
<code>p[2]</code>
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_9976305713579571914_3">
<input class="form-check-input" type="radio" name="radio_9976305713579571914" id="radio_9976305713579571914_3" value="3">
<span class="label-body px-1">
<code>p*2</code>
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_9976305713579571914_4">
<input class="form-check-input" type="radio" name="radio_9976305713579571914" id="radio_9976305713579571914_4" value="4">
<span class="label-body px-1">
<code>p(x=&gt;2)</code>
</span>
</label>
</div>
</div>
</div>
<div id="9976305713579571914_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_9976305713579571914"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 4;
var msgBox = document.getElementById('9976305713579571914_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_9976305713579571914")
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_9976305713579571914")
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>In the large, the graph of <span class="math inline">\(p=x^{101} - x + 1\)</span> will</p>
<div class="cell" data-hold="true" data-execution_count="52">
<div class="cell-output cell-output-display" data-execution_count="52">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="13530449032116469889" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_13530449032116469889">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_13530449032116469889_1">
<input class="form-check-input" type="radio" name="radio_13530449032116469889" id="radio_13530449032116469889_1" value="1">
<span class="label-body px-1">
Be \(U\)-shaped, opening upward
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_13530449032116469889_2">
<input class="form-check-input" type="radio" name="radio_13530449032116469889" id="radio_13530449032116469889_2" value="2">
<span class="label-body px-1">
Be \(U\)-shaped, opening downward
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_13530449032116469889_3">
<input class="form-check-input" type="radio" name="radio_13530449032116469889" id="radio_13530449032116469889_3" value="3">
<span class="label-body px-1">
Overall, go upwards from \(-\infty\) to \(+\infty\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_13530449032116469889_4">
<input class="form-check-input" type="radio" name="radio_13530449032116469889" id="radio_13530449032116469889_4" value="4">
<span class="label-body px-1">
Overall, go downwards from \(+\infty\) to \(-\infty\)
</span>
</label>
</div>
</div>
</div>
<div id="13530449032116469889_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_13530449032116469889"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 3;
var msgBox = document.getElementById('13530449032116469889_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_13530449032116469889")
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_13530449032116469889")
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>In the large, the graph of <span class="math inline">\(p=x^{102} - x^{101} + x + 1\)</span> will</p>
<div class="cell" data-hold="true" data-execution_count="53">
<div class="cell-output cell-output-display" data-execution_count="53">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="8298265012659132938" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_8298265012659132938">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_8298265012659132938_1">
<input class="form-check-input" type="radio" name="radio_8298265012659132938" id="radio_8298265012659132938_1" value="1">
<span class="label-body px-1">
Be \(U\)-shaped, opening upward
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_8298265012659132938_2">
<input class="form-check-input" type="radio" name="radio_8298265012659132938" id="radio_8298265012659132938_2" value="2">
<span class="label-body px-1">
Be \(U\)-shaped, opening downward
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_8298265012659132938_3">
<input class="form-check-input" type="radio" name="radio_8298265012659132938" id="radio_8298265012659132938_3" value="3">
<span class="label-body px-1">
Overall, go upwards from \(-\infty\) to \(+\infty\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_8298265012659132938_4">
<input class="form-check-input" type="radio" name="radio_8298265012659132938" id="radio_8298265012659132938_4" value="4">
<span class="label-body px-1">
Overall, go downwards from \(+\infty\) to \(-\infty\)
</span>
</label>
</div>
</div>
</div>
<div id="8298265012659132938_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_8298265012659132938"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 1;
var msgBox = document.getElementById('8298265012659132938_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_8298265012659132938")
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_8298265012659132938")
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>In the large, the graph of <span class="math inline">\(p=-x^{10} + x^9 + x^8 + x^7 + x^6\)</span> will</p>
<div class="cell" data-hold="true" data-execution_count="54">
<div class="cell-output cell-output-display" data-execution_count="54">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="15561108228234012904" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_15561108228234012904">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_15561108228234012904_1">
<input class="form-check-input" type="radio" name="radio_15561108228234012904" id="radio_15561108228234012904_1" value="1">
<span class="label-body px-1">
Be \(U\)-shaped, opening upward
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_15561108228234012904_2">
<input class="form-check-input" type="radio" name="radio_15561108228234012904" id="radio_15561108228234012904_2" value="2">
<span class="label-body px-1">
Be \(U\)-shaped, opening downward
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_15561108228234012904_3">
<input class="form-check-input" type="radio" name="radio_15561108228234012904" id="radio_15561108228234012904_3" value="3">
<span class="label-body px-1">
Overall, go upwards from \(-\infty\) to \(+\infty\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_15561108228234012904_4">
<input class="form-check-input" type="radio" name="radio_15561108228234012904" id="radio_15561108228234012904_4" value="4">
<span class="label-body px-1">
Overall, go downwards from \(+\infty\) to \(-\infty\)
</span>
</label>
</div>
</div>
</div>
<div id="15561108228234012904_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_15561108228234012904"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 2;
var msgBox = document.getElementById('15561108228234012904_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_15561108228234012904")
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_15561108228234012904")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
</section>
<section id="question-7" class="level6">
<h6 class="anchored" data-anchor-id="question-7">Question</h6>
<p>Use <code>SymPy</code> to factor the polynomial <span class="math inline">\(x^{11} - x\)</span>. How many factors are found?</p>
<div class="cell" data-hold="true" data-execution_count="55">
<div class="cell-output cell-output-display" data-execution_count="55">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="16928029585630841431" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_16928029585630841431">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="16928029585630841431" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="16928029585630841431_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("16928029585630841431").addEventListener("change", function() {
var correct = (Math.abs(this.value - 5) <= 0);
var msgBox = document.getElementById('16928029585630841431_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_16928029585630841431")
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_16928029585630841431")
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>Use <code>SymPy</code> to factor the polynomial <span class="math inline">\(x^{12} - 1\)</span>. How many factors are found?</p>
<div class="cell" data-hold="true" data-execution_count="56">
<div class="cell-output cell-output-display" data-execution_count="56">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="3772274614958833958" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_3772274614958833958">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="3772274614958833958" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="3772274614958833958_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("3772274614958833958").addEventListener("change", function() {
var correct = (Math.abs(this.value - 6) <= 0);
var msgBox = document.getElementById('3772274614958833958_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_3772274614958833958")
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_3772274614958833958")
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>What is the monic polynomial with roots <span class="math inline">\(x=-1\)</span>, <span class="math inline">\(x=0\)</span>, and <span class="math inline">\(x=2\)</span>?</p>
<div class="cell" data-hold="true" data-execution_count="57">
<div class="cell-output cell-output-display" data-execution_count="57">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="1855149482095150509" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_1855149482095150509">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_1855149482095150509_1">
<input class="form-check-input" type="radio" name="radio_1855149482095150509" id="radio_1855149482095150509_1" value="1">
<span class="label-body px-1">
<code>x^3 + x^2 - 2x</code>
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_1855149482095150509_2">
<input class="form-check-input" type="radio" name="radio_1855149482095150509" id="radio_1855149482095150509_2" value="2">
<span class="label-body px-1">
<code>x^3 - x^2 - 2x</code>
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_1855149482095150509_3">
<input class="form-check-input" type="radio" name="radio_1855149482095150509" id="radio_1855149482095150509_3" value="3">
<span class="label-body px-1">
<code>x^3 - 3x^2 + 2x</code>
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_1855149482095150509_4">
<input class="form-check-input" type="radio" name="radio_1855149482095150509" id="radio_1855149482095150509_4" value="4">
<span class="label-body px-1">
<code>x^3 + x^2 + 2x</code>
</span>
</label>
</div>
</div>
</div>
<div id="1855149482095150509_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_1855149482095150509"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 2;
var msgBox = document.getElementById('1855149482095150509_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_1855149482095150509")
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_1855149482095150509")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
</section>
<section id="question-10" class="level6">
<h6 class="anchored" data-anchor-id="question-10">Question</h6>
<p>Use <code>expand</code> to expand the expression <code>((x-h)^3 - x^3) / h</code> where <code>x</code> and <code>h</code> are symbolic constants. What is the value:</p>
<div class="cell" data-hold="true" data-execution_count="58">
<div class="cell-output cell-output-display" data-execution_count="58">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="16391561392778088233" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_16391561392778088233">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_16391561392778088233_1">
<input class="form-check-input" type="radio" name="radio_16391561392778088233" id="radio_16391561392778088233_1" value="1">
<span class="label-body px-1">
<code>0</code>
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_16391561392778088233_2">
<input class="form-check-input" type="radio" name="radio_16391561392778088233" id="radio_16391561392778088233_2" value="2">
<span class="label-body px-1">
<code>-h^2 + 3hx - 3x^2</code>
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_16391561392778088233_3">
<input class="form-check-input" type="radio" name="radio_16391561392778088233" id="radio_16391561392778088233_3" value="3">
<span class="label-body px-1">
<code>h^3 + 3h^2x + 3hx^2 + x^3 -x^3/h</code>
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_16391561392778088233_4">
<input class="form-check-input" type="radio" name="radio_16391561392778088233" id="radio_16391561392778088233_4" value="4">
<span class="label-body px-1">
<code>x^3 - x^3/h</code>
</span>
</label>
</div>
</div>
</div>
<div id="16391561392778088233_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_16391561392778088233"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 2;
var msgBox = document.getElementById('16391561392778088233_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_16391561392778088233")
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_16391561392778088233")
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/inversefunctions.html" class="pagination-link">
<i class="bi bi-arrow-left-short"></i> <span class="nav-page-text"><span class="chapter-number">10</span>&nbsp; <span class="chapter-title">The Inverse of a Function</span></span>
</a>
</div>
<div class="nav-page nav-page-next">
<a href="../precalc/polynomial_roots.html" class="pagination-link">
<span class="nav-page-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Roots of a polynomial</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>