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

2852 lines
174 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 - 12&nbsp; Roots of a polynomial</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/polynomials_package.html" rel="next">
<link href="../precalc/polynomial.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">12</span>&nbsp; <span class="chapter-title">Roots of a polynomial</span></h1>
<button type="button" class="quarto-btn-toggle btn" aria-label="Show secondary navigation">
<i class="bi bi-chevron-right"></i>
</button>
</div>
</nav>
</header>
<!-- content -->
<div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar">
<!-- sidebar -->
<nav id="quarto-sidebar" class="sidebar collapse sidebar-navigation floating overflow-auto">
<div class="mt-2 flex-shrink-0 align-items-center">
<div class="sidebar-search">
<div id="quarto-search" class="" title="Search"></div>
</div>
</div>
<div class="sidebar-menu-container">
<ul class="list-unstyled mt-1">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../index.html" class="sidebar-item-text sidebar-link">Preface</a>
</div>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" aria-expanded="true">Precalculus Concepts</a>
<a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" aria-expanded="true">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-1" class="collapse list-unstyled sidebar-section depth1 show">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/calculator.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">From calculator to computer</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/variables.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">2</span>&nbsp; <span class="chapter-title">Variables</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/numbers_types.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">3</span>&nbsp; <span class="chapter-title">Number systems</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/logical_expressions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">4</span>&nbsp; <span class="chapter-title">Inequalities, Logical expressions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/vectors.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">5</span>&nbsp; <span class="chapter-title">Vectors</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/ranges.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">6</span>&nbsp; <span class="chapter-title">Ranges and Sets</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/functions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">7</span>&nbsp; <span class="chapter-title">Functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/plotting.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">8</span>&nbsp; <span class="chapter-title">The Graph of a Function</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/transformations.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">9</span>&nbsp; <span class="chapter-title">Function manipulations</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/inversefunctions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">10</span>&nbsp; <span class="chapter-title">The Inverse of a Function</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/polynomial.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">11</span>&nbsp; <span class="chapter-title">Polynomials</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/polynomial_roots.html" class="sidebar-item-text sidebar-link active"><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="#the-factor-theorem" id="toc-the-factor-theorem" class="nav-link active" data-scroll-target="#the-factor-theorem"> <span class="header-section-number">12.0.1</span> The factor theorem</a></li>
<li><a href="#polynomial-division" id="toc-polynomial-division" class="nav-link" data-scroll-target="#polynomial-division"> <span class="header-section-number">12.0.2</span> Polynomial Division</a></li>
<li><a href="#the-rational-root-theorem" id="toc-the-rational-root-theorem" class="nav-link" data-scroll-target="#the-rational-root-theorem"> <span class="header-section-number">12.0.3</span> The rational root theorem</a></li>
<li><a href="#the-fundamental-theorem-of-algebra" id="toc-the-fundamental-theorem-of-algebra" class="nav-link" data-scroll-target="#the-fundamental-theorem-of-algebra"> <span class="header-section-number">12.0.4</span> The fundamental theorem of algebra</a></li>
<li><a href="#finding-roots-of-a-polynomial" id="toc-finding-roots-of-a-polynomial" class="nav-link" data-scroll-target="#finding-roots-of-a-polynomial"> <span class="header-section-number">12.1</span> Finding roots of a polynomial</a>
<ul class="collapse">
<li><a href="#the-roots-function" id="toc-the-roots-function" class="nav-link" data-scroll-target="#the-roots-function"> <span class="header-section-number">12.1.1</span> The <code>roots</code> function</a></li>
<li><a href="#numerically-finding-roots" id="toc-numerically-finding-roots" class="nav-link" data-scroll-target="#numerically-finding-roots"> <span class="header-section-number">12.1.2</span> Numerically finding roots</a></li>
<li><a href="#the-solveset-function" id="toc-the-solveset-function" class="nav-link" data-scroll-target="#the-solveset-function"> <span class="header-section-number">12.1.3</span> The solveset function</a></li>
</ul></li>
<li><a href="#do-numeric-methods-matter-when-you-can-just-graph" id="toc-do-numeric-methods-matter-when-you-can-just-graph" class="nav-link" data-scroll-target="#do-numeric-methods-matter-when-you-can-just-graph"> <span class="header-section-number">12.2</span> Do numeric methods matter when you can just graph?</a></li>
<li><a href="#some-facts-about-the-real-roots-of-a-polynomial" id="toc-some-facts-about-the-real-roots-of-a-polynomial" class="nav-link" data-scroll-target="#some-facts-about-the-real-roots-of-a-polynomial"> <span class="header-section-number">12.3</span> Some facts about the real roots of a polynomial</a>
<ul class="collapse">
<li><a href="#descartes-rule-of-signs" id="toc-descartes-rule-of-signs" class="nav-link" data-scroll-target="#descartes-rule-of-signs"> <span class="header-section-number">12.3.1</span> Descartes rule of signs</a></li>
<li><a href="#cauchys-bound-on-the-magnitude-of-the-real-roots." id="toc-cauchys-bound-on-the-magnitude-of-the-real-roots." class="nav-link" data-scroll-target="#cauchys-bound-on-the-magnitude-of-the-real-roots."> <span class="header-section-number">12.3.2</span> Cauchys bound on the magnitude of the real roots.</a></li>
</ul></li>
<li><a href="#questions" id="toc-questions" class="nav-link" data-scroll-target="#questions"> <span class="header-section-number">12.4</span> Questions</a></li>
<li><a href="#appendix-proof-of-descartes-rule-of-signs" id="toc-appendix-proof-of-descartes-rule-of-signs" class="nav-link" data-scroll-target="#appendix-proof-of-descartes-rule-of-signs"> <span class="header-section-number">12.5</span> Appendix: Proof of Descartes rule of signs</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_roots.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">12</span>&nbsp; <span class="chapter-title">Roots of a polynomial</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">CalculusWithJulia</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="im">using</span> <span class="bu">Plots</span></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="im">using</span> <span class="bu">SymPy</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<hr>
<p>The <a href="http://en.wikipedia.org/wiki/Properties_of_polynomial_roots">roots</a> of a polynomial are the values of <span class="math inline">\(x\)</span> that when substituted into the expression yield <span class="math inline">\(0\)</span>. For example, the polynomial <span class="math inline">\(x^2 - x\)</span> has two roots, <span class="math inline">\(0\)</span> and <span class="math inline">\(1\)</span>. A simple graph verifies this:</p>
<div class="cell" data-hold="true" data-execution_count="4">
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="fu">f</span>(x) <span class="op">=</span> x<span class="op">^</span><span class="fl">2</span> <span class="op">-</span> x</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(f, <span class="op">-</span><span class="fl">2</span>, <span class="fl">2</span>)</span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a><span class="fu">plot!</span>(zero, <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="5">
<p><img src="polynomial_roots_files/figure-html/cell-5-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>The graph crosses the <span class="math inline">\(x\)</span>-axis at both <span class="math inline">\(0\)</span> and <span class="math inline">\(1\)</span>.</p>
<p>What is known about polynomial roots? Some simple questions might be:</p>
<ul>
<li>Will a polynomial always have a root?</li>
<li>How many roots can there be?</li>
<li>How large can the roots be?</li>
</ul>
<p>We look at such questions here.</p>
<section id="the-factor-theorem" class="level3" data-number="12.0.1">
<h3 data-number="12.0.1" class="anchored" data-anchor-id="the-factor-theorem"><span class="header-section-number">12.0.1</span> The factor theorem</h3>
<p>We begin with a comment that ties together two concepts related to polynomials. It allows us to speak of roots or factors interchangeably:</p>
<blockquote class="blockquote">
<p>The <a href="http://en.wikipedia.org/wiki/Factor_theorem">factor theorem</a> relates the <em>roots</em> of a polynomial with its <em>factors</em>: <span class="math inline">\(r\)</span> is a root of <span class="math inline">\(p\)</span> if <em>and</em> only if <span class="math inline">\((x-r)\)</span> is a factor of the polynomial <span class="math inline">\(p\)</span>.</p>
</blockquote>
<p>Clearly, if <span class="math inline">\(p\)</span> is factored as <span class="math inline">\(a(x-r_1) \cdot (x-r_2) \cdots (x - r_k)\)</span> then each <span class="math inline">\(r_i\)</span> is a root, as a product involving at least one <span class="math inline">\(0\)</span> term will be <span class="math inline">\(0\)</span>. The other implication is a consequence of polynomial division.</p>
</section>
<section id="polynomial-division" class="level3" data-number="12.0.2">
<h3 data-number="12.0.2" class="anchored" data-anchor-id="polynomial-division"><span class="header-section-number">12.0.2</span> Polynomial Division</h3>
<p><a href="http://en.wikipedia.org/wiki/Euclidean_division">Euclidean division</a> of integers <span class="math inline">\(a, b\)</span> uniquely writes <span class="math inline">\(a = b\cdot q + r\)</span> where <span class="math inline">\(0 \leq r &lt; |b|\)</span>. The quotient is <span class="math inline">\(q\)</span> and the remainder <span class="math inline">\(r\)</span>. There is an analogy for polynomial division, where for two polynomial functions <span class="math inline">\(f(x)\)</span> and <span class="math inline">\(g(x)\)</span> it is possible to write</p>
<p><span class="math display">\[
f(x) = g(x) \cdot q(x) + r(x)
\]</span></p>
<p>where the degree of <span class="math inline">\(r\)</span> is less than the degree of <span class="math inline">\(g(x)\)</span>. The <a href="http://en.wikipedia.org/wiki/Long_division">long-division algorithm</a> can be used to find both <span class="math inline">\(q(x)\)</span> and <span class="math inline">\(r(x)\)</span>.</p>
<p>For the special case of a linear factor where <span class="math inline">\(g(x) = x - c\)</span>, the remainder must be of degree <span class="math inline">\(0\)</span> (a non-zero constant) or the <span class="math inline">\(0\)</span> polynomial. The above simplifies to</p>
<p><span class="math display">\[
f(x) = (x-c) \cdot q(x) + r
\]</span></p>
<p>From this, we see that <span class="math inline">\(f(c) = r\)</span>. Hence, when <span class="math inline">\(c\)</span> is a root of <span class="math inline">\(f(x)\)</span>, then it must be that <span class="math inline">\(r=0\)</span> and so, <span class="math inline">\((x-c)\)</span> is a factor.</p>
<hr>
<p>The division algorithm for the case of linear term, <span class="math inline">\((x-c)\)</span>, can be carried out by the <a href="http://en.wikipedia.org/wiki/Synthetic_division">synthetic division</a> algorithm. This algorithm produces <span class="math inline">\(q(x)\)</span> and <span class="math inline">\(r\)</span>, a.k.a <span class="math inline">\(f(c)\)</span>. The Wikipedia page describes the algorithm well.</p>
<p>The following is an example where <span class="math inline">\(f(x) = x^4 + 2x^2 + 5\)</span> and <span class="math inline">\(g(x) = x-2\)</span>:</p>
<pre class="{verbatim}"><code>2 | 1 0 2 0 5
| 2 4 12 24
-------------
1 2 6 12 29</code></pre>
<p>The polynomial <span class="math inline">\(f(x)\)</span> is coded in terms of its coefficients (<span class="math inline">\(a_n\)</span>, <span class="math inline">\(a_{n-1}\)</span>, <span class="math inline">\(\dots\)</span>, <span class="math inline">\(a_1\)</span>, <span class="math inline">\(a_0\)</span>) and is written on the top row. The algorithm then proceeds from left to right. The number just produced on the bottom row is multiplied by <span class="math inline">\(c\)</span> and placed under the coefficient of <span class="math inline">\(f(x)\)</span>. Then values are then added to produce the next number. The sequence produced above is <code>1 2 6 12 29</code>. The last value (<code>29</code>) is <span class="math inline">\(r=f(c)\)</span>, the others encode the coefficients of <code>q(x)</code>, which for this problem is <span class="math inline">\(q(x)=x^3 + 2x + 6 + 12\)</span>. That is, we have written:</p>
<p><span class="math display">\[
x^4 + 2x^2 + 5 = (x-2) \cdot (x^3 + 2x + 6 + 12) + 29.
\]</span></p>
<p>As <span class="math inline">\(r\)</span> is not <span class="math inline">\(0\)</span>, we can say that <span class="math inline">\(2\)</span> is not a root of <span class="math inline">\(f(x)\)</span>.</p>
<p>If we were to track down the computation that produced <span class="math inline">\(f(2) = 29\)</span>, we would have</p>
<p><span class="math display">\[
5 + 2 \cdot (0 + 2 \cdot (2 + 2 \cdot (0 + (2 \cdot 1))))
\]</span></p>
<p>In terms of <span class="math inline">\(c\)</span> and the coefficients <span class="math inline">\(a_0, a_1, a_2, a_3\)</span>, and <span class="math inline">\(a_4\)</span> this is</p>
<p><span class="math display">\[
a_0 + c\cdot(a_1 + c\cdot(a_2 + c\cdot(a_3 + c\cdot a_4))),
\]</span></p>
<p>The above pattern provides a means to compute <span class="math inline">\(f(c)\)</span> and could easily be generalized for higher degree polynomials. This generalization is called <a href="http://en.wikipedia.org/wiki/Horner%27s_method">Horners</a> method. Horners method has the advantage of also being faster and more accurate when floating point issues are accounted for.</p>
<p>A simple implementation of Horners algorithm would look like this, if indexing were <code>0</code>-based:</p>
<div class="cell" data-execution_count="5">
<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="kw">function</span> <span class="fu">horner</span>(p, x)</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> n <span class="op">=</span> <span class="fu">degree</span>(p)</span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> Σ <span class="op">=</span> p[n]</span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> i <span class="kw">in</span> (n<span class="op">-</span><span class="fl">1</span>)<span class="op">:-</span><span class="fl">1</span><span class="op">:</span><span class="fl">0</span></span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a> Σ <span class="op">=</span> Σ <span class="op">*</span> x <span class="op">+</span> p[i]</span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a> <span class="cf">end</span></span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span>(Σ)</span>
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a><span class="kw">end</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="6">
<pre><code>horner (generic function with 1 method)</code></pre>
</div>
</div>
<p>Recording the different values of <code>Σ</code> would recover the polynomial <code>q</code>.</p>
<p><code>Julia</code> has a built-in method, <code>evalpoly</code>, to compute polynomial evaluations this way. To illustrate:</p>
<div class="cell" data-execution_count="6">
<div class="sourceCode cell-code" id="cb6"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="pp">@syms</span> x<span class="op">::</span><span class="dt">real </span><span class="co"># assumes x is real</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>(x,)</code></pre>
</div>
</div>
<div class="cell" data-hold="true" data-execution_count="7">
<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>p <span class="op">=</span> (<span class="fl">1</span>, <span class="fl">2</span>, <span class="fl">3</span>, <span class="fl">4</span>, <span class="fl">5</span>) <span class="co"># 1 + 2x + 3x^2 + 4x^3 + 5x^4</span></span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a><span class="fu">evalpoly</span>(x, p)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="8">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
x \left(x \left(x \left(5 x + 4\right) + 3\right) + 2\right) + 1
\]
</span>
</div>
</div>
<hr>
<p>The <code>SymPy</code> package can carry out polynomial long division.</p>
<p>This naive attempt to divide wont “just work” though:</p>
<div class="cell" data-execution_count="8">
<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>(x<span class="op">^</span><span class="fl">4</span> <span class="op">+</span> <span class="fl">2</span>x<span class="op">^</span><span class="fl">2</span> <span class="op">+</span> <span class="fl">5</span>) <span class="op">/</span> (x<span class="op">-</span><span class="fl">2</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="9">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
\frac{x^{4} + 2 x^{2} + 5}{x - 2}
\]
</span>
</div>
</div>
<p><code>SymPy</code> is fairly conservative in how it simplifies answers, and, as written, there is no compelling reason to change the expressions, though in our example we want it done.</p>
<p>For this task, <code>divrem</code> is available:</p>
<div class="cell" data-execution_count="9">
<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>quotient, remainder <span class="op">=</span> <span class="fu">divrem</span>(x<span class="op">^</span><span class="fl">4</span> <span class="op">+</span> <span class="fl">2</span>x<span class="op">^</span><span class="fl">2</span> <span class="op">+</span> <span class="fl">5</span>, x <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="10">
<pre><code>(x^3 + 2*x^2 + 6*x + 12, 29)</code></pre>
</div>
</div>
<p>The answer is a tuple containing the quotient and remainder. The quotient itself could be found with <code>div</code> or <code>÷</code> and the remainder with <code>rem</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>For those who have worked with SymPy within Python, <code>divrem</code> is the <code>div</code> method renamed, as <code>Julia</code>s <code>div</code> method has the generic meaning of returning the quotient.</p>
</div>
</div>
<p>As well, the <code>apart</code> function could be used for this task. This function computes the <a href="http://en.wikipedia.org/wiki/Partial_fraction_decomposition">partial fraction</a> decomposition of a ratio of polynomial functions.</p>
<div class="cell" data-execution_count="10">
<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="fu">apart</span>((x<span class="op">^</span><span class="fl">4</span> <span class="op">+</span> <span class="fl">2</span>x<span class="op">^</span><span class="fl">2</span> <span class="op">+</span> <span class="fl">5</span>) <span class="op">/</span> (x<span class="op">-</span><span class="fl">2</span>))</span></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;">
\[
x^{3} + 2 x^{2} + 6 x + 12 + \frac{29}{x - 2}
\]
</span>
</div>
</div>
<p>The function <code>together</code> would combine such terms, as an “inverse” to <code>apart</code>. This isnt so much of interest at the moment, but will be when techniques of integration are looked at.</p>
</section>
<section id="the-rational-root-theorem" class="level3" data-number="12.0.3">
<h3 data-number="12.0.3" class="anchored" data-anchor-id="the-rational-root-theorem"><span class="header-section-number">12.0.3</span> The rational root theorem</h3>
<p>Factoring polynomials to find roots is a task that most all readers here will recognize, and, perhaps, remember not so fondly. One helpful trick to find possible roots <em>by hand</em> is the <a href="http://en.wikipedia.org/wiki/Rational_root_theorem">rational root theorem</a>: if a polynomial has integer coefficients with <span class="math inline">\(a_0 \neq 0\)</span>, than any rational root, <span class="math inline">\(p/q\)</span>, must have <span class="math inline">\(p\)</span> dividing the constant <span class="math inline">\(a_0\)</span> and <span class="math inline">\(q\)</span> dividing the leading term <span class="math inline">\(a_n\)</span>.</p>
<p>To glimpse why, suppose we have a polynomial with a rational root and integer coefficients. With this in mind, a polynomial with identical roots may be written as <span class="math inline">\((qx -p)(a_{n-1}x^{n-1}+\cdots a_1 x + a_0)\)</span>, where each coefficient is an integer. Multiplying through, we get that the polynomial is <span class="math inline">\(qa_{n-1}x^n + \cdots + pa_0\)</span>. So <span class="math inline">\(q\)</span> is a factor of the leading coefficient and <span class="math inline">\(p\)</span> is a factor of the constant.</p>
<p>An immediate consequence is that if the polynomial with integer coefficients is monic, then any rational root must be an integer.</p>
<p>This gives a finite - though possibly large - set of values that can be checked to exhaust the possibility of a rational root. By hand this process can be tedious, though may be speeded up using synthetic division. This task is one of the mainstays of high school algebra where problems are chosen judiciously to avoid too many possibilities.</p>
<p>However, one of the great triumphs of computer algebra is the ability to factor polynomials with integer (or rational) coefficients over the rational numbers. This is typically done by first factoring over modular numbers (akin to those on a clock face) and has nothing to do with the rational root test.</p>
<p><code>SymPy</code> can quickly find such a factorization, even for quite large polynomials with rational or integer coefficients.</p>
<p>For example, factoring <span class="math inline">\(p = 2x^4 + x^3 -19x^2 -9x +9\)</span>. This has <em>possible</em> rational roots of plus or minus <span class="math inline">\(1\)</span> or <span class="math inline">\(2\)</span> divided by <span class="math inline">\(1\)</span>, <span class="math inline">\(3\)</span>, or <span class="math inline">\(9\)</span> - <span class="math inline">\(12\)</span> possible answers for this modest question. By hand that can be a bit of work, but <code>factor</code> does it without fuss:</p>
<div class="cell" data-hold="true" data-execution_count="11">
<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>p <span class="op">=</span> <span class="fl">2</span>x<span class="op">^</span><span class="fl">4</span> <span class="op">+</span> x<span class="op">^</span><span class="fl">3</span> <span class="op">-</span> <span class="fl">19</span>x<span class="op">^</span><span class="fl">2</span> <span class="op">-</span> <span class="fl">9</span>x <span class="op">+</span> <span class="fl">9</span></span>
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a><span class="fu">factor</span>(p)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="12">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
\left(x - 3\right) \left(x + 1\right) \left(x + 3\right) \left(2 x - 1\right)
\]
</span>
</div>
</div>
</section>
<section id="the-fundamental-theorem-of-algebra" class="level3" data-number="12.0.4">
<h3 data-number="12.0.4" class="anchored" data-anchor-id="the-fundamental-theorem-of-algebra"><span class="header-section-number">12.0.4</span> The fundamental theorem of algebra</h3>
<p>There is a basic fact about the roots of a polynomial of degree <span class="math inline">\(n\)</span>. Before formally stating it, we consider the earlier observation that a polynomial of degree <span class="math inline">\(n\)</span> for large values of <span class="math inline">\(x\)</span> has a graph that looks like the leading term. However, except at <span class="math inline">\(0\)</span>, monomials do not cross the <span class="math inline">\(x\)</span> axis, the roots must be the result of the interaction of lower order terms. Intuitively, since each term can contribute only one basic shape up or down, there can not be arbitrarily many roots. In fact, a consequence of the <a href="http://en.wikipedia.org/wiki/Fundamental_theorem_of_algebra">Fundamental Theorem of Algebra</a> (Gauss) is:</p>
<blockquote class="blockquote">
<p>A polynomial of degree <span class="math inline">\(n\)</span> with real or complex coefficients has at most <span class="math inline">\(n\)</span> real roots.</p>
</blockquote>
<p>This statement can be proved with the factor theorem and the division algorithm.</p>
<p>In fact the fundamental theorem states that there are exactly <span class="math inline">\(n\)</span> roots, though, in general, one must consider multiple roots and possible complex roots to get all <span class="math inline">\(n\)</span>. (Consider <span class="math inline">\(x^2\)</span> to see why multiplicity must be accounted for and <span class="math inline">\(x^2 + 1\)</span> to see why complex values may be necessary.)</p>
<div class="callout-warning 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">
Warning
</div>
</div>
<div class="callout-body-container callout-body">
<p>The special case of the <span class="math inline">\(0\)</span> polynomial having no degree defined eliminates needing to exclude it, as it has infinitely many roots. Otherwise, the language would be qualified to have <span class="math inline">\(n \geq 0\)</span>.</p>
</div>
</div>
</section>
<section id="finding-roots-of-a-polynomial" class="level2" data-number="12.1">
<h2 data-number="12.1" class="anchored" data-anchor-id="finding-roots-of-a-polynomial"><span class="header-section-number">12.1</span> Finding roots of a polynomial</h2>
<p>Knowing that a certain number of roots exist and actually finding those roots are different matters. For the simplest cases (the linear case) with <span class="math inline">\(a_0 + a_1x\)</span>, we know by solving algebraically that the root is <span class="math inline">\(-a_0/a_1\)</span>. (We assume <span class="math inline">\(a_1\neq 0\)</span>.) Of course, when <span class="math inline">\(a_1 \neq 0\)</span>, the graph of the polynomial will be a line with some non-zero slope, so will cross the <span class="math inline">\(x\)</span>-axis as the line and this axis are not parallel.</p>
<p>For the quadratic case, there is the famous <a href="http://en.wikipedia.org/wiki/Quadratic_formula">quadratic formula</a> (known since <span class="math inline">\(2000\)</span> BC) to find the two roots guaranteed by the formula:</p>
<p><span class="math display">\[
\frac{-b \pm \sqrt{b^2 - 4ac}}{2a}.
\]</span></p>
<p>The discriminant is defined as <span class="math inline">\(b^2 - 4ac\)</span>. When this is negative, the square root requires the concept of complex numbers to be defined, and the formula shows the two complex roots are conjugates. When the discriminant is <span class="math inline">\(0\)</span>, then the root has multiplicity two, e.g., the polynomial will factor as <span class="math inline">\(a_2(x-r)^2\)</span>. Finally, when the discriminant is positive, there will be two distinct, real roots. This figure shows the <span class="math inline">\(3\)</span> cases, that are illustrated by <span class="math inline">\(x^2 -1\)</span>, <span class="math inline">\(x^2\)</span> and <span class="math inline">\(x^2 + 1\)</span>:</p>
<div class="cell" data-execution_count="12">
<div class="sourceCode cell-code" id="cb14"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(x<span class="op">^</span><span class="fl">2</span> <span class="op">-</span> <span class="fl">1</span>, <span class="op">-</span><span class="fl">2</span>, <span class="fl">2</span>, legend<span class="op">=</span><span class="cn">false</span>) <span class="co"># two roots</span></span>
<span id="cb14-2"><a href="#cb14-2" aria-hidden="true" tabindex="-1"></a><span class="fu">plot!</span>(x<span class="op">^</span><span class="fl">2</span>, <span class="op">-</span><span class="fl">2</span>, <span class="fl">2</span>) <span class="co"># one (double) root</span></span>
<span id="cb14-3"><a href="#cb14-3" aria-hidden="true" tabindex="-1"></a><span class="fu">plot!</span>(x<span class="op">^</span><span class="fl">2</span> <span class="op">+</span> <span class="fl">1</span>, <span class="op">-</span><span class="fl">2</span>, <span class="fl">2</span>) <span class="co"># no real root</span></span>
<span id="cb14-4"><a href="#cb14-4" aria-hidden="true" tabindex="-1"></a><span class="fu">plot!</span>(zero, <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="13">
<p><img src="polynomial_roots_files/figure-html/cell-13-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>There are similar formulas for the <a href="http://en.wikipedia.org/wiki/Cubic_function#General_formula_for_roots">cubic</a> and <a href="http://en.wikipedia.org/wiki/Quartic_function#General_formula_for_roots">quartic</a> cases. (The <a href="http://arxiv.org/pdf/math/0005026v1.pdf">cubic formula</a> was known to Cardano in <span class="math inline">\(1545\)</span>, though through Tartagli, and the quartic was solved by Ferrari, Cardanos roommate.)</p>
<p>In general, there is no such formula using radicals for <span class="math inline">\(5\)</span>th degree polynomials or higher, a proof first given by Ruffini in <span class="math inline">\(1803\)</span> with improvement by Abel in <span class="math inline">\(1824\)</span>. Even though the fundamental theorem shows that any polynomial can be factored into linear and quadratic terms, there is no general method as to how. (It is the case that <em>some</em> such polynomials may be solvable by radicals, just not all of them.)</p>
<p>The <code>factor</code> function of <code>SymPy</code> only finds factors of polynomials with integer or rational coefficients corresponding to rational roots. There are alternatives.</p>
<p>Finding roots with <code>SymPy</code> can also be done through its <code>solve</code> function, a function which also has a more general usage, as it can solve simple expressions or more than one expression. Here we illustrate that <code>solve</code> can easily handle quadratic expressions:</p>
<div class="cell" data-execution_count="13">
<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">solve</span>(x<span class="op">^</span><span class="fl">2</span> <span class="op">+</span> <span class="fl">2</span>x <span class="op">-</span> <span class="fl">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="14">
<pre><code>2-element Vector{Sym}:
-3
1</code></pre>
</div>
</div>
<p>The answer is a vector of values that when substituted in for the free variable <code>x</code> produce <span class="math inline">\(0.\)</span> The call to <code>solve</code> does not have an equals sign. To solve a more complicated expression of the type <span class="math inline">\(f(x) = g(x),\)</span> one can solve <span class="math inline">\(f(x) - g(x) = 0,\)</span> use the <code>Eq</code> function, or use <code>f ~ g</code>.</p>
<p>When the expression to solve has more than one free variable, the variable to solve for should be explicitly stated with a second argument. For example, here we show that <code>solve</code> is aware of the quadratic formula:</p>
<div class="cell" data-execution_count="14">
<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="pp">@syms</span> a b<span class="op">::</span><span class="dt">real </span>c<span class="op">::</span><span class="dt">positive</span></span>
<span id="cb17-2"><a href="#cb17-2" aria-hidden="true" tabindex="-1"></a><span class="fu">solve</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, 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="15">
<pre><code>2-element Vector{Sym}:
(-b - sqrt(-4*a*c + b^2))/(2*a)
(-b + sqrt(-4*a*c + b^2))/(2*a)</code></pre>
</div>
</div>
<p>The <code>solve</code> function will respect assumptions made when a variable is defined through <code>symbols</code> or <code>@syms</code>:</p>
<div class="cell" data-execution_count="15">
<div class="sourceCode cell-code" id="cb19"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a><span class="fu">solve</span>(a<span class="op">^</span><span class="fl">2</span> <span class="op">+</span> <span class="fl">1</span>) <span class="co"># works, as a can be complex</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>2-element Vector{Sym}:
-
</code></pre>
</div>
</div>
<div class="cell" data-execution_count="16">
<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">solve</span>(b<span class="op">^</span><span class="fl">2</span> <span class="op">+</span> <span class="fl">1</span>) <span class="co"># fails, as b is assumed real</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">
<pre><code>Any[]</code></pre>
</div>
</div>
<div class="cell" data-execution_count="17">
<div class="sourceCode cell-code" id="cb23"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true" tabindex="-1"></a><span class="fu">solve</span>(c <span class="op">+</span> <span class="fl">1</span>) <span class="co"># fails, as c is assumed positive</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="18">
<pre><code>Any[]</code></pre>
</div>
</div>
<p>Previously, it was mentioned that <code>factor</code> only factors polynomials with integer coefficients over rational roots. However, <code>solve</code> can be used to factor. Here is an example:</p>
<div class="cell" data-execution_count="18">
<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><span class="fu">factor</span>(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="19">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
x^{2} - 2
\]
</span>
</div>
</div>
<p>Nothing is found, as the roots are <span class="math inline">\(\pm \sqrt{2}\)</span>, irrational numbers.</p>
<div class="cell" data-execution_count="19">
<div class="sourceCode cell-code" id="cb26"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb26-1"><a href="#cb26-1" aria-hidden="true" tabindex="-1"></a>rts <span class="op">=</span> <span class="fu">solve</span>(x<span class="op">^</span><span class="fl">2</span> <span class="op">-</span> <span class="fl">2</span>)</span>
<span id="cb26-2"><a href="#cb26-2" aria-hidden="true" tabindex="-1"></a><span class="fu">prod</span>(x<span class="op">-</span>r <span class="cf">for</span> r <span class="kw">in</span> rts)</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;">
\[
\left(x - \sqrt{2}\right) \left(x + \sqrt{2}\right)
\]
</span>
</div>
</div>
<p>Solving cubics and quartics can be done exactly using radicals. For example, here we see the solutions to a quartic equation can be quite involved, yet still explicit. (We use <code>y</code> so that complex-valued solutions, if any, will be found.)</p>
<div class="cell" data-execution_count="20">
<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><span class="pp">@syms</span> y <span class="co"># possibly complex</span></span>
<span id="cb27-2"><a href="#cb27-2" aria-hidden="true" tabindex="-1"></a><span class="fu">solve</span>(y<span class="op">^</span><span class="fl">4</span> <span class="op">-</span> <span class="fl">2</span>y <span class="op">-</span> <span class="fl">1</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="21">
<pre><code>4-element Vector{Sym}:
-sqrt(-2/(3*(1/4 + sqrt(129)/36)^(1/3)) + 2*(1/4 + sqrt(129)/36)^(1/3))/2 - sqrt(-4/sqrt(-2/(3*(1/4 + sqrt(129)/36)^(1/3)) + 2*(1/4 + sqrt(129)/36)^(1/3)) - 2*(1/4 + sqrt(129)/36)^(1/3) + 2/(3*(1/4 + sqrt(129)/36)^(1/3)))/2
-sqrt(-2/(3*(1/4 + sqrt(129)/36)^(1/3)) + 2*(1/4 + sqrt(129)/36)^(1/3))/2 + sqrt(-4/sqrt(-2/(3*(1/4 + sqrt(129)/36)^(1/3)) + 2*(1/4 + sqrt(129)/36)^(1/3)) - 2*(1/4 + sqrt(129)/36)^(1/3) + 2/(3*(1/4 + sqrt(129)/36)^(1/3)))/2
sqrt(-2/(3*(1/4 + sqrt(129)/36)^(1/3)) + 2*(1/4 + sqrt(129)/36)^(1/3))/2 + sqrt(-2*(1/4 + sqrt(129)/36)^(1/3) + 2/(3*(1/4 + sqrt(129)/36)^(1/3)) + 4/sqrt(-2/(3*(1/4 + sqrt(129)/36)^(1/3)) + 2*(1/4 + sqrt(129)/36)^(1/3)))/2
-sqrt(-2*(1/4 + sqrt(129)/36)^(1/3) + 2/(3*(1/4 + sqrt(129)/36)^(1/3)) + 4/sqrt(-2/(3*(1/4 + sqrt(129)/36)^(1/3)) + 2*(1/4 + sqrt(129)/36)^(1/3)))/2 + sqrt(-2/(3*(1/4 + sqrt(129)/36)^(1/3)) + 2*(1/4 + sqrt(129)/36)^(1/3))/2</code></pre>
</div>
</div>
<p>Third- and fourth-degree polynomials can be solved in general, with increasingly more complicated answers. The following finds one of the answers for a general third-degre polynomial:</p>
<div class="cell" data-hold="true" data-execution_count="21">
<div class="sourceCode cell-code" id="cb29"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb29-1"><a href="#cb29-1" aria-hidden="true" tabindex="-1"></a><span class="pp">@syms</span> a[<span class="fl">0</span><span class="op">:</span><span class="fl">3</span>]</span>
<span id="cb29-2"><a href="#cb29-2" aria-hidden="true" tabindex="-1"></a>p <span class="op">=</span> <span class="fu">sum</span>(a<span class="op">*</span>x<span class="op">^</span>(i<span class="op">-</span><span class="fl">1</span>) <span class="cf">for</span> (i,a) <span class="kw">in</span> <span class="fu">enumerate</span>(a))</span>
<span id="cb29-3"><a href="#cb29-3" aria-hidden="true" tabindex="-1"></a>rts <span class="op">=</span> <span class="fu">solve</span>(p, x)</span>
<span id="cb29-4"><a href="#cb29-4" aria-hidden="true" tabindex="-1"></a>rts[<span class="fl">1</span>] <span class="co"># there are three roots</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="22">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
- \frac{a₂}{3 a₃} - \frac{- \frac{3 a₁}{a₃} + \frac{a₂^{2}}{a₃^{2}}}{3 \sqrt[3]{\frac{27 a₀}{2 a₃} - \frac{9 a₁ a₂}{2 a₃^{2}} + \frac{a₂^{3}}{a₃^{3}} + \frac{\sqrt{- 4 \left(- \frac{3 a₁}{a₃} + \frac{a₂^{2}}{a₃^{2}}\right)^{3} + \left(\frac{27 a₀}{a₃} - \frac{9 a₁ a₂}{a₃^{2}} + \frac{2 a₂^{3}}{a₃^{3}}\right)^{2}}}{2}}} - \frac{\sqrt[3]{\frac{27 a₀}{2 a₃} - \frac{9 a₁ a₂}{2 a₃^{2}} + \frac{a₂^{3}}{a₃^{3}} + \frac{\sqrt{- 4 \left(- \frac{3 a₁}{a₃} + \frac{a₂^{2}}{a₃^{2}}\right)^{3} + \left(\frac{27 a₀}{a₃} - \frac{9 a₁ a₂}{a₃^{2}} + \frac{2 a₂^{3}}{a₃^{3}}\right)^{2}}}{2}}}{3}
\]
</span>
</div>
</div>
<p>Some fifth degree polynomials are solvable in terms of radicals, however, <code>solve</code> will not seem to have luck with this particular fifth degree polynomial:</p>
<div class="cell" data-execution_count="22">
<div class="sourceCode cell-code" id="cb30"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb30-1"><a href="#cb30-1" aria-hidden="true" tabindex="-1"></a><span class="fu">solve</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></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>1-element Vector{Sym}:
CRootOf(x^5 - x + 1, 0)</code></pre>
</div>
</div>
<p>(Though there is no formula involving only radicals like the quadratic equation, there is a formula for the roots in terms of a function called the <a href="http://en.wikipedia.org/wiki/Bring_radical">Bring radical</a>.)</p>
<section id="the-roots-function" class="level3" data-number="12.1.1">
<h3 data-number="12.1.1" class="anchored" data-anchor-id="the-roots-function"><span class="header-section-number">12.1.1</span> The <code>roots</code> function</h3>
<p>Related to <code>solve</code> is the specialized <code>roots</code> function for identifying roots, Unlike solve, it will identify multiplicities.</p>
<p>For a polynomial with only one indeterminate the usage is straight foward:</p>
<div class="cell" data-execution_count="23">
<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">roots</span>((x<span class="op">-</span><span class="fl">1</span>)<span class="op">^</span><span class="fl">2</span> <span class="op">*</span> (x<span class="op">-</span><span class="fl">2</span>)<span class="op">^</span><span class="fl">2</span>) <span class="co"># solve doesn't identify multiplicities</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>Dict{Any, Any} with 2 entries:
1 =&gt; 2
2 =&gt; 2</code></pre>
</div>
</div>
<p>For a polynomial with symbolic coefficients, the difference between the symbol and the coefficients must be identified. <code>SymPy</code> has a <code>Poly</code> type to do so. The following call illustrates:</p>
<div class="cell" data-hold="true" data-execution_count="24">
<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="pp">@syms</span> a b c</span>
<span id="cb34-2"><a href="#cb34-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="cb34-3"><a href="#cb34-3" aria-hidden="true" tabindex="-1"></a>q <span class="op">=</span> sympy.<span class="fu">Poly</span>(p, x) <span class="co"># identify `x` as indeterminate; alternatively p.as_poly(x)</span></span>
<span id="cb34-4"><a href="#cb34-4" aria-hidden="true" tabindex="-1"></a><span class="fu">roots</span>(q)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="25">
<pre><code>Dict{Any, Any} with 2 entries:
-b/(2*a) - sqrt(-4*a*c + b^2)/(2*a) =&gt; 1
-b/(2*a) + sqrt(-4*a*c + b^2)/(2*a) =&gt; 1</code></pre>
</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 sympy <code>Poly</code> function must be found within the underlying <code>sympy</code> module, a Python object, hence is qualified as <code>sympy.Poly</code>. This is common when using <code>SymPy</code>, as only a small handful of the many functions available are turned into <code>Julia</code> functions, the rest are used as would be done in Python. (This is similar, but different than qualifying by a <code>Julia</code> module when there are two conflicting names. An example will be the use of the name <code>roots</code> in both <code>SymPy</code> and <code>Polynomials</code> to refer to a function that finds the roots of a polynomial. If both functions were loaded, then the last line in the above example would need to be <code>SymPy.roots(q)</code> (note the capitalization.)</p>
</div>
</div>
</section>
<section id="numerically-finding-roots" class="level3" data-number="12.1.2">
<h3 data-number="12.1.2" class="anchored" data-anchor-id="numerically-finding-roots"><span class="header-section-number">12.1.2</span> Numerically finding roots</h3>
<p>The <code>solve</code> function can be used to get numeric approximations to the roots. It is as easy as calling <code>N</code> on the solutions:</p>
<div class="cell" data-hold="true" data-execution_count="25">
<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>rts <span class="op">=</span> <span class="fu">solve</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">0</span>)</span>
<span id="cb36-2"><a href="#cb36-2" aria-hidden="true" tabindex="-1"></a><span class="fu">N</span>.(rts) <span class="co"># note the `.(` to broadcast over all values in rts</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>1-element Vector{BigFloat}:
-1.167303978261418684256045899854842180720560371525489039140082449275651903429536</code></pre>
</div>
</div>
<p>This polynomial has <span class="math inline">\(1\)</span> real root found by <code>solve</code>, as <code>x</code> is assumed to be real.</p>
<p>Here we see another example:</p>
<div class="cell" data-execution_count="26">
<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>ex <span class="op">=</span> x<span class="op">^</span><span class="fl">7</span> <span class="op">-</span><span class="fl">3</span>x<span class="op">^</span><span class="fl">6</span> <span class="op">+</span> <span class="fl">2</span>x<span class="op">^</span><span class="fl">5</span> <span class="op">-</span><span class="fl">1</span>x<span class="op">^</span><span class="fl">3</span> <span class="op">+</span> <span class="fl">2</span>x<span class="op">^</span><span class="fl">2</span> <span class="op">+</span> <span class="fl">1</span>x<span class="op">^</span><span class="fl">1</span> <span class="op">-</span> <span class="fl">2</span></span>
<span id="cb38-2"><a href="#cb38-2" aria-hidden="true" tabindex="-1"></a><span class="fu">solve</span>(ex)</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">
<pre><code>3-element Vector{Sym}:
1
2
CRootOf(x^5 - x - 1, 0)</code></pre>
</div>
</div>
<p>This finds two of the seven possible roots, the remainder of the real roots can be found numerically:</p>
<div class="cell" data-execution_count="27">
<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">N</span>.(<span class="fu">solve</span>(ex))</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="28">
<pre><code>3-element Vector{Real}:
1
2
1.167303978261418684256045899854842180720560371525489039140082449275651903429536</code></pre>
</div>
</div>
</section>
<section id="the-solveset-function" class="level3" data-number="12.1.3">
<h3 data-number="12.1.3" class="anchored" data-anchor-id="the-solveset-function"><span class="header-section-number">12.1.3</span> The solveset function</h3>
<p>SymPy is phasing in the <code>solveset</code> function to replace <code>solve</code>. The main reason being that <code>solve</code> has too many different output types (a vector, a dictionary, …). The output of <code>solveset</code> is always a set. For tasks like this, which return a finite set, we use the <code>elements</code> function to access the individual answers. To illustrate:</p>
<div class="cell" data-execution_count="28">
<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="op">=</span> <span class="fl">8</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">2</span> <span class="op">+</span> <span class="fl">1</span></span>
<span id="cb42-2"><a href="#cb42-2" aria-hidden="true" tabindex="-1"></a>𝒑_rts <span class="op">=</span> <span class="fu">solveset</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">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
\left\{- \sqrt{\frac{1}{2} - \frac{\sqrt{2}}{4}}, \sqrt{\frac{1}{2} - \frac{\sqrt{2}}{4}}, - \sqrt{\frac{\sqrt{2}}{4} + \frac{1}{2}}, \sqrt{\frac{\sqrt{2}}{4} + \frac{1}{2}}\right\}
\]
</span>
</div>
</div>
<p>The <code>𝒑_rts</code> object, a <code>FiniteSet</code>, does not allow immediate access to its elements. For that <code>elements</code> will work to return a vector:</p>
<div class="cell" data-execution_count="29">
<div class="sourceCode cell-code" id="cb43"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb43-1"><a href="#cb43-1" aria-hidden="true" tabindex="-1"></a><span class="fu">elements</span>(𝒑_rts)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="30">
<pre><code>4-element Vector{Sym}:
-sqrt(1/2 - sqrt(2)/4)
sqrt(sqrt(2)/4 + 1/2)
sqrt(1/2 - sqrt(2)/4)
-sqrt(sqrt(2)/4 + 1/2)</code></pre>
</div>
</div>
<p>To get the numeric approximation, we compose these function calls:</p>
<div class="cell" data-execution_count="30">
<div class="sourceCode cell-code" id="cb45"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb45-1"><a href="#cb45-1" aria-hidden="true" tabindex="-1"></a><span class="fu">N</span>.(<span class="fu">elements</span>(<span class="fu">solveset</span>(𝒑)))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="31">
<pre><code>4-element Vector{BigFloat}:
-0.3826834323650897717284599840303988667613445624856270414338006356275460339600903
0.9238795325112867561281831893967882868224166258636424861150977312805350075011054
0.3826834323650897717284599840303988667613445624856270414338006356275460339600903
-0.9238795325112867561281831893967882868224166258636424861150977312805350075011054</code></pre>
</div>
</div>
</section>
</section>
<section id="do-numeric-methods-matter-when-you-can-just-graph" class="level2" data-number="12.2">
<h2 data-number="12.2" class="anchored" data-anchor-id="do-numeric-methods-matter-when-you-can-just-graph"><span class="header-section-number">12.2</span> Do numeric methods matter when you can just graph?</h2>
<p>It may seem that certain practices related to roots of polynomials are unnecessary as we could just graph the equation and look for the roots. This feeling is perhaps motivated by the examples given in textbooks to be worked by hand, which necessarily focus on smallish solutions. But, in general, without some sense of where the roots are, an informative graph itself can be hard to produce. That is, technology doesnt displace thinking - it only supplements it.</p>
<p>For another example, consider the polynomial <span class="math inline">\((x-20)^5 - (x-20) + 1\)</span>. In this form we might think the roots are near <span class="math inline">\(20\)</span>. However, were we presented with this polynomial in expanded form: <span class="math inline">\(x^5 - 100x^4 + 4000x^3 - 80000x^2 + 799999x - 3199979\)</span>, we might be tempted to just graph it to find roots. A naive graph might be to plot over <span class="math inline">\([-10, 10]\)</span>:</p>
<div class="cell" data-execution_count="31">
<div class="sourceCode cell-code" id="cb47"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb47-1"><a href="#cb47-1" aria-hidden="true" tabindex="-1"></a>𝐩 <span class="op">=</span> x<span class="op">^</span><span class="fl">5</span> <span class="op">-</span> <span class="fl">100</span>x<span class="op">^</span><span class="fl">4</span> <span class="op">+</span> <span class="fl">4000</span>x<span class="op">^</span><span class="fl">3</span> <span class="op">-</span> <span class="fl">80000</span>x<span class="op">^</span><span class="fl">2</span> <span class="op">+</span> <span class="fl">799999</span>x <span class="op">-</span> <span class="fl">3199979</span></span>
<span id="cb47-2"><a href="#cb47-2" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(𝐩, <span class="op">-</span><span class="fl">10</span>, <span class="fl">10</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="32">
<p><img src="polynomial_roots_files/figure-html/cell-32-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>This seems to indicate a root near <span class="math inline">\(10\)</span>. But look at the scale of the <span class="math inline">\(y\)</span> axis. The value at <span class="math inline">\(-10\)</span> is around <span class="math inline">\(-25,000,000\)</span> so it is really hard to tell if <span class="math inline">\(f\)</span> is near <span class="math inline">\(0\)</span> when <span class="math inline">\(x=10\)</span>, as the range is too large.</p>
<p>A graph over <span class="math inline">\([10,20]\)</span> is still unclear:</p>
<div class="cell" data-execution_count="32">
<div class="sourceCode cell-code" id="cb48"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb48-1"><a href="#cb48-1" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(𝐩, <span class="fl">10</span>,<span class="fl">20</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="33">
<p><img src="polynomial_roots_files/figure-html/cell-33-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>We see that what looked like a zero near <span class="math inline">\(10\)</span>, was actually a number around <span class="math inline">\(-100,000\)</span>.</p>
<p>Continuing, a plot over <span class="math inline">\([15, 20]\)</span> still isnt that useful. It isnt until we get close to <span class="math inline">\(18\)</span> that the large values of the polynomial allow a clear vision of the values near <span class="math inline">\(0\)</span>. That being said, plotting anything bigger than <span class="math inline">\(22\)</span> quickly makes the large values hide those near <span class="math inline">\(0\)</span>, and might make us think where the function dips back down there is a second or third zero, when only <span class="math inline">\(1\)</span> is the case. (We know that, as this is the same <span class="math inline">\(x^5 - x + 1\)</span> shifted to the right by <span class="math inline">\(20\)</span> units.)</p>
<div class="cell" data-execution_count="33">
<div class="sourceCode cell-code" id="cb49"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb49-1"><a href="#cb49-1" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(𝐩, <span class="fl">18</span>, <span class="fl">22</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">
<p><img src="polynomial_roots_files/figure-html/cell-34-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>Not that it cant be done, but graphically solving for a root here can require some judicious choice of viewing window. Even worse is the case where something might graphically look like a root, but in fact not be a root. Something like <span class="math inline">\((x-100)^2 + 0.1\)</span> will demonstrate.</p>
<p>For another example, the following polynomial when plotted over <span class="math inline">\([-5,7]\)</span> appears to have two real roots:</p>
<div class="cell" data-execution_count="34">
<div class="sourceCode cell-code" id="cb50"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb50-1"><a href="#cb50-1" aria-hidden="true" tabindex="-1"></a>h <span class="op">=</span> x<span class="op">^</span><span class="fl">7</span> <span class="op">-</span> <span class="fl">16129</span>x<span class="op">^</span><span class="fl">2</span> <span class="op">+</span> <span class="fl">254</span>x <span class="op">-</span> <span class="fl">1</span></span>
<span id="cb50-2"><a href="#cb50-2" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(h, <span class="op">-</span><span class="fl">5</span>, <span class="fl">7</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">
<p><img src="polynomial_roots_files/figure-html/cell-35-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>in fact there are three, two are <em>very</em> close together:</p>
<div class="cell" data-execution_count="35">
<div class="sourceCode cell-code" id="cb51"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb51-1"><a href="#cb51-1" aria-hidden="true" tabindex="-1"></a><span class="fu">N</span>.(<span class="fu">solve</span>(h))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="36">
<pre><code>3-element Vector{BigFloat}:
0.007874015406930341157555003028161633376551552518768059431667490175426147404348286
0.007874016089132754403608727898779727134193464194254785228308443233139693780655877
6.939437409621392124436713492447610272200680501712185816507667632045076114762801</code></pre>
</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 difference of the two roots is around <code>1e-10</code>. For the graph over the interval of <span class="math inline">\([-5,7]\)</span> there are about <span class="math inline">\(800\)</span> “pixels” used, so each pixel represents a size of about <code>1.5e-2</code>. So the cluster of roots would safely be hidden under a single “pixel.”</p>
</div>
</div>
<p>The point of this is to say, that it is useful to know where to look for roots, even if graphing calculators or graphing programs make drawing graphs relatively painless. A better way in this case would be to find the real roots first, and then incorporate that information into the choice of plot window.</p>
</section>
<section id="some-facts-about-the-real-roots-of-a-polynomial" class="level2" data-number="12.3">
<h2 data-number="12.3" class="anchored" data-anchor-id="some-facts-about-the-real-roots-of-a-polynomial"><span class="header-section-number">12.3</span> Some facts about the real roots of a polynomial</h2>
<p>A polynomial with real coefficients may or may not have real roots. The following discusses some simple checks on the number of real roots and bounds on how big they can be. This can be <em>roughly</em> used to narrow viewing windows when graphing polynomials.</p>
<section id="descartes-rule-of-signs" class="level3" data-number="12.3.1">
<h3 data-number="12.3.1" class="anchored" data-anchor-id="descartes-rule-of-signs"><span class="header-section-number">12.3.1</span> Descartes rule of signs</h3>
<p>The study of polynomial roots is an old one. In <span class="math inline">\(1637\)</span> Descartes published a <em>simple</em> method to determine an upper bound on the number of <em>positive</em> real roots of a polynomial.</p>
<blockquote class="blockquote">
<p><a href="http://en.wikipedia.org/wiki/Descartes%27_rule_of_signs">Descartes rule of signs</a>: if <span class="math inline">\(p=a_n x^n + a_{n-1}x^{n-1} + \cdots a_1x + a_0\)</span> then the number of positive real roots is either equal to the number of sign differences between consecutive nonzero coefficients, or is less than it by an even number. Repeated roots are counted separately.</p>
</blockquote>
<p>One method of proof (sketched at the end of this section) first shows that in synthetic division by <span class="math inline">\((x-c)\)</span> with <span class="math inline">\(c &gt; 0\)</span>, we must have that any sign change in <span class="math inline">\(q\)</span> is related to a sign change in <span class="math inline">\(p\)</span> and there must be at least one more in <span class="math inline">\(p\)</span>. This is then used to show that there can be only as many positive roots as sign changes. That the difference comes in pairs is related to complex roots of real polynomials always coming in pairs.</p>
<p>An immediate consequence, is that a polynomial whose coefficients are all non-negative will have no positive real roots.</p>
<p>Applying this to the polynomial <span class="math inline">\(x^5 -x + 1\)</span> we get That the coefficients have signs: <code>+ 0 0 0 - +</code> which collapses to the sign pattern <code>+</code>, <code>-</code>, <code>+</code>. This pattern has two changes of sign. The number of <em>positive</em> real roots is either <span class="math inline">\(2\)</span> or <span class="math inline">\(0\)</span>. In fact there are <span class="math inline">\(0\)</span> for this case.</p>
<p>What about negative roots? Cleary, any negative root of <span class="math inline">\(p\)</span> is a positive root of <span class="math inline">\(q(x) = p(-x)\)</span>, as the graph of <span class="math inline">\(q\)</span> is just that of <span class="math inline">\(p\)</span> flipped through the <span class="math inline">\(y\)</span> axis. But the coefficients of <span class="math inline">\(q\)</span> are the same as <span class="math inline">\(p\)</span>, except for the odd-indexed coefficients (<span class="math inline">\(a_1, a_3, \dots\)</span>) have a changed sign. Continuing with our example, for <span class="math inline">\(q(x) = -x^5 + x + 1\)</span> we get the new sign pattern <code>-</code>, <code>+</code>, <code>+</code> which yields one sign change. That is, there <em>must</em> be a negative real root, and indeed there is, <span class="math inline">\(x \approx -1.1673\)</span>.</p>
<p>With this knowledge, we could have known that in an earlier example the graph of <code>p = x^7 - 16129x^2 + 254x - 1</code> which indicated two positive real roots was misleading, as there must be <span class="math inline">\(1\)</span> or <span class="math inline">\(3\)</span> by a count of the sign changes.</p>
<p>For another example, if we looked at <span class="math inline">\(f(x) = x^5 - 100x^4 + 4000x^3 - 80000x^2 + 799999x - 3199979\)</span> again, we see that there could be <span class="math inline">\(1\)</span>, <span class="math inline">\(3\)</span>, or <span class="math inline">\(5\)</span> <em>positive</em> roots. However, changing the signs of the odd powers leaves all “-” signs, so there are <span class="math inline">\(0\)</span> negative roots. From the graph, we saw just <span class="math inline">\(1\)</span> real root, not <span class="math inline">\(3\)</span> or <span class="math inline">\(5\)</span>. We can verify numerically with:</p>
<div class="cell" data-execution_count="36">
<div class="sourceCode cell-code" id="cb53"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb53-1"><a href="#cb53-1" aria-hidden="true" tabindex="-1"></a>j <span class="op">=</span> x<span class="op">^</span><span class="fl">5</span> <span class="op">-</span> <span class="fl">100</span>x<span class="op">^</span><span class="fl">4</span> <span class="op">+</span> <span class="fl">4000</span>x<span class="op">^</span><span class="fl">3</span> <span class="op">-</span> <span class="fl">80000</span>x<span class="op">^</span><span class="fl">2</span> <span class="op">+</span> <span class="fl">799999</span>x <span class="op">-</span> <span class="fl">3199979</span></span>
<span id="cb53-2"><a href="#cb53-2" aria-hidden="true" tabindex="-1"></a><span class="fu">N</span>.(<span class="fu">solve</span>(j))</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>1-element Vector{BigFloat}:
18.83269602173858131574395410014515781927943962847451096085991755072434809657041</code></pre>
</div>
</div>
</section>
<section id="cauchys-bound-on-the-magnitude-of-the-real-roots." class="level3" data-number="12.3.2">
<h3 data-number="12.3.2" class="anchored" data-anchor-id="cauchys-bound-on-the-magnitude-of-the-real-roots."><span class="header-section-number">12.3.2</span> Cauchys bound on the magnitude of the real roots.</h3>
<p>Descartes rule gives a bound on how many real roots there may be. Cauchy provided a bound on how large they can be. Assume our polynomial is monic (if not, divide by <span class="math inline">\(a_n\)</span> to make it so, as this wont effect the roots). Then any real root is no larger in absolute value than <span class="math inline">\(|a_0| + |a_1| + |a_2| + \cdots + |a_n|\)</span>, (this is expressed in different ways.)</p>
<p>To see precisely <a href="https://captainblack.wordpress.com/2009/03/08/cauchys-upper-bound-for-the-roots-of-a-polynomial/">why</a> this bound works, suppose <span class="math inline">\(x\)</span> is a root with <span class="math inline">\(|x| &gt; 1\)</span> and let <span class="math inline">\(h\)</span> be the bound. Then since <span class="math inline">\(x\)</span> is a root, we can solve <span class="math inline">\(a_0 + a_1x + \cdots + 1 \cdot x^n = 0\)</span> for <span class="math inline">\(x^n\)</span> as:</p>
<p><span class="math display">\[
x^n = -(a_0 + a_1 x + \cdots a_{n-1}x^{n-1})
\]</span></p>
<p>Which after taking absolute values of both sides, yields:</p>
<p><span class="math display">\[
|x^n| \leq |a_0| + |a_1||x| + |a_2||x^2| + \cdots |a_{n-1}| |x^{n-1}| \leq (h-1) (1 + |x| + |x^2| + \cdots |x^{n-1}|).
\]</span></p>
<p>The last sum can be computed using a formula for geometric sums, <span class="math inline">\((|x^n| - 1)/(|x|-1)\)</span>. Rearranging, gives the inequality:</p>
<p><span class="math display">\[
|x| - 1 \leq (h-1) \cdot (1 - \frac{1}{|x^n|} ) \leq (h-1)
\]</span></p>
<p>from which it follows that <span class="math inline">\(|x| \leq h\)</span>, as desired.</p>
<p>For our polynomial <span class="math inline">\(x^5 -x + 1\)</span> we have the sum above is <span class="math inline">\(3\)</span>. The lone real root is approximately <span class="math inline">\(-1.1673\)</span> which satisfies <span class="math inline">\(|-1.1673| \leq 3\)</span>.</p>
</section>
</section>
<section id="questions" class="level2" data-number="12.4">
<h2 data-number="12.4" class="anchored" data-anchor-id="questions"><span class="header-section-number">12.4</span> Questions</h2>
<section id="question" class="level6">
<h6 class="anchored" data-anchor-id="question">Question</h6>
<p>What is the remainder of dividing <span class="math inline">\(x^4 - x^3 - x^2 + 2\)</span> by <span class="math inline">\(x-2\)</span>?</p>
<div class="cell" data-hold="true" data-execution_count="37">
<div class="cell-output cell-output-display" data-execution_count="38">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="14318082245935350206" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_14318082245935350206">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_14318082245935350206_1">
<input class="form-check-input" type="radio" name="radio_14318082245935350206" id="radio_14318082245935350206_1" value="1">
<span class="label-body px-1">
\(x^3 + x^2 + x + 2\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_14318082245935350206_2">
<input class="form-check-input" type="radio" name="radio_14318082245935350206" id="radio_14318082245935350206_2" value="2">
<span class="label-body px-1">
\(0\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_14318082245935350206_3">
<input class="form-check-input" type="radio" name="radio_14318082245935350206" id="radio_14318082245935350206_3" value="3">
<span class="label-body px-1">
\(x-2\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_14318082245935350206_4">
<input class="form-check-input" type="radio" name="radio_14318082245935350206" id="radio_14318082245935350206_4" value="4">
<span class="label-body px-1">
\(6\)
</span>
</label>
</div>
</div>
</div>
<div id="14318082245935350206_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_14318082245935350206"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 4;
var msgBox = document.getElementById('14318082245935350206_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_14318082245935350206")
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_14318082245935350206")
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>What is the remainder of dividing <span class="math inline">\(x^4 - x^3 - x^2 + 2\)</span> by <span class="math inline">\(x^3 - 2x\)</span>?</p>
<div class="cell" data-hold="true" data-execution_count="38">
<div class="cell-output cell-output-display" data-execution_count="39">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="7857301028443255577" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_7857301028443255577">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_7857301028443255577_1">
<input class="form-check-input" type="radio" name="radio_7857301028443255577" id="radio_7857301028443255577_1" value="1">
<span class="label-body px-1">
\(x^2 - 2x + 2\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_7857301028443255577_2">
<input class="form-check-input" type="radio" name="radio_7857301028443255577" id="radio_7857301028443255577_2" value="2">
<span class="label-body px-1">
\(x - 1\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_7857301028443255577_3">
<input class="form-check-input" type="radio" name="radio_7857301028443255577" id="radio_7857301028443255577_3" value="3">
<span class="label-body px-1">
\(2\)
</span>
</label>
</div>
</div>
</div>
<div id="7857301028443255577_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_7857301028443255577"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 1;
var msgBox = document.getElementById('7857301028443255577_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_7857301028443255577")
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_7857301028443255577")
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>We have that <span class="math inline">\(x^5 - x + 1 = (x^3 + x^2 - 1) \cdot (x^2 - x + 1) + (-2x + 2)\)</span>.</p>
<p>What is the remainder of dividing <span class="math inline">\(x^5 - x + 1\)</span> by <span class="math inline">\(x^2 - x + 1\)</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="17893377901442521750" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_17893377901442521750">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_17893377901442521750_1">
<input class="form-check-input" type="radio" name="radio_17893377901442521750" id="radio_17893377901442521750_1" value="1">
<span class="label-body px-1">
\(x^3 + x^2 - 1\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_17893377901442521750_2">
<input class="form-check-input" type="radio" name="radio_17893377901442521750" id="radio_17893377901442521750_2" value="2">
<span class="label-body px-1">
\(-2x + 2\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_17893377901442521750_3">
<input class="form-check-input" type="radio" name="radio_17893377901442521750" id="radio_17893377901442521750_3" value="3">
<span class="label-body px-1">
\(x^2 - x + 1\)
</span>
</label>
</div>
</div>
</div>
<div id="17893377901442521750_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_17893377901442521750"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 2;
var msgBox = document.getElementById('17893377901442521750_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_17893377901442521750")
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_17893377901442521750")
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>Consider this output from synthetic division</p>
<pre class="{verbatim}"><code>2 | 1 0 0 0 -1 1
| 2 4 8 16 30
---------------
1 2 4 8 15 31</code></pre>
<p>representing <span class="math inline">\(p(x) = q(x)\cdot(x-c) + r\)</span>.</p>
<p>What is <span class="math inline">\(p(x)\)</span>?</p>
<div class="cell" data-hold="true" 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="17832428998610039850" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_17832428998610039850">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_17832428998610039850_1">
<input class="form-check-input" type="radio" name="radio_17832428998610039850" id="radio_17832428998610039850_1" value="1">
<span class="label-body px-1">
\(x^4 +2x^3 + 4x^2 + 8x + 15\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_17832428998610039850_2">
<input class="form-check-input" type="radio" name="radio_17832428998610039850" id="radio_17832428998610039850_2" value="2">
<span class="label-body px-1">
\(x^5 - x + 1\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_17832428998610039850_3">
<input class="form-check-input" type="radio" name="radio_17832428998610039850" id="radio_17832428998610039850_3" value="3">
<span class="label-body px-1">
\(31\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_17832428998610039850_4">
<input class="form-check-input" type="radio" name="radio_17832428998610039850" id="radio_17832428998610039850_4" value="4">
<span class="label-body px-1">
\(2x^4 + 4x^3 + 8x^2 + 16x + 30\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_17832428998610039850_5">
<input class="form-check-input" type="radio" name="radio_17832428998610039850" id="radio_17832428998610039850_5" value="5">
<span class="label-body px-1">
\(x^5 + 2x^4 + 4x^3 + 8x^2 + 15x + 31\)
</span>
</label>
</div>
</div>
</div>
<div id="17832428998610039850_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_17832428998610039850"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 2;
var msgBox = document.getElementById('17832428998610039850_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_17832428998610039850")
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_17832428998610039850")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
<p>What is <span class="math inline">\(q(x)\)</span>?</p>
<div class="cell" data-hold="true" 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="15111148251099033030" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_15111148251099033030">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_15111148251099033030_1">
<input class="form-check-input" type="radio" name="radio_15111148251099033030" id="radio_15111148251099033030_1" value="1">
<span class="label-body px-1">
\(2x^4 + 4x^3 + 8x^2 + 16x + 30\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_15111148251099033030_2">
<input class="form-check-input" type="radio" name="radio_15111148251099033030" id="radio_15111148251099033030_2" value="2">
<span class="label-body px-1">
\(x^5 - x + 1\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_15111148251099033030_3">
<input class="form-check-input" type="radio" name="radio_15111148251099033030" id="radio_15111148251099033030_3" value="3">
<span class="label-body px-1">
\(31\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_15111148251099033030_4">
<input class="form-check-input" type="radio" name="radio_15111148251099033030" id="radio_15111148251099033030_4" value="4">
<span class="label-body px-1">
\(x^4 +2x^3 + 4x^2 + 8x + 15\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_15111148251099033030_5">
<input class="form-check-input" type="radio" name="radio_15111148251099033030" id="radio_15111148251099033030_5" value="5">
<span class="label-body px-1">
\(x^5 + 2x^4 + 4x^3 + 8x^2 + 15x + 31\)
</span>
</label>
</div>
</div>
</div>
<div id="15111148251099033030_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_15111148251099033030"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 4;
var msgBox = document.getElementById('15111148251099033030_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_15111148251099033030")
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_15111148251099033030")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
<p>What is <span class="math inline">\(r\)</span>?</p>
<div class="cell" data-hold="true" 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="12699156824072365421" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_12699156824072365421">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_12699156824072365421_1">
<input class="form-check-input" type="radio" name="radio_12699156824072365421" id="radio_12699156824072365421_1" value="1">
<span class="label-body px-1">
\(x^5 + 2x^4 + 4x^3 + 8x^2 + 15x + 31\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_12699156824072365421_2">
<input class="form-check-input" type="radio" name="radio_12699156824072365421" id="radio_12699156824072365421_2" value="2">
<span class="label-body px-1">
\(2x^4 + 4x^3 + 8x^2 + 16x + 30\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_12699156824072365421_3">
<input class="form-check-input" type="radio" name="radio_12699156824072365421" id="radio_12699156824072365421_3" value="3">
<span class="label-body px-1">
\(31\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_12699156824072365421_4">
<input class="form-check-input" type="radio" name="radio_12699156824072365421" id="radio_12699156824072365421_4" value="4">
<span class="label-body px-1">
\(x^4 +2x^3 + 4x^2 + 8x + 15\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_12699156824072365421_5">
<input class="form-check-input" type="radio" name="radio_12699156824072365421" id="radio_12699156824072365421_5" value="5">
<span class="label-body px-1">
\(x^5 - x + 1\)
</span>
</label>
</div>
</div>
</div>
<div id="12699156824072365421_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_12699156824072365421"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 3;
var msgBox = document.getElementById('12699156824072365421_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_12699156824072365421")
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_12699156824072365421")
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>Let <span class="math inline">\(p=x^4 -9x^3 +30x^2 -44x + 24\)</span></p>
<p>Factor <span class="math inline">\(p\)</span>. What are the factors?</p>
<div class="cell" data-hold="true" 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="5598429489591203112" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_5598429489591203112">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_5598429489591203112_1">
<input class="form-check-input" type="radio" name="radio_5598429489591203112" id="radio_5598429489591203112_1" value="1">
<span class="label-body px-1">
\((x-2)\) and \((x-3)\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_5598429489591203112_2">
<input class="form-check-input" type="radio" name="radio_5598429489591203112" id="radio_5598429489591203112_2" value="2">
<span class="label-body px-1">
\((x+2)\) and \((x+3)\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_5598429489591203112_3">
<input class="form-check-input" type="radio" name="radio_5598429489591203112" id="radio_5598429489591203112_3" value="3">
<span class="label-body px-1">
\(2\) and \(3\)
</span>
</label>
</div>
</div>
</div>
<div id="5598429489591203112_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_5598429489591203112"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 1;
var msgBox = document.getElementById('5598429489591203112_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_5598429489591203112")
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_5598429489591203112")
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>Does the expression <span class="math inline">\(x^4 - 5\)</span> factor over the rational numbers?</p>
<div class="cell" data-hold="true" 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="10698618582009416975" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_10698618582009416975">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_10698618582009416975_1">
<input class="form-check-input" type="radio" name="radio_10698618582009416975" id="radio_10698618582009416975_1" value="1">
<span class="label-body px-1">
Yes
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_10698618582009416975_2">
<input class="form-check-input" type="radio" name="radio_10698618582009416975" id="radio_10698618582009416975_2" value="2">
<span class="label-body px-1">
No
</span>
</label>
</div>
</div>
</div>
<div id="10698618582009416975_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_10698618582009416975"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 2;
var msgBox = document.getElementById('10698618582009416975_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_10698618582009416975")
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_10698618582009416975")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
<p>Using <code>solve</code>, how many real roots does <span class="math inline">\(x^4 - 5\)</span> have:</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="13239821996293865143" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_13239821996293865143">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="13239821996293865143" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="13239821996293865143_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("13239821996293865143").addEventListener("change", function() {
var correct = (Math.abs(this.value - 2) <= 0);
var msgBox = document.getElementById('13239821996293865143_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_13239821996293865143")
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_13239821996293865143")
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>The Soviet historian I. Y. Depman claimed that in <span class="math inline">\(1486\)</span>, Spanish mathematician Valmes was burned at the stake for claiming to have solved the <a href="https://en.wikipedia.org/wiki/Quartic_function">quartic equation</a>. Here we dont face such consequences.</p>
<p>Find the largest real root of <span class="math inline">\(x^4 - 10x^3 + 32x^2 - 38x + 15\)</span>.</p>
<div class="cell" data-hold="true" 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="4689200467513042783" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_4689200467513042783">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="4689200467513042783" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="4689200467513042783_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("4689200467513042783").addEventListener("change", function() {
var correct = (Math.abs(this.value - 5) <= 0);
var msgBox = document.getElementById('4689200467513042783_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_4689200467513042783")
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_4689200467513042783")
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>What are the numeric values of the real roots of <span class="math inline">\(f(x) = x^6 - 5x^5 + x^4 - 3x^3 + x^2 - x + 1\)</span>?</p>
<div class="cell" data-hold="true" 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="1531462526772717766" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_1531462526772717766">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_1531462526772717766_1">
<input class="form-check-input" type="radio" name="radio_1531462526772717766" id="radio_1531462526772717766_1" value="1">
<span class="label-body px-1">
<code>[0.578696, 4.91368]</code>
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_1531462526772717766_2">
<input class="form-check-input" type="radio" name="radio_1531462526772717766" id="radio_1531462526772717766_2" value="2">
<span class="label-body px-1">
<code>[-0.434235+0.613836im, -0.434235-0.613836im]</code>
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_1531462526772717766_3">
<input class="form-check-input" type="radio" name="radio_1531462526772717766" id="radio_1531462526772717766_3" value="3">
<span class="label-body px-1">
<code>[-0.434235, -0.434235, 0.188049, 0.188049]</code>
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_1531462526772717766_4">
<input class="form-check-input" type="radio" name="radio_1531462526772717766" id="radio_1531462526772717766_4" value="4">
<span class="label-body px-1">
<code>[-0.434235, -0.434235, 0.188049, 0.188049, 0.578696, 4.91368]</code>
</span>
</label>
</div>
</div>
</div>
<div id="1531462526772717766_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_1531462526772717766"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 1;
var msgBox = document.getElementById('1531462526772717766_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_1531462526772717766")
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_1531462526772717766")
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>Odd polynomials must have at least one real root.</p>
<p>Consider the polynomial <span class="math inline">\(x^5 - 3x + 1\)</span>. Does it have more than one real root?</p>
<div class="cell" data-hold="true" 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="9697970579492196079" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_9697970579492196079">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_9697970579492196079_1">
<input class="form-check-input" type="radio" name="radio_9697970579492196079" id="radio_9697970579492196079_1" value="1">
<span class="label-body px-1">
Yes
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_9697970579492196079_2">
<input class="form-check-input" type="radio" name="radio_9697970579492196079" id="radio_9697970579492196079_2" value="2">
<span class="label-body px-1">
No
</span>
</label>
</div>
</div>
</div>
<div id="9697970579492196079_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_9697970579492196079"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 1;
var msgBox = document.getElementById('9697970579492196079_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_9697970579492196079")
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_9697970579492196079")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
<p>Consider the polynomial <span class="math inline">\(x^5 - 1.5x + 1\)</span>. Does it have more than one real root?</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="6308875033399784038" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_6308875033399784038">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_6308875033399784038_1">
<input class="form-check-input" type="radio" name="radio_6308875033399784038" id="radio_6308875033399784038_1" value="1">
<span class="label-body px-1">
Yes
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_6308875033399784038_2">
<input class="form-check-input" type="radio" name="radio_6308875033399784038" id="radio_6308875033399784038_2" value="2">
<span class="label-body px-1">
No
</span>
</label>
</div>
</div>
</div>
<div id="6308875033399784038_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_6308875033399784038"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 2;
var msgBox = document.getElementById('6308875033399784038_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_6308875033399784038")
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_6308875033399784038")
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 maximum number of positive, real roots that Descartes bound says <span class="math inline">\(p=x^5 + x^4 - x^3 + x^2 + x + 1\)</span> can have?</p>
<div class="cell" data-hold="true" data-execution_count="50">
<div class="cell-output cell-output-display" data-execution_count="51">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="4381621454038133620" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_4381621454038133620">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="4381621454038133620" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="4381621454038133620_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("4381621454038133620").addEventListener("change", function() {
var correct = (Math.abs(this.value - 2) <= 0);
var msgBox = document.getElementById('4381621454038133620_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_4381621454038133620")
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_4381621454038133620")
if (explanation != null) {
explanation.style.display = "block";
}
}
});
</script>
</div>
</div>
<p>How many positive, real roots does it actually have?</p>
<div class="cell" data-hold="true" data-execution_count="51">
<div class="cell-output cell-output-display" data-execution_count="52">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="15010351769014241255" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_15010351769014241255">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="15010351769014241255" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="15010351769014241255_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("15010351769014241255").addEventListener("change", function() {
var correct = (Math.abs(this.value - 0) <= 0);
var msgBox = document.getElementById('15010351769014241255_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_15010351769014241255")
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_15010351769014241255")
if (explanation != null) {
explanation.style.display = "block";
}
}
});
</script>
</div>
</div>
<p>What is the maximum number of negative, real roots that Descartes bound says <span class="math inline">\(p=x^5 + x^4 - x^3 + x^2 + x + 1\)</span> can have?</p>
<div class="cell" data-hold="true" data-execution_count="52">
<div class="cell-output cell-output-display" data-execution_count="53">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="1438369780054157106" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_1438369780054157106">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="1438369780054157106" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="1438369780054157106_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("1438369780054157106").addEventListener("change", function() {
var correct = (Math.abs(this.value - 3) <= 0);
var msgBox = document.getElementById('1438369780054157106_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_1438369780054157106")
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_1438369780054157106")
if (explanation != null) {
explanation.style.display = "block";
}
}
});
</script>
</div>
</div>
<p>How many negative, real roots does it actually have?</p>
<div class="cell" data-hold="true" data-execution_count="53">
<div class="cell-output cell-output-display" data-execution_count="54">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="17801488992381592512" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_17801488992381592512">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="17801488992381592512" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="17801488992381592512_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("17801488992381592512").addEventListener("change", function() {
var correct = (Math.abs(this.value - 1) <= 0);
var msgBox = document.getElementById('17801488992381592512_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_17801488992381592512")
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_17801488992381592512")
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>Let <span class="math inline">\(f(x) = x^5 - 4x^4 + x^3 - 2x^2 + x\)</span>. What does Cauchys bound say is the largest possible magnitude of a root?</p>
<div class="cell" data-hold="true" data-execution_count="54">
<div class="cell-output cell-output-display" data-execution_count="55">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="4958386236705940302" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_4958386236705940302">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="4958386236705940302" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="4958386236705940302_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("4958386236705940302").addEventListener("change", function() {
var correct = (Math.abs(this.value - 9) <= 0);
var msgBox = document.getElementById('4958386236705940302_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_4958386236705940302")
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_4958386236705940302")
if (explanation != null) {
explanation.style.display = "block";
}
}
});
</script>
</div>
</div>
<p>What is the largest magnitude of a real root?</p>
<div class="cell" data-hold="true" data-execution_count="55">
<div class="cell-output cell-output-display" data-execution_count="56">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="5494360582774555350" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_5494360582774555350">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="5494360582774555350" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="5494360582774555350_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("5494360582774555350").addEventListener("change", function() {
var correct = (Math.abs(this.value - 3.8577520031414356) <= 0.001);
var msgBox = document.getElementById('5494360582774555350_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_5494360582774555350")
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_5494360582774555350")
if (explanation != null) {
explanation.style.display = "block";
}
}
});
</script>
</div>
</div>
</section>
<section id="question-11" class="level6">
<h6 class="anchored" data-anchor-id="question-11">Question</h6>
<p>As <span class="math inline">\(1 + 2 + 3 + 4\)</span> is <span class="math inline">\(10\)</span>, Cauchys bound says that the magnitude of the largest real root of <span class="math inline">\(x^3 - ax^2 + bx - c\)</span> is <span class="math inline">\(10\)</span> where <span class="math inline">\(a,b,c\)</span> is one of <span class="math inline">\(2,3,4\)</span>. By considering all 6 such possible polynomials (such as <span class="math inline">\(x^3 - 3x^2 + 2x - 4\)</span>) what is the largest magnitude or a root?</p>
<div class="cell" data-hold="true" data-execution_count="56">
<div class="cell-output cell-output-display" data-execution_count="57">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="9501221396202226897" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_9501221396202226897">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="9501221396202226897" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="9501221396202226897_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("9501221396202226897").addEventListener("change", function() {
var correct = (Math.abs(this.value - 3.677993483398446) <= 0.001);
var msgBox = document.getElementById('9501221396202226897_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_9501221396202226897")
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_9501221396202226897")
if (explanation != null) {
explanation.style.display = "block";
}
}
});
</script>
</div>
</div>
</section>
<section id="question-12" class="level6">
<h6 class="anchored" data-anchor-id="question-12">Question</h6>
<p>The roots of the <a href="https://en.wikipedia.org/wiki/Chebyshev_polynomials">Chebyshev</a> polynomials are helpful for some numeric algorithms. These are a family of polynomials related by <span class="math inline">\(T_{n+1}(x) = 2xT_n(x) - T_{n-1}(x)\)</span> (a recurrence relation in the manner of the Fibonacci sequence). The first two are <span class="math inline">\(T_0(x) = 1\)</span> and <span class="math inline">\(T_1(x) =x\)</span>.</p>
<ul>
<li>Based on the relation, figure out <span class="math inline">\(T_2(x)\)</span>. It is</li>
</ul>
<div class="cell" data-hold="true" data-execution_count="57">
<div class="cell-output cell-output-display" data-execution_count="58">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="11324702410108433175" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_11324702410108433175">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_11324702410108433175_1">
<input class="form-check-input" type="radio" name="radio_11324702410108433175" id="radio_11324702410108433175_1" value="1">
<span class="label-body px-1">
\(4x^2 - 1\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_11324702410108433175_2">
<input class="form-check-input" type="radio" name="radio_11324702410108433175" id="radio_11324702410108433175_2" value="2">
<span class="label-body px-1">
\(2x^2\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_11324702410108433175_3">
<input class="form-check-input" type="radio" name="radio_11324702410108433175" id="radio_11324702410108433175_3" value="3">
<span class="label-body px-1">
\(x\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_11324702410108433175_4">
<input class="form-check-input" type="radio" name="radio_11324702410108433175" id="radio_11324702410108433175_4" value="4">
<span class="label-body px-1">
\(2x\)
</span>
</label>
</div>
</div>
</div>
<div id="11324702410108433175_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_11324702410108433175"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 1;
var msgBox = document.getElementById('11324702410108433175_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_11324702410108433175")
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_11324702410108433175")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
<ul>
<li>True or false, the <span class="math inline">\(degree\)</span> of <span class="math inline">\(T_n(x)\)</span> is <span class="math inline">\(n\)</span>: (Look at the defining relation and reason this out).</li>
</ul>
<div class="cell" data-hold="true" data-execution_count="58">
<div class="cell-output cell-output-display" data-execution_count="59">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="7148828897817452299" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_7148828897817452299">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_7148828897817452299_1">
<input class="form-check-input" type="radio" name="radio_7148828897817452299" id="radio_7148828897817452299_1" value="1">
<span class="label-body px-1">
Yes
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_7148828897817452299_2">
<input class="form-check-input" type="radio" name="radio_7148828897817452299" id="radio_7148828897817452299_2" value="2">
<span class="label-body px-1">
No
</span>
</label>
</div>
</div>
</div>
<div id="7148828897817452299_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_7148828897817452299"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 1;
var msgBox = document.getElementById('7148828897817452299_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_7148828897817452299")
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_7148828897817452299")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
<ul>
<li>The fifth one is <span class="math inline">\(T_5(x) = 32x^5 - 32x^3 + 6x\)</span>. Cauchys bound says that the largest root has absolute value</li>
</ul>
<div class="cell" data-execution_count="59">
<div class="sourceCode cell-code" id="cb56"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb56-1"><a href="#cb56-1" aria-hidden="true" tabindex="-1"></a><span class="fl">1</span> <span class="op">+</span> <span class="fl">1</span> <span class="op">+</span> <span class="fl">6</span><span class="op">/</span><span class="fl">32</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="60">
<pre><code>2.1875</code></pre>
</div>
</div>
<p>The Chebyshev polynomials have the property that in fact all <span class="math inline">\(n\)</span> roots are real, distinct, and in <span class="math inline">\([-1, 1]\)</span>. Using <code>SymPy</code>, find the magnitude of the largest root:</p>
<div class="cell" data-hold="true" data-execution_count="60">
<div class="cell-output cell-output-display" data-execution_count="61">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="5381937110571888143" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_5381937110571888143">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="5381937110571888143" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="5381937110571888143_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("5381937110571888143").addEventListener("change", function() {
var correct = (Math.abs(this.value - 0.9510565162951535721164393333793821434056986341257502224473056444301531700851959) <= 0.001);
var msgBox = document.getElementById('5381937110571888143_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_5381937110571888143")
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_5381937110571888143")
if (explanation != null) {
explanation.style.display = "block";
}
}
});
</script>
</div>
</div>
<ul>
<li>Plotting <code>p</code> over the interval <span class="math inline">\([-2,2]\)</span> does not help graphically identify the roots:</li>
</ul>
<div class="cell" data-hold="true" data-execution_count="61">
<div class="sourceCode cell-code" id="cb58"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb58-1"><a href="#cb58-1" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(<span class="fl">16</span>x<span class="op">^</span><span class="fl">5</span> <span class="op">-</span> <span class="fl">20</span>x<span class="op">^</span><span class="fl">3</span> <span class="op">+</span> <span class="fl">5</span>x, <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="62">
<p><img src="polynomial_roots_files/figure-html/cell-62-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>Does graphing over <span class="math inline">\([-1,1]\)</span> show clearly the <span class="math inline">\(5\)</span> roots?</p>
<div class="cell" data-hold="true" data-execution_count="62">
<div class="cell-output cell-output-display" data-execution_count="63">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="7950267449579478432" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_7950267449579478432">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_7950267449579478432_1">
<input class="form-check-input" type="radio" name="radio_7950267449579478432" id="radio_7950267449579478432_1" value="1">
<span class="label-body px-1">
Yes
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_7950267449579478432_2">
<input class="form-check-input" type="radio" name="radio_7950267449579478432" id="radio_7950267449579478432_2" value="2">
<span class="label-body px-1">
No
</span>
</label>
</div>
</div>
</div>
<div id="7950267449579478432_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_7950267449579478432"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 1;
var msgBox = document.getElementById('7950267449579478432_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_7950267449579478432")
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_7950267449579478432")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
</section>
</section>
<section id="appendix-proof-of-descartes-rule-of-signs" class="level2" data-number="12.5">
<h2 data-number="12.5" class="anchored" data-anchor-id="appendix-proof-of-descartes-rule-of-signs"><span class="header-section-number">12.5</span> Appendix: Proof of Descartes rule of signs</h2>
<p><a href="http://www.cut-the-knot.org/fta/ROS2.shtml">Proof modified from this post</a>.</p>
<p>First, we can assume <span class="math inline">\(p\)</span> is monic (<span class="math inline">\(p_n=1\)</span> and <em>positive</em>), and <span class="math inline">\(p_0\)</span> is non zero. The latter, as we can easily deflate the polynomial by dividing by <span class="math inline">\(x\)</span> if <span class="math inline">\(p_0\)</span> is zero.</p>
<p>Let <code>var(p)</code> be the number of sign changes and <code>pos(p)</code> the number of positive real roots of <code>p</code>.</p>
<p>First: For a monic <span class="math inline">\(p\)</span> if <span class="math inline">\(p_0 &lt; 0\)</span> then <code>var(p)</code> is odd and if <span class="math inline">\(p_0 &gt; 0\)</span> then <code>var(p)</code> is even.</p>
<p>This is true for degree <span class="math inline">\(n=1\)</span> the two sign patterns under the assumption are <code>+-</code> (<span class="math inline">\(p_0 &lt; 0\)</span>) or <code>++</code> (<span class="math inline">\(p_0 &gt; 0\)</span>). If it is true for degree <span class="math inline">\(n-1\)</span>, then the we can consider the sign pattern of such an <span class="math inline">\(n\)</span> degree polynomial having one of these patterns: <code>+...+-</code> or <code>+...--</code> (if <span class="math inline">\(p_0 &lt; 0\)</span>) or <code>+...++</code> or <code>+...-+</code> if (<span class="math inline">\(p_0&gt;0\)</span>). An induction step applied to all but the last sign for these four patterns leads to even, odd, even, odd as the number of sign changes. Incorporating the last sign leads to odd, odd, even, even as the number of sign changes.</p>
<p>Second: For a monic <span class="math inline">\(p\)</span> if <code>p_0 &lt; 0</code> then <code>pos(p)</code> is <em>odd</em>, if <code>p_0 &gt; 0</code> then <code>pos(p)</code> is even.</p>
<p>This is clearly true for <strong>monic</strong> degree <span class="math inline">\(1\)</span> polynomials: if <span class="math inline">\(c\)</span> is positive <span class="math inline">\(p = x - c\)</span> has one real root (an odd number) and <span class="math inline">\(p = x + c\)</span> has <span class="math inline">\(0\)</span> real roots (an even number). Now, suppose <span class="math inline">\(p\)</span> has degree <span class="math inline">\(n\)</span> and is monic. Then as <span class="math inline">\(x\)</span> goes to <span class="math inline">\(\infty\)</span>, it must be <span class="math inline">\(p\)</span> goes to <span class="math inline">\(\infty\)</span>.</p>
<p>If <span class="math inline">\(p_0 &lt; 0\)</span> then there must be a positive real root, say <span class="math inline">\(r\)</span>, (Bolzanos intermediate value theorem). Dividing <span class="math inline">\(p\)</span> by <span class="math inline">\((x-r)\)</span> to produce <span class="math inline">\(q\)</span> requires <span class="math inline">\(q_0\)</span> to be <em>positive</em> and of lower degree. By <em>induction</em> <span class="math inline">\(q\)</span> will have an even number of roots. Add in the root <span class="math inline">\(r\)</span> to see that <span class="math inline">\(p\)</span> will have an <strong>odd</strong> number of roots.</p>
<p>Now consider the case <span class="math inline">\(p_0 &gt; 0\)</span>. There are two possibilities either <code>pos(p)</code> is zero or positive. If <code>pos(p)</code> is <span class="math inline">\(0\)</span> then there are an even number of roots. If <code>pos(p)</code> is positive, then call <span class="math inline">\(r\)</span> one of the real positive roots. Again divide by <span class="math inline">\(x-r\)</span> to produce <span class="math inline">\(p = (x-r) \cdot q\)</span>. Then <span class="math inline">\(q_0\)</span> must be <em>negative</em> for <span class="math inline">\(p_0\)</span> to be positive. By <em>induction</em> <span class="math inline">\(q\)</span> must have an odd number or roots, meaning <span class="math inline">\(p\)</span> must have an even numbers</p>
<p>So there is parity between <code>var(p)</code> and <code>pos(p)</code>: if <span class="math inline">\(p\)</span> is monic and <span class="math inline">\(p_0 &lt; 0\)</span> then both <code>var(p)</code> and <code>pos(p)</code> are both odd; and if <span class="math inline">\(p_0 &gt; 0\)</span> both <code>var(p)</code> and <code>pos(p)</code> are both even.</p>
<p>Descartes rule of signs will be established if it can be shown that <code>var(p)</code> is at least as big as <code>pos(p)</code>. Supppose <span class="math inline">\(r\)</span> is a positive real root of <span class="math inline">\(p\)</span> with <span class="math inline">\(p = (x-r)q\)</span>. We show that <code>var(p) &gt; var(q)</code> which can be repeatedly applied to show that if <span class="math inline">\(p=(x-r_1)\cdot(x-r_2)\cdot \cdots \cdot (x-r_l) q\)</span>, where the <span class="math inline">\(r_i\)</span>s are the postive real roots, then <code>var(p) &gt;= l + var(q) &gt;= l = pos(p)</code>.</p>
<p>As <span class="math inline">\(p = (x-c)q\)</span> we must have the leading term is <span class="math inline">\(p_nx^n = x \cdot q_{n-1} x^{n-1}\)</span> so <span class="math inline">\(q_{n_1}\)</span> will also be <code>+</code> under our monic assumption. Looking at a possible pattern for the signs of <span class="math inline">\(q\)</span>, we might see the following unfinished synthetic division table for a specific <span class="math inline">\(q\)</span>:</p>
<pre class="{verbatim}"><code> + ? ? ? ? ? ? ? ?
+ ? ? ? ? ? ? ? ?
-----------------
+ - - - + - + + 0</code></pre>
<p>But actually, we can fill in more, as the second row is formed by multiplying a postive <span class="math inline">\(c\)</span>:</p>
<pre class="{verbatim}"><code> + ? ? ? ? ? ? ? ?
+ + - - - + - + +
-----------------
+ - - - + - + + 0</code></pre>
<p>Whats more, using the fact that to get <code>0</code> the two summands must differ in sign and to have a <code>?</code> plus <code>+</code> yield a <code>-</code>, the <code>?</code> must be <code>-</code> (and reverse), the following must be the case for the signs of <code>p</code>:</p>
<pre class="{verbatim}"><code> + - ? ? + - + ? -
+ + - - - + - + +
-----------------
+ - - - + - + + 0</code></pre>
<p>If the bottom row represents <span class="math inline">\(q_7, q_6, \dots, q_0\)</span> and the top row <span class="math inline">\(p_8, p_7, \dots, p_0\)</span>, then the sign changes in <span class="math inline">\(q\)</span> from <code>+</code> to <code>-</code> are matched by sign changes in <span class="math inline">\(p\)</span>. The ones in <span class="math inline">\(q\)</span> from <span class="math inline">\(-\)</span> to <span class="math inline">\(+\)</span> are also matched regardless of the sign of the first two question marks (though <span class="math inline">\(p\)</span> could possibly have more). The last sign change in <span class="math inline">\(p\)</span> between <span class="math inline">\(p_2\)</span> and <span class="math inline">\(p_0\)</span> has no counterpart in <span class="math inline">\(q\)</span>, so there is at least one more sign change in <span class="math inline">\(p\)</span> than <span class="math inline">\(q\)</span>.</p>
<p>As such, the <code>var(p)</code> <span class="math inline">\(\geq 1 +\)</span> <code>var(q)</code>.</p>
</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/polynomial.html" class="pagination-link">
<i class="bi bi-arrow-left-short"></i> <span class="nav-page-text"><span class="chapter-number">11</span>&nbsp; <span class="chapter-title">Polynomials</span></span>
</a>
</div>
<div class="nav-page nav-page-next">
<a href="../precalc/polynomials_package.html" class="pagination-link">
<span class="nav-page-text"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">The Polynomials package</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>