2608 lines
228 KiB
HTML
2608 lines
228 KiB
HTML
|
<!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 - 21 Implications of continuity</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="../derivatives/derivatives.html" rel="next">
|
|||
|
<link href="../limits/continuity.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">21</span> <span class="chapter-title">Implications of continuity</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 collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" aria-expanded="false">Precalculus Concepts</a>
|
|||
|
<a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" aria-expanded="false">
|
|||
|
<i class="bi bi-chevron-right ms-2"></i>
|
|||
|
</a>
|
|||
|
</div>
|
|||
|
<ul id="quarto-sidebar-section-1" class="collapse list-unstyled sidebar-section depth1 ">
|
|||
|
<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> <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> <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> <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> <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> <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> <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> <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> <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> <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> <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> <span class="chapter-title">Polynomials</span></a>
|
|||
|
</div>
|
|||
|
</li>
|
|||
|
<li class="sidebar-item">
|
|||
|
<div class="sidebar-item-container">
|
|||
|
<a href="../precalc/polynomial_roots.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">12</span> <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> <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> <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> <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> <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> <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" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-2" aria-expanded="true">Limits</a>
|
|||
|
<a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-2" aria-expanded="true">
|
|||
|
<i class="bi bi-chevron-right ms-2"></i>
|
|||
|
</a>
|
|||
|
</div>
|
|||
|
<ul id="quarto-sidebar-section-2" class="collapse list-unstyled sidebar-section depth1 show">
|
|||
|
<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> <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> <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> <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 active"><span class="chapter-number">21</span> <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> <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> <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> <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> <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> <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> <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> <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> <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> <span class="chapter-title">Newton’s 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> <span class="chapter-title">Derivative-free alternatives to Newton’s 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> <span class="chapter-title">L’Hospital’s 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> <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> <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> <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> <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> <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> <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> <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> <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> <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> <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> <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> <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> <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> <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> <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> <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> <span class="chapter-title">Euler’s 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> <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> <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> <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> <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> <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> <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> <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> <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> <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> <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> <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> <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> <span class="chapter-title">Green’s 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> <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> <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> <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> <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> <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> <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> <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> <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="#intermediate-value-theorem" id="toc-intermediate-value-theorem" class="nav-link active" data-scroll-target="#intermediate-value-theorem"> <span class="header-section-number">21.1</span> Intermediate Value Theorem</a>
|
|||
|
<ul class="collapse">
|
|||
|
<li><a href="#bolzano-and-the-bisection-method" id="toc-bolzano-and-the-bisection-method" class="nav-link" data-scroll-target="#bolzano-and-the-bisection-method"> <span class="header-section-number">21.1.1</span> Bolzano and the bisection method</a></li>
|
|||
|
<li><a href="#the-find_zero-function." id="toc-the-find_zero-function." class="nav-link" data-scroll-target="#the-find_zero-function."> <span class="header-section-number">21.1.2</span> The <code>find_zero</code> function.</a></li>
|
|||
|
<li><a href="#the-find_zeros-function" id="toc-the-find_zeros-function" class="nav-link" data-scroll-target="#the-find_zeros-function"> <span class="header-section-number">21.1.3</span> The <code>find_zeros</code> function</a></li>
|
|||
|
<li><a href="#an-alternate-interface-to-find_zero" id="toc-an-alternate-interface-to-find_zero" class="nav-link" data-scroll-target="#an-alternate-interface-to-find_zero"> <span class="header-section-number">21.1.4</span> An alternate interface to <code>find_zero</code></a></li>
|
|||
|
</ul></li>
|
|||
|
<li><a href="#extreme-value-theorem" id="toc-extreme-value-theorem" class="nav-link" data-scroll-target="#extreme-value-theorem"> <span class="header-section-number">21.2</span> Extreme value theorem</a></li>
|
|||
|
<li><a href="#continuity-and-closed-and-open-sets" id="toc-continuity-and-closed-and-open-sets" class="nav-link" data-scroll-target="#continuity-and-closed-and-open-sets"> <span class="header-section-number">21.3</span> Continuity and closed and open sets</a></li>
|
|||
|
<li><a href="#questions" id="toc-questions" class="nav-link" data-scroll-target="#questions"> <span class="header-section-number">21.4</span> Questions</a></li>
|
|||
|
</ul>
|
|||
|
<div class="toc-actions"><div><i class="bi bi-github"></i></div><div class="action-links"><p><a href="https://github.com/jverzani/CalculusWithJuliaNotes.jl/edit/main/quarto/limits/intermediate_value_theorem.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">21</span> <span class="chapter-title">Implications of continuity</span></h1>
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<div class="quarto-title-meta">
|
|||
|
|
|||
|
|
|||
|
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
</header>
|
|||
|
|
|||
|
<p>This section uses these 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">Roots</span></span>
|
|||
|
<span id="cb1-4"><a href="#cb1-4" 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>Continuity for functions is a valued property which carries implications. In this section we discuss two: the intermediate value theorem and the extreme value theorem. These two theorems speak to some fundamental applications of calculus: finding zeros of a function and finding extrema of a function.</p>
|
|||
|
<section id="intermediate-value-theorem" class="level2" data-number="21.1">
|
|||
|
<h2 data-number="21.1" class="anchored" data-anchor-id="intermediate-value-theorem"><span class="header-section-number">21.1</span> Intermediate Value Theorem</h2>
|
|||
|
<blockquote class="blockquote">
|
|||
|
<p>The <em>intermediate value theorem</em>: If <span class="math inline">\(f\)</span> is continuous on <span class="math inline">\([a,b]\)</span> with, say, <span class="math inline">\(f(a) < f(b)\)</span>, then for any <span class="math inline">\(y\)</span> with <span class="math inline">\(f(a) \leq y \leq f(b)\)</span> there exists a <span class="math inline">\(c\)</span> in <span class="math inline">\([a,b]\)</span> with <span class="math inline">\(f(c) = y\)</span>.</p>
|
|||
|
</blockquote>
|
|||
|
<div class="cell" data-cache="true" data-hold="true" data-execution_count="4">
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="5">
|
|||
|
<div class="d-flex justify-content-center"> <figure class="figure"> <img src="data:image/gif;base64,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
|
|||
|
<figcaption class="figure-caption"><div class="markdown"><p>Illustration of intermediate value theorem. The theorem implies that any randomly chosen \(y\) value between \(f(a)\) and \(f(b)\) will have at least one \(x\) in \([a,b]\) with \(f(x)=y\).</p>
|
|||
|
</div> </figcaption>
|
|||
|
</figure>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>In the early years of calculus, the intermediate value theorem was intricately connected with the definition of continuity, now it is a consequence.</p>
|
|||
|
<p>The basic proof starts with a set of points in <span class="math inline">\([a,b]\)</span>: <span class="math inline">\(C = \{x \text{ in } [a,b] \text{ with } f(x) \leq y\}\)</span>. The set is not empty (as <span class="math inline">\(a\)</span> is in <span class="math inline">\(C\)</span>) so it <em>must</em> have a largest value, call it <span class="math inline">\(c\)</span> (this requires the completeness property of the real numbers). By continuity of <span class="math inline">\(f\)</span>, it can be shown that <span class="math inline">\(\lim_{x \rightarrow c-} f(x) = f(c) \leq y\)</span> and <span class="math inline">\(\lim_{y \rightarrow c+}f(x) =f(c) \geq y\)</span>, which forces <span class="math inline">\(f(c) = y\)</span>.</p>
|
|||
|
<section id="bolzano-and-the-bisection-method" class="level3" data-number="21.1.1">
|
|||
|
<h3 data-number="21.1.1" class="anchored" data-anchor-id="bolzano-and-the-bisection-method"><span class="header-section-number">21.1.1</span> Bolzano and the bisection method</h3>
|
|||
|
<p>Suppose we have a continuous function <span class="math inline">\(f(x)\)</span> on <span class="math inline">\([a,b]\)</span> with <span class="math inline">\(f(a) < 0\)</span> and <span class="math inline">\(f(b) > 0\)</span>. Then as <span class="math inline">\(f(a) < 0 < f(b)\)</span>, the intermediate value theorem guarantees the existence of a <span class="math inline">\(c\)</span> in <span class="math inline">\([a,b]\)</span> with <span class="math inline">\(f(c) = 0\)</span>. This was a special case of the intermediate value theorem proved by Bolzano first. Such <span class="math inline">\(c\)</span> are called <em>zeros</em> of the function <span class="math inline">\(f\)</span>.</p>
|
|||
|
<p>We use this fact when a building a “sign chart” of a polynomial function. Between any two consecutive real zeros the polynomial can not change sign. (Why?) So a “test point” can be used to determine the sign of the function over an entire interval.</p>
|
|||
|
<p>Here, we use the Bolzano theorem to give an algorithm - the <em>bisection method</em> - to locate the value <span class="math inline">\(c\)</span> under the assumption <span class="math inline">\(f\)</span> is continous on <span class="math inline">\([a,b]\)</span> and changes sign between <span class="math inline">\(a\)</span> and <span class="math inline">\(b\)</span>.</p>
|
|||
|
<div class="cell" data-cache="true" data-hold="true" data-execution_count="5">
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="6">
|
|||
|
<div class="d-flex justify-content-center"> <figure class="figure"> <img src="data:image/gif;base64,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
|
|||
|
<figcaption class="figure-caption"><div class="markdown"><p>Illustration of the bisection method to find a zero of a function. At each step the interval has \(f(a)\) and \(f(b)\) having opposite signs so that the intermediate value theorem guaratees a zero.</p>
|
|||
|
</div> </figcaption>
|
|||
|
</figure>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>Call <span class="math inline">\([a,b]\)</span> a <em>bracketing</em> interval if <span class="math inline">\(f(a)\)</span> and <span class="math inline">\(f(b)\)</span> have different signs. We remark that having different signs can be expressed mathematically as <span class="math inline">\(f(a) \cdot f(b) < 0\)</span>.</p>
|
|||
|
<p>We can narrow down where a zero is in <span class="math inline">\([a,b]\)</span> by following this recipe:</p>
|
|||
|
<ul>
|
|||
|
<li>Pick a midpoint of the interval, for concreteness <span class="math inline">\(c = (a+b)/2\)</span>.</li>
|
|||
|
<li>If <span class="math inline">\(f(c) = 0\)</span> we are done, having found a zero in <span class="math inline">\([a,b]\)</span>.</li>
|
|||
|
<li>Otherwise if must be that either <span class="math inline">\(f(a)\cdot f(c) < 0\)</span> or <span class="math inline">\(f(c) \cdot f(b) < 0\)</span>. If <span class="math inline">\(f(a) \cdot f(c) < 0\)</span>, then let <span class="math inline">\(b=c\)</span> and repeat the above. Otherwise, let <span class="math inline">\(a=c\)</span> and repeat the above.</li>
|
|||
|
</ul>
|
|||
|
<p>At each step the bracketing interval is narrowed – indeed split in half as defined – or a zero is found.</p>
|
|||
|
<p>For the real numbers this algorithm never stops unless a zero is found. A “limiting” process is used to say that if it doesn’t stop, it will converge to some value.</p>
|
|||
|
<p>However, using floating point numbers leads to differences from the real-number situation. In this case, due to the ultimate granularity of the approximation of floating point values to the real numbers, the bracketing interval eventually can’t be subdivided, that is no <span class="math inline">\(c\)</span> is found over the floating point numbers with <span class="math inline">\(a < c < b\)</span>. So there is a natural stopping criteria: stop when there is an exact zero, when the bracketing interval gets too small to subdivide, or when the interval is as small as desired.</p>
|
|||
|
<p>We can write a relatively simple program to implement this algorithm:</p>
|
|||
|
<div class="cell" data-execution_count="6">
|
|||
|
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="kw">function</span> <span class="fu">simple_bisection</span>(f, a, b)</span>
|
|||
|
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="fu">f</span>(a) <span class="op">==</span> <span class="fl">0</span> <span class="cf">return</span>(a) <span class="cf">end</span></span>
|
|||
|
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="fu">f</span>(b) <span class="op">==</span> <span class="fl">0</span> <span class="cf">return</span>(b) <span class="cf">end</span></span>
|
|||
|
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="fu">f</span>(a) <span class="op">*</span> <span class="fu">f</span>(b) <span class="op">></span> <span class="fl">0</span> <span class="fu">error</span>(<span class="st">"[a,b] is not a bracketing interval"</span>) <span class="cf">end</span></span>
|
|||
|
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a></span>
|
|||
|
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a> tol <span class="op">=</span> <span class="fl">1e-14</span> <span class="co"># small number (but should depend on size of a, b)</span></span>
|
|||
|
<span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a> c <span class="op">=</span> a<span class="op">/</span><span class="fl">2</span> <span class="op">+</span> b<span class="op">/</span><span class="fl">2</span></span>
|
|||
|
<span id="cb2-8"><a href="#cb2-8" aria-hidden="true" tabindex="-1"></a></span>
|
|||
|
<span id="cb2-9"><a href="#cb2-9" aria-hidden="true" tabindex="-1"></a> <span class="cf">while</span> <span class="fu">abs</span>(b<span class="op">-</span>a) <span class="op">></span> tol</span>
|
|||
|
<span id="cb2-10"><a href="#cb2-10" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="fu">f</span>(c) <span class="op">==</span> <span class="fl">0</span> <span class="cf">return</span>(c) <span class="cf">end</span></span>
|
|||
|
<span id="cb2-11"><a href="#cb2-11" aria-hidden="true" tabindex="-1"></a></span>
|
|||
|
<span id="cb2-12"><a href="#cb2-12" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="fu">f</span>(a) <span class="op">*</span> <span class="fu">f</span>(c) <span class="op"><</span> <span class="fl">0</span></span>
|
|||
|
<span id="cb2-13"><a href="#cb2-13" aria-hidden="true" tabindex="-1"></a> a, b <span class="op">=</span> a, c</span>
|
|||
|
<span id="cb2-14"><a href="#cb2-14" aria-hidden="true" tabindex="-1"></a> <span class="cf">else</span></span>
|
|||
|
<span id="cb2-15"><a href="#cb2-15" aria-hidden="true" tabindex="-1"></a> a, b <span class="op">=</span> c, b</span>
|
|||
|
<span id="cb2-16"><a href="#cb2-16" aria-hidden="true" tabindex="-1"></a> <span class="cf">end</span></span>
|
|||
|
<span id="cb2-17"><a href="#cb2-17" aria-hidden="true" tabindex="-1"></a></span>
|
|||
|
<span id="cb2-18"><a href="#cb2-18" aria-hidden="true" tabindex="-1"></a> c <span class="op">=</span> a<span class="op">/</span><span class="fl">2</span> <span class="op">+</span> b<span class="op">/</span><span class="fl">2</span></span>
|
|||
|
<span id="cb2-19"><a href="#cb2-19" aria-hidden="true" tabindex="-1"></a></span>
|
|||
|
<span id="cb2-20"><a href="#cb2-20" aria-hidden="true" tabindex="-1"></a> <span class="cf">end</span></span>
|
|||
|
<span id="cb2-21"><a href="#cb2-21" aria-hidden="true" tabindex="-1"></a> c</span>
|
|||
|
<span id="cb2-22"><a href="#cb2-22" 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="7">
|
|||
|
<pre><code>simple_bisection (generic function with 1 method)</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>This function uses a <code>while</code> loop to repeat the process of subdividing <span class="math inline">\([a,b]\)</span>. A <code>while</code> loop will repeat until the condition is no longer <code>true</code>. The above will stop for reasonably sized floating point values (within <span class="math inline">\((-100, 100)\)</span>, say), but, as written, ignores the fact that the gap between floating point values depends on their magnitude.</p>
|
|||
|
<p>The value <span class="math inline">\(c\)</span> returned <em>need not</em> be an exact zero. Let’s see:</p>
|
|||
|
<div class="cell" data-execution_count="7">
|
|||
|
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a>c <span class="op">=</span> <span class="fu">simple_bisection</span>(sin, <span class="fl">3</span>, <span class="fl">4</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="8">
|
|||
|
<pre><code>3.141592653589793</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>This value of <span class="math inline">\(c\)</span> is a floating-point approximation to <span class="math inline">\(\pi\)</span>, but is not <em>quite</em> a zero:</p>
|
|||
|
<div class="cell" data-execution_count="8">
|
|||
|
<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="fu">sin</span>(c)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="9">
|
|||
|
<pre><code>1.2246467991473532e-16</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>(Even <code>pi</code> itself is not a “zero” due to floating point issues.)</p>
|
|||
|
</section>
|
|||
|
<section id="the-find_zero-function." class="level3" data-number="21.1.2">
|
|||
|
<h3 data-number="21.1.2" class="anchored" data-anchor-id="the-find_zero-function."><span class="header-section-number">21.1.2</span> The <code>find_zero</code> function.</h3>
|
|||
|
<p>The <code>Roots</code> package has a function <code>find_zero</code> that implements the bisection method when called as <code>find_zero(f, (a,b))</code> where <span class="math inline">\([a,b]\)</span> is a bracket. Its use is similar to <code>simple_bisection</code> above. This package is loaded when <code>CalculusWithJulia</code> is. We illlustrate the usage of <code>find_zero</code> in the following:</p>
|
|||
|
<div class="cell" data-execution_count="9">
|
|||
|
<div class="sourceCode cell-code" id="cb8"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a>xstar <span class="op">=</span> <span class="fu">find_zero</span>(sin, (<span class="fl">3</span>, <span class="fl">4</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="10">
|
|||
|
<pre><code>3.141592653589793</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<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>Notice, the call <code>find_zero(sin, (3, 4))</code> again fits the template <code>action(function, args...)</code> that we see repeatedly. The <code>find_zero</code> function can also be called through <code>fzero</code>. The use of <code>(3, 4)</code> to specify the interval is not necessary. For example <code>[3,4]</code> would work equally as well. (Anything where <code>extrema</code> is defined works.)</p>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>This function utilizes some facts about floating point values to guarantee that the answer will be an <em>exact</em> zero or a value where there is a sign change between the next bigger floating point or the next smaller, which means the sign at the next and previous floating point values is different:</p>
|
|||
|
<div class="cell" data-execution_count="10">
|
|||
|
<div class="sourceCode cell-code" id="cb10"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="fu">sin</span>(xstar), <span class="fu">sign</span>(<span class="fu">sin</span>(<span class="fu">prevfloat</span>(xstar))), <span class="fu">sign</span>(<span class="fu">sin</span>(<span class="fu">nextfloat</span>(xstar)))</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">
|
|||
|
<pre><code>(1.2246467991473532e-16, 1.0, -1.0)</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<section id="example" class="level5">
|
|||
|
<h5 class="anchored" data-anchor-id="example">Example</h5>
|
|||
|
<p>The polynomial <span class="math inline">\(p(x) = x^5 - x + 1\)</span> has a zero between <span class="math inline">\(-2\)</span> and <span class="math inline">\(-1\)</span>. Find it.</p>
|
|||
|
<div class="cell" data-execution_count="11">
|
|||
|
<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">p</span>(x) <span class="op">=</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>
|
|||
|
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a>c₀ <span class="op">=</span> <span class="fu">find_zero</span>(p, (<span class="op">-</span><span class="fl">2</span>, <span class="op">-</span><span class="fl">1</span>))</span>
|
|||
|
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a>(c₀, <span class="fu">p</span>(c₀))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="12">
|
|||
|
<pre><code>(-1.1673039782614187, -6.661338147750939e-16)</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>We see, as before, that <span class="math inline">\(p(c)\)</span> is not quite <span class="math inline">\(0\)</span>. But it can be easily checked that <code>p</code> is negative at the previous floating point number, while <code>p</code> is seen to be positive at the returned value:</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">p</span>(c₀), <span class="fu">sign</span>(<span class="fu">p</span>(<span class="fu">prevfloat</span>(c₀))), <span class="fu">sign</span>(<span class="fu">p</span>(<span class="fu">nextfloat</span>(c₀)))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="13">
|
|||
|
<pre><code>(-6.661338147750939e-16, -1.0, 1.0)</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</section>
|
|||
|
<section id="example-1" class="level5">
|
|||
|
<h5 class="anchored" data-anchor-id="example-1">Example</h5>
|
|||
|
<p>The function <span class="math inline">\(q(x) = e^x - x^4\)</span> has a zero between <span class="math inline">\(5\)</span> and <span class="math inline">\(10\)</span>, as this graph shows:</p>
|
|||
|
<div class="cell" data-execution_count="13">
|
|||
|
<div class="sourceCode cell-code" id="cb16"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="fu">q</span>(x) <span class="op">=</span> <span class="fu">exp</span>(x) <span class="op">-</span> x<span class="op">^</span><span class="fl">4</span></span>
|
|||
|
<span id="cb16-2"><a href="#cb16-2" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(q, <span class="fl">5</span>, <span class="fl">10</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="14">
|
|||
|
<p><img src="intermediate_value_theorem_files/figure-html/cell-14-output-1.svg" class="img-fluid"></p>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>Find the zero numerically. The plot shows <span class="math inline">\(q(5) < 0 < q(10)\)</span>, so <span class="math inline">\([5,10]\)</span> is a bracket. We thus have:</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="fu">find_zero</span>(q, (<span class="fl">5</span>, <span class="fl">10</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="15">
|
|||
|
<pre><code>8.6131694564414</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</section>
|
|||
|
<section id="example-2" class="level5">
|
|||
|
<h5 class="anchored" data-anchor-id="example-2">Example</h5>
|
|||
|
<p>Find all real zeros of <span class="math inline">\(f(x) = x^3 -x + 1\)</span> using the bisection method.</p>
|
|||
|
<p>We show next that symbolic values can be used with <code>find_zero</code>, should that be useful.</p>
|
|||
|
<p>First, we produce a plot to identify a bracketing interval</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="pp">@syms</span> x</span>
|
|||
|
<span id="cb19-2"><a href="#cb19-2" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(x<span class="op">^</span><span class="fl">3</span> <span class="op">-</span> x <span class="op">+</span> <span class="fl">1</span>, <span class="op">-</span><span class="fl">3</span>, <span class="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="16">
|
|||
|
<p><img src="intermediate_value_theorem_files/figure-html/cell-16-output-1.svg" class="img-fluid"></p>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>It appears (and a plot over <span class="math inline">\([0,1]\)</span> verifies) that there is one zero between <span class="math inline">\(-2\)</span> and <span class="math inline">\(-1\)</span>. It is found with:</p>
|
|||
|
<div class="cell" data-execution_count="16">
|
|||
|
<div class="sourceCode cell-code" id="cb20"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb20-1"><a href="#cb20-1" aria-hidden="true" tabindex="-1"></a><span class="fu">find_zero</span>(x<span class="op">^</span><span class="fl">3</span> <span class="op">-</span> x <span class="op">+</span> <span class="fl">1</span>, (<span class="op">-</span><span class="fl">2</span>, <span class="op">-</span><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="17">
|
|||
|
<pre><code>-1.324717957244746</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</section>
|
|||
|
<section id="example-3" class="level5">
|
|||
|
<h5 class="anchored" data-anchor-id="example-3">Example</h5>
|
|||
|
<p>The equation <span class="math inline">\(\cos(x) = x\)</span> has just one solution, as can be seen in this plot:</p>
|
|||
|
<div class="cell" data-execution_count="17">
|
|||
|
<div class="sourceCode cell-code" id="cb22"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb22-1"><a href="#cb22-1" aria-hidden="true" tabindex="-1"></a><span class="fu">𝒇</span>(x) <span class="op">=</span> <span class="fu">cos</span>(x)</span>
|
|||
|
<span id="cb22-2"><a href="#cb22-2" aria-hidden="true" tabindex="-1"></a><span class="fu">𝒈</span>(x) <span class="op">=</span> x</span>
|
|||
|
<span id="cb22-3"><a href="#cb22-3" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(𝒇, <span class="op">-</span><span class="cn">pi</span>, <span class="cn">pi</span>)</span>
|
|||
|
<span id="cb22-4"><a href="#cb22-4" aria-hidden="true" tabindex="-1"></a><span class="fu">plot!</span>(𝒈)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="18">
|
|||
|
<p><img src="intermediate_value_theorem_files/figure-html/cell-18-output-1.svg" class="img-fluid"></p>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>Find it.</p>
|
|||
|
<p>We see from the graph that it is clearly between <span class="math inline">\(0\)</span> and <span class="math inline">\(2\)</span>, so all we need is a function. (We have two.) The trick is to observe that solving <span class="math inline">\(f(x) = g(x)\)</span> is the same problem as solving for <span class="math inline">\(x\)</span> where <span class="math inline">\(f(x) - g(x) = 0\)</span>. So we define the difference and use that:</p>
|
|||
|
<div class="cell" data-execution_count="18">
|
|||
|
<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">𝒉</span>(x) <span class="op">=</span> <span class="fu">𝒇</span>(x) <span class="op">-</span> <span class="fu">𝒈</span>(x)</span>
|
|||
|
<span id="cb23-2"><a href="#cb23-2" aria-hidden="true" tabindex="-1"></a><span class="fu">find_zero</span>(𝒉, (<span class="fl">0</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">
|
|||
|
<pre><code>0.7390851332151607</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</section>
|
|||
|
<section id="using-parameterized-functions-fxp-with-find_zero" class="level4">
|
|||
|
<h4 class="anchored" data-anchor-id="using-parameterized-functions-fxp-with-find_zero">Using parameterized functions (<code>f(x,p)</code>) with <code>find_zero</code></h4>
|
|||
|
<p>Geometry will tell us that <span class="math inline">\(\cos(x) = x/p\)</span> for <em>one</em> <span class="math inline">\(x\)</span> in <span class="math inline">\([0, \pi/2]\)</span> whenever <span class="math inline">\(p>0\)</span>. We could set up finding this value for a given <span class="math inline">\(p\)</span> by making <span class="math inline">\(p\)</span> part of the function definition, but as an illustration of passing parameters, we leave <code>p</code> as a parameter (in this case, as a second value with default of <span class="math inline">\(1\)</span>):</p>
|
|||
|
<div class="cell" data-hold="true" data-execution_count="19">
|
|||
|
<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">f</span>(x, p<span class="op">=</span><span class="fl">1</span>) <span class="op">=</span> <span class="fu">cos</span>(x) <span class="op">-</span> x<span class="op">/</span>p</span>
|
|||
|
<span id="cb25-2"><a href="#cb25-2" aria-hidden="true" tabindex="-1"></a>I <span class="op">=</span> (<span class="fl">0</span>, <span class="cn">pi</span><span class="op">/</span><span class="fl">2</span>)</span>
|
|||
|
<span id="cb25-3"><a href="#cb25-3" aria-hidden="true" tabindex="-1"></a><span class="fu">find_zero</span>(f, I), <span class="fu">find_zero</span>(f, I, p<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="20">
|
|||
|
<pre><code>(0.7390851332151607, 1.0298665293222589)</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>The second number is the solution when <code>p=2</code>.</p>
|
|||
|
<section id="example-4" class="level5">
|
|||
|
<h5 class="anchored" data-anchor-id="example-4">Example</h5>
|
|||
|
<p>We wish to compare two trash collection plans</p>
|
|||
|
<ul>
|
|||
|
<li>Plan 1: You pay <span class="math inline">\(47.49\)</span> plus <span class="math inline">\(0.77\)</span> per bag.</li>
|
|||
|
<li>Plan 2: You pay <span class="math inline">\(30.00\)</span> plus <span class="math inline">\(2.00\)</span> per bag.</li>
|
|||
|
</ul>
|
|||
|
<p>There are some cases where plan 1 is cheaper and some where plan 2 is. Categorize them.</p>
|
|||
|
<p>Both plans are <em>linear models</em> and may be written in <em>slope-intercept</em> form:</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="fu">plan1</span>(x) <span class="op">=</span> <span class="fl">47.49</span> <span class="op">+</span> <span class="fl">0.77</span>x</span>
|
|||
|
<span id="cb27-2"><a href="#cb27-2" aria-hidden="true" tabindex="-1"></a><span class="fu">plan2</span>(x) <span class="op">=</span> <span class="fl">30.00</span> <span class="op">+</span> <span class="fl">2.00</span>x</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="21">
|
|||
|
<pre><code>plan2 (generic function with 1 method)</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>Assuming this is a realistic problem and an average American household might produce <span class="math inline">\(10\)</span>-<span class="math inline">\(20\)</span> bags of trash a month (yes, that seems too much!) we plot in that range:</p>
|
|||
|
<div class="cell" 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="fu">plot</span>(plan1, <span class="fl">10</span>, <span class="fl">20</span>)</span>
|
|||
|
<span id="cb29-2"><a href="#cb29-2" aria-hidden="true" tabindex="-1"></a><span class="fu">plot!</span>(plan2)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="22">
|
|||
|
<p><img src="intermediate_value_theorem_files/figure-html/cell-22-output-1.svg" class="img-fluid"></p>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>We can see the intersection point is around <span class="math inline">\(14\)</span> and that if a family generates between <span class="math inline">\(0\)</span>-<span class="math inline">\(14\)</span> bags of trash per month that plan <span class="math inline">\(2\)</span> would be cheaper.</p>
|
|||
|
<p>Let’s get a numeric value, using a simple bracket and an anonymous function:</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">find_zero</span>(x <span class="op">-></span> <span class="fu">plan1</span>(x) <span class="op">-</span> <span class="fu">plan2</span>(x), (<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="23">
|
|||
|
<pre><code>14.21951219512195</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</section>
|
|||
|
<section id="example-the-flight-of-an-arrow" class="level5">
|
|||
|
<h5 class="anchored" data-anchor-id="example-the-flight-of-an-arrow">Example, the flight of an arrow</h5>
|
|||
|
<p>The flight of an arrow can be modeled using various functions, depending on assumptions. Suppose an arrow is launched in the air from a height of <span class="math inline">\(0\)</span> feet above the ground at an angle of <span class="math inline">\(\theta = \pi/4\)</span>. With a suitable choice for the initial velocity, a model without wind resistance for the height of the arrow at a distance <span class="math inline">\(x\)</span> units away may be:</p>
|
|||
|
<p><span class="math display">\[
|
|||
|
j(x) = \tan(\theta) x - (1/2) \cdot g(\frac{x}{v_0 \cos\theta})^2.
|
|||
|
\]</span></p>
|
|||
|
<p>In <code>julia</code> we have, taking <span class="math inline">\(v_0=200\)</span>:</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">j</span>(x; theta<span class="op">=</span><span class="cn">pi</span><span class="op">/</span><span class="fl">4</span>, g<span class="op">=</span><span class="fl">32</span>, v0<span class="op">=</span><span class="fl">200</span>) <span class="op">=</span> <span class="fu">tan</span>(theta)<span class="op">*</span>x <span class="op">-</span> (<span class="fl">1</span><span class="op">/</span><span class="fl">2</span>)<span class="fu">*g*</span>(x<span class="op">/</span>(<span class="fu">v0*cos</span>(theta)))<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="24">
|
|||
|
<pre><code>j (generic function with 1 method)</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>With a velocity-dependent wind resistance given by <span class="math inline">\(\gamma\)</span>, again with some units, a similar equation can be constructed. It takes a different form:</p>
|
|||
|
<p><span class="math display">\[
|
|||
|
d(x) = (\frac{g}{\gamma v_0 \cos(\theta)} + \tan(\theta)) \cdot x +
|
|||
|
\frac{g}{\gamma^2}\log(\frac{v_0\cos(\theta) - \gamma x}{v_0\cos(\theta)})
|
|||
|
\]</span></p>
|
|||
|
<p>Again, <span class="math inline">\(v_0\)</span> is the initial velocity and is taken to be <span class="math inline">\(200\)</span> and <span class="math inline">\(\gamma\)</span> a resistance, which we take to be <span class="math inline">\(1\)</span>. With this, we have the following <code>julia</code> definition (with a slight reworking of <span class="math inline">\(\gamma\)</span>):</p>
|
|||
|
<div class="cell" 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="kw">function</span> <span class="fu">d</span>(x; theta<span class="op">=</span><span class="cn">pi</span><span class="op">/</span><span class="fl">4</span>, g<span class="op">=</span><span class="fl">32</span>, v0<span class="op">=</span><span class="fl">200</span>, gamma<span class="op">=</span><span class="fl">1</span>)</span>
|
|||
|
<span id="cb34-2"><a href="#cb34-2" aria-hidden="true" tabindex="-1"></a> a <span class="op">=</span> gamma <span class="op">*</span> v0 <span class="op">*</span> <span class="fu">cos</span>(theta)</span>
|
|||
|
<span id="cb34-3"><a href="#cb34-3" aria-hidden="true" tabindex="-1"></a> (g<span class="op">/</span>a <span class="op">+</span> <span class="fu">tan</span>(theta)) <span class="op">*</span> x <span class="op">+</span> g<span class="op">/</span>gamma<span class="op">^</span><span class="fl">2</span> <span class="op">*</span> <span class="fu">log</span>((a<span class="op">-</span>gamma<span class="op">^</span><span class="fl">2</span> <span class="op">*</span> x)<span class="op">/</span>a)</span>
|
|||
|
<span id="cb34-4"><a href="#cb34-4" 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="25">
|
|||
|
<pre><code>d (generic function with 1 method)</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>For each model, we wish to find the value of <span class="math inline">\(x\)</span> after launching where the height is modeled to be <span class="math inline">\(0\)</span>. That is how far will the arrow travel before touching the ground?</p>
|
|||
|
<p>For the model without wind resistance, we can graph the function easily enough. Let’s guess the distance is no more than <span class="math inline">\(500\)</span> feet:</p>
|
|||
|
<div class="cell" 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><span class="fu">plot</span>(j, <span class="fl">0</span>, <span class="fl">500</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="26">
|
|||
|
<p><img src="intermediate_value_theorem_files/figure-html/cell-26-output-1.svg" class="img-fluid"></p>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>Well, we haven’t even seen the peak yet. Better to do a little spade work first. This is a quadratic function, so we can use <code>roots</code> from <code>SymPy</code> to find the roots:</p>
|
|||
|
<div class="cell" data-execution_count="26">
|
|||
|
<div class="sourceCode cell-code" id="cb37"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb37-1"><a href="#cb37-1" aria-hidden="true" tabindex="-1"></a><span class="fu">roots</span>(<span class="fu">j</span>(x))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="27">
|
|||
|
<pre><code>Dict{Any, Any} with 2 entries:
|
|||
|
1250.00000000000 => 1
|
|||
|
0 => 1</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>We see that <span class="math inline">\(1250\)</span> is the largest root. So we plot over this domain to visualize the flight:</p>
|
|||
|
<div class="cell" data-execution_count="27">
|
|||
|
<div class="sourceCode cell-code" id="cb39"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb39-1"><a href="#cb39-1" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(j, <span class="fl">0</span>, <span class="fl">1250</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="28">
|
|||
|
<p><img src="intermediate_value_theorem_files/figure-html/cell-28-output-1.svg" class="img-fluid"></p>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>As for the model with wind resistance, a quick plot over the same interval, <span class="math inline">\([0, 1250]\)</span> yields:</p>
|
|||
|
<div class="cell" data-execution_count="28">
|
|||
|
<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">plot</span>(d, <span class="fl">0</span>, <span class="fl">1250</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="29">
|
|||
|
<p><img src="intermediate_value_theorem_files/figure-html/cell-29-output-1.svg" class="img-fluid"></p>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>This graph eventually goes negative and then stops. This is due to the asymptote in model when <code>(a - gamma^2*x)/a</code> is zero. To plot the trajectory until it returns to <span class="math inline">\(0\)</span>, we need to identify the value of the zero. This model is non-linear and we don’t have the simplicity of using <code>roots</code> to find out the answer, so we solve for when <span class="math inline">\(a-\gamma^2 x\)</span> is <span class="math inline">\(0\)</span>:</p>
|
|||
|
<div class="cell" data-execution_count="29">
|
|||
|
<div class="sourceCode cell-code" id="cb41"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb41-1"><a href="#cb41-1" aria-hidden="true" tabindex="-1"></a>gamma <span class="op">=</span> <span class="fl">1</span></span>
|
|||
|
<span id="cb41-2"><a href="#cb41-2" aria-hidden="true" tabindex="-1"></a>a <span class="op">=</span> <span class="fl">200</span> <span class="op">*</span> <span class="fu">cos</span>(<span class="cn">pi</span><span class="op">/</span><span class="fl">4</span>)</span>
|
|||
|
<span id="cb41-3"><a href="#cb41-3" aria-hidden="true" tabindex="-1"></a>b <span class="op">=</span> a<span class="op">/</span>gamma<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="30">
|
|||
|
<pre><code>141.4213562373095</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>Note that the function is infinite at <code>b</code>:</p>
|
|||
|
<div class="cell" data-execution_count="30">
|
|||
|
<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">d</span>(b)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="31">
|
|||
|
<pre><code>-Inf</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>From the graph, we can see the zero is around <code>b</code>. As <code>y(b)</code> is <code>-Inf</code> we can use the bracket <code>(b/2,b)</code></p>
|
|||
|
<div class="cell" data-execution_count="31">
|
|||
|
<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>x1 <span class="op">=</span> <span class="fu">find_zero</span>(d, (b<span class="op">/</span><span class="fl">2</span>, b))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="32">
|
|||
|
<pre><code>140.7792933802306</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>The answer is approximately <span class="math inline">\(140.7\)</span></p>
|
|||
|
<p>(The bisection method only needs to know the sign of the function. Other bracketing methods would have issues with an endpoint with an infinite function value. To use them, some value between the zero and <code>b</code> would needed.)</p>
|
|||
|
<p>Finally, we plot both graphs at once to see that it was a very windy day indeed.</p>
|
|||
|
<div class="cell" data-execution_count="32">
|
|||
|
<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="fu">plot</span>(j, <span class="fl">0</span>, <span class="fl">1250</span>, label<span class="op">=</span><span class="st">"no wind"</span>)</span>
|
|||
|
<span id="cb47-2"><a href="#cb47-2" aria-hidden="true" tabindex="-1"></a><span class="fu">plot!</span>(d, <span class="fl">0</span>, x1, label<span class="op">=</span><span class="st">"windy day"</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="intermediate_value_theorem_files/figure-html/cell-33-output-1.svg" class="img-fluid"></p>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</section>
|
|||
|
<section id="example-bisection-and-non-continuity" class="level5">
|
|||
|
<h5 class="anchored" data-anchor-id="example-bisection-and-non-continuity">Example: bisection and non-continuity</h5>
|
|||
|
<p>The Bolzano theorem assumes a continuous function <span class="math inline">\(f\)</span>, and when applicable, yields an algorithm to find a guaranteed zero.</p>
|
|||
|
<p>However, the algorithm itself does not know that the function is continuous or not, only that the function changes sign. As such, it can produce answers that are not “zeros” when used with discontinuous functions.</p>
|
|||
|
<p>In general a function over floating point values could be considered as a large table of mappings: each of the <span class="math inline">\(2^{64}\)</span> floating point values gets assigned a value. This is discrete mapping, there is nothing the computer sees related to continuity.</p>
|
|||
|
<blockquote class="blockquote">
|
|||
|
<p>The concept of continuity, if needed, must be verified by the user of the algorithm.</p>
|
|||
|
</blockquote>
|
|||
|
<p>We have seen this when plotting rational functions or functions with vertical asymptotes. The default algorithms just connect points with lines. The user must manage the discontinuity (by assigning some values <code>NaN</code>, say); the algorithms used do not.</p>
|
|||
|
<p>In this particular case, the bisection algorithm can still be fruitful even when the function is not continuous, as the algorithm will yield information about crossing values of <span class="math inline">\(0\)</span>, possibly at discontinuities. But the user of the algorithm must be aware that the answers are only guaranteed to be zeros of the function if the function is continuous and the algorithm did not check for that assumption.</p>
|
|||
|
<p>As an example, let <span class="math inline">\(f(x) = 1/x\)</span>. Clearly the interval <span class="math inline">\([-1,1]\)</span> is a “bracketing” interval as <span class="math inline">\(f(x)\)</span> changes sign between <span class="math inline">\(a\)</span> and <span class="math inline">\(b\)</span>. What does the algorithm yield:</p>
|
|||
|
<div class="cell" data-execution_count="33">
|
|||
|
<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">fᵢ</span>(x) <span class="op">=</span> <span class="fl">1</span><span class="op">/</span>x</span>
|
|||
|
<span id="cb48-2"><a href="#cb48-2" aria-hidden="true" tabindex="-1"></a>x0 <span class="op">=</span> <span class="fu">find_zero</span>(fᵢ, (<span class="op">-</span><span class="fl">1</span>, <span class="fl">1</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="34">
|
|||
|
<pre><code>0.0</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>The function is not defined at the answer, but we do have the fact that just to the left of the answer (<code>prevfloat</code>) and just to the right of the answer (<code>nextfloat</code>) the function changes sign:</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><span class="fu">sign</span>(<span class="fu">fᵢ</span>(<span class="fu">prevfloat</span>(x0))), <span class="fu">sign</span>(<span class="fu">fᵢ</span>(<span class="fu">nextfloat</span>(x0)))</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">
|
|||
|
<pre><code>(-1.0, 1.0)</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>So, the “bisection method” applied here finds a point where the function crosses <span class="math inline">\(0\)</span>, either by continuity or by jumping over the <span class="math inline">\(0\)</span>. (A <code>jump</code> discontinuity at <span class="math inline">\(x=c\)</span> is defined by the left and right limits of <span class="math inline">\(f\)</span> at <span class="math inline">\(c\)</span> existing but being unequal. The algorithm can find <span class="math inline">\(c\)</span> when this type of function jumps over <span class="math inline">\(0\)</span>.)</p>
|
|||
|
</section>
|
|||
|
</section>
|
|||
|
</section>
|
|||
|
<section id="the-find_zeros-function" class="level3" data-number="21.1.3">
|
|||
|
<h3 data-number="21.1.3" class="anchored" data-anchor-id="the-find_zeros-function"><span class="header-section-number">21.1.3</span> The <code>find_zeros</code> function</h3>
|
|||
|
<p>The bisection method suggests a naive means to search for all zeros within an interval <span class="math inline">\((a, b)\)</span>: split the interval into many small intervals and for each that is a bracketing interval find a zero. This simple description has three flaws: it might miss values where the function doesn’t actually cross the <span class="math inline">\(x\)</span> axis; it might miss values where the function just dips to the other side; and it might miss multiple values in the same small interval.</p>
|
|||
|
<p>Still, with some engineering, this can be a useful approach, save the caveats. This idea is implemented in the <code>find_zeros</code> function of the <code>Roots</code> package. The function is called via <code>find_zeros(f, (a, b))</code> but here the interval <span class="math inline">\([a,b]\)</span> is not necessarily a bracketing interval.</p>
|
|||
|
<p>To see, we have:</p>
|
|||
|
<div class="cell" data-hold="true" data-execution_count="35">
|
|||
|
<div class="sourceCode cell-code" id="cb52"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb52-1"><a href="#cb52-1" aria-hidden="true" tabindex="-1"></a><span class="fu">f</span>(x) <span class="op">=</span> <span class="fu">cos</span>(<span class="fl">10</span><span class="op">*</span><span class="cn">pi</span><span class="op">*</span>x)</span>
|
|||
|
<span id="cb52-2"><a href="#cb52-2" aria-hidden="true" tabindex="-1"></a><span class="fu">find_zeros</span>(f, (<span class="fl">0</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="36">
|
|||
|
<pre><code>10-element Vector{Float64}:
|
|||
|
0.05
|
|||
|
0.15
|
|||
|
0.25
|
|||
|
0.35
|
|||
|
0.45
|
|||
|
0.5499999999999999
|
|||
|
0.6499999999999999
|
|||
|
0.75
|
|||
|
0.85
|
|||
|
0.95</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>Or for a polynomial:</p>
|
|||
|
<div class="cell" data-hold="true" data-execution_count="36">
|
|||
|
<div class="sourceCode cell-code" id="cb54"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb54-1"><a href="#cb54-1" aria-hidden="true" tabindex="-1"></a><span class="fu">f</span>(x) <span class="op">=</span> x<span class="op">^</span><span class="fl">5</span> <span class="op">-</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> x<span class="op">^</span><span class="fl">2</span> <span class="op">+</span> <span class="fl">1</span></span>
|
|||
|
<span id="cb54-2"><a href="#cb54-2" aria-hidden="true" tabindex="-1"></a><span class="fu">find_zeros</span>(f, (<span class="op">-</span><span class="fl">10</span>, <span class="fl">10</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="37">
|
|||
|
<pre><code>1-element Vector{Float64}:
|
|||
|
-0.6518234538234416</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>(Here <span class="math inline">\(-10\)</span> and <span class="math inline">\(10\)</span> were arbitrarily chosen. Cauchy’s method could be used to be more systematic.)</p>
|
|||
|
<section id="example-solving-fx-gx" class="level5">
|
|||
|
<h5 class="anchored" data-anchor-id="example-solving-fx-gx">Example: Solving f(x) = g(x)</h5>
|
|||
|
<p>Use <code>find_zeros</code> to find when <span class="math inline">\(e^x = x^5\)</span> in the interval <span class="math inline">\([-20, 20]\)</span>. Verify the answers.</p>
|
|||
|
<p>To proceed with <code>find_zeros</code>, we define <span class="math inline">\(f(x) = e^x - x^5\)</span>, as <span class="math inline">\(f(x) = 0\)</span> precisely when <span class="math inline">\(e^x = x^5\)</span>. The zeros are then found with:</p>
|
|||
|
<div class="cell" data-execution_count="37">
|
|||
|
<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="fu">f₁</span>(x) <span class="op">=</span> <span class="fu">exp</span>(x) <span class="op">-</span> x<span class="op">^</span><span class="fl">5</span></span>
|
|||
|
<span id="cb56-2"><a href="#cb56-2" aria-hidden="true" tabindex="-1"></a>zs <span class="op">=</span> <span class="fu">find_zeros</span>(f₁, (<span class="op">-</span><span class="fl">20</span>,<span class="fl">20</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="38">
|
|||
|
<pre><code>2-element Vector{Float64}:
|
|||
|
1.2958555090953687
|
|||
|
12.713206788867632</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>The output of <code>find_zeros</code> is a vector of values. To check that each value is an approximate zero can be done with the “.” (broadcast) syntax:</p>
|
|||
|
<div class="cell" data-execution_count="38">
|
|||
|
<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">f₁</span>.(zs)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="39">
|
|||
|
<pre><code>2-element Vector{Float64}:
|
|||
|
0.0
|
|||
|
0.0</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>(For a continuous function this should be the case that the values returned by <code>find_zeros</code> are approximate zeros. Bear in mind that if <span class="math inline">\(f\)</span> is not continous the algorithm might find jumping points that are not zeros and may not even be in the domain of the function.)</p>
|
|||
|
</section>
|
|||
|
</section>
|
|||
|
<section id="an-alternate-interface-to-find_zero" class="level3" data-number="21.1.4">
|
|||
|
<h3 data-number="21.1.4" class="anchored" data-anchor-id="an-alternate-interface-to-find_zero"><span class="header-section-number">21.1.4</span> An alternate interface to <code>find_zero</code></h3>
|
|||
|
<p>The <code>find_zero</code> function in the <code>Roots</code> package is an interface to one of several methods. For now we focus on the <em>bracketing</em> methods, later we will see others. Bracketing methods, among others, include <code>Roots.Bisection()</code>, the basic bisection method though with a different sense of “middle” than <span class="math inline">\((a+b)/2\)</span> and used by default above; <code>Roots.A42()</code>, which will typically converge much faster than simple bisection; <code>Roots.Brent()</code> for the classic method of Brent, and <code>FalsePosition()</code> for a family of <em>regula falsi</em> methods. These can all be used by specifying the method in a call to <code>find_zero</code>.</p>
|
|||
|
<p>Alternatively, <code>Roots</code> implements the <code>CommonSolve</code> interface popularized by its use in the <code>DifferentialEquations.jl</code> ecosystem, a wildly successful area for <code>Julia</code>. The basic setup is two steps: setup a “problem,” solve the problem.</p>
|
|||
|
<p>To set up a problem, we call <code>ZeroProblem</code> with the function and an initial interval, as in:</p>
|
|||
|
<div class="cell" data-execution_count="39">
|
|||
|
<div class="sourceCode cell-code" id="cb60"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb60-1"><a href="#cb60-1" aria-hidden="true" tabindex="-1"></a><span class="fu">f₅</span>(x) <span class="op">=</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>
|
|||
|
<span id="cb60-2"><a href="#cb60-2" aria-hidden="true" tabindex="-1"></a>prob <span class="op">=</span> <span class="fu">ZeroProblem</span>(f₅, (<span class="fl">1</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="40">
|
|||
|
<pre><code>ZeroProblem{typeof(f₅), Tuple{Int64, Int64}}(f₅, (1, 2))</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>Then we can “solve” this problem with <code>solve</code>. For example:</p>
|
|||
|
<div class="cell" data-execution_count="40">
|
|||
|
<div class="sourceCode cell-code" id="cb62"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb62-1"><a href="#cb62-1" aria-hidden="true" tabindex="-1"></a><span class="fu">solve</span>(prob), <span class="fu">solve</span>(prob, Roots.<span class="fu">Brent</span>()), <span class="fu">solve</span>(prob, Roots.<span class="fu">A42</span>())</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="41">
|
|||
|
<pre><code>(1.1673039782614187, 1.1673039782614187, 1.1673039782614187)</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>Though the answers are identical, the methods employed were not. The first call, with an unspecified method, defaults to bisection.</p>
|
|||
|
</section>
|
|||
|
</section>
|
|||
|
<section id="extreme-value-theorem" class="level2" data-number="21.2">
|
|||
|
<h2 data-number="21.2" class="anchored" data-anchor-id="extreme-value-theorem"><span class="header-section-number">21.2</span> Extreme value theorem</h2>
|
|||
|
<p>The Extreme Value Theorem is another consequence of continuity.</p>
|
|||
|
<p>To discuss the extreme value theorem, we define an <em>absolute maximum</em>.</p>
|
|||
|
<blockquote class="blockquote">
|
|||
|
<p>The absolute maximum of <span class="math inline">\(f(x)\)</span> over an interval <span class="math inline">\(I\)</span>, when it exists, is the value <span class="math inline">\(f(c)\)</span>, <span class="math inline">\(c\)</span> in <span class="math inline">\(I\)</span>, where <span class="math inline">\(f(x) \leq f(c)\)</span> for any <span class="math inline">\(x\)</span> in <span class="math inline">\(I\)</span>.</p>
|
|||
|
<p>Similarly, an <em>absolute minimum</em> of <span class="math inline">\(f(x)\)</span> over an interval <span class="math inline">\(I\)</span> can be defined, when it exists, by a value <span class="math inline">\(f(c)\)</span> where <span class="math inline">\(c\)</span> is in <span class="math inline">\(I\)</span> <em>and</em> <span class="math inline">\(f(c) \leq f(x)\)</span> for any <span class="math inline">\(x\)</span> in <span class="math inline">\(I\)</span>.</p>
|
|||
|
</blockquote>
|
|||
|
<p>Related but different is the concept of a relative of <em>local extrema</em>:</p>
|
|||
|
<blockquote class="blockquote">
|
|||
|
<p>A local maxima for <span class="math inline">\(f\)</span> is a value <span class="math inline">\(f(c)\)</span> where <span class="math inline">\(c\)</span> is in <strong>some</strong> <em>open</em> interval <span class="math inline">\(I=(a,b)\)</span>, <span class="math inline">\(I\)</span> in the domain of <span class="math inline">\(f\)</span>, and <span class="math inline">\(f(c)\)</span> is an absolute maxima for <span class="math inline">\(f\)</span> over <span class="math inline">\(I\)</span>. Similarly, an local minima for <span class="math inline">\(f\)</span> is a value <span class="math inline">\(f(c)\)</span> where <span class="math inline">\(c\)</span> is in <strong>some</strong> <em>open</em> interval <span class="math inline">\(I=(a,b)\)</span>, <span class="math inline">\(I\)</span> in the domain of <span class="math inline">\(f\)</span>, and <span class="math inline">\(f(x)\)</span> is an absolute minima for <span class="math inline">\(f\)</span> over <span class="math inline">\(I\)</span>.</p>
|
|||
|
</blockquote>
|
|||
|
<p>The term <em>local extrema</em> is used to describe either a local maximum or local minimum.</p>
|
|||
|
<p>The key point, is the extrema are values in the <em>range</em> that are realized by some value in the <em>domain</em> (possibly more than one.)</p>
|
|||
|
<p>This chart of the <a href="http://hardrock100.com/">Hardrock 100</a> illustrates the two concepts.</p>
|
|||
|
<div class="quarto-figure quarto-figure-center">
|
|||
|
<figure class="figure">
|
|||
|
<p><img src="../limits/figures/hardrock-100.png" class="img-fluid figure-img"></p>
|
|||
|
<p></p><figcaption class="figure-caption">Elevation profile of the Hardrock 100 ultramarathon. Treating the elevation profile as a function, the absolute maximum is just about 14,000 feet and the absolute minimum about 7600 feet. These are of interest to the runner for different reasons. Also of interest would be each local maxima and local minima - the peaks and valleys of the graph - and the total elevation climbed - the latter so important/unforgettable its value makes it into the chart’s title.</figcaption><p></p>
|
|||
|
</figure>
|
|||
|
</div>
|
|||
|
<p>The extreme value theorem discusses an assumption that ensures absolute maximum and absolute minimum values exist.</p>
|
|||
|
<blockquote class="blockquote">
|
|||
|
<p>The <em>extreme value theorem</em>: If <span class="math inline">\(f(x)\)</span> is continuous over a closed interval <span class="math inline">\([a,b]\)</span> then <span class="math inline">\(f\)</span> has an absolute maximum and an absolute minimum over <span class="math inline">\([a,b]\)</span>.</p>
|
|||
|
</blockquote>
|
|||
|
<p>(By continuous over <span class="math inline">\([a,b]\)</span> we mean continuous on <span class="math inline">\((a,b)\)</span> and right continuous at <span class="math inline">\(a\)</span> and left continuous at <span class="math inline">\(b\)</span>.)</p>
|
|||
|
<p>The assumption that <span class="math inline">\([a,b]\)</span> includes its endpoints (it is closed) is crucial to make a guarantee. There are functions which are continuous on open intervals for which this result is not true. For example, <span class="math inline">\(f(x) = 1/x\)</span> on <span class="math inline">\((0,1)\)</span>. This function will have no smallest value or largest value, as defined above.</p>
|
|||
|
<p>The extreme value theorem is an important theoretical tool for investigating maxima and minima of functions.</p>
|
|||
|
<section id="example-5" class="level5">
|
|||
|
<h5 class="anchored" data-anchor-id="example-5">Example</h5>
|
|||
|
<p>The function <span class="math inline">\(f(x) = \sqrt{1-x^2}\)</span> is continuous on the interval <span class="math inline">\([-1,1]\)</span> (in the sense above). It then has an absolute maximum, we can see to be <span class="math inline">\(1\)</span> occurring at an interior point <span class="math inline">\(0\)</span>. The absolute minimum is <span class="math inline">\(0\)</span>, it occurs at each endpoint.</p>
|
|||
|
</section>
|
|||
|
<section id="example-6" class="level5">
|
|||
|
<h5 class="anchored" data-anchor-id="example-6">Example</h5>
|
|||
|
<p>The function <span class="math inline">\(f(x) = x \cdot e^{-x}\)</span> on the closed interval <span class="math inline">\([0, 5]\)</span> is continuous. Hence it has an absolute maximum, which a graph shows to be <span class="math inline">\(0.4\)</span>. It has an absolute minimum, clearly the value <span class="math inline">\(0\)</span> occurring at the endpoint.</p>
|
|||
|
<div class="cell" data-hold="true" data-execution_count="42">
|
|||
|
<div class="sourceCode cell-code" id="cb64"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb64-1"><a href="#cb64-1" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(x <span class="op">-></span> x <span class="op">*</span> <span class="fu">exp</span>(<span class="op">-</span>x), <span class="fl">0</span>, <span class="fl">5</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="43">
|
|||
|
<p><img src="intermediate_value_theorem_files/figure-html/cell-43-output-1.svg" class="img-fluid"></p>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</section>
|
|||
|
<section id="example-7" class="level5">
|
|||
|
<h5 class="anchored" data-anchor-id="example-7">Example</h5>
|
|||
|
<p>The tangent function does not have a <em>guarantee</em> of absolute maximum or minimum over <span class="math inline">\((-\pi/2, \pi/2),\)</span> as it is not <em>continuous</em> at the endpoints. In fact, it doesn’t have either extrema - it has vertical asymptotes at each endpoint of this interval.</p>
|
|||
|
</section>
|
|||
|
<section id="example-8" class="level5">
|
|||
|
<h5 class="anchored" data-anchor-id="example-8">Example</h5>
|
|||
|
<p>The function <span class="math inline">\(f(x) = x^{2/3}\)</span> over the interval <span class="math inline">\([-2,2]\)</span> has cusp at <span class="math inline">\(0\)</span>. However, it is continuous on this closed interval, so must have an absolute maximum and absolute minimum. They can be seen from the graph to occur at the endpoints and the cusp at <span class="math inline">\(x=0\)</span>, respectively:</p>
|
|||
|
<div class="cell" data-hold="true" data-execution_count="43">
|
|||
|
<div class="sourceCode cell-code" id="cb65"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb65-1"><a href="#cb65-1" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(x <span class="op">-></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">3</span>), <span class="op">-</span><span class="fl">2</span>, <span class="fl">2</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="44">
|
|||
|
<p><img src="intermediate_value_theorem_files/figure-html/cell-44-output-1.svg" class="img-fluid"></p>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>(The use of just <code>x^(2/3)</code> would fail, can you guess why?)</p>
|
|||
|
</section>
|
|||
|
<section id="example-9" class="level5">
|
|||
|
<h5 class="anchored" data-anchor-id="example-9">Example</h5>
|
|||
|
<p>A New York Times <a href="https://www.nytimes.com/2016/07/30/world/europe/norway-considers-a-birthday-gift-for-finland-the-peak-of-an-arctic-mountain.html">article</a> discusses an idea of Norway moving its border some 490 feet north and 650 feet east in order to have the peak of Mount Halti be the highest point in Finland, as currently it would be on the boundary. Mathematically this hints at a higher dimensional version of the extreme value theorem.</p>
|
|||
|
</section>
|
|||
|
</section>
|
|||
|
<section id="continuity-and-closed-and-open-sets" class="level2" data-number="21.3">
|
|||
|
<h2 data-number="21.3" class="anchored" data-anchor-id="continuity-and-closed-and-open-sets"><span class="header-section-number">21.3</span> Continuity and closed and open sets</h2>
|
|||
|
<p>We comment on two implications of continuity that can be generalized to more general settings.</p>
|
|||
|
<p>The two intervals <span class="math inline">\((a,b)\)</span> and <span class="math inline">\([a,b]\)</span> differ as the latter includes the endpoints. The extreme value theorem shows this distinction can make a big difference in what can be said regarding <em>images</em> of such interval.</p>
|
|||
|
<p>In particular, if <span class="math inline">\(f\)</span> is continuous and <span class="math inline">\(I = [a,b]\)</span> with <span class="math inline">\(a\)</span> and <span class="math inline">\(b\)</span> finite (<span class="math inline">\(I\)</span> is <em>closed</em> and bounded) then the <em>image</em> of <span class="math inline">\(I\)</span> sometimes denoted <span class="math inline">\(f(I) = \{y: y=f(x) \text{ for } x \in I\}\)</span> has the property that it will be an interval and will include its endpoints (also closed and bounded).</p>
|
|||
|
<p>That <span class="math inline">\(f(I)\)</span> is an interval is a consequence of the intermediate value theorem. That <span class="math inline">\(f(I)\)</span> contains its endpoints is the extreme value theorem.</p>
|
|||
|
<p>On the real line, sets that are closed and bounded are “compact,” a term that generalizes to other settings.</p>
|
|||
|
<blockquote class="blockquote">
|
|||
|
<p>Continuity implies that the <em>image</em> of a compact set is compact.</p>
|
|||
|
</blockquote>
|
|||
|
<p>Now let <span class="math inline">\((c,d)\)</span> be an <em>open</em> interval in the range of <span class="math inline">\(f\)</span>. An open interval is an open set. On the real line, an open set is one where each point in the set, <span class="math inline">\(a\)</span>, has some <span class="math inline">\(\delta\)</span> such that if <span class="math inline">\(|b-a| < \delta\)</span> then <span class="math inline">\(b\)</span> is also in the set.</p>
|
|||
|
<blockquote class="blockquote">
|
|||
|
<p>Continuity implies that the <em>preimage</em> of an open set is an open set.</p>
|
|||
|
</blockquote>
|
|||
|
<p>The <em>preimage</em> of an open set, <span class="math inline">\(I\)</span>, is <span class="math inline">\(\{a: f(a) \in I\}\)</span>. (All <span class="math inline">\(a\)</span> with an image in <span class="math inline">\(I\)</span>.) Taking some pair <span class="math inline">\((a,y)\)</span> with <span class="math inline">\(y\)</span> in <span class="math inline">\(I\)</span> and <span class="math inline">\(a\)</span> in the preimage as <span class="math inline">\(f(a)=y\)</span>. Let <span class="math inline">\(\epsilon\)</span> be such that <span class="math inline">\(|x-y| < \epsilon\)</span> implies <span class="math inline">\(x\)</span> is in <span class="math inline">\(I\)</span>. Then as <span class="math inline">\(f\)</span> is continuous at <span class="math inline">\(a\)</span>, given <span class="math inline">\(\epsilon\)</span> there is a <span class="math inline">\(\delta\)</span> such that <span class="math inline">\(|b-a| <\delta\)</span> implies <span class="math inline">\(|f(b) - f(a)| < \epsilon\)</span> or <span class="math inline">\(|f(b)-y| < \epsilon\)</span> which means that <span class="math inline">\(f(b)\)</span> is in the <span class="math inline">\(I\)</span> so <span class="math inline">\(b\)</span> is in the preimage, implying the preimage is an open set.</p>
|
|||
|
</section>
|
|||
|
<section id="questions" class="level2" data-number="21.4">
|
|||
|
<h2 data-number="21.4" class="anchored" data-anchor-id="questions"><span class="header-section-number">21.4</span> Questions</h2>
|
|||
|
<section id="question" class="level6">
|
|||
|
<h6 class="anchored" data-anchor-id="question">Question</h6>
|
|||
|
<p>There is negative zero in the interval <span class="math inline">\([-10, 0]\)</span> for the function <span class="math inline">\(f(x) = e^x - x^4\)</span>. Find its value numerically:</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="4876110463265385846" data-controltype="">
|
|||
|
<div class="form-group ">
|
|||
|
<div class="controls">
|
|||
|
<div class="form" id="controls_4876110463265385846">
|
|||
|
<div style="padding-top: 5px">
|
|||
|
<br>
|
|||
|
<div class="input-group">
|
|||
|
<input id="4876110463265385846" type="number" class="form-control" placeholder="Numeric answer">
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div id="4876110463265385846_message" style="padding-bottom: 15px"></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
|
|||
|
<script text="text/javascript">
|
|||
|
document.getElementById("4876110463265385846").addEventListener("change", function() {
|
|||
|
var correct = (Math.abs(this.value - -0.8155534188089607) <= 0.001);
|
|||
|
var msgBox = document.getElementById('4876110463265385846_message');
|
|||
|
if(correct) {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_4876110463265385846")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "none";
|
|||
|
}
|
|||
|
} else {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_4876110463265385846")
|
|||
|
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>There is zero in the interval <span class="math inline">\([0, 5]\)</span> for the function <span class="math inline">\(f(x) = e^x - x^4\)</span>. Find its value numerically:</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="7179423150067606023" data-controltype="">
|
|||
|
<div class="form-group ">
|
|||
|
<div class="controls">
|
|||
|
<div class="form" id="controls_7179423150067606023">
|
|||
|
<div style="padding-top: 5px">
|
|||
|
<br>
|
|||
|
<div class="input-group">
|
|||
|
<input id="7179423150067606023" type="number" class="form-control" placeholder="Numeric answer">
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div id="7179423150067606023_message" style="padding-bottom: 15px"></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
|
|||
|
<script text="text/javascript">
|
|||
|
document.getElementById("7179423150067606023").addEventListener("change", function() {
|
|||
|
var correct = (Math.abs(this.value - 1.4296118247255556) <= 0.001);
|
|||
|
var msgBox = document.getElementById('7179423150067606023_message');
|
|||
|
if(correct) {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_7179423150067606023")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "none";
|
|||
|
}
|
|||
|
} else {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_7179423150067606023")
|
|||
|
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>Let <span class="math inline">\(f(x) = x^2 - 10 \cdot x \cdot \log(x)\)</span>. This function has two zeros on the positive <span class="math inline">\(x\)</span> axis. You are asked to find the largest (graph and bracket…).</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="3219964530336959280" data-controltype="">
|
|||
|
<div class="form-group ">
|
|||
|
<div class="controls">
|
|||
|
<div class="form" id="controls_3219964530336959280">
|
|||
|
<div style="padding-top: 5px">
|
|||
|
<br>
|
|||
|
<div class="input-group">
|
|||
|
<input id="3219964530336959280" type="number" class="form-control" placeholder="Numeric answer">
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div id="3219964530336959280_message" style="padding-bottom: 15px"></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
|
|||
|
<script text="text/javascript">
|
|||
|
document.getElementById("3219964530336959280").addEventListener("change", function() {
|
|||
|
var correct = (Math.abs(this.value - 35.77152063957298) <= 0.001);
|
|||
|
var msgBox = document.getElementById('3219964530336959280_message');
|
|||
|
if(correct) {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_3219964530336959280")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "none";
|
|||
|
}
|
|||
|
} else {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_3219964530336959280")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "block";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
});
|
|||
|
|
|||
|
</script>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</section>
|
|||
|
<section id="question-3" class="level6">
|
|||
|
<h6 class="anchored" data-anchor-id="question-3">Question</h6>
|
|||
|
<p>The <code>airyai</code> function has infinitely many negative roots, as the function oscillates when <span class="math inline">\(x < 0\)</span> and <em>no</em> positive roots. Find the <em>second largest root</em> using the graph to bracket the answer, and then solve.</p>
|
|||
|
<div class="cell" data-execution_count="47">
|
|||
|
<div class="sourceCode cell-code" id="cb66"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb66-1"><a href="#cb66-1" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(airyai, <span class="op">-</span><span class="fl">10</span>, <span class="fl">10</span>) <span class="co"># `airyai` loaded in `SpecialFunctions` by `CalculusWithJulia`</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="48">
|
|||
|
<p><img src="intermediate_value_theorem_files/figure-html/cell-48-output-1.svg" class="img-fluid"></p>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>The second largest root is:</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="12430309449270167780" data-controltype="">
|
|||
|
<div class="form-group ">
|
|||
|
<div class="controls">
|
|||
|
<div class="form" id="controls_12430309449270167780">
|
|||
|
<div style="padding-top: 5px">
|
|||
|
<br>
|
|||
|
<div class="input-group">
|
|||
|
<input id="12430309449270167780" type="number" class="form-control" placeholder="Numeric answer">
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div id="12430309449270167780_message" style="padding-bottom: 15px"></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
|
|||
|
<script text="text/javascript">
|
|||
|
document.getElementById("12430309449270167780").addEventListener("change", function() {
|
|||
|
var correct = (Math.abs(this.value - -4.087949444130973) <= 1.0e-8);
|
|||
|
var msgBox = document.getElementById('12430309449270167780_message');
|
|||
|
if(correct) {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_12430309449270167780")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "none";
|
|||
|
}
|
|||
|
} else {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_12430309449270167780")
|
|||
|
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>(From <a href="http://ocw.mit.edu/ans7870/resources/Strang/Edited/Calculus/Calculus.pdf">Strang</a>, p. 37)</p>
|
|||
|
<p>Certainly <span class="math inline">\(x^3\)</span> equals <span class="math inline">\(3^x\)</span> at <span class="math inline">\(x=3\)</span>. Find the largest value for which <span class="math inline">\(x^3 = 3x\)</span>.</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="16536971894800616228" data-controltype="">
|
|||
|
<div class="form-group ">
|
|||
|
<div class="controls">
|
|||
|
<div class="form" id="controls_16536971894800616228">
|
|||
|
<div style="padding-top: 5px">
|
|||
|
<br>
|
|||
|
<div class="input-group">
|
|||
|
<input id="16536971894800616228" type="number" class="form-control" placeholder="Numeric answer">
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div id="16536971894800616228_message" style="padding-bottom: 15px"></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
|
|||
|
<script text="text/javascript">
|
|||
|
document.getElementById("16536971894800616228").addEventListener("change", function() {
|
|||
|
var correct = (Math.abs(this.value - 3.0000000000000013) <= 0.001);
|
|||
|
var msgBox = document.getElementById('16536971894800616228_message');
|
|||
|
if(correct) {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_16536971894800616228")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "none";
|
|||
|
}
|
|||
|
} else {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_16536971894800616228")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "block";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
});
|
|||
|
|
|||
|
</script>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>Compare <span class="math inline">\(x^2\)</span> and <span class="math inline">\(2^x\)</span>. They meet at <span class="math inline">\(2\)</span>, where do the meet again?</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="3058759968280026108" data-controltype="">
|
|||
|
<div class="form-group ">
|
|||
|
<div class="controls">
|
|||
|
<div class="form" id="controls_3058759968280026108">
|
|||
|
<div style="padding-top: 5px">
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_3058759968280026108_1">
|
|||
|
<input class="form-check-input" type="radio" name="radio_3058759968280026108" id="radio_3058759968280026108_1" value="1">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
Before and after 2
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_3058759968280026108_2">
|
|||
|
<input class="form-check-input" type="radio" name="radio_3058759968280026108" id="radio_3058759968280026108_2" value="2">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
Only after 2
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_3058759968280026108_3">
|
|||
|
<input class="form-check-input" type="radio" name="radio_3058759968280026108" id="radio_3058759968280026108_3" value="3">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
Only before 2
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div id="3058759968280026108_message" style="padding-bottom: 15px"></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
|
|||
|
<script text="text/javascript">
|
|||
|
document.querySelectorAll('input[name="radio_3058759968280026108"]').forEach(function(rb) {
|
|||
|
rb.addEventListener("change", function() {
|
|||
|
var correct = rb.value == 1;
|
|||
|
var msgBox = document.getElementById('3058759968280026108_message');
|
|||
|
if(correct) {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_3058759968280026108")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "none";
|
|||
|
}
|
|||
|
} else {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_3058759968280026108")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "block";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
})});
|
|||
|
|
|||
|
</script>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>Just by graphing, find a number in <span class="math inline">\(b\)</span> with <span class="math inline">\(2 < b < 3\)</span> where for values less than <span class="math inline">\(b\)</span> there is a zero beyond <span class="math inline">\(b\)</span> of <span class="math inline">\(b^x - x^b\)</span> and for values more than <span class="math inline">\(b\)</span> there isn’t.</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="13576008636290178839" data-controltype="">
|
|||
|
<div class="form-group ">
|
|||
|
<div class="controls">
|
|||
|
<div class="form" id="controls_13576008636290178839">
|
|||
|
<div style="padding-top: 5px">
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_13576008636290178839_1">
|
|||
|
<input class="form-check-input" type="radio" name="radio_13576008636290178839" id="radio_13576008636290178839_1" value="1">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
\(b \approx 2.2\)
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_13576008636290178839_2">
|
|||
|
<input class="form-check-input" type="radio" name="radio_13576008636290178839" id="radio_13576008636290178839_2" value="2">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
\(b \approx 2.9\)
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_13576008636290178839_3">
|
|||
|
<input class="form-check-input" type="radio" name="radio_13576008636290178839" id="radio_13576008636290178839_3" value="3">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
\(b \approx 2.5\)
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_13576008636290178839_4">
|
|||
|
<input class="form-check-input" type="radio" name="radio_13576008636290178839" id="radio_13576008636290178839_4" value="4">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
\(b \approx 2.7\)
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div id="13576008636290178839_message" style="padding-bottom: 15px"></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
|
|||
|
<script text="text/javascript">
|
|||
|
document.querySelectorAll('input[name="radio_13576008636290178839"]').forEach(function(rb) {
|
|||
|
rb.addEventListener("change", function() {
|
|||
|
var correct = rb.value == 4;
|
|||
|
var msgBox = document.getElementById('13576008636290178839_message');
|
|||
|
if(correct) {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_13576008636290178839")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "none";
|
|||
|
}
|
|||
|
} else {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_13576008636290178839")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "block";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
})});
|
|||
|
|
|||
|
</script>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</section>
|
|||
|
<section id="question-what-goes-up-must-come-down" class="level6">
|
|||
|
<h6 class="anchored" data-anchor-id="question-what-goes-up-must-come-down">Question: What goes up must come down…</h6>
|
|||
|
<div class="quarto-figure quarto-figure-center">
|
|||
|
<figure class="figure">
|
|||
|
<p><img src="../limits/figures/cannonball.jpg" class="img-fluid figure-img"></p>
|
|||
|
<p></p><figcaption class="figure-caption">Trajectories of potential cannonball fires with air-resistance included. (http://ej.iop.org/images/0143-0807/33/1/149/Full/ejp405251f1_online.jpg)</figcaption><p></p>
|
|||
|
</figure>
|
|||
|
</div>
|
|||
|
<p>In 1638, according to Amir D. <a href="http://books.google.com/books?id=kvGt2OlUnQ4C&pg=PA28&lpg=PA28&dq=mersenne+cannon+ball+tests&source=bl&ots=wEUd7e0jFk&sig=LpFuPoUvODzJdaoug4CJsIGZZHw&hl=en&sa=X&ei=KUGcU6OAKJCfyASnioCoBA&ved=0CCEQ6AEwAA#v=onepage&q=mersenne%20cannon%20ball%20tests&f=false">Aczel</a>, an experiment was performed in the French Countryside. A monk, Marin Mersenne, launched a cannonball straight up into the air in an attempt to help Descartes prove facts about the rotation of the earth. Though the experiment was not successful, Mersenne later observed that the time for the cannonball to go up was greater than the time to come down. <a href="http://www.maa.org/publications/periodicals/american-mathematical-monthly/american-mathematical-monthly-contents-junejuly-2014">“Vertical Projection in a Resisting Medium: Reflections on Observations of Mersenne”.</a></p>
|
|||
|
<p>This isn’t the case for simple ballistic motion where the time to go up is equal to the time to come down. We can “prove” this numerically. For simple ballistic motion:</p>
|
|||
|
<p><span class="math display">\[
|
|||
|
f(t) = -\frac{1}{2} \cdot 32 t^2 + v_0t.
|
|||
|
\]</span></p>
|
|||
|
<p>The time to go up and down are found by the two zeros of this function. The peak time is related to a zero of a function given by <code>f'</code>, which for now we’ll take as a mystery operation, but later will be known as the derivative. (The notation assumes <code>CalculusWithJulia</code> has been loaded.)</p>
|
|||
|
<p>Let <span class="math inline">\(v_0= 390\)</span>. The three times in question can be found from the zeros of <code>f</code> and <code>f'</code>. What are they?</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="2835153114100767285" data-controltype="">
|
|||
|
<div class="form-group ">
|
|||
|
<div class="controls">
|
|||
|
<div class="form" id="controls_2835153114100767285">
|
|||
|
<div style="padding-top: 5px">
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_2835153114100767285_1">
|
|||
|
<input class="form-check-input" type="radio" name="radio_2835153114100767285" id="radio_2835153114100767285_1" value="1">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
\((-4.9731, 0.0, 4.9731)\)
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_2835153114100767285_2">
|
|||
|
<input class="form-check-input" type="radio" name="radio_2835153114100767285" id="radio_2835153114100767285_2" value="2">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
\((0.0, 625.0, 1250.0)\)
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_2835153114100767285_3">
|
|||
|
<input class="form-check-input" type="radio" name="radio_2835153114100767285" id="radio_2835153114100767285_3" value="3">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
\((0.0, 12.1875, 24.375)\)
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div id="2835153114100767285_message" style="padding-bottom: 15px"></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
|
|||
|
<script text="text/javascript">
|
|||
|
document.querySelectorAll('input[name="radio_2835153114100767285"]').forEach(function(rb) {
|
|||
|
rb.addEventListener("change", function() {
|
|||
|
var correct = rb.value == 3;
|
|||
|
var msgBox = document.getElementById('2835153114100767285_message');
|
|||
|
if(correct) {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_2835153114100767285")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "none";
|
|||
|
}
|
|||
|
} else {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_2835153114100767285")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "block";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
})});
|
|||
|
|
|||
|
</script>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</section>
|
|||
|
<section id="question-what-goes-up-must-come-down-again" class="level6">
|
|||
|
<h6 class="anchored" data-anchor-id="question-what-goes-up-must-come-down-again">Question What goes up must come down… (again)</h6>
|
|||
|
<p>For simple ballistic motion you find that the time to go up is the time to come down. For motion within a resistant medium, such as air, this isn’t the case. Suppose a model for the height as a function of time is given by</p>
|
|||
|
<p><span class="math display">\[
|
|||
|
h(t) = (\frac{g}{\gamma^2} + \frac{v_0}{\gamma})(1 - e^{-\gamma t}) - \frac{gt}{\gamma}
|
|||
|
\]</span></p>
|
|||
|
<p>(<a href="http://www.researchgate.net/publication/230963032_On_the_trajectories_of_projectiles_depicted_in_early_ballistic_woodcuts">From “On the trajectories of projectiles depicted in early ballistic Woodcuts”</a>)</p>
|
|||
|
<p>Here <span class="math inline">\(g=32\)</span>, again we take <span class="math inline">\(v_0=390\)</span>, and <span class="math inline">\(\gamma\)</span> is a drag coefficient that we will take to be <span class="math inline">\(1\)</span>. This is valid when <span class="math inline">\(h(t) \geq 0\)</span>. In <code>Julia</code>, rather than hard-code the parameter values, for added flexibility we can pass them in as keyword arguments:</p>
|
|||
|
<div class="cell" data-execution_count="54">
|
|||
|
<div class="sourceCode cell-code" id="cb67"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb67-1"><a href="#cb67-1" aria-hidden="true" tabindex="-1"></a><span class="fu">h</span>(t; g<span class="op">=</span><span class="fl">32</span>, v0<span class="op">=</span><span class="fl">390</span>, gamma<span class="op">=</span><span class="fl">1</span>) <span class="op">=</span> (g<span class="op">/</span>gamma<span class="op">^</span><span class="fl">2</span> <span class="op">+</span> v0<span class="op">/</span>gamma)<span class="fu">*</span>(<span class="fl">1</span> <span class="op">-</span> <span class="fu">exp</span>(<span class="op">-</span>gamma<span class="op">*</span>t)) <span class="op">-</span> g<span class="op">*</span>t<span class="op">/</span>gamma</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="55">
|
|||
|
<pre><code>h (generic function with 1 method)</code></pre>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>Now find the three times: <span class="math inline">\(t_0\)</span>, the starting time; <span class="math inline">\(t_a\)</span>, the time at the apex of the flight; and <span class="math inline">\(t_f\)</span>, the time the object returns to the ground.</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="2613242763902632192" data-controltype="">
|
|||
|
<div class="form-group ">
|
|||
|
<div class="controls">
|
|||
|
<div class="form" id="controls_2613242763902632192">
|
|||
|
<div style="padding-top: 5px">
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_2613242763902632192_1">
|
|||
|
<input class="form-check-input" type="radio" name="radio_2613242763902632192" id="radio_2613242763902632192_1" value="1">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
\((0, 13.187, 30.0)\)
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_2613242763902632192_2">
|
|||
|
<input class="form-check-input" type="radio" name="radio_2613242763902632192" id="radio_2613242763902632192_2" value="2">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
\((0, 32.0, 390.0)\)
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_2613242763902632192_3">
|
|||
|
<input class="form-check-input" type="radio" name="radio_2613242763902632192" id="radio_2613242763902632192_3" value="3">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
\((0, 2.579, 13.187)\)
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div id="2613242763902632192_message" style="padding-bottom: 15px"></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
|
|||
|
<script text="text/javascript">
|
|||
|
document.querySelectorAll('input[name="radio_2613242763902632192"]').forEach(function(rb) {
|
|||
|
rb.addEventListener("change", function() {
|
|||
|
var correct = rb.value == 3;
|
|||
|
var msgBox = document.getElementById('2613242763902632192_message');
|
|||
|
if(correct) {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_2613242763902632192")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "none";
|
|||
|
}
|
|||
|
} else {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_2613242763902632192")
|
|||
|
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>Part of the proof of the intermediate value theorem rests on knowing what the limit is of <span class="math inline">\(f(x)\)</span> when <span class="math inline">\(f(x) > y\)</span> for all <span class="math inline">\(x\)</span>. What can we say about <span class="math inline">\(L\)</span> supposing <span class="math inline">\(L = \lim_{x \rightarrow c+}f(x)\)</span> under this assumption on <span class="math inline">\(f\)</span>?</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="510156253468090291" data-controltype="">
|
|||
|
<div class="form-group ">
|
|||
|
<div class="controls">
|
|||
|
<div class="form" id="controls_510156253468090291">
|
|||
|
<div style="padding-top: 5px">
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_510156253468090291_1">
|
|||
|
<input class="form-check-input" type="radio" name="radio_510156253468090291" id="radio_510156253468090291_1" value="1">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
It must be that \(L > y\) as each \(f(x)\) is.
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_510156253468090291_2">
|
|||
|
<input class="form-check-input" type="radio" name="radio_510156253468090291" id="radio_510156253468090291_2" value="2">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
It must be that \(L \geq y\)
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_510156253468090291_3">
|
|||
|
<input class="form-check-input" type="radio" name="radio_510156253468090291" id="radio_510156253468090291_3" value="3">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
It can happen that \(L < y\), \(L=y\), or \(L>y\)
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div id="510156253468090291_message" style="padding-bottom: 15px"></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
|
|||
|
<script text="text/javascript">
|
|||
|
document.querySelectorAll('input[name="radio_510156253468090291"]').forEach(function(rb) {
|
|||
|
rb.addEventListener("change", function() {
|
|||
|
var correct = rb.value == 2;
|
|||
|
var msgBox = document.getElementById('510156253468090291_message');
|
|||
|
if(correct) {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_510156253468090291")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "none";
|
|||
|
}
|
|||
|
} else {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_510156253468090291")
|
|||
|
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 extreme value theorem has two assumptions: a continuous function and a <em>closed</em> interval. Which of the following examples fails to satisfy the consequence of the extreme value theorem because the interval is not closed? (The consequence - the existence of an absolute maximum and minimum - can happen even if the theorem does not apply.)</p>
|
|||
|
<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="9804016610703575098" data-controltype="">
|
|||
|
<div class="form-group ">
|
|||
|
<div class="controls">
|
|||
|
<div class="form" id="controls_9804016610703575098">
|
|||
|
<div style="padding-top: 5px">
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_9804016610703575098_1">
|
|||
|
<input class="form-check-input" type="radio" name="radio_9804016610703575098" id="radio_9804016610703575098_1" value="1">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
\(f(x) = \sin(x),~ I=(-2\pi, 2\pi)\)
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_9804016610703575098_2">
|
|||
|
<input class="form-check-input" type="radio" name="radio_9804016610703575098" id="radio_9804016610703575098_2" value="2">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
\(f(x) = \sin(x),~ I=(-\pi, \pi)\)
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_9804016610703575098_3">
|
|||
|
<input class="form-check-input" type="radio" name="radio_9804016610703575098" id="radio_9804016610703575098_3" value="3">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
\(f(x) = \sin(x),~ I=(-\pi/2, \pi/2)\)
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_9804016610703575098_4">
|
|||
|
<input class="form-check-input" type="radio" name="radio_9804016610703575098" id="radio_9804016610703575098_4" value="4">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
None of the above
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div id="9804016610703575098_message" style="padding-bottom: 15px"></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
|
|||
|
<script text="text/javascript">
|
|||
|
document.querySelectorAll('input[name="radio_9804016610703575098"]').forEach(function(rb) {
|
|||
|
rb.addEventListener("change", function() {
|
|||
|
var correct = rb.value == 3;
|
|||
|
var msgBox = document.getElementById('9804016610703575098_message');
|
|||
|
if(correct) {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_9804016610703575098")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "none";
|
|||
|
}
|
|||
|
} else {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_9804016610703575098")
|
|||
|
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>The extreme value theorem has two assumptions: a continuous function and a <em>closed</em> interval. Which of the following examples fails to satisfy the consequence of the extreme value theorem because the function is not continuous?</p>
|
|||
|
<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="4239549052329829598" data-controltype="">
|
|||
|
<div class="form-group ">
|
|||
|
<div class="controls">
|
|||
|
<div class="form" id="controls_4239549052329829598">
|
|||
|
<div style="padding-top: 5px">
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_4239549052329829598_1">
|
|||
|
<input class="form-check-input" type="radio" name="radio_4239549052329829598" id="radio_4239549052329829598_1" value="1">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
\(f(x) = 1/x,~ I=[1,2]\)
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_4239549052329829598_2">
|
|||
|
<input class="form-check-input" type="radio" name="radio_4239549052329829598" id="radio_4239549052329829598_2" value="2">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
\(f(x) = 1/x,~ I=[-2, -1]\)
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_4239549052329829598_3">
|
|||
|
<input class="form-check-input" type="radio" name="radio_4239549052329829598" id="radio_4239549052329829598_3" value="3">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
\(f(x) = 1/x,~ I=[-1, 1]\)
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_4239549052329829598_4">
|
|||
|
<input class="form-check-input" type="radio" name="radio_4239549052329829598" id="radio_4239549052329829598_4" value="4">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
none of the above
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div id="4239549052329829598_message" style="padding-bottom: 15px"></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
|
|||
|
<script text="text/javascript">
|
|||
|
document.querySelectorAll('input[name="radio_4239549052329829598"]').forEach(function(rb) {
|
|||
|
rb.addEventListener("change", function() {
|
|||
|
var correct = rb.value == 3;
|
|||
|
var msgBox = document.getElementById('4239549052329829598_message');
|
|||
|
if(correct) {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_4239549052329829598")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "none";
|
|||
|
}
|
|||
|
} else {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_4239549052329829598")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "block";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
})});
|
|||
|
|
|||
|
</script>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</section>
|
|||
|
<section id="question-8" class="level6">
|
|||
|
<h6 class="anchored" data-anchor-id="question-8">Question</h6>
|
|||
|
<p>The extreme value theorem has two assumptions: a continuous function and a <em>closed</em> interval. Which of the following examples fails to satisfy the consequence of the extreme value theorem because the function is not continuous?</p>
|
|||
|
<div class="cell" data-hold="true" data-execution_count="59">
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="60">
|
|||
|
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="10720567294637288215" data-controltype="">
|
|||
|
<div class="form-group ">
|
|||
|
<div class="controls">
|
|||
|
<div class="form" id="controls_10720567294637288215">
|
|||
|
<div style="padding-top: 5px">
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_10720567294637288215_1">
|
|||
|
<input class="form-check-input" type="radio" name="radio_10720567294637288215" id="radio_10720567294637288215_1" value="1">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
\(f(x) = \text{sign}(x),~ I=[-1, 1]\)
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_10720567294637288215_2">
|
|||
|
<input class="form-check-input" type="radio" name="radio_10720567294637288215" id="radio_10720567294637288215_2" value="2">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
\(f(x) = 1/x,~ I=[-4, -1]\)
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_10720567294637288215_3">
|
|||
|
<input class="form-check-input" type="radio" name="radio_10720567294637288215" id="radio_10720567294637288215_3" value="3">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
\(f(x) = \text{floor}(x),~ I=[-1/2, 1/2]\)
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_10720567294637288215_4">
|
|||
|
<input class="form-check-input" type="radio" name="radio_10720567294637288215" id="radio_10720567294637288215_4" value="4">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
none of the above
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div id="10720567294637288215_message" style="padding-bottom: 15px"></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
|
|||
|
<script text="text/javascript">
|
|||
|
document.querySelectorAll('input[name="radio_10720567294637288215"]').forEach(function(rb) {
|
|||
|
rb.addEventListener("change", function() {
|
|||
|
var correct = rb.value == 4;
|
|||
|
var msgBox = document.getElementById('10720567294637288215_message');
|
|||
|
if(correct) {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_10720567294637288215")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "none";
|
|||
|
}
|
|||
|
} else {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_10720567294637288215")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "block";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
})});
|
|||
|
|
|||
|
</script>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</section>
|
|||
|
<section id="question-9" class="level6">
|
|||
|
<h6 class="anchored" data-anchor-id="question-9">Question</h6>
|
|||
|
<p>The function <span class="math inline">\(f(x) = x^3 - x\)</span> is continuous over the interval <span class="math inline">\(I=[-2,2]\)</span>. Find a value <span class="math inline">\(c\)</span> for which <span class="math inline">\(M=f(c)\)</span> is an absolute maximum over <span class="math inline">\(I\)</span>.</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="14556504948147491542" data-controltype="">
|
|||
|
<div class="form-group ">
|
|||
|
<div class="controls">
|
|||
|
<div class="form" id="controls_14556504948147491542">
|
|||
|
<div style="padding-top: 5px">
|
|||
|
<br>
|
|||
|
<div class="input-group">
|
|||
|
<input id="14556504948147491542" type="number" class="form-control" placeholder="Numeric answer">
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div id="14556504948147491542_message" style="padding-bottom: 15px"></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
|
|||
|
<script text="text/javascript">
|
|||
|
document.getElementById("14556504948147491542").addEventListener("change", function() {
|
|||
|
var correct = (Math.abs(this.value - 2) <= 0);
|
|||
|
var msgBox = document.getElementById('14556504948147491542_message');
|
|||
|
if(correct) {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_14556504948147491542")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "none";
|
|||
|
}
|
|||
|
} else {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_14556504948147491542")
|
|||
|
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>The function <span class="math inline">\(f(x) = x^3 - x\)</span> is continuous over the interval <span class="math inline">\(I=[-1,1]\)</span>. Find a value <span class="math inline">\(c\)</span> for which <span class="math inline">\(M=f(c)\)</span> is an absolute maximum over <span class="math inline">\(I\)</span>.</p>
|
|||
|
<div class="cell" data-hold="true" data-execution_count="61">
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="62">
|
|||
|
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="652296873500071137" data-controltype="">
|
|||
|
<div class="form-group ">
|
|||
|
<div class="controls">
|
|||
|
<div class="form" id="controls_652296873500071137">
|
|||
|
<div style="padding-top: 5px">
|
|||
|
<br>
|
|||
|
<div class="input-group">
|
|||
|
<input id="652296873500071137" type="number" class="form-control" placeholder="Numeric answer">
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div id="652296873500071137_message" style="padding-bottom: 15px"></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
|
|||
|
<script text="text/javascript">
|
|||
|
document.getElementById("652296873500071137").addEventListener("change", function() {
|
|||
|
var correct = (Math.abs(this.value - -0.5773502691896257) <= 0.001);
|
|||
|
var msgBox = document.getElementById('652296873500071137_message');
|
|||
|
if(correct) {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_652296873500071137")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "none";
|
|||
|
}
|
|||
|
} else {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_652296873500071137")
|
|||
|
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>Consider the continuous function <span class="math inline">\(f(x) = \sin(x)\)</span> over the closed interval <span class="math inline">\(I=[0, 10\pi]\)</span>. Which of these is true?</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="8939049494800405387" data-controltype="">
|
|||
|
<div class="form-group ">
|
|||
|
<div class="controls">
|
|||
|
<div class="form" id="controls_8939049494800405387">
|
|||
|
<div style="padding-top: 5px">
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_8939049494800405387_1">
|
|||
|
<input class="form-check-input" type="radio" name="radio_8939049494800405387" id="radio_8939049494800405387_1" value="1">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
There is no value \(c\) for which \(f(c)\) is an absolute maximum over \(I\).
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_8939049494800405387_2">
|
|||
|
<input class="form-check-input" type="radio" name="radio_8939049494800405387" id="radio_8939049494800405387_2" value="2">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
There is just one value of \(c\) for which \(f(c)\) is an absolute maximum over \(I\).
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_8939049494800405387_3">
|
|||
|
<input class="form-check-input" type="radio" name="radio_8939049494800405387" id="radio_8939049494800405387_3" value="3">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
There are many values of \(c\) for which \(f(c)\) is an absolute maximum over \(I\).
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div id="8939049494800405387_message" style="padding-bottom: 15px"></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
|
|||
|
<script text="text/javascript">
|
|||
|
document.querySelectorAll('input[name="radio_8939049494800405387"]').forEach(function(rb) {
|
|||
|
rb.addEventListener("change", function() {
|
|||
|
var correct = rb.value == 3;
|
|||
|
var msgBox = document.getElementById('8939049494800405387_message');
|
|||
|
if(correct) {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_8939049494800405387")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "none";
|
|||
|
}
|
|||
|
} else {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_8939049494800405387")
|
|||
|
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>Consider the continuous function <span class="math inline">\(f(x) = \sin(x)\)</span> over the closed interval <span class="math inline">\(I=[0, 10\pi]\)</span>. Which of these is true?</p>
|
|||
|
<div class="cell" data-hold="true" data-execution_count="63">
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="64">
|
|||
|
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="1287756978337452849" data-controltype="">
|
|||
|
<div class="form-group ">
|
|||
|
<div class="controls">
|
|||
|
<div class="form" id="controls_1287756978337452849">
|
|||
|
<div style="padding-top: 5px">
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_1287756978337452849_1">
|
|||
|
<input class="form-check-input" type="radio" name="radio_1287756978337452849" id="radio_1287756978337452849_1" value="1">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
There is no value \(M\) for which \(M=f(c)\), \(c\) in \(I\) for which \(M\) is an absolute maximum over \(I\).
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_1287756978337452849_2">
|
|||
|
<input class="form-check-input" type="radio" name="radio_1287756978337452849" id="radio_1287756978337452849_2" value="2">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
There is just one value \(M\) for which \(M=f(c)\), \(c\) in \(I\) for which \(M\) is an absolute maximum over \(I\).
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_1287756978337452849_3">
|
|||
|
<input class="form-check-input" type="radio" name="radio_1287756978337452849" id="radio_1287756978337452849_3" value="3">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
There are many values \(M\) for which \(M=f(c)\), \(c\) in \(I\) for which \(M\) is an absolute maximum over \(I\).
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div id="1287756978337452849_message" style="padding-bottom: 15px"></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
|
|||
|
<script text="text/javascript">
|
|||
|
document.querySelectorAll('input[name="radio_1287756978337452849"]').forEach(function(rb) {
|
|||
|
rb.addEventListener("change", function() {
|
|||
|
var correct = rb.value == 2;
|
|||
|
var msgBox = document.getElementById('1287756978337452849_message');
|
|||
|
if(correct) {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_1287756978337452849")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "none";
|
|||
|
}
|
|||
|
} else {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_1287756978337452849")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "block";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
})});
|
|||
|
|
|||
|
</script>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</section>
|
|||
|
<section id="question-13" class="level6">
|
|||
|
<h6 class="anchored" data-anchor-id="question-13">Question</h6>
|
|||
|
<p>The extreme value theorem says that on a closed interval a continuous function has an extreme value <span class="math inline">\(M=f(c)\)</span> for some <span class="math inline">\(c\)</span>. Does it also say that <span class="math inline">\(c\)</span> is unique? Which of these examples might help you answer this?</p>
|
|||
|
<div class="cell" data-hold="true" data-execution_count="64">
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="65">
|
|||
|
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="8336103282973678690" data-controltype="">
|
|||
|
<div class="form-group ">
|
|||
|
<div class="controls">
|
|||
|
<div class="form" id="controls_8336103282973678690">
|
|||
|
<div style="padding-top: 5px">
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_8336103282973678690_1">
|
|||
|
<input class="form-check-input" type="radio" name="radio_8336103282973678690" id="radio_8336103282973678690_1" value="1">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
\(f(x) = \sin(x),\quad I=[0, 2\pi]\)
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_8336103282973678690_2">
|
|||
|
<input class="form-check-input" type="radio" name="radio_8336103282973678690" id="radio_8336103282973678690_2" value="2">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
\(f(x) = \sin(x),\quad I=[-\pi/2, \pi/2]\)
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_8336103282973678690_3">
|
|||
|
<input class="form-check-input" type="radio" name="radio_8336103282973678690" id="radio_8336103282973678690_3" value="3">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
\(f(x) = \sin(x),\quad I=[-2\pi, 2\pi]\)
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div id="8336103282973678690_message" style="padding-bottom: 15px"></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
|
|||
|
<script text="text/javascript">
|
|||
|
document.querySelectorAll('input[name="radio_8336103282973678690"]').forEach(function(rb) {
|
|||
|
rb.addEventListener("change", function() {
|
|||
|
var correct = rb.value == 3;
|
|||
|
var msgBox = document.getElementById('8336103282973678690_message');
|
|||
|
if(correct) {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_8336103282973678690")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "none";
|
|||
|
}
|
|||
|
} else {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_8336103282973678690")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "block";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
})});
|
|||
|
|
|||
|
</script>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</section>
|
|||
|
<section id="question-14" class="level5">
|
|||
|
<h5 class="anchored" data-anchor-id="question-14">Question</h5>
|
|||
|
<p>The zeros of the equation <span class="math inline">\(\cos(x) \cdot \cosh(x) = 1\)</span> are related to vibrations of rods. Using <code>find_zeros</code>, what is the largest zero in the interval <span class="math inline">\([0, 6\pi]\)</span>?</p>
|
|||
|
<div class="cell" data-hold="true" data-execution_count="65">
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="66">
|
|||
|
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="6304903279522801603" data-controltype="">
|
|||
|
<div class="form-group ">
|
|||
|
<div class="controls">
|
|||
|
<div class="form" id="controls_6304903279522801603">
|
|||
|
<div style="padding-top: 5px">
|
|||
|
<br>
|
|||
|
<div class="input-group">
|
|||
|
<input id="6304903279522801603" type="number" class="form-control" placeholder="Numeric answer">
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div id="6304903279522801603_message" style="padding-bottom: 15px"></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
|
|||
|
<script text="text/javascript">
|
|||
|
document.getElementById("6304903279522801603").addEventListener("change", function() {
|
|||
|
var correct = (Math.abs(this.value - 17.27875965739948) <= 0.001);
|
|||
|
var msgBox = document.getElementById('6304903279522801603_message');
|
|||
|
if(correct) {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_6304903279522801603")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "none";
|
|||
|
}
|
|||
|
} else {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_6304903279522801603")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "block";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
});
|
|||
|
|
|||
|
</script>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</section>
|
|||
|
<section id="question-15" class="level5">
|
|||
|
<h5 class="anchored" data-anchor-id="question-15">Question</h5>
|
|||
|
<p>A parametric equation is specified by a parameterization <span class="math inline">\((f(t), g(t)), a \leq t \leq b\)</span>. The parameterization will be continuous if and only if each function is continuous.</p>
|
|||
|
<p>Suppose <span class="math inline">\(k_x\)</span> and <span class="math inline">\(k_y\)</span> are positive integers and <span class="math inline">\(a, b\)</span> are positive numbers, will the <a href="https://en.wikipedia.org/wiki/Parametric_equation#Lissajous_Curve">Lissajous</a> curve given by <span class="math inline">\((a\cos(k_x t), b\sin(k_y t))\)</span> be continuous?</p>
|
|||
|
<div class="cell" data-hold="true" data-execution_count="66">
|
|||
|
<div class="cell-output cell-output-display" data-execution_count="67">
|
|||
|
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="2252864133929389324" data-controltype="">
|
|||
|
<div class="form-group ">
|
|||
|
<div class="controls">
|
|||
|
<div class="form" id="controls_2252864133929389324">
|
|||
|
<div style="padding-top: 5px">
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_2252864133929389324_1">
|
|||
|
<input class="form-check-input" type="radio" name="radio_2252864133929389324" id="radio_2252864133929389324_1" value="1">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
Yes
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
<div class="form-check">
|
|||
|
<label class="form-check-label" for="radio_2252864133929389324_2">
|
|||
|
<input class="form-check-input" type="radio" name="radio_2252864133929389324" id="radio_2252864133929389324_2" value="2">
|
|||
|
|
|||
|
<span class="label-body px-1">
|
|||
|
No
|
|||
|
</span>
|
|||
|
</label>
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div id="2252864133929389324_message" style="padding-bottom: 15px"></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
|
|||
|
<script text="text/javascript">
|
|||
|
document.querySelectorAll('input[name="radio_2252864133929389324"]').forEach(function(rb) {
|
|||
|
rb.addEventListener("change", function() {
|
|||
|
var correct = rb.value == 1;
|
|||
|
var msgBox = document.getElementById('2252864133929389324_message');
|
|||
|
if(correct) {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_2252864133929389324")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "none";
|
|||
|
}
|
|||
|
} else {
|
|||
|
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>";
|
|||
|
var explanation = document.getElementById("explanation_2252864133929389324")
|
|||
|
if (explanation != null) {
|
|||
|
explanation.style.display = "block";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
})});
|
|||
|
|
|||
|
</script>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<p>Here is a sample graph for <span class="math inline">\(a=1, b=2, k_x=3, k_y=4\)</span>:</p>
|
|||
|
<div class="cell" data-hold="true" data-execution_count="67">
|
|||
|
<div class="sourceCode cell-code" id="cb69"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb69-1"><a href="#cb69-1" aria-hidden="true" tabindex="-1"></a>a,b <span class="op">=</span> <span class="fl">1</span>, <span class="fl">2</span></span>
|
|||
|
<span id="cb69-2"><a href="#cb69-2" aria-hidden="true" tabindex="-1"></a>k_x, k_y <span class="op">=</span> <span class="fl">3</span>, <span class="fl">4</span></span>
|
|||
|
<span id="cb69-3"><a href="#cb69-3" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(t <span class="op">-></span> a <span class="op">*</span> <span class="fu">cos</span>(k_x <span class="op">*</span>t), t<span class="op">-></span> b <span class="op">*</span> <span class="fu">sin</span>(k_y <span class="op">*</span> t), <span class="fl">0</span>, <span class="fl">4</span>pi)</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="68">
|
|||
|
<p><img src="intermediate_value_theorem_files/figure-html/cell-68-output-1.svg" class="img-fluid"></p>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
</section>
|
|||
|
</section>
|
|||
|
|
|||
|
</main> <!-- /main -->
|
|||
|
<script id="quarto-html-after-body" type="application/javascript">
|
|||
|
window.document.addEventListener("DOMContentLoaded", function (event) {
|
|||
|
const toggleBodyColorMode = (bsSheetEl) => {
|
|||
|
const mode = bsSheetEl.getAttribute("data-mode");
|
|||
|
const bodyEl = window.document.querySelector("body");
|
|||
|
if (mode === "dark") {
|
|||
|
bodyEl.classList.add("quarto-dark");
|
|||
|
bodyEl.classList.remove("quarto-light");
|
|||
|
} else {
|
|||
|
bodyEl.classList.add("quarto-light");
|
|||
|
bodyEl.classList.remove("quarto-dark");
|
|||
|
}
|
|||
|
}
|
|||
|
const toggleBodyColorPrimary = () => {
|
|||
|
const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
|
|||
|
if (bsSheetEl) {
|
|||
|
toggleBodyColorMode(bsSheetEl);
|
|||
|
}
|
|||
|
}
|
|||
|
toggleBodyColorPrimary();
|
|||
|
const icon = "";
|
|||
|
const anchorJS = new window.AnchorJS();
|
|||
|
anchorJS.options = {
|
|||
|
placement: 'right',
|
|||
|
icon: icon
|
|||
|
};
|
|||
|
anchorJS.add('.anchored');
|
|||
|
const clipboard = new window.ClipboardJS('.code-copy-button', {
|
|||
|
target: function(trigger) {
|
|||
|
return trigger.previousElementSibling;
|
|||
|
}
|
|||
|
});
|
|||
|
clipboard.on('success', function(e) {
|
|||
|
// button target
|
|||
|
const button = e.trigger;
|
|||
|
// don't keep focus
|
|||
|
button.blur();
|
|||
|
// flash "checked"
|
|||
|
button.classList.add('code-copy-button-checked');
|
|||
|
var currentTitle = button.getAttribute("title");
|
|||
|
button.setAttribute("title", "Copied!");
|
|||
|
setTimeout(function() {
|
|||
|
button.setAttribute("title", currentTitle);
|
|||
|
button.classList.remove('code-copy-button-checked');
|
|||
|
}, 1000);
|
|||
|
// clear code selection
|
|||
|
e.clearSelection();
|
|||
|
});
|
|||
|
function tippyHover(el, contentFn) {
|
|||
|
const config = {
|
|||
|
allowHTML: true,
|
|||
|
content: contentFn,
|
|||
|
maxWidth: 500,
|
|||
|
delay: 100,
|
|||
|
arrow: false,
|
|||
|
appendTo: function(el) {
|
|||
|
return el.parentElement;
|
|||
|
},
|
|||
|
interactive: true,
|
|||
|
interactiveBorder: 10,
|
|||
|
theme: 'quarto',
|
|||
|
placement: 'bottom-start'
|
|||
|
};
|
|||
|
window.tippy(el, config);
|
|||
|
}
|
|||
|
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
|
|||
|
for (var i=0; i<noterefs.length; i++) {
|
|||
|
const ref = noterefs[i];
|
|||
|
tippyHover(ref, function() {
|
|||
|
let href = ref.getAttribute('href');
|
|||
|
try { href = new URL(href).hash; } catch {}
|
|||
|
const id = href.replace(/^#\/?/, "");
|
|||
|
const note = window.document.getElementById(id);
|
|||
|
return note.innerHTML;
|
|||
|
});
|
|||
|
}
|
|||
|
var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
|
|||
|
for (var i=0; i<bibliorefs.length; i++) {
|
|||
|
const ref = bibliorefs[i];
|
|||
|
const cites = ref.parentNode.getAttribute('data-cites').split(' ');
|
|||
|
tippyHover(ref, function() {
|
|||
|
var popup = window.document.createElement('div');
|
|||
|
cites.forEach(function(cite) {
|
|||
|
var citeDiv = window.document.createElement('div');
|
|||
|
citeDiv.classList.add('hanging-indent');
|
|||
|
citeDiv.classList.add('csl-entry');
|
|||
|
var biblioDiv = window.document.getElementById('ref-' + cite);
|
|||
|
if (biblioDiv) {
|
|||
|
citeDiv.innerHTML = biblioDiv.innerHTML;
|
|||
|
}
|
|||
|
popup.appendChild(citeDiv);
|
|||
|
});
|
|||
|
return popup.innerHTML;
|
|||
|
});
|
|||
|
}
|
|||
|
var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
|
|||
|
var filterRegex = new RegExp('/' + window.location.host + '/');
|
|||
|
var isInternal = (href) => {
|
|||
|
return filterRegex.test(href) || localhostRegex.test(href);
|
|||
|
}
|
|||
|
// Inspect non-navigation links and adorn them if external
|
|||
|
var links = window.document.querySelectorAll('a:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external)');
|
|||
|
for (var i=0; i<links.length; i++) {
|
|||
|
const link = links[i];
|
|||
|
if (!isInternal(link.href)) {
|
|||
|
// target, if specified
|
|||
|
link.setAttribute("target", "_blank");
|
|||
|
}
|
|||
|
}
|
|||
|
});
|
|||
|
</script>
|
|||
|
<nav class="page-navigation">
|
|||
|
<div class="nav-page nav-page-previous">
|
|||
|
<a href="../limits/continuity.html" class="pagination-link">
|
|||
|
<i class="bi bi-arrow-left-short"></i> <span class="nav-page-text"><span class="chapter-number">20</span> <span class="chapter-title">Continuity</span></span>
|
|||
|
</a>
|
|||
|
</div>
|
|||
|
<div class="nav-page nav-page-next">
|
|||
|
<a href="../derivatives/derivatives.html" class="pagination-link">
|
|||
|
<span class="nav-page-text"><span class="chapter-number">22</span> <span class="chapter-title">Derivatives</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>
|