CalculusWithJuliaNotes.jl/quarto/308797b5/integrals/ftc.html

2808 lines
190 KiB
HTML
Raw Normal View History

2022-08-11 19:00:43 +02:00
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
<meta charset="utf-8">
<meta name="generator" content="quarto-1.0.32">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>Calculus with Julia - 37&nbsp; Fundamental Theorem or Calculus</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="../integrals/substitution.html" rel="next">
<link href="../integrals/area.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">37</span>&nbsp; <span class="chapter-title">Fundamental Theorem or Calculus</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>&nbsp; <span class="chapter-title">From calculator to computer</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/variables.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">2</span>&nbsp; <span class="chapter-title">Variables</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/numbers_types.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">3</span>&nbsp; <span class="chapter-title">Number systems</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/logical_expressions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">4</span>&nbsp; <span class="chapter-title">Inequalities, Logical expressions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/vectors.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">5</span>&nbsp; <span class="chapter-title">Vectors</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/ranges.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">6</span>&nbsp; <span class="chapter-title">Ranges and Sets</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/functions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">7</span>&nbsp; <span class="chapter-title">Functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/plotting.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">8</span>&nbsp; <span class="chapter-title">The Graph of a Function</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/transformations.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">9</span>&nbsp; <span class="chapter-title">Function manipulations</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/inversefunctions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">10</span>&nbsp; <span class="chapter-title">The Inverse of a Function</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/polynomial.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">11</span>&nbsp; <span class="chapter-title">Polynomials</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/polynomial_roots.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Roots of a polynomial</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/polynomials_package.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">The Polynomials package</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/rational_functions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">14</span>&nbsp; <span class="chapter-title">Rational functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/exp_log_functions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">15</span>&nbsp; <span class="chapter-title">Exponential and logarithmic functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/trig_functions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">16</span>&nbsp; <span class="chapter-title">Trigonometric functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/julia_overview.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">17</span>&nbsp; <span class="chapter-title">Overview of Julia commands</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-2" aria-expanded="false">Limits</a>
<a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-2" aria-expanded="false">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-2" class="collapse list-unstyled sidebar-section depth1 ">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../limits/limits.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">18</span>&nbsp; <span class="chapter-title">Limits</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../limits/limits_extensions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">19</span>&nbsp; <span class="chapter-title">Limits, issues, extensions of the concept</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../limits/continuity.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">20</span>&nbsp; <span class="chapter-title">Continuity</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../limits/intermediate_value_theorem.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">21</span>&nbsp; <span class="chapter-title">Implications of continuity</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-3" aria-expanded="false">Derivatives</a>
<a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-3" aria-expanded="false">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-3" class="collapse list-unstyled sidebar-section depth1 ">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/derivatives.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">22</span>&nbsp; <span class="chapter-title">Derivatives</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/numeric_derivatives.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">23</span>&nbsp; <span class="chapter-title">Numeric derivatives</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/symbolic_derivatives.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">24</span>&nbsp; <span class="chapter-title">Symbolic derivatives</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/mean_value_theorem.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">25</span>&nbsp; <span class="chapter-title">The mean value theorem for differentiable functions.</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/optimization.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">26</span>&nbsp; <span class="chapter-title">Optimization</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/first_second_derivatives.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">27</span>&nbsp; <span class="chapter-title">The first and second derivatives</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/curve_sketching.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">28</span>&nbsp; <span class="chapter-title">Curve Sketching</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/linearization.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">29</span>&nbsp; <span class="chapter-title">Linearization</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/newtons_method.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">30</span>&nbsp; <span class="chapter-title">Newtons method</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/more_zeros.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">31</span>&nbsp; <span class="chapter-title">Derivative-free alternatives to Newtons method</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/lhospitals_rule.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">32</span>&nbsp; <span class="chapter-title">LHospitals Rule</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/implicit_differentiation.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">33</span>&nbsp; <span class="chapter-title">Implicit Differentiation</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/related_rates.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">34</span>&nbsp; <span class="chapter-title">Related rates</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/taylor_series_polynomials.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">35</span>&nbsp; <span class="chapter-title">Taylor Polynomials and other Approximating Polynomials</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-4" aria-expanded="true">Integrals</a>
<a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-4" aria-expanded="true">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-4" class="collapse list-unstyled sidebar-section depth1 show">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/area.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">36</span>&nbsp; <span class="chapter-title">Area under a curve</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/ftc.html" class="sidebar-item-text sidebar-link active"><span class="chapter-number">37</span>&nbsp; <span class="chapter-title">Fundamental Theorem or Calculus</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/substitution.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">38</span>&nbsp; <span class="chapter-title">Substitution</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/integration_by_parts.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">39</span>&nbsp; <span class="chapter-title">Integration By Parts</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/partial_fractions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">40</span>&nbsp; <span class="chapter-title">Partial Fractions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/improper_integrals.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">41</span>&nbsp; <span class="chapter-title">Improper Integrals</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/mean_value_theorem.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">42</span>&nbsp; <span class="chapter-title">Mean value theorem for integrals</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/area_between_curves.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">43</span>&nbsp; <span class="chapter-title">Area between two curves</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/center_of_mass.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">44</span>&nbsp; <span class="chapter-title">Center of Mass</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/volumes_slice.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">45</span>&nbsp; <span class="chapter-title">Volumes by slicing</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/arc_length.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">46</span>&nbsp; <span class="chapter-title">Arc length</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/surface_area.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">47</span>&nbsp; <span class="chapter-title">Surface Area</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-5" aria-expanded="false">ODEs</a>
<a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-5" aria-expanded="false">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-5" class="collapse list-unstyled sidebar-section depth1 ">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../ODEs/odes.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">48</span>&nbsp; <span class="chapter-title">ODEs</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../ODEs/euler.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">49</span>&nbsp; <span class="chapter-title">Eulers method</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../ODEs/solve.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">50</span>&nbsp; <span class="chapter-title">The problem-algorithm-solve interface</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../ODEs/differential_equations.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">51</span>&nbsp; <span class="chapter-title">The <code>DifferentialEquations</code> suite</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-6" aria-expanded="false">Differential vector calculus</a>
<a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-6" aria-expanded="false">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-6" class="collapse list-unstyled sidebar-section depth1 ">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../differentiable_vector_calculus/polar_coordinates.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">52</span>&nbsp; <span class="chapter-title">Polar Coordinates and Curves</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../differentiable_vector_calculus/vectors.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">53</span>&nbsp; <span class="chapter-title">Vectors and matrices</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../differentiable_vector_calculus/vector_valued_functions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">54</span>&nbsp; <span class="chapter-title">Vector-valued functions, <span class="math inline">\(f:R \rightarrow R^n\)</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../differentiable_vector_calculus/scalar_functions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">55</span>&nbsp; <span class="chapter-title">Scalar functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../differentiable_vector_calculus/scalar_functions_applications.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">56</span>&nbsp; <span class="chapter-title">Applications with scalar functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../differentiable_vector_calculus/vector_fields.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">57</span>&nbsp; <span class="chapter-title">Functions <span class="math inline">\(R^n \rightarrow R^m\)</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../differentiable_vector_calculus/plots_plotting.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">58</span>&nbsp; <span class="chapter-title">2D and 3D plots in Julia with Plots</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-7" aria-expanded="false">Integral vector calculus</a>
<a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-7" aria-expanded="false">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-7" class="collapse list-unstyled sidebar-section depth1 ">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integral_vector_calculus/double_triple_integrals.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">59</span>&nbsp; <span class="chapter-title">Multi-dimensional integrals</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integral_vector_calculus/line_integrals.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">60</span>&nbsp; <span class="chapter-title">Line and Surface Integrals</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integral_vector_calculus/div_grad_curl.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">61</span>&nbsp; <span class="chapter-title">The Gradient, Divergence, and Curl</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integral_vector_calculus/stokes_theorem.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">62</span>&nbsp; <span class="chapter-title">Greens Theorem, Stokes Theorem, and the Divergence Theorem</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integral_vector_calculus/review.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">63</span>&nbsp; <span class="chapter-title">Quick Review of Vector Calculus</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-8" aria-expanded="false">Alternatives</a>
<a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-8" aria-expanded="false">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-8" class="collapse list-unstyled sidebar-section depth1 ">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../alternatives/plotly_plotting.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">64</span>&nbsp; <span class="chapter-title">JavaScript based plotting libraries</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../alternatives/makie_plotting.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">65</span>&nbsp; <span class="chapter-title">Calculus plots with Makie</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-9" aria-expanded="false">Appendices</a>
<a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-9" aria-expanded="false">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-9" class="collapse list-unstyled sidebar-section depth1 ">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../misc/getting_started_with_julia.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">66</span>&nbsp; <span class="chapter-title">Getting started with Julia</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../misc/julia_interfaces.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">67</span>&nbsp; <span class="chapter-title">Julia interfaces</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../misc/calculus_with_julia.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">68</span>&nbsp; <span class="chapter-title">The <code>CalculusWithJulia</code> package</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../misc/unicode.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">69</span>&nbsp; <span class="chapter-title">Usages of Unicode symbols</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../misc/quick_notes.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">70</span>&nbsp; <span class="chapter-title">Quick introduction to Calculus with Julia</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../references.html" class="sidebar-item-text sidebar-link">References</a>
</div>
</li>
</ul>
</div>
</nav>
<!-- margin-sidebar -->
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
<nav id="TOC" role="doc-toc">
<h2 id="toc-title">Table of contents</h2>
<ul>
<li><a href="#using-the-fundamental-theorem-of-calculus-to-evaluate-definite-integrals" id="toc-using-the-fundamental-theorem-of-calculus-to-evaluate-definite-integrals" class="nav-link active" data-scroll-target="#using-the-fundamental-theorem-of-calculus-to-evaluate-definite-integrals"> <span class="header-section-number">37.1</span> Using the fundamental theorem of calculus to evaluate definite integrals</a>
<ul class="collapse">
<li><a href="#an-alternate-notation-for-fb---fa" id="toc-an-alternate-notation-for-fb---fa" class="nav-link" data-scroll-target="#an-alternate-notation-for-fb---fa"> <span class="header-section-number">37.1.1</span> An alternate notation for <span class="math inline">\(F(b) - F(a)\)</span></a></li>
</ul></li>
<li><a href="#the-indefinite-integral" id="toc-the-indefinite-integral" class="nav-link" data-scroll-target="#the-indefinite-integral"> <span class="header-section-number">37.2</span> The indefinite integral</a>
<ul class="collapse">
<li><a href="#the-integrate-function-from-sympy" id="toc-the-integrate-function-from-sympy" class="nav-link" data-scroll-target="#the-integrate-function-from-sympy"> <span class="header-section-number">37.2.1</span> The <code>integrate</code> function from <code>SymPy</code></a></li>
</ul></li>
<li><a href="#rules-of-integration" id="toc-rules-of-integration" class="nav-link" data-scroll-target="#rules-of-integration"> <span class="header-section-number">37.3</span> Rules of integration</a></li>
<li><a href="#the-derivative-of-the-integral" id="toc-the-derivative-of-the-integral" class="nav-link" data-scroll-target="#the-derivative-of-the-integral"> <span class="header-section-number">37.4</span> The derivative of the integral</a></li>
<li><a href="#questions" id="toc-questions" class="nav-link" data-scroll-target="#questions"> <span class="header-section-number">37.5</span> Questions</a></li>
<li><a href="#more-on-sympys-integrate" id="toc-more-on-sympys-integrate" class="nav-link" data-scroll-target="#more-on-sympys-integrate"> <span class="header-section-number">37.6</span> More on SymPys <code>integrate</code></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/integrals/ftc.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">37</span>&nbsp; <span class="chapter-title">Fundamental Theorem or Calculus</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">SymPy</span></span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="im">using</span> <span class="bu">Roots</span></span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a><span class="im">using</span> <span class="bu">QuadGK</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<hr>
<p>We refer to the example from the section on <a href="../precalc/transformations.html#two_operators_D_S">transformations</a> where two operators on functions were defined:</p>
<p><span class="math display">\[
D(f)(k) = f(k) - f(k-1), \quad S(f)(k) = f(1) + f(2) + \cdots + f(k).
\]</span></p>
<p>It was remarked that these relationships hold: <span class="math inline">\(D(S(f))(k) = f(k)\)</span> and <span class="math inline">\(S(D(f))(k) = f(k) - f(0)\)</span>. These being a consequence of the inverse relationship between addition and subtraction. These two relationships are examples of a more general pair of relationships known as the <a href="http://en.wikipedia.org/wiki/Fundamental_theorem_of_calculus">Fundamental theorem of calculus</a> or FTC.</p>
<p>We will see that with suitable rewriting, the derivative of a function is related to a certain limit of <code>D(f)</code> and the definite integral of a function is related to a certain limit of <code>S(f)</code>. The addition and subtraction rules encapsulated in the relations of <span class="math inline">\(D(S(f))(k) = f(k)\)</span> and <span class="math inline">\(S(D(f))(k) = f(k) - f(0)\)</span> then generalize to these calculus counterparts.</p>
<p>The FTC details the interconnectivity between the operations of integration and differentiation.</p>
<p>For example:</p>
<blockquote class="blockquote">
<p>What is the definite integral of the derivative?</p>
</blockquote>
<p>That is, what is <span class="math inline">\(A = \int_a^b f'(x) dx\)</span>? (Assume <span class="math inline">\(f'\)</span> is continuous.)</p>
<p>To investigate, we begin with the right Riemann sum using <span class="math inline">\(h = (b-a)/n\)</span>:</p>
<p><span class="math display">\[
A \approx S_n = \sum_{i=1}^n f'(a + ih) \cdot h.
\]</span></p>
<p>But the mean value theorem says that for small <span class="math inline">\(h\)</span> we have <span class="math inline">\(f'(x) \approx (f(x) - f(x-h))/h\)</span>. Using this approximation with <span class="math inline">\(x=a+ih\)</span> gives:</p>
<p><span class="math display">\[
A \approx
\sum_{i=1}^n \left(f(a + ih) - f(a + (i-1)h)\right).
\]</span></p>
<p>If we let <span class="math inline">\(g(i) = f(a + ih)\)</span>, then the summand above is just <span class="math inline">\(g(i) - g(i-1) = D(g)(i)\)</span> and the above then is just the sum of the <span class="math inline">\(D(g)(i)\)</span>s, or:</p>
<p><span class="math display">\[
A \approx S(D(g))(n) = g(n) - g(0).
\]</span></p>
<p>But <span class="math inline">\(g(n) - g(0) = f(a + nh) - f(a + 0h) = f(b) - f(a)\)</span>. That is, we expect that the <span class="math inline">\(\approx\)</span> in the limit becomes <span class="math inline">\(=\)</span>, or:</p>
<p><span class="math display">\[
\int_a^b f'(x) dx = f(b) - f(a).
\]</span></p>
<p>This is indeed the case.</p>
<p>The other question would be</p>
<blockquote class="blockquote">
<p>What is the derivative of the integral?</p>
</blockquote>
<p>That is, can we find the derivative of <span class="math inline">\(\int_0^x f(u) du\)</span>? (The derivative in <span class="math inline">\(x\)</span>, the variable <span class="math inline">\(u\)</span> is a dummy variable of integration.)</p>
<p>Lets look first at the integral using the right-Riemann sum, again using <span class="math inline">\(h=(b-a)/n\)</span>:</p>
<p><span class="math display">\[
\int_a^b f(u) du \approx f(a + 1h)h + f(a + 2h)h + \cdots f(a +nh)h = S(g)(n),
\]</span></p>
<p>where we define <span class="math inline">\(g(i) = f(a + ih)h\)</span>. In the above, <span class="math inline">\(n\)</span> relates to <span class="math inline">\(b\)</span>, but we could have stopped accumulating at any value. The analog for <span class="math inline">\(S(g)(k)\)</span> would be <span class="math inline">\(\int_a^x f(u) du\)</span> where <span class="math inline">\(x = a + kh\)</span>. That is we can make a function out of integration by considering the mapping <span class="math inline">\((x, \int_a^x f(u) du)\)</span>. This might be written as <span class="math inline">\(F(x) = \int_a^x f(u)du\)</span>. With this definition, can we take a derivative in <span class="math inline">\(x\)</span>?</p>
<p>Again, we fix a large <span class="math inline">\(n\)</span> and let <span class="math inline">\(h=(b-a)/n\)</span>. And suppose <span class="math inline">\(x = a + Mh\)</span> for some <span class="math inline">\(M\)</span>. Then writing out the approximations to both the definite integral and the derivative we have</p>
<p><span class="math display">\[
\begin{align*}
F'(x) = &amp; \frac{d}{dx} \int_a^x f(u) du \\
&amp; \approx \frac{F(x) - F(x-h)}{h} \\
&amp;= \frac{\int_a^x f(u) du - \int_a^{x-h} f(u) du}{h}\\
&amp; \approx \frac{\left(f(a + 1h)h + f(a + 2h)h + \cdots + f(a + (M-1)h)h + f(a + Mh)h\right)}{h}\\
&amp;- \quad
\frac{\left(f(a + 1h)h + f(a + 2h)h + \cdots + f(a + (M-1)h)h \right)}{h} \\
&amp; = \left(f(a + 1h) + \quad f(a + 2h) + \cdots + f(a + (M-1)h) + f(a + Mh)\right)\\
&amp;- \quad
\left(f(a + 1h) + f(a + 2h) + \cdots + f(a + (M-1)h) \right) \\
&amp;= f(a + Mh).
\end{align*}
\]</span></p>
<p>If <span class="math inline">\(g(i) = f(a + ih)\)</span>, then the above becomes</p>
<p><span class="math display">\[
\begin{align*}
F'(x) &amp; \approx D(S(g))(M) \\
&amp;= f(a + Mh)\\
&amp;= f(x).
\end{align*}
\]</span></p>
<p>That is <span class="math inline">\(F'(x) \approx f(x)\)</span>.</p>
<p>In the limit, then, we would expect that</p>
<p><span class="math display">\[
\frac{d}{dx} \int_a^x f(u) du = f(x).
\]</span></p>
<p>With these heuristics, we now have:</p>
<blockquote class="blockquote">
<p><strong>The fundamental theorem of calculus</strong></p>
<p>Part 1: Let <span class="math inline">\(f\)</span> be a continuous function on a closed interval <span class="math inline">\([a,b]\)</span> and define <span class="math inline">\(F(x) = \int_a^x f(u) du\)</span> for <span class="math inline">\(a \leq x \leq b\)</span>. Then <span class="math inline">\(F\)</span> is continuous on <span class="math inline">\([a,b]\)</span>, differentiable on <span class="math inline">\((a,b)\)</span> and moreover, <span class="math inline">\(F'(x) =f(x)\)</span>.</p>
<p>Part 2: Now suppose <span class="math inline">\(f\)</span> is any integrable function on a closed interval <span class="math inline">\([a,b]\)</span> and <span class="math inline">\(F(x)\)</span> is <em>any</em> differentiable function on <span class="math inline">\([a,b]\)</span> with <span class="math inline">\(F'(x) = f(x)\)</span>. Then <span class="math inline">\(\int_a^b f(x)dx=F(b)-F(a)\)</span>.</p>
</blockquote>
<div class="callout-note callout callout-style-default callout-captioned">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-caption-container flex-fill">
Note
</div>
</div>
<div class="callout-body-container callout-body">
<p>In Part 1, the integral <span class="math inline">\(F(x) = \int_a^x f(u) du\)</span> is defined for any Riemann integrable function, <span class="math inline">\(f\)</span>. If the function is not continuous, then it is true the <span class="math inline">\(F\)</span> will be continuous, but it need not be true that it is differentiable at all points in <span class="math inline">\((a,b)\)</span>. Forming <span class="math inline">\(F\)</span> from <span class="math inline">\(f\)</span> is a form of <em>smoothing</em>. It makes a continuous function out of an integrable one, a differentiable function from a continuous one, and a <span class="math inline">\(k+1\)</span>-times differentiable function from a <span class="math inline">\(k\)</span>-times differentiable one.</p>
</div>
</div>
<section id="using-the-fundamental-theorem-of-calculus-to-evaluate-definite-integrals" class="level2" data-number="37.1">
<h2 data-number="37.1" class="anchored" data-anchor-id="using-the-fundamental-theorem-of-calculus-to-evaluate-definite-integrals"><span class="header-section-number">37.1</span> Using the fundamental theorem of calculus to evaluate definite integrals</h2>
<p>The major use of the FTC is the computation of <span class="math inline">\(\int_a^b f(x) dx\)</span>. Rather then resort to Riemann sums or geometric arguments, there is an alternative - <em>when possible</em>, find a function <span class="math inline">\(F\)</span> with <span class="math inline">\(F'(x) = f(x)\)</span> and compute <span class="math inline">\(F(b) - F(a)\)</span>.</p>
<p>Some examples:</p>
<ul>
<li>Consider the problem of Archimedes, <span class="math inline">\(\int_0^1 x^2 dx\)</span>. Clearly, we have with <span class="math inline">\(f(x) = x^2\)</span> that <span class="math inline">\(F(x)=x^3/3\)</span> will satisfy the assumptions of the FTC, so that:</li>
</ul>
<p><span class="math display">\[
\int_0^1 x^2 dx = F(1) - F(0) = \frac{1^3}{3} - \frac{0^3}{3} = \frac{1}{3}.
\]</span></p>
<ul>
<li>More generally, we know if <span class="math inline">\(n\neq-1\)</span> that if <span class="math inline">\(f(x) = x^{n}\)</span>, that</li>
</ul>
<p><span class="math display">\[
F(x) = x^{n+1}/(n+1)
\]</span></p>
<p>will satisfy <span class="math inline">\(F'(x)=f(x)\)</span>, so that</p>
<p><span class="math display">\[
\int_a^b x^n dx = \frac{b^{n+1} - a^{n+1}}{n+1}, \quad n\neq -1.
\]</span></p>
<p>(Well almost! We must be careful to know that <span class="math inline">\(a \cdot b &gt; 0\)</span>, as otherwise we will encounter a place where <span class="math inline">\(f(x)\)</span> may not be integrable.)</p>
<p>We note that the above includes the case of a constant, or <span class="math inline">\(n=0\)</span>.</p>
<p>What about the case <span class="math inline">\(n=-1\)</span>, or <span class="math inline">\(f(x) = 1/x\)</span>, that is not covered by the above? For this special case, it is known that <span class="math inline">\(F(x) = \log(x)\)</span> (natural log) will have <span class="math inline">\(F'(x) = 1/x\)</span>. This gives for <span class="math inline">\(0 &lt; a &lt; b\)</span>:</p>
<p><span class="math display">\[
\int_a^b \frac{1}{x} dx = \log(b) - \log(a).
\]</span></p>
<ul>
<li>Let <span class="math inline">\(f(x) = \cos(x)\)</span>. How much area is between <span class="math inline">\(-\pi/2\)</span> and <span class="math inline">\(\pi/2\)</span>? We have that <span class="math inline">\(F(x) = \sin(x)\)</span> will have <span class="math inline">\(F'(x) = f(x)\)</span>, so:</li>
</ul>
<p><span class="math display">\[
\int_{-\pi/2}^{\pi/2} \cos(x) dx = F(\pi/2) - F(-\pi/2) = 1 - (-1) = 2.
\]</span></p>
<section id="an-alternate-notation-for-fb---fa" class="level3" data-number="37.1.1">
<h3 data-number="37.1.1" class="anchored" data-anchor-id="an-alternate-notation-for-fb---fa"><span class="header-section-number">37.1.1</span> An alternate notation for <span class="math inline">\(F(b) - F(a)\)</span></h3>
<p>The expression <span class="math inline">\(F(b) - F(a)\)</span> is often written in this more compact form:</p>
<p><span class="math display">\[
\int_a^b f(x) dx = F(b) - F(a) = F(x)\big|_{x=a}^b, \text{ or just expr}\big|_{x=a}^b.
\]</span></p>
<p>The vertical bar is used for the <em>evaluation</em> step, in this case the <span class="math inline">\(a\)</span> and <span class="math inline">\(b\)</span> mirror that of the definite integral. This notation lends itself to working inline, as we illustrate with this next problem where we “know” a function “<span class="math inline">\(F\)</span>”, so just express it “inline”:</p>
<p><span class="math display">\[
\int_0^{\pi/4} \sec^2(x) dx = \tan(x) \big|_{x=0}^{\pi/4} = 1 - 0 = 1.
\]</span></p>
<p>A consequence of this notation is:</p>
<p><span class="math display">\[
F(x) \big|_{x=a}^b = -F(x) \big|_{x=b}^a.
\]</span></p>
<p>This says nothing more than <span class="math inline">\(F(b)-F(a) = -F(a) - (-F(b))\)</span>, though more compactly.</p>
</section>
</section>
<section id="the-indefinite-integral" class="level2" data-number="37.2">
<h2 data-number="37.2" class="anchored" data-anchor-id="the-indefinite-integral"><span class="header-section-number">37.2</span> The indefinite integral</h2>
<p>A function <span class="math inline">\(F(x)\)</span> with <span class="math inline">\(F'(x) = f(x)\)</span> is known as an <em>antiderivative</em> of <span class="math inline">\(f\)</span>. For a given <span class="math inline">\(f\)</span>, there are infinitely many antiderivatives: if <span class="math inline">\(F(x)\)</span> is one, then so is <span class="math inline">\(G(x) = F(x) + C\)</span>. But - due to the mean value theorem - all antiderivatives for <span class="math inline">\(f\)</span> differ at most by a constant.</p>
<p>The <strong>indefinite integral</strong> of <span class="math inline">\(f(x)\)</span> is denoted by:</p>
<p><span class="math display">\[
\int f(x) dx.
\]</span></p>
<p>(There are no limits of integration.) There are two possible definitions: this refers to the set of <em>all</em> antiderivatives, or is just one of the set of all antiderivatives for <span class="math inline">\(f\)</span>. The former gives rise to expressions such as</p>
<p><span class="math display">\[
\int x^2 dx = \frac{x^3}{3} + C
\]</span></p>
<p>where <span class="math inline">\(C\)</span> is the <em>constant of integration</em> and isnt really a fixed constant, but any possible constant. These notes will follow the lead of <code>SymPy</code> and not give a <span class="math inline">\(C\)</span> in the expression, but instead rely on the reader to understand that there could be many other possible expressions given, though all differ by no more than a constant. This means, that <span class="math inline">\(\int f(x) dx\)</span> refers to <em>an</em> antiderivative, not <em>the</em> collection of all antiderivatives.</p>
<section id="the-integrate-function-from-sympy" class="level3" data-number="37.2.1">
<h3 data-number="37.2.1" class="anchored" data-anchor-id="the-integrate-function-from-sympy"><span class="header-section-number">37.2.1</span> The <code>integrate</code> function from <code>SymPy</code></h3>
<p><code>SymPy</code> provides the <code>integrate</code> function to perform integration. There are two usages:</p>
<ul>
<li><code>integrate(ex, var)</code> to find an antiderivative</li>
<li><code>integrate(ex, (var, a, b))</code> to find the definite integral. This integrates the expression in the variable <code>var</code> from <code>a</code> to <code>b</code>.</li>
</ul>
<p>To illustrate, we have, this call finds an antiderivative:</p>
<div class="cell" data-execution_count="4">
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="pp">@syms</span> x</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="fu">integrate</span>(<span class="fu">sin</span>(x),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="5">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
- \cos{\left(x \right)}
\]
</span>
</div>
</div>
<p>Whereas this call computes the “area” under <span class="math inline">\(f(x)\)</span> between <code>a</code> and <code>b</code>:</p>
<div class="cell" data-execution_count="5">
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="fu">integrate</span>(<span class="fu">sin</span>(x), (x, <span class="fl">0</span>, <span class="cn">pi</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="6">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
2.0
\]
</span>
</div>
</div>
<p>As does this for a different function:</p>
<div class="cell" data-execution_count="6">
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">integrate</span>(<span class="fu">acos</span>(<span class="fl">1</span><span class="op">-</span>x), (x, <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="7">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
\pi
\]
</span>
</div>
</div>
<p>Answers may depend on conditions, as here, where the case <span class="math inline">\(n=-1\)</span> breaks a pattern:</p>
<div class="cell" data-hold="true" data-execution_count="7">
<div class="sourceCode cell-code" id="cb5"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="pp">@syms</span> x<span class="op">::</span><span class="dt">real </span>n<span class="op">::</span><span class="dt">real</span></span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="fu">integrate</span>(x<span class="op">^</span>n, x) <span class="co"># indefinite integral</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="8">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
\begin{cases} \frac{x^{n + 1}}{n + 1} &amp; \text{for}\: n \neq -1 \\\log{\left(x \right)} &amp; \text{otherwise} \end{cases}
\]
</span>
</div>
</div>
<p>Answers may depend on specific assumptions:</p>
<div class="cell" data-hold="true" 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="pp">@syms</span> u</span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a><span class="fu">integrate</span>(<span class="fu">abs</span>(u),u)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="9">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
\int \left|{u}\right|\, du
\]
</span>
</div>
</div>
<p>Yet</p>
<div class="cell" data-hold="true" data-execution_count="9">
<div class="sourceCode cell-code" id="cb7"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="pp">@syms</span> u<span class="op">::</span><span class="dt">real</span></span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="fu">integrate</span>(<span class="fu">abs</span>(u),u)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="10">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
\begin{cases} - \frac{u^{2}}{2} &amp; \text{for}\: u \leq 0 \\\frac{u^{2}}{2} &amp; \text{otherwise} \end{cases}
\]
</span>
</div>
</div>
<p>Answers may not be available as elementary functions, but there may be special functions that have special cases.</p>
<div class="cell" data-hold="true" data-execution_count="10">
<div class="sourceCode cell-code" id="cb8"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="pp">@syms</span> x<span class="op">::</span><span class="dt">real</span></span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a><span class="fu">integrate</span>(x <span class="op">/</span> <span class="fu">sqrt</span>(<span class="fl">1</span><span class="op">-</span>x<span class="op">^</span><span class="fl">3</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="11">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
\frac{x^{2} \Gamma\left(\frac{2}{3}\right) {{}_{2}F_{1}\left(\begin{matrix} \frac{1}{2}, \frac{2}{3} \\ \frac{5}{3} \end{matrix}\middle| {x^{3} e^{2 i \pi}} \right)}}{3 \Gamma\left(\frac{5}{3}\right)}
\]
</span>
</div>
</div>
<p>The different cases explored by <code>integrate</code> are after the questions.</p>
</section>
</section>
<section id="rules-of-integration" class="level2" data-number="37.3">
<h2 data-number="37.3" class="anchored" data-anchor-id="rules-of-integration"><span class="header-section-number">37.3</span> Rules of integration</h2>
<p>There are some “rules” of integration that allow integrals to be re-expressed. These follow from the rules of derivatives.</p>
<ul>
<li>The integral of a constant times a function:</li>
</ul>
<p><span class="math display">\[
\int c \cdot f(x) dx = c \cdot \int f(x) dx.
\]</span></p>
<p>This follows as if <span class="math inline">\(F(x)\)</span> is an antiderivative of <span class="math inline">\(f(x)\)</span>, then <span class="math inline">\([cF(x)]' = c f(x)\)</span> by rules of derivatives.</p>
<ul>
<li>The integral of a sum of functions:</li>
</ul>
<p><span class="math display">\[
\int (f(x) + g(x)) dx = \int f(x) dx + \int g(x) dx.
\]</span></p>
<p>This follows immediately as if <span class="math inline">\(F(x)\)</span> and <span class="math inline">\(G(x)\)</span> are antiderivatives of <span class="math inline">\(f(x)\)</span> and <span class="math inline">\(g(x)\)</span>, then <span class="math inline">\([F(x) + G(x)]' = f(x) + g(x)\)</span>, so the right hand side will have a derivative of <span class="math inline">\(f(x) + g(x)\)</span>.</p>
<p>In fact, this more general form where <span class="math inline">\(c\)</span> and <span class="math inline">\(d\)</span> are constants covers both cases:</p>
<p><span class="math display">\[
\int (cf(x) + dg(x)) dx = c \int f(x) dx + d \int g(x) dx.
\]</span></p>
<p>This statement is nothing more than the derivative formula <span class="math inline">\([cf(x) + dg(x)]' = cf'(x) + dg'(x)\)</span>. The product rule gives rise to a technique called <em>integration by parts</em> and the chain rule gives rise to a technique of <em>integration by substitution</em>, but we defer those discussions to other sections.</p>
<section id="examples" class="level5">
<h5 class="anchored" data-anchor-id="examples">Examples</h5>
<ul>
<li>The antiderivative of the polynomial <span class="math inline">\(p(x) = a_n x^n + \cdots a_1 x + a_0\)</span> follows from the linearity of the integral and the general power rule:</li>
</ul>
<p><span class="math display">\[
\begin{align}
\int (a_n x^n + \cdots a_1 x + a_0) dx
&amp;= \int a_nx^n dx + \cdots \int a_1 x dx + \int a_0 dx \\
&amp;= a_n \int x^n dx + \cdots + a_1 \int x dx + a_0 \int dx \\
&amp;= a_n\frac{x^{n+1}}{n+1} + \cdots + a_1 \frac{x^2}{2} + a_0 \frac{x}{1}.
\end{align}
\]</span></p>
<ul>
<li>More generally, a <a href="https://en.wikipedia.org/wiki/Laurent_polynomial">Laurent</a> polynomial allows for terms with negative powers. These too can be handled by the above. For example</li>
</ul>
<p><span class="math display">\[
\begin{align}
\int (\frac{2}{x} + 2 + 2x) dx
&amp;= \int \frac{2}{x} dx + \int 2 dx + \int 2x dx \\
&amp;= 2\int \frac{1}{x} dx + 2 \int dx + 2 \int xdx\\
&amp;= 2\log(x) + 2x + 2\frac{x^2}{2}.
\end{align}
\]</span></p>
<ul>
<li>Consider this integral:</li>
</ul>
<p><span class="math display">\[
\int_0^\pi 100 \sin(x) dx = F(\pi) - F(0),
\]</span></p>
<p>where <span class="math inline">\(F(x)\)</span> is an antiderivative of <span class="math inline">\(100\sin(x)\)</span>. But:</p>
<p><span class="math display">\[
\int 100 \sin(x) dx = 100 \int \sin(x) dx = 100 (-\cos(x)).
\]</span></p>
<p>So the answer to the question is</p>
<p><span class="math display">\[
\int_0^\pi 100 \sin(x) dx = (100 (-\cos(\pi))) - (100(-\cos(0))) = (100(-(-1))) - (100(-1)) = 200.
\]</span></p>
<p>This seems like a lot of work, and indeed it is more than is needed. The following would be more typical once the rules are learned:</p>
<p><span class="math display">\[
\int_0^\pi 100 \sin(x) dx = -100(-\cos(x)) \big|_0^{\pi} = 100 \cos(x) \big|_{\pi}^0 = 100(1) - 100(-1) = 200.
\]</span></p>
</section>
</section>
<section id="the-derivative-of-the-integral" class="level2" data-number="37.4">
<h2 data-number="37.4" class="anchored" data-anchor-id="the-derivative-of-the-integral"><span class="header-section-number">37.4</span> The derivative of the integral</h2>
<p>The relationship that <span class="math inline">\([\int_a^x f(u) du]' = f(x)\)</span> is a bit harder to appreciate, as it doesnt help answer many ready made questions. Here we give some examples of its use.</p>
<p>First, the expression defining an antiderivative, or indefinite integral, is given in term of a definite integral:</p>
<p><span class="math display">\[
F(x) = \int_a^x f(u) du.
\]</span></p>
<p>The value of <span class="math inline">\(a\)</span> does not matter, as long as the integral is defined.</p>
<div class="cell" data-cache="true" data-hold="true" data-execution_count="11">
<div class="cell-output cell-output-display" data-execution_count="12">
<div class="d-flex justify-content-center"> <figure class="figure"> <img src="data:image/gif;base64,R0lGODlhAANAAvcBAAAAAAD/AAR7wwUFBQkIBQoKCgwODA1fkRAQEBESEhIWFhak+hcRBBcnLBec7Rej+Rek+hik+hkZGRml+hoXDBql+xul+h0dHR2m+h2m+x40PCEhISGo+yMjIyQbCCQmJiWp+yWq+yeq+ieq+yhEUCsrKywcACwiDSw6Qyys+y8oGzElDzExMTIlCjJXaTKu+zQoETQuIzQ0MzRTYjUvJDYpETYwJTY2Njac2jcpEDcxJjg4ODix+zkzKDk5OTorETs1Kjs7Ozuy+zwmADwtETw8PD0tET03LD09PT4+Pj9GSUFAQEFjdUJCQkMwCUO1+kREREZGRUgvAEg9KEhISEpKSkxxhky5+01NTVBQUFNTU1O7/FRUVFVVVVY7BlZ6jle48lhYWFi+/Fq8+VxcXF2//F2//GBgYGJEDWOInmRCAmRkZGTC/GZfUmbD/GjA9mjD/GjE/GtHBGtra2yQpWzF/G52em7G/HBvbnFxcXTI+3XJ/HZPCXd3d3h4eHp6enqcsXrL/HtRAn7G837M/ICAgIODg4SEhISzz4WFhYXP/YhYAImJiYrR/YyMjIynuI/S/ZHR+JJfAJKSkpaWlZaywpbP8pfW/ZmZmZ6enqDZ/aFoAKOjo6e/zampqand/aurq6vD0a6urrByALHg/bLh/bOzs7a2trbi/ri4uLrK07u7u7vk/r3l/b6+vsF9AMPU3sPn/sXFxcXo/smCAMnJycqDAMrq/cvLy8zLyM2FAM3Nzc7Ozs/s/dDQ0NHt/tKIANLS0tLt/tPT09Pc4dSJANTu/tXV1dbW1tbi6dbu/NfX19jw/tnw/tra2tyOANzx/d3d3d7e3uDi4+Dz/uLz/uL0/uP0/uXVuOXl5efw9uj2/+rq6ur3/+yYAO3t7e34/+34//Dw8PH2+fH5//H6//Pz8/T09PXjwvX19fX7/vb7//f39/igAPj4+Pr6+vr8/vzz5fz8/P39/P3+/v7sy/7+/v+lAP/tzf/tzv/68v/68//78//79f/8+P///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQFZAABACwAAAAAAANAAocAAAAA/wAEe8MFBQUJCAUKCgoMDgwNX5EQEBAREhISFhYWpPoXEQQXJywXnO0Xo/kXpPoYpPoZGRkZpfoaFwwapfsbpfodHR0dpvodpvseNDwhISEhqPsjIyMkGwgkJiYlqfslqvsnqvonqvsoRFArKyssHAAsIg0sOkMsrPsvKBsxJQ8xMTEyJQoyV2kyrvs0KBE0LiM0NDM0U2I1LyQ2KRE2MCU2NjY2nNo3KRA3MSY4ODg4sfs5Myg5OTk6KxE7NSo7Ozs7svs8JgA8LRE8PDw9LRE9Nyw9PT0+Pj4/RklBQEBBY3VCQkJDMAlDtfpERERGRkVILwBIPShISEhKSkpMcYZMuftNTU1QUFBTU1NTu/xUVFRVVVVWOwZWeo5XuPJYWFhYvvxavPlcXFxdv/xgYGBiRA1jiJ5kQgJkZGRkwvxmX1Jmw/xowPZow/xoxPxrRwRra2tskKVsxfxudnpuxvxwb25xcXF0yPt1yfx2Twl3d3d4eHh6enp6nLF6y/x7UQJ+xvN+zPyAgICDg4OEhISEs8+FhYWFz/2IWACJiYmK0f2MjIyMp7iP0v2R0fiSXwCSkpKWlpWWssKWz/KX1v2ZmZmenp6g2f2haACjo6Onv82pqamp3f2rq6urw9Gurq6wcgCx4P2y4f2zs7O2tra24v64uLi6ytO7u7u75P695f2+vr7BfQDD1N7D5/7FxcXF6P7JggDJycnKgwDK6v3Ly8vMy8jNhQDNzc3Ozs7P7P3Q0NDR7f7SiADS0tLS7f7T09PT3OHUiQDU7v7V1dXW1tbW4unW7vzX19fY8P7Z8P7a2trcjgDc8f3d3d3e3t7g4uPg8/7i8/7i9P7j9P7l1bjl5eXn8Pbo9v/q6urq9//smADt7e3t+P/w8PDx9vnx+f/x+v/z8/P09PT148L19fX1+/72+//39/f4oAD4+Pj6+vr6/P788+X8/Pz9/fz9/v7+7Mv+/v7/pQD/7c3/7c7/+vL/+vP/+/P/+/X//Pj///////////8I/wD7CRxIsKDBgwgTKlzIsKHDhxAjSpxIsaLFixgzatzIsaPHjyBDihxJsqTJkyhTqlzJsqXLlzBjypxJs6bNmzhz6tzJs6fPn0CDCh1KtKjRo0iTKl3KtKnTp1CjSp1KtarVq1izat3KtavXr2DDih1LtqzZsyDxyFh7B63bt3Djyp3rEMskaNCw0d3Lt6/fv1KxdAJMuLDhw4hjYklgoEishe3w4iWXuLLly5gPG2PXTpICcAoJfWBBuhO506hTq17NurXr17Bjy55Nu7bt27hzt96mu7fv38CDCx8unDfx48iTK1+u3Djz2+o2blClkMynzF7L0cPelTJ3rt6hnv9LcKv69e9ataPXGn791fZKz5nZtGlJEnjm3WNVr98q/P5S/YcUPJLIocYl7CxkHYBV8cdggA9SJSBWC0YYlYMWOjVhhkltaFWFHDaFYYhKeUgiUSZSBeKJSY3IolEpvvhTjFKtKGNRLt4oFI066sQjVDb2GFSOQvr0Y5E1HelUkEj2RGSTPkK541dMSpnTk1bapGSWLW3JVJVc1oRlmDJ5SSZKZioF5pkxjcmmS2m+OVKcSK0pZ0tu3qkSnXp6xKdRdvaZUp6CmvRnoRkdSlSgiJZEaKMiKQopRZIKxeikIT2KqZ+bdknleZ0Oul2oKVVKKkOmAnXpqRppyupFqb7/elCsPq0qq0Wu3joRrboKxCtPtvYqUa7CPvSrrsfqFGyxDxHLLKrPfpRsTstGu5Cz1iI07avb3lRttghhC25B3Z5abk3fjluQuOr62i5G59KU7rv9sNtuvJ3iK9O879qrrr6YAgwTv+36O67AkCLsEsHqGgyuwohCzBLD4zqcrcSCYqwSxeBabK3GeoKMEsfZehytyHKibBLJ1pr8rMpswkwSy9G6zKzMZOIsEs3P2lyszlwCDRLPzPosrNBWIu0R0cUa3avSUELNEdPCOo0svRZJvRHVvVp9q9ZFgp0R17p6LavYPaJ9Edm3ms0t1hWpbRHbsrrNqtwy4k0R3a/a/20u3JR+Cviwow5urOER6T0R36z6TariJ0IeEeOnOh6q5CFi/hDlpFqeL+IQae4Q56F6vqnoFqLOEOmdmh4w6Id7xfqmrk+q+oO35wc7Q7UnvHtDuSc0O6a9Nxp8f8cfNPykxUf8O7Syg/r8Qc0Xmrx71xe0PKTVZzy9QtkTtH2j3fcZ/nfnCzQ+ouWH/H1C6fezfqHt3xl/ZvHPL2j9Kb+vreD+W1fhAuguAhIkf9IjIP/edD/MINCAA1lgzCA4kAdSUIJnauBlLAhBDOaMggXsiv765MEwadAyHDRgCYMGwn6kUIEDJOAJK/PCAK4wSzNMTA39d8OktXCH7+uhlP9yiBggfk+IUfshADsYwwAS8TBGnB4Sm/REw0TxeVNEUhULc8XfZTFsSoweCL8opC0Spou7I2PawijCBNqwif4zI2DQCDs16kiOf6Ej6Ox4Izz6RY+I42Pe2MiVEepJkC/yY18AaThEskiRfGHk4BwZOUJuxZB3oiSJILkXSQJOk5mzpFYwKSdQcoiTdPEk3EyZIVTORZVYY2XqRJkVUr5JlhFypVxgSS9c4o6WFHIjD+H4Pl3GhZf9Iub3jAkXZBZMmdNj5luc2TBoPk+abqFmxaz5O2yiRZsd4+buvHkWcJZMnLAjp1nM2TJ0gk6dZWFnzdyJOHiSRZ49o6fh7Dn/FnwWTZ+D46dYNMeHBERDQcIMIkABJ9CwYI4WURhAMxA6xoXCraFgkRw7btAMiVL0ghbFGka/Ijk/LKIfHlVIGAihipbq5Y0gHKlXINcLGbQDpRNVSBZKsISehuI5QA2qUIc6HOcQ9ahITapSVWPUpTr1qVAlTlOjGp2KZAELf
<figcaption class="figure-caption"><div class="markdown"><p>Illustration showing \(F(x) = \int_a^x f(u) du\) is a function that accumulates area. The value of \(A\) is the area over \([x_{n-1}, x_n]\) and also the difference \(F(x_n) - F(x_{n-1})\).</p>
</div> </figcaption>
</figure>
</div>
</div>
</div>
<p>The picture for this, for non-negative <span class="math inline">\(f\)</span>, is of accumulating area as <span class="math inline">\(x\)</span> increases. It can be used to give insight into some formulas:</p>
<p>For any function, we know that <span class="math inline">\(F(b) - F(c) + F(c) - F(a) = F(b) - F(a)\)</span>. For this specific function, this translates into this property of the integral:</p>
<p><span class="math display">\[
\int_a^b f(x) dx = \int_a^c f(x) dx + \int_c^b f(x) dx.
\]</span></p>
<p>Similarly, <span class="math inline">\(\int_a^a f(x) dx = F(a) - F(a) = 0\)</span> follows.</p>
<p>To see that the value of <span class="math inline">\(a\)</span> does not matter, consider <span class="math inline">\(a_0 &lt; a_1\)</span>. Then we have with</p>
<p><span class="math display">\[
F(x) = \int_{a_0}^x f(u)du, \quad G(x) = \int_{a_0}^x f(u)du,
\]</span></p>
<p>That <span class="math inline">\(F(x) = G(x) + \int_{a_0}^{a_1} f(u) du\)</span>. The additional part may look complicated, but the point is that as far as <span class="math inline">\(x\)</span> is involved, it is a constant. Hence both <span class="math inline">\(F\)</span> and <span class="math inline">\(G\)</span> are antiderivatives if either one is.</p>
<section id="example" class="level5">
<h5 class="anchored" data-anchor-id="example">Example</h5>
<p>From the familiar formula rate <span class="math inline">\(\times\)</span> time <span class="math inline">\(=\)</span> distance, we “know,” for example, that a car traveling 60 miles an hour for one hour will have traveled 60 miles. This allows us to translate statements about the speed (or more generally velocity) into statements about position at a given time. If the speed is not constant, we dont have such an easy conversion.</p>
<p>Suppose our velocity at time <span class="math inline">\(t\)</span> is <span class="math inline">\(v(t)\)</span>, and always positive. We want to find the position at time <span class="math inline">\(t\)</span>, <span class="math inline">\(x(t)\)</span>. Lets assume <span class="math inline">\(x(0) = 0\)</span>. Let <span class="math inline">\(h\)</span> be some small time step, say <span class="math inline">\(h=(t - 0)/n\)</span> for some large <span class="math inline">\(n&gt;0\)</span>. Then we can <em>approximate</em> <span class="math inline">\(v(t)\)</span> between <span class="math inline">\([ih, (i+1)h)\)</span> by <span class="math inline">\(v(ih)\)</span>. This is a constant so the change in position over the time interval <span class="math inline">\([ih, (i+1)h)\)</span> would simply be <span class="math inline">\(v(ih) \cdot h\)</span>, and ignoring the accumulated errors, the approximate position at time <span class="math inline">\(t\)</span> would be found by adding this pieces together: <span class="math inline">\(x(t) \approx v(0h)\cdot h + v(1h)\cdot h + v(2h) \cdot h + \cdots + v(nh)h\)</span>. But we recognize this (as did <a href="http://www.math.harvard.edu/~knill/teaching/math1a_2011/exhibits/bressoud/">Beeckman</a> in 1618) as nothing more than an approximation for the Riemann sum of <span class="math inline">\(v\)</span> over the interval <span class="math inline">\([0, t]\)</span>. That is, we expect:</p>
<p><span class="math display">\[
x(t) = \int_0^t v(u) du.
\]</span></p>
<p>Hopefully this makes sense: our position is the result of accumulating our change in position over small units of time. The old one-foot-in-front-of-another approach to walking out the door.</p>
<p>The above was simplified by the assumption that <span class="math inline">\(x(0) = 0\)</span>. What if <span class="math inline">\(x(0) = x_0\)</span> for some non-zero value. Then the above is not exactly correct, as <span class="math inline">\(\int_0^0 v(u) du = 0\)</span>. So instead, we might write this more concretely as:</p>
<p><span class="math display">\[
x(t) = x_0 + \int_0^t v(u) du.
\]</span></p>
<p>There is a similar relationship between velocity and acceleration, but lets think about it formally. If we know that the acceleration is the rate of change of velocity, then we have <span class="math inline">\(a(t) = v'(t)\)</span>. By the FTC, then</p>
<p><span class="math display">\[
\int_0^t a(u) du = \int_0^t v'(t) = v(t) - v(0).
\]</span></p>
<p>Rewriting gives a similar statement as before:</p>
<p><span class="math display">\[
v(t) = v_0 + \int_0^t a(u) du.
\]</span></p>
</section>
<section id="example-1" class="level5">
<h5 class="anchored" data-anchor-id="example-1">Example</h5>
<p>In probability theory, for a positive, continuous random variable, the probability that the random value is less than <span class="math inline">\(a\)</span> is given by <span class="math inline">\(P(X \leq a) = F(a) = \int_{0}^a f(x) dx\)</span>. (Positive means the integral starts at <span class="math inline">\(0\)</span>, whereas in general it could be <span class="math inline">\(-\infty\)</span>, a minor complication that we havent yet discussed.)</p>
<p>For example, the exponential distribution with rate <span class="math inline">\(1\)</span> has <span class="math inline">\(f(x) = e^{-x}\)</span>. Compute <span class="math inline">\(F(x)\)</span>.</p>
<p>This is just <span class="math inline">\(F(x) = \int_0^x e^{-u} du = -e^{-u}\big|_0^x = 1 - e^{-x}\)</span>.</p>
<p>The “uniform” distribution on <span class="math inline">\([a,b]\)</span> has</p>
<p><span class="math display">\[
F(x) =
\begin{cases}
0 &amp; x &lt; a\\
\frac{x-a}{b-a} &amp; a \leq x \leq b\\
1 &amp; x &gt; b
\end{cases}
\]</span></p>
<p>Find <span class="math inline">\(f(x)\)</span>. There are some subtleties here. If we assume that <span class="math inline">\(F(x) = \int_0^x f(u) du\)</span> then we know if <span class="math inline">\(f(x)\)</span> is continuous that <span class="math inline">\(F'(x) = f(x)\)</span>. Differentiating we get</p>
<p><span class="math display">\[
f(x) = \begin{cases}
0 &amp; x &lt; a\\
\frac{1}{b-a} &amp; a &lt; x &lt; b\\
0 &amp; x &gt; b
\end{cases}
\]</span></p>
<p>However, the function <span class="math inline">\(f\)</span> is <em>not</em> continuous on <span class="math inline">\([a,b]\)</span> and <span class="math inline">\(F'(x)\)</span> is not differentiable on <span class="math inline">\((a,b)\)</span>. It is true that <span class="math inline">\(f\)</span> is integrable, and where <span class="math inline">\(F\)</span> is differentiable <span class="math inline">\(F'=f\)</span>. So <span class="math inline">\(f\)</span> is determined except possibly at the points <span class="math inline">\(x=a\)</span> and <span class="math inline">\(x=b\)</span>.</p>
</section>
<section id="example-2" class="level5">
<h5 class="anchored" data-anchor-id="example-2">Example</h5>
<p>The error function is defined by <span class="math inline">\(\text{erf}(x) = 2/\sqrt{\pi}\int_0^x e^{-u^2} du\)</span>. It is implemented in <code>Julia</code> through <code>erf</code>. Suppose, we were to ask where it takes on its maximum value, what would we find?</p>
<p>The answer will either be at a critical point, at <span class="math inline">\(0\)</span> or as <span class="math inline">\(x\)</span> goes to <span class="math inline">\(\infty\)</span>. We can differentiate to find critical points:</p>
<p><span class="math display">\[
[\text{erf}(x)] = \frac{2}{\pi}e^{-x^2}.
\]</span></p>
<p>Oh, this is never <span class="math inline">\(0\)</span>, so there are no critical points. The maximum occurs at <span class="math inline">\(0\)</span> or as <span class="math inline">\(x\)</span> goes to <span class="math inline">\(\infty\)</span>. Clearly at <span class="math inline">\(0\)</span>, we have <span class="math inline">\(\text{erf}(0)=0\)</span>, so the answer will be as <span class="math inline">\(x\)</span> goes to <span class="math inline">\(\infty\)</span>.</p>
<p>In retrospect, this is a silly question. As <span class="math inline">\(f(x) &gt; 0\)</span> for all <span class="math inline">\(x\)</span>, we <em>must</em> have that <span class="math inline">\(F(x)\)</span> is strictly increasing, so never gets to a local maximum.</p>
</section>
<section id="example-3" class="level5">
<h5 class="anchored" data-anchor-id="example-3">Example</h5>
<p>The <a href="http://en.wikipedia.org/wiki/Dawson_function">Dawson</a> function is</p>
<p><span class="math display">\[
F(x) = e^{-x^2} \int_0^x e^{t^2} dt
\]</span></p>
<p>Characterize any local maxima or minima.</p>
<p>For this we need to consider the product rule. The fundamental theorem of calculus will help with the right-hand side. We have:</p>
<p><span class="math display">\[
F'(x) = (-2x)e^{-x^2} \int_0^x e^{t^2} dt + e^{-x^2} e^{x^2} = -2x F(x) + 1
\]</span></p>
<p>We need to figure out when this is <span class="math inline">\(0\)</span>. For that, we use some numeric math.</p>
<div class="cell" data-execution_count="12">
<div class="sourceCode cell-code" id="cb9"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="fu">F</span>(x) <span class="op">=</span> <span class="fu">exp</span>(<span class="op">-</span>x<span class="op">^</span><span class="fl">2</span>) <span class="op">*</span> <span class="fu">quadgk</span>(t <span class="op">-&gt;</span> <span class="fu">exp</span>(t<span class="op">^</span><span class="fl">2</span>), <span class="fl">0</span>, x)[<span class="fl">1</span>]</span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="fu">Fp</span>(x) <span class="op">=</span> <span class="fu">-2x*F</span>(x) <span class="op">+</span> <span class="fl">1</span></span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a>cps <span class="op">=</span> <span class="fu">find_zeros</span>(Fp, <span class="op">-</span><span class="fl">4</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="13">
<pre><code>2-element Vector{Float64}:
-0.9241388730045916
0.9241388730045916</code></pre>
</div>
</div>
<p>We could take a second derivative to characterize. For that we use <span class="math inline">\(F''(x) = [-2xF(x) + 1]' = -2F(x) + -2x(-2xF(x) + 1)\)</span>, so</p>
<div class="cell" data-execution_count="13">
<div class="sourceCode cell-code" id="cb11"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="fu">Fpp</span>(x) <span class="op">=</span> <span class="fu">-2F</span>(x) <span class="op">+</span> <span class="fl">4</span>x<span class="op">^</span><span class="fl">2</span><span class="fu">*F</span>(x) <span class="op">-</span> <span class="fl">2</span>x</span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a><span class="fu">Fpp</span>.(cps)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="14">
<pre><code>2-element Vector{Float64}:
1.0820884492703637
-1.0820884492703637</code></pre>
</div>
</div>
<p>The first value being positive says there is a relative minimum at <span class="math inline">\(-0.924139\)</span>, at <span class="math inline">\(0.924139\)</span> there is a relative maximum.</p>
</section>
<section id="example-4" class="level5">
<h5 class="anchored" data-anchor-id="example-4">Example</h5>
<p>Returning to probability, suppose there are <span class="math inline">\(n\)</span> positive random numbers <span class="math inline">\(X_1\)</span>, <span class="math inline">\(X_2\)</span>, …, <span class="math inline">\(X_n\)</span>. A natural question might be to ask what formulas describes the largest of these values, assuming each is identical in some way. A description that is helpful is to define <span class="math inline">\(F(a) = P(X \leq a)\)</span> for some random number <span class="math inline">\(X\)</span>. That is the probability that <span class="math inline">\(X\)</span> is less than or equal to <span class="math inline">\(a\)</span> is <span class="math inline">\(F(a)\)</span>. For many situations, there is a <em>density</em> function, <span class="math inline">\(f\)</span>, for which <span class="math inline">\(F(a) = \int_0^a f(x) dx\)</span>.</p>
<p>Under assumptions that the <span class="math inline">\(X\)</span> are identical and independent, the largest value, <span class="math inline">\(M\)</span>, may b characterized by <span class="math inline">\(P(M \leq a) = \left[F(a)\right]^n\)</span>. Using <span class="math inline">\(f\)</span> and <span class="math inline">\(F\)</span> describe the derivative of this expression.</p>
<p>This problem is constructed to take advantage of the FTC, and we have:</p>
<p><span class="math display">\[
\begin{align*}
\left[P(M \leq a)\right]'
&amp;= \left[F(a)^n\right]'\\
&amp;= n \cdot F(a)^{n-1} \left[F(a)\right]'\\
&amp;= n F(a)^{n-1}f(a)
\end{align*}
\]</span></p>
</section>
<section id="example-5" class="level5">
<h5 class="anchored" data-anchor-id="example-5">Example</h5>
<p>Suppose again probabilities of a random number between <span class="math inline">\(0\)</span> and <span class="math inline">\(1\)</span>, say, are given by a positive, continuous function <span class="math inline">\(f(x)\)</span>on <span class="math inline">\((0,1)\)</span> by <span class="math inline">\(F(a) = P(X \leq a) = \int_0^a f(x) dx\)</span>. The median value of the random number is a value of <span class="math inline">\(a\)</span> for which <span class="math inline">\(P(X \leq a) = 1/2\)</span>. Such an <span class="math inline">\(a\)</span> makes <span class="math inline">\(X\)</span> a coin toss betting if <span class="math inline">\(X\)</span> is less than <span class="math inline">\(a\)</span> is like betting on heads to come up. More generally the <span class="math inline">\(q\)</span>th quantile of <span class="math inline">\(X\)</span> is a number <span class="math inline">\(a\)</span> with <span class="math inline">\(P(X \leq a) = q\)</span>. The definition is fine, but for a given <span class="math inline">\(f\)</span> and <span class="math inline">\(q\)</span> can we find <span class="math inline">\(a\)</span>?</p>
<p>Abstractly, we are solving <span class="math inline">\(F(a) = q\)</span> or <span class="math inline">\(F(a)-q = 0\)</span> for <span class="math inline">\(a\)</span>. That is, this is a zero-finding question. We have discussed different options for this problem: bisection, a range of derivative free methods, and Newtons method. As evaluating <span class="math inline">\(F\)</span> involves an integral, which may involve many evaluations of <span class="math inline">\(f\)</span>, a method which converges quickly is preferred. For that, Newtons method is a good idea, it having quadratic convergence in this case, as <span class="math inline">\(a\)</span> is a simple zero given that <span class="math inline">\(F\)</span> is increasing under the assumptions above.</p>
<p>Newtons method involves the update step <code>x = x - f(x)/f'(x)</code>. For this “<span class="math inline">\(f\)</span>” is <span class="math inline">\(h(x) = \int_0^x f(u) du - q\)</span>. The derivative is easy, the FTC just applies: <span class="math inline">\(h'(x) = f(x)\)</span>; no need for automatic differentiation, which may not even apply to this setup.</p>
<p>To do a concrete example, we take the <a href="https://en.wikipedia.org/wiki/Beta_distribution">Beta</a>(<span class="math inline">\(\alpha, \beta\)</span>) distribution (<span class="math inline">\(\alpha, \beta &gt; 0\)</span>) which has density, <span class="math inline">\(f\)</span>, over <span class="math inline">\([0,1]\)</span> given by</p>
<p><span class="math display">\[
f(x) = x^{\alpha-1}\cdot (1-x)^{\beta-1} \cdot \frac{\Gamma(\alpha+\beta)}{\Gamma(\alpha)\Gamma(\beta)}
\]</span></p>
<p>The Wikipedia link above gives an approximate answer for the median of <span class="math inline">\((\alpha-1/3)/(\alpha+\beta-2/3)\)</span> when <span class="math inline">\(\alpha,\beta &gt; 1\)</span>. Lets see how correct this is when <span class="math inline">\(\alpha=5\)</span> and <span class="math inline">\(\beta=6\)</span>. The <code>gamma</code> function used below implements <span class="math inline">\(\Gamma\)</span>. It is in the <code>SpecialFunctions</code> package, which is loaded with the <code>CalculusWithJulia</code> package.</p>
<div class="cell" data-execution_count="14">
<div class="sourceCode cell-code" id="cb13"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a>alpha, beta <span class="op">=</span> <span class="fl">5</span>,<span class="fl">6</span></span>
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a><span class="fu">f</span>(x) <span class="op">=</span> x<span class="op">^</span>(alpha<span class="op">-</span><span class="fl">1</span>)<span class="fu">*</span>(<span class="fl">1</span><span class="op">-</span>x)<span class="op">^</span>(beta<span class="op">-</span><span class="fl">1</span>) <span class="op">*</span> <span class="fu">gamma</span>(alpha <span class="op">+</span> beta) <span class="op">/</span> (<span class="fu">gamma</span>(alpha) <span class="op">*</span> <span class="fu">gamma</span>(beta))</span>
<span id="cb13-3"><a href="#cb13-3" aria-hidden="true" tabindex="-1"></a>q <span class="op">=</span> <span class="fl">1</span><span class="op">/</span><span class="fl">2</span></span>
<span id="cb13-4"><a href="#cb13-4" aria-hidden="true" tabindex="-1"></a><span class="fu">h</span>(x) <span class="op">=</span> <span class="fu">first</span>(<span class="fu">quadgk</span>(f, <span class="fl">0</span>, x)) <span class="op">-</span> q</span>
<span id="cb13-5"><a href="#cb13-5" aria-hidden="true" tabindex="-1"></a><span class="fu">hp</span>(x) <span class="op">=</span> <span class="fu">f</span>(x)</span>
<span id="cb13-6"><a href="#cb13-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-7"><a href="#cb13-7" aria-hidden="true" tabindex="-1"></a>x0 <span class="op">=</span> (alpha<span class="op">-</span><span class="fl">1</span><span class="op">/</span><span class="fl">3</span>)<span class="op">/</span>(alpha <span class="op">+</span> beta <span class="op">-</span> <span class="fl">2</span><span class="op">/</span><span class="fl">3</span>)</span>
<span id="cb13-8"><a href="#cb13-8" aria-hidden="true" tabindex="-1"></a>xstar <span class="op">=</span> <span class="fu">find_zero</span>((h, hp), x0, Roots.<span class="fu">Newton</span>())</span>
<span id="cb13-9"><a href="#cb13-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-10"><a href="#cb13-10" aria-hidden="true" tabindex="-1"></a>xstar, 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="15">
<pre><code>(0.4516941562236631, 0.45161290322580644)</code></pre>
</div>
</div>
<p>The asymptotic answer agrees with the answer in the first four decimal places.</p>
<p>As an aside, we ask how many function evaluations were taken? We can track this with a trick - using a closure to record when <span class="math inline">\(f\)</span> is called:</p>
<div class="cell" data-execution_count="15">
<div class="sourceCode cell-code" id="cb15"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="kw">function</span> <span class="fu">FnWrapper</span>(f)</span>
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a> ctr <span class="op">=</span> <span class="fl">0</span></span>
<span id="cb15-3"><a href="#cb15-3" aria-hidden="true" tabindex="-1"></a> <span class="kw">function</span>(x)</span>
<span id="cb15-4"><a href="#cb15-4" aria-hidden="true" tabindex="-1"></a> ctr <span class="op">+=</span> <span class="fl">1</span></span>
<span id="cb15-5"><a href="#cb15-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">f</span>(x)</span>
<span id="cb15-6"><a href="#cb15-6" aria-hidden="true" tabindex="-1"></a> <span class="kw">end</span></span>
<span id="cb15-7"><a href="#cb15-7" 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="16">
<pre><code>FnWrapper (generic function with 1 method)</code></pre>
</div>
</div>
<p>Then we have the above using <code>FnWrapper(f)</code> in place of <code>f</code>:</p>
<div class="cell" data-hold="true" data-execution_count="16">
<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>ff <span class="op">=</span> <span class="fu">FnWrapper</span>(f)</span>
<span id="cb17-2"><a href="#cb17-2" aria-hidden="true" tabindex="-1"></a><span class="fu">F</span>(x) <span class="op">=</span> <span class="fu">first</span>(<span class="fu">quadgk</span>(ff, <span class="fl">0</span>, x))</span>
<span id="cb17-3"><a href="#cb17-3" aria-hidden="true" tabindex="-1"></a><span class="fu">h</span>(x) <span class="op">=</span> <span class="fu">F</span>(x) <span class="op">-</span> q</span>
<span id="cb17-4"><a href="#cb17-4" aria-hidden="true" tabindex="-1"></a><span class="fu">hp</span>(x) <span class="op">=</span> <span class="fu">ff</span>(x)</span>
<span id="cb17-5"><a href="#cb17-5" aria-hidden="true" tabindex="-1"></a>xstar <span class="op">=</span> <span class="fu">find_zero</span>((h, hp), x0, Roots.<span class="fu">Newton</span>())</span>
<span id="cb17-6"><a href="#cb17-6" aria-hidden="true" tabindex="-1"></a>xstar, ff.ctr</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>(0.4516941562236631, Core.Box(48))</code></pre>
</div>
</div>
<p>So the answer is the same. Newtons method converged in 3 steps, and called <code>h</code> or <code>hp</code> 5 times.</p>
<p>Assuming the number inside <code>Core.Box</code> is the value of <code>ctr</code>, we see not so many function calls, just <span class="math inline">\(48\)</span>.</p>
<p>Were <code>f</code> very expensive to compute or <code>h</code> expensive to compute (which can happen if, say, <code>f</code> were highly oscillatory) then steps could be made to cut this number down, such as evaluating <span class="math inline">\(F(x_n) = \int_{x_0}^{x_n} f(x) dx\)</span>, using linearity, as <span class="math inline">\(\int_0^{x_0} f(x) dx + \int_{x_0}^{x_1}f(x)dx + \int_{x_1}^{x_2}f(x)dx + \cdots + \int_{x_{n-1}}^{x_n}f(x)dx\)</span>. Then all but the last term could be stored from the previous steps of Newtons method. The last term presumably being less costly as it would typically involve a small interval.</p>
<div class="callout-note callout callout-style-default callout-captioned">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-caption-container flex-fill">
Note
</div>
</div>
<div class="callout-body-container callout-body">
<p>The trick using a closure relies on an internal way of accessing elements in a closure. The same trick could be implemented many different ways which arent reliant on undocumented internals, this approach was just a tad more convenient. It shouldnt be copied for work intended for distribution, as the internals may change without notice or deprecation.</p>
</div>
</div>
</section>
<section id="example-6" class="level5">
<h5 class="anchored" data-anchor-id="example-6">Example</h5>
<p>A junior engineer at <code>Treadmillz.com</code> is tasked with updating the display of calories burned for an older-model treadmill. The old display involved a sequence of LED “dots” that updated each minute. The last 10 minutes were displayed. Each dot corresponded to one calorie burned, so the total number of calories burned in the past 10 minutes was the number of dots displayed, or the sum of each column of dots. An example might be:</p>
<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="op">**</span></span>
<span id="cb19-2"><a href="#cb19-2" aria-hidden="true" tabindex="-1"></a> <span class="op">****</span></span>
<span id="cb19-3"><a href="#cb19-3" aria-hidden="true" tabindex="-1"></a> <span class="op">*****</span></span>
<span id="cb19-4"><a href="#cb19-4" aria-hidden="true" tabindex="-1"></a> <span class="op">********</span></span>
<span id="cb19-5"><a href="#cb19-5" aria-hidden="true" tabindex="-1"></a><span class="op">**********</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<p>In this example display there was 1 calorie burned in the first minute, then 2, then 5, 5, 4, 3, 2, 2, 1. The total is <span class="math inline">\(24\)</span>.</p>
<p>In her work the junior engineer found this old function for updating the display</p>
<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="kw">function</span> cnew <span class="op">=</span> <span class="fu">update</span>(Cnew, Cold)</span>
<span id="cb20-2"><a href="#cb20-2" aria-hidden="true" tabindex="-1"></a> cnew <span class="op">=</span> Cnew <span class="op">-</span> Cold</span>
<span id="cb20-3"><a href="#cb20-3" 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>
<p>She discovered that the function was written awhile ago, and in MATLAB. The function receives the values <code>Cnew</code> and <code>Cold</code> which indicate the <em>total</em> number of calories burned up until that time frame. The value <code>cnew</code> is the number of calories burned in the minute. (Some other engineer has cleverly figured out how many calories have been burned during the time on the machine.)</p>
<p>The new display will have twice as many dots, so the display can be updated every 30 seconds and still display 10 minutes worth of data. What should the <code>update</code> function now look like?</p>
<p>Her first attempt was simply to rewrite the function in <code>Julia</code>:</p>
<div class="cell" data-execution_count="19">
<div class="sourceCode cell-code" id="cb21"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a><span class="kw">function</span> <span class="fu">update₁</span>(Cnew, Cold)</span>
<span id="cb21-2"><a href="#cb21-2" aria-hidden="true" tabindex="-1"></a> cnew <span class="op">=</span> Cnew <span class="op">-</span> Cold</span>
<span id="cb21-3"><a href="#cb21-3" 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="18">
<pre><code>update₁ (generic function with 1 method)</code></pre>
</div>
</div>
<p>This has the advantage that each “dot” still represents a calorie burned, so that a user can still count the dots to see the total burned in the past 10 minutes.</p>
<div class="sourceCode cell-code" id="cb23"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true" tabindex="-1"></a> <span class="op">*</span> <span class="op">*</span></span>
<span id="cb23-2"><a href="#cb23-2" aria-hidden="true" tabindex="-1"></a> <span class="op">******</span> <span class="op">*</span></span>
<span id="cb23-3"><a href="#cb23-3" aria-hidden="true" tabindex="-1"></a> <span class="op">*************</span> <span class="op">*</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<p>Sadly though, users didnt like it. Instead of a set of dots being, say, 5 high, they were now 3 high and 2 high. It “looked” like they were doing less work! What to do?</p>
<p>The users actually were not responding to the number of dots, which hadnt changed, but rather the <em>area</em> that they represented - and this shrank in half. (It is much easier to visualize area than count dots when tired.) How to adjust for that?</p>
<p>Well our engineer knew - double the dots and count each as half a calorie. This makes the “area” constant. She also generalized letting <code>n</code> be the number of updates per minute, in anticipation of even further improvements in the display technology:</p>
<div class="cell" data-execution_count="21">
<div class="sourceCode cell-code" id="cb24"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb24-1"><a href="#cb24-1" aria-hidden="true" tabindex="-1"></a><span class="kw">function</span> <span class="fu">update</span>(Cnew, Cold, n)</span>
<span id="cb24-2"><a href="#cb24-2" aria-hidden="true" tabindex="-1"></a> cnew <span class="op">=</span> (Cnew <span class="op">-</span> Cold) <span class="op">*</span> n</span>
<span id="cb24-3"><a href="#cb24-3" 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="19">
<pre><code>update (generic function with 1 method)</code></pre>
</div>
</div>
<p>Then the “area” represented by the dots stays fixed over this time frame.</p>
<p>The engineer then thought a bit more, as the form of her answer seemed familiar. She decides to parameterize it in terms of <span class="math inline">\(t\)</span> and found with <span class="math inline">\(h=1/n\)</span>: <code>c(t) = (C(t) - C(t-h))/h</code>. Ahh - the derivative approximation. But then what is the “area”? It is no longer just the sum of the dots, but in terms of the functions she finds that each column represents <span class="math inline">\(c(t)\cdot h\)</span>, and the sum is just <span class="math inline">\(c(t_1)h + c(t_2)h + \cdots c(t_n)h\)</span> which looks like an approximate integral.</p>
<p>If the display were to reach the modern age and replace LED “dots” with a higher-pixel display, then the function to display would be <span class="math inline">\(c(t) = C'(t)\)</span> and the area displayed would be <span class="math inline">\(\int_{t-10}^t c(u) du\)</span>.</p>
<p>Thinking a bit harder, she knows that her <code>update</code> function is getting <span class="math inline">\(C(t)\)</span>, and displaying the <em>rate</em> of calorie burn leads to the area displayed being interpretable as the total calories burned between <span class="math inline">\(t\)</span> and <span class="math inline">\(t-10\)</span> (or <span class="math inline">\(C(t)-C(t-10)\)</span>) by the fundamental theorem of calculus.</p>
</section>
</section>
<section id="questions" class="level2" data-number="37.5">
<h2 data-number="37.5" class="anchored" data-anchor-id="questions"><span class="header-section-number">37.5</span> Questions</h2>
<section id="question" class="level6">
<h6 class="anchored" data-anchor-id="question">Question</h6>
<p>If <span class="math inline">\(F(x) = e^{x^2}\)</span> is an antiderivative for <span class="math inline">\(f\)</span>, find <span class="math inline">\(\int_0^2 f(x) dx\)</span>.</p>
<div class="cell" data-hold="true" data-execution_count="22">
<div class="cell-output cell-output-display" data-execution_count="20">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="18252794993904361898" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_18252794993904361898">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="18252794993904361898" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="18252794993904361898_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("18252794993904361898").addEventListener("change", function() {
var correct = (Math.abs(this.value - 53.598150033144236) <= 0.001);
var msgBox = document.getElementById('18252794993904361898_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_18252794993904361898")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_18252794993904361898")
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>If <span class="math inline">\(\sin(x) - x\cos(x)\)</span> is an antiderivative for <span class="math inline">\(x\sin(x)\)</span>, find the following integral <span class="math inline">\(\int_0^\pi x\sin(x) dx\)</span>.</p>
<div class="cell" data-hold="true" data-execution_count="23">
<div class="cell-output cell-output-display" data-execution_count="21">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="12772303283783889388" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_12772303283783889388">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="12772303283783889388" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="12772303283783889388_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("12772303283783889388").addEventListener("change", function() {
var correct = (Math.abs(this.value - 3.141592653589793) <= 0.001);
var msgBox = document.getElementById('12772303283783889388_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_12772303283783889388")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_12772303283783889388")
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>Find an antiderivative then evaluate <span class="math inline">\(\int_0^1 x(1-x) dx\)</span>.</p>
<div class="cell" data-hold="true" data-execution_count="24">
<div class="cell-output cell-output-display" data-execution_count="22">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="5241857650783570425" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_5241857650783570425">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="5241857650783570425" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="5241857650783570425_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("5241857650783570425").addEventListener("change", function() {
var correct = (Math.abs(this.value - 0.16666666666666669) <= 0.001);
var msgBox = document.getElementById('5241857650783570425_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_5241857650783570425")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_5241857650783570425")
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>Use the fact that <span class="math inline">\([e^x]' = e^x\)</span> to evaluate <span class="math inline">\(\int_0^e (e^x - 1) dx\)</span>.</p>
<div class="cell" data-hold="true" data-execution_count="25">
<div class="cell-output cell-output-display" data-execution_count="23">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="13334011617388149681" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_13334011617388149681">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="13334011617388149681" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="13334011617388149681_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("13334011617388149681").addEventListener("change", function() {
var correct = (Math.abs(this.value - 11.435980413020218) <= 0.001);
var msgBox = document.getElementById('13334011617388149681_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_13334011617388149681")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_13334011617388149681")
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>Find the value of <span class="math inline">\(\int_0^1 (1-x^2/2 + x^4/24) dx\)</span>.</p>
<div class="cell" data-hold="true" data-execution_count="26">
<div class="cell-output cell-output-display" data-execution_count="24">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="15961466113015377221" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_15961466113015377221">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="15961466113015377221" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="15961466113015377221_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("15961466113015377221").addEventListener("change", function() {
var correct = (Math.abs(this.value - 0.8416666666666667) <= 0.001);
var msgBox = document.getElementById('15961466113015377221_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_15961466113015377221")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_15961466113015377221")
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>Using <code>SymPy</code>, what is an antiderivative for <span class="math inline">\(x^2 \sin(x)\)</span>?</p>
<div class="cell" data-hold="true" data-execution_count="27">
<div class="cell-output cell-output-display" data-execution_count="25">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="14718758777491919191" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_14718758777491919191">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_14718758777491919191_1">
<input class="form-check-input" type="radio" name="radio_14718758777491919191" id="radio_14718758777491919191_1" value="1">
<span class="label-body px-1">
\(-x^2\cos(x)\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_14718758777491919191_2">
<input class="form-check-input" type="radio" name="radio_14718758777491919191" id="radio_14718758777491919191_2" value="2">
<span class="label-body px-1">
\(-x^2\cos(x) + 2x\sin(x)\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_14718758777491919191_3">
<input class="form-check-input" type="radio" name="radio_14718758777491919191" id="radio_14718758777491919191_3" value="3">
<span class="label-body px-1">
\(-x^2\cos(x) + 2x\sin(x) + 2\cos(x)\)
</span>
</label>
</div>
</div>
</div>
<div id="14718758777491919191_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_14718758777491919191"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 3;
var msgBox = document.getElementById('14718758777491919191_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_14718758777491919191")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_14718758777491919191")
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>Using <code>SymPy</code>, what is an antiderivative for <span class="math inline">\(xe^{-x}\)</span>?</p>
<div class="cell" data-hold="true" data-execution_count="28">
<div class="cell-output cell-output-display" data-execution_count="26">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="2670367263412137435" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_2670367263412137435">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_2670367263412137435_1">
<input class="form-check-input" type="radio" name="radio_2670367263412137435" id="radio_2670367263412137435_1" value="1">
<span class="label-body px-1">
\(-e^{-x}\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_2670367263412137435_2">
<input class="form-check-input" type="radio" name="radio_2670367263412137435" id="radio_2670367263412137435_2" value="2">
<span class="label-body px-1">
\(-xe^{-x}\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_2670367263412137435_3">
<input class="form-check-input" type="radio" name="radio_2670367263412137435" id="radio_2670367263412137435_3" value="3">
<span class="label-body px-1">
\(-(1+x) e^{-x}\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_2670367263412137435_4">
<input class="form-check-input" type="radio" name="radio_2670367263412137435" id="radio_2670367263412137435_4" value="4">
<span class="label-body px-1">
\(-(1 + x + x^2) e^{-x}\)
</span>
</label>
</div>
</div>
</div>
<div id="2670367263412137435_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_2670367263412137435"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 3;
var msgBox = document.getElementById('2670367263412137435_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_2670367263412137435")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_2670367263412137435")
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>Using <code>SymPy</code>, integrate the function <span class="math inline">\(\int_0^{2\pi} e^x \cdot \sin(x) dx\)</span>.</p>
<div class="cell" data-hold="true" data-execution_count="29">
<div class="cell-output cell-output-display" data-execution_count="27">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="7101918230869549490" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_7101918230869549490">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="7101918230869549490" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="7101918230869549490_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("7101918230869549490").addEventListener("change", function() {
var correct = (Math.abs(this.value - -267.24582776238236) <= 0.001);
var msgBox = document.getElementById('7101918230869549490_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_7101918230869549490")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_7101918230869549490")
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>A particle has velocity <span class="math inline">\(v(t) = 2t^2 - t\)</span> between <span class="math inline">\(0\)</span> and <span class="math inline">\(1\)</span>. If <span class="math inline">\(x(0) = 0\)</span>, find the position <span class="math inline">\(x(1)\)</span>.</p>
<div class="cell" data-hold="true" data-execution_count="30">
<div class="cell-output cell-output-display" data-execution_count="28">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="136606276605667364" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_136606276605667364">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="136606276605667364" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="136606276605667364_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("136606276605667364").addEventListener("change", function() {
var correct = (Math.abs(this.value - 0.16666666666666669) <= 0.001);
var msgBox = document.getElementById('136606276605667364_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_136606276605667364")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_136606276605667364")
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>A particle has acceleration given by <span class="math inline">\(\sin(t)\)</span> between <span class="math inline">\(0\)</span> and <span class="math inline">\(\pi\)</span>. If the initial velocity is <span class="math inline">\(v(0) = 0\)</span>, find <span class="math inline">\(v(\pi/2)\)</span>.</p>
<div class="cell" data-hold="true" data-execution_count="31">
<div class="cell-output cell-output-display" data-execution_count="29">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="10032846323623507997" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_10032846323623507997">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="10032846323623507997" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="10032846323623507997_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("10032846323623507997").addEventListener("change", function() {
var correct = (Math.abs(this.value - 0.9999999999999999) <= 0.001);
var msgBox = document.getElementById('10032846323623507997_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_10032846323623507997")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_10032846323623507997")
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 position of a particle is given by <span class="math inline">\(x(t) = \int_0^t g(u) du\)</span>, where <span class="math inline">\(x(0)=0\)</span> and <span class="math inline">\(g(u)\)</span> is given by this piecewise linear graph:</p>
<div class="cell" data-hold="true" data-execution_count="32">
<div class="cell-output cell-output-display" data-execution_count="30">
<p><img src="ftc_files/figure-html/cell-33-output-1.svg" class="img-fluid"></p>
</div>
</div>
<ul>
<li>The velocity of the particle is positive over:</li>
</ul>
<div class="cell" data-hold="true" data-execution_count="33">
<div class="cell-output cell-output-display" data-execution_count="31">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="11564345620660291279" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_11564345620660291279">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_11564345620660291279_1">
<input class="form-check-input" type="radio" name="radio_11564345620660291279" id="radio_11564345620660291279_1" value="1">
<span class="label-body px-1">
It is always positive
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_11564345620660291279_2">
<input class="form-check-input" type="radio" name="radio_11564345620660291279" id="radio_11564345620660291279_2" value="2">
<span class="label-body px-1">
It is always negative
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_11564345620660291279_3">
<input class="form-check-input" type="radio" name="radio_11564345620660291279" id="radio_11564345620660291279_3" value="3">
<span class="label-body px-1">
Between \(0\) and \(1\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_11564345620660291279_4">
<input class="form-check-input" type="radio" name="radio_11564345620660291279" id="radio_11564345620660291279_4" value="4">
<span class="label-body px-1">
Between \(1\) and \(5\)
</span>
</label>
</div>
</div>
</div>
<div id="11564345620660291279_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_11564345620660291279"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 4;
var msgBox = document.getElementById('11564345620660291279_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_11564345620660291279")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_11564345620660291279")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
<ul>
<li>The position of the particle is <span class="math inline">\(0\)</span> at <span class="math inline">\(t=0\)</span> and:</li>
</ul>
<div class="cell" data-hold="true" data-execution_count="34">
<div class="cell-output cell-output-display" data-execution_count="32">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="11865180700532602305" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_11865180700532602305">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_11865180700532602305_1">
<input class="form-check-input" type="radio" name="radio_11865180700532602305" id="radio_11865180700532602305_1" value="1">
<span class="label-body px-1">
\(t=1\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_11865180700532602305_2">
<input class="form-check-input" type="radio" name="radio_11865180700532602305" id="radio_11865180700532602305_2" value="2">
<span class="label-body px-1">
\(t=2\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_11865180700532602305_3">
<input class="form-check-input" type="radio" name="radio_11865180700532602305" id="radio_11865180700532602305_3" value="3">
<span class="label-body px-1">
\(t=3\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_11865180700532602305_4">
<input class="form-check-input" type="radio" name="radio_11865180700532602305" id="radio_11865180700532602305_4" value="4">
<span class="label-body px-1">
\(t=4\)
</span>
</label>
</div>
</div>
</div>
<div id="11865180700532602305_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_11865180700532602305"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 2;
var msgBox = document.getElementById('11865180700532602305_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_11865180700532602305")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_11865180700532602305")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
<ul>
<li>The position of the particle at time <span class="math inline">\(t=5\)</span> is?</li>
</ul>
<div class="cell" data-hold="true" data-execution_count="35">
<div class="cell-output cell-output-display" data-execution_count="33">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="12602581003195016687" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_12602581003195016687">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="12602581003195016687" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="12602581003195016687_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("12602581003195016687").addEventListener("change", function() {
var correct = (Math.abs(this.value - 4) <= 0);
var msgBox = document.getElementById('12602581003195016687_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_12602581003195016687")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_12602581003195016687")
if (explanation != null) {
explanation.style.display = "block";
}
}
});
</script>
</div>
</div>
<ul>
<li>On the interval <span class="math inline">\([2,3]\)</span>:</li>
</ul>
<div class="cell" data-hold="true" data-execution_count="36">
<div class="cell-output cell-output-display" data-execution_count="34">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="15730730901235994563" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_15730730901235994563">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_15730730901235994563_1">
<input class="form-check-input" type="radio" name="radio_15730730901235994563" id="radio_15730730901235994563_1" value="1">
<span class="label-body px-1">
The position, \(x(t)\), stays constant
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_15730730901235994563_2">
<input class="form-check-input" type="radio" name="radio_15730730901235994563" id="radio_15730730901235994563_2" value="2">
<span class="label-body px-1">
The position, \(x(t)\), increases with a slope of \(1\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_15730730901235994563_3">
<input class="form-check-input" type="radio" name="radio_15730730901235994563" id="radio_15730730901235994563_3" value="3">
<span class="label-body px-1">
The position, \(x(t)\), increases quadratically from \(-1/2\) to \(1\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_15730730901235994563_4">
<input class="form-check-input" type="radio" name="radio_15730730901235994563" id="radio_15730730901235994563_4" value="4">
<span class="label-body px-1">
The position, \(x(t)\), increases quadratically from \(0\) to \(1\)
</span>
</label>
</div>
</div>
</div>
<div id="15730730901235994563_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_15730730901235994563"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 2;
var msgBox = document.getElementById('15730730901235994563_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_15730730901235994563")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_15730730901235994563")
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>Let <span class="math inline">\(F(x) = \int_{t-10}^t f(u) du\)</span> for <span class="math inline">\(f(u)\)</span> a positive, continuous function. What is <span class="math inline">\(F'(t)\)</span>?</p>
<div class="cell" data-hold="true" data-execution_count="37">
<div class="cell-output cell-output-display" data-execution_count="35">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="15680736411252109597" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_15680736411252109597">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_15680736411252109597_1">
<input class="form-check-input" type="radio" name="radio_15680736411252109597" id="radio_15680736411252109597_1" value="1">
<span class="label-body px-1">
\(f(t)\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_15680736411252109597_2">
<input class="form-check-input" type="radio" name="radio_15680736411252109597" id="radio_15680736411252109597_2" value="2">
<span class="label-body px-1">
\(-f(t-10)\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_15680736411252109597_3">
<input class="form-check-input" type="radio" name="radio_15680736411252109597" id="radio_15680736411252109597_3" value="3">
<span class="label-body px-1">
\(f(t) - f(t-10)\)
</span>
</label>
</div>
</div>
</div>
<div id="15680736411252109597_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_15680736411252109597"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 3;
var msgBox = document.getElementById('15680736411252109597_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_15680736411252109597")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_15680736411252109597")
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>Suppose <span class="math inline">\(f(x) \geq 0\)</span> and <span class="math inline">\(F(x) = \int_0^x f(u) du\)</span>. <span class="math inline">\(F(x)\)</span> is continuous and so has a maximum value on the interval <span class="math inline">\([0,1]\)</span> taken at some <span class="math inline">\(c\)</span> in <span class="math inline">\([0,1]\)</span>. It is</p>
<div class="cell" data-hold="true" data-execution_count="38">
<div class="cell-output cell-output-display" data-execution_count="36">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="11196944585389088952" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_11196944585389088952">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_11196944585389088952_1">
<input class="form-check-input" type="radio" name="radio_11196944585389088952" id="radio_11196944585389088952_1" value="1">
<span class="label-body px-1">
At a critical point
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_11196944585389088952_2">
<input class="form-check-input" type="radio" name="radio_11196944585389088952" id="radio_11196944585389088952_2" value="2">
<span class="label-body px-1">
At the endpoint \(0\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_11196944585389088952_3">
<input class="form-check-input" type="radio" name="radio_11196944585389088952" id="radio_11196944585389088952_3" value="3">
<span class="label-body px-1">
At the endpoint \(1\)
</span>
</label>
</div>
</div>
</div>
<div id="11196944585389088952_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_11196944585389088952"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 3;
var msgBox = document.getElementById('11196944585389088952_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_11196944585389088952")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_11196944585389088952")
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>Let <span class="math inline">\(F(x) = \int_0^x f(u) du\)</span>, where <span class="math inline">\(f(x)\)</span> is given by the graph below. Identify the <span class="math inline">\(x\)</span> values of all <em>relative maxima</em> of <span class="math inline">\(F(x)\)</span>. Explain why you know these are the values.</p>
<div class="cell" data-hold="true" data-execution_count="39">
<div class="cell-output cell-output-display" data-execution_count="37">
<p><img src="ftc_files/figure-html/cell-40-output-1.svg" class="img-fluid"></p>
</div>
</div>
<div class="cell" data-hold="true" data-execution_count="40">
<div class="cell-output cell-output-display" data-execution_count="38">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="2252193788457182525" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_2252193788457182525">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_2252193788457182525_1">
<input class="form-check-input" type="radio" name="radio_2252193788457182525" id="radio_2252193788457182525_1" value="1">
<span class="label-body px-1">
The derivative of \(F\) is \(f\), so by the second derivative test, \(x=7\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_2252193788457182525_2">
<input class="form-check-input" type="radio" name="radio_2252193788457182525" id="radio_2252193788457182525_2" value="2">
<span class="label-body px-1">
The derivative of \(F\) is \(f\), so by the first derivative test, \(x=3, 9\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_2252193788457182525_3">
<input class="form-check-input" type="radio" name="radio_2252193788457182525" id="radio_2252193788457182525_3" value="3">
<span class="label-body px-1">
The graph of \(f\) has relative maxima at \(x=2,6,8\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_2252193788457182525_4">
<input class="form-check-input" type="radio" name="radio_2252193788457182525" id="radio_2252193788457182525_4" value="4">
<span class="label-body px-1">
The derivative of \(F\) is \(f\), so by the first derivative test, \(x=1,5\)
</span>
</label>
</div>
</div>
</div>
<div id="2252193788457182525_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_2252193788457182525"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 2;
var msgBox = document.getElementById('2252193788457182525_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_2252193788457182525")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_2252193788457182525")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
</section>
<section id="question-14" class="level6">
<h6 class="anchored" data-anchor-id="question-14">Question</h6>
<p>Suppose <span class="math inline">\(f(x)\)</span> is monotonically decreasing with <span class="math inline">\(f(0)=1\)</span>, <span class="math inline">\(f(1/2) = 0\)</span> and <span class="math inline">\(f(1) = -1\)</span>. Let <span class="math inline">\(F(x) = \int_0^x f(u) du\)</span>. <span class="math inline">\(F(x)\)</span> is continuous and so has a maximum value on the interval <span class="math inline">\([0,1]\)</span> taken at some <span class="math inline">\(c\)</span> in <span class="math inline">\([0,1]\)</span>. It is</p>
<div class="cell" data-hold="true" data-execution_count="41">
<div class="cell-output cell-output-display" data-execution_count="39">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="5457755685667355416" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_5457755685667355416">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_5457755685667355416_1">
<input class="form-check-input" type="radio" name="radio_5457755685667355416" id="radio_5457755685667355416_1" value="1">
<span class="label-body px-1">
At a critical point, either \(0\) or \(1\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_5457755685667355416_2">
<input class="form-check-input" type="radio" name="radio_5457755685667355416" id="radio_5457755685667355416_2" value="2">
<span class="label-body px-1">
At a critical point, \(1/2\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_5457755685667355416_3">
<input class="form-check-input" type="radio" name="radio_5457755685667355416" id="radio_5457755685667355416_3" value="3">
<span class="label-body px-1">
At the endpoint \(0\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_5457755685667355416_4">
<input class="form-check-input" type="radio" name="radio_5457755685667355416" id="radio_5457755685667355416_4" value="4">
<span class="label-body px-1">
At the endpoint \(1\)
</span>
</label>
</div>
</div>
</div>
<div id="5457755685667355416_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_5457755685667355416"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 2;
var msgBox = document.getElementById('5457755685667355416_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_5457755685667355416")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_5457755685667355416")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
</section>
<section id="question-15" class="level6">
<h6 class="anchored" data-anchor-id="question-15">Question</h6>
<p>Barrow presented a version of the fundamental theorem of calculus in a 1670 volume edited by Newton, Barrows student (cf.&nbsp;<a href="http://www.maa.org/sites/default/files/0746834234133.di020795.02p0640b.pdf">Wagner</a>). His version can be stated as follows (cf.&nbsp;<a href="http://www.maa.org/publications/ebooks/mathematical-time-capsules">Jardine</a>):</p>
<p>Consider the following figure where <span class="math inline">\(f\)</span> is a strictly increasing function with <span class="math inline">\(f(0) = 0\)</span>. and <span class="math inline">\(x &gt; 0\)</span>. The function <span class="math inline">\(A(x) = \int_0^x f(u) du\)</span> is also plotted. The point <span class="math inline">\(Q\)</span> is <span class="math inline">\(f(x)\)</span>, and the point <span class="math inline">\(P\)</span> is <span class="math inline">\(A(x)\)</span>. The point <span class="math inline">\(T\)</span> is chosen to so that the length between <span class="math inline">\(T\)</span> and <span class="math inline">\(x\)</span> times the length between <span class="math inline">\(Q\)</span> and <span class="math inline">\(x\)</span> equals the length from <span class="math inline">\(P\)</span> to <span class="math inline">\(x\)</span>. (<span class="math inline">\(\lvert Tx \rvert \cdot \lvert Qx \rvert = \lvert Px \rvert\)</span>.) Barrow showed that the line segment <span class="math inline">\(PT\)</span> is tangent to the graph of <span class="math inline">\(A(x)\)</span>. This figure illustrates the labeling for some function:</p>
<div class="cell" data-hold="true" data-execution_count="42">
<div class="cell-output cell-output-display" data-execution_count="40">
<p><img src="ftc_files/figure-html/cell-43-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>The fact that <span class="math inline">\(\lvert Tx \rvert \cdot \lvert Qx \rvert = \lvert Px \rvert\)</span> says what in terms of <span class="math inline">\(f(x)\)</span>, <span class="math inline">\(A(x)\)</span> and <span class="math inline">\(A'(x)\)</span>?</p>
<div class="cell" data-hold="true" data-execution_count="43">
<div class="cell-output cell-output-display" data-execution_count="41">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="5912542598376258088" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_5912542598376258088">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_5912542598376258088_1">
<input class="form-check-input" type="radio" name="radio_5912542598376258088" id="radio_5912542598376258088_1" value="1">
<span class="label-body px-1">
\(\lvert Tx \rvert \cdot f(x) = A(x)\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_5912542598376258088_2">
<input class="form-check-input" type="radio" name="radio_5912542598376258088" id="radio_5912542598376258088_2" value="2">
<span class="label-body px-1">
\(A(x) / \lvert Tx \rvert = A'(x)\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_5912542598376258088_3">
<input class="form-check-input" type="radio" name="radio_5912542598376258088" id="radio_5912542598376258088_3" value="3">
<span class="label-body px-1">
\(A(x) \cdot A'(x) = f(x)\)
</span>
</label>
</div>
</div>
</div>
<div id="5912542598376258088_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_5912542598376258088"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 1;
var msgBox = document.getElementById('5912542598376258088_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_5912542598376258088")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_5912542598376258088")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
<p>The fact that <span class="math inline">\(\lvert PT \rvert\)</span> is tangent says what in terms of <span class="math inline">\(f(x)\)</span>, <span class="math inline">\(A(x)\)</span> and <span class="math inline">\(A'(x)\)</span>?</p>
<div class="cell" data-hold="true" data-execution_count="44">
<div class="cell-output cell-output-display" data-execution_count="42">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="14920185708711825437" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_14920185708711825437">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_14920185708711825437_1">
<input class="form-check-input" type="radio" name="radio_14920185708711825437" id="radio_14920185708711825437_1" value="1">
<span class="label-body px-1">
\(\lvert Tx \rvert \cdot f(x) = A(x)\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_14920185708711825437_2">
<input class="form-check-input" type="radio" name="radio_14920185708711825437" id="radio_14920185708711825437_2" value="2">
<span class="label-body px-1">
\(A(x) / \lvert Tx \rvert = A'(x)\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_14920185708711825437_3">
<input class="form-check-input" type="radio" name="radio_14920185708711825437" id="radio_14920185708711825437_3" value="3">
<span class="label-body px-1">
\(A(x) \cdot A'(x) = f(x)\)
</span>
</label>
</div>
</div>
</div>
<div id="14920185708711825437_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_14920185708711825437"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 2;
var msgBox = document.getElementById('14920185708711825437_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_14920185708711825437")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_14920185708711825437")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
<p>Solving, we get:</p>
<div class="cell" data-hold="true" data-execution_count="45">
<div class="cell-output cell-output-display" data-execution_count="43">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="7840521597294429077" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_7840521597294429077">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_7840521597294429077_1">
<input class="form-check-input" type="radio" name="radio_7840521597294429077" id="radio_7840521597294429077_1" value="1">
<span class="label-body px-1">
\(A(x) = A^2(x) / f(x)\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_7840521597294429077_2">
<input class="form-check-input" type="radio" name="radio_7840521597294429077" id="radio_7840521597294429077_2" value="2">
<span class="label-body px-1">
\(A'(x) = A(x)\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_7840521597294429077_3">
<input class="form-check-input" type="radio" name="radio_7840521597294429077" id="radio_7840521597294429077_3" value="3">
<span class="label-body px-1">
\(A(x) = f(x)\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_7840521597294429077_4">
<input class="form-check-input" type="radio" name="radio_7840521597294429077" id="radio_7840521597294429077_4" value="4">
<span class="label-body px-1">
\(A'(x) = f(x)\)
</span>
</label>
</div>
</div>
</div>
<div id="7840521597294429077_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_7840521597294429077"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 4;
var msgBox = document.getElementById('7840521597294429077_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_7840521597294429077")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_7840521597294429077")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
</section>
<section id="question-16" class="level6">
<h6 class="anchored" data-anchor-id="question-16">Question</h6>
<p>According to <a href="http://www.math.harvard.edu/~knill/teaching/math1a_2011/exhibits/bressoud/">Bressoud</a> “Newton observes that the rate of change of an accumulated quantity is the rate at which that quantity is accumulating”. Which part of the FTC does this refer to:</p>
<div class="cell" data-hold="true" data-execution_count="46">
<div class="cell-output cell-output-display" data-execution_count="44">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="324878520044564447" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_324878520044564447">
<div style="padding-top: 5px">
<div class="form-check">
<label class="form-check-label" for="radio_324878520044564447_1">
<input class="form-check-input" type="radio" name="radio_324878520044564447" id="radio_324878520044564447_1" value="1">
<span class="label-body px-1">
Part 1: \([\int_a^x f(u) du]' = f\)
</span>
</label>
</div>
<div class="form-check">
<label class="form-check-label" for="radio_324878520044564447_2">
<input class="form-check-input" type="radio" name="radio_324878520044564447" id="radio_324878520044564447_2" value="2">
<span class="label-body px-1">
Part 2: \(\int_a^b f(u) du = F(b)- F(a)\).
</span>
</label>
</div>
</div>
</div>
<div id="324878520044564447_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.querySelectorAll('input[name="radio_324878520044564447"]').forEach(function(rb) {
rb.addEventListener("change", function() {
var correct = rb.value == 1;
var msgBox = document.getElementById('324878520044564447_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_324878520044564447")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_324878520044564447")
if (explanation != null) {
explanation.style.display = "block";
}
}
})});
</script>
</div>
</div>
</section>
</section>
<section id="more-on-sympys-integrate" class="level2" data-number="37.6">
<h2 data-number="37.6" class="anchored" data-anchor-id="more-on-sympys-integrate"><span class="header-section-number">37.6</span> More on SymPys <code>integrate</code></h2>
<p>Finding the value of a definite integral through the fundamental theorem of calculus relies on the algebraic identification of an antiderivative. This is difficult to do by hand and by computer, and is complicated by the fact that not every <a href="https://en.wikipedia.org/wiki/Elementary_function">elementary</a>function has an elementary antiderivative. <code>SymPy</code>s documentation on integration indicates that several different means to integrate a function are used internally. As it is of interest here, it is copied with just minor edits below (from an older version of SymPy):</p>
<section id="simple-heuristics-based-on-pattern-matching-and-integral-table" class="level4">
<h4 class="anchored" data-anchor-id="simple-heuristics-based-on-pattern-matching-and-integral-table">Simple heuristics (based on pattern matching and integral table):</h4>
<ul>
<li>most frequently used functions (e.g.&nbsp;polynomials, products of trigonometric functions)</li>
</ul>
</section>
<section id="integration-of-rational-functions" class="level4">
<h4 class="anchored" data-anchor-id="integration-of-rational-functions">Integration of rational functions:</h4>
<ul>
<li>A complete algorithm for integrating rational functions is implemented (the Lazard-Rioboo-Trager algorithm). The algorithm also uses the partial fraction decomposition algorithm implemented in <code>apart</code> as a preprocessor to make this process faster. Note that the integral of a rational function is always elementary, but in general, it may include a <code>RootSum</code>.</li>
</ul>
</section>
<section id="full-risch-algorithm" class="level4">
<h4 class="anchored" data-anchor-id="full-risch-algorithm">Full Risch algorithm:</h4>
<ul>
<li>The Risch algorithm is a complete decision procedure for integrating elementary functions, which means that given any elementary function, it will either compute an elementary antiderivative, or else prove that none exists. Currently, part of transcendental case is implemented, meaning elementary integrals containing exponentials, logarithms, and (soon!) trigonometric functions can be computed. The algebraic case, e.g., functions containing roots, is much more difficult and is not implemented yet.</li>
<li>If the routine fails (because the integrand is not elementary, or because a case is not implemented yet), it continues on to the next algorithms below. If the routine proves that the integrals is nonelementary, it still moves on to the algorithms below, because we might be able to find a closed-form solution in terms of special functions. If <code>risch=true</code>, however, it will stop here.</li>
</ul>
</section>
<section id="the-meijer-g-function-algorithm" class="level4">
<h4 class="anchored" data-anchor-id="the-meijer-g-function-algorithm">The Meijer G-Function algorithm:</h4>
<ul>
<li>This algorithm works by first rewriting the integrand in terms of very general Meijer G-Function (<code>meijerg</code> in <code>SymPy</code>), integrating it, and then rewriting the result back, if possible. This algorithm is particularly powerful for definite integrals (which is actually part of a different method of Integral), since it can compute closed-form solutions of definite integrals even when no closed-form indefinite integral exists. But it also is capable of computing many indefinite integrals as well.</li>
<li>Another advantage of this method is that it can use some results about the Meijer G-Function to give a result in terms of a Piecewise expression, which allows to express conditionally convergent integrals.</li>
<li>Setting <code>meijerg=true</code> will cause <code>integrate</code> to use only this method.</li>
</ul>
</section>
<section id="the-manual-integration-algorithm" class="level4">
<h4 class="anchored" data-anchor-id="the-manual-integration-algorithm">The “manual integration” algorithm:</h4>
<ul>
<li>This algorithm tries to mimic how a person would find an antiderivative by hand, for example by looking for a substitution or applying integration by parts. This algorithm does not handle as many integrands but can return results in a more familiar form.</li>
<li>Sometimes this algorithm can evaluate parts of an integral; in this case <code>integrate</code> will try to evaluate the rest of the integrand using the other methods here.</li>
<li>Setting <code>manual=true</code> will cause <code>integrate</code> to use only this method.</li>
</ul>
</section>
<section id="the-heuristic-risch-algorithm" class="level4">
<h4 class="anchored" data-anchor-id="the-heuristic-risch-algorithm">The Heuristic Risch algorithm:</h4>
<ul>
<li>This is a heuristic version of the Risch algorithm, meaning that it is not deterministic. This is tried as a last resort because it can be very slow. It is still used because not enough of the full Risch algorithm is implemented, so that there are still some integrals that can only be computed using this method. The goal is to implement enough of the Risch and Meijer G-function methods so that this can be deleted. Setting <code>heurisch=true</code> will cause <code>integrate</code> to use only this method. Set <code>heurisch=false</code> to not use it.</li>
</ul>
</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="../integrals/area.html" class="pagination-link">
<i class="bi bi-arrow-left-short"></i> <span class="nav-page-text"><span class="chapter-number">36</span>&nbsp; <span class="chapter-title">Area under a curve</span></span>
</a>
</div>
<div class="nav-page nav-page-next">
<a href="../integrals/substitution.html" class="pagination-link">
<span class="nav-page-text"><span class="chapter-number">38</span>&nbsp; <span class="chapter-title">Substitution</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>