Calculus1 Differentiation Apps - Maple Help

Home : Support : Online Help : Applications and Example Worksheets : Calculus : Calculus1 Differentiation Apps

Calculus 1:  Applications of Differentiation

The Student[Calculus1] package contains three routines that can be used to both work with and visualize the concepts of Taylor approximations, charting a function, and using Newton's method.  This worksheet demonstrates this functionality.

For further information about any command in the Calculus1 package, see the corresponding help page.  For a general overview, see Calculus1.

Getting Started

While any command in the package can be referred to using the long form, for example, Student[Calculus1][FunctionChart],  it is easier, and often clearer, to load the package, and then use the short form command names.

 > $\mathrm{restart}$
 > $\mathrm{with}\left(\mathrm{Student}\left[\mathrm{Calculus1}\right]\right):$

The following sections show how the routines work.

Taylor Approximations

If at a point $c$, a function $f$ has a power series expansion
$f\left(x\right)={\sum }_{n=0}^{\infty }\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}{a}_{n}{\left(x-c\right)}^{n}$
the coefficients ${a}_{n}$ are given by:
${a}_{n}=\frac{{f}^{\left(n\right)}\left(c\right)}{n!}$

where ${f}^{\left(n\right)}\left(c\right)$ is the nth derivative of $f$ evaluated at the point $c$.  Named after the English mathematician Brook Taylor, this infinite series is called the Taylor expansion of the function $f$ at $c$.

The Taylor expansion of the exponential function ${ⅇ}^{x}$ is:
${ⅇ}^{x}={\sum }_{n=0}^{\infty }\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}\frac{{x}^{n}}{n!}$

from which it follows that:

$ⅇ={\sum }_{n=0}^{\infty }\phantom{\rule[-0.0ex]{5.0px}{0.0ex}}\frac{1}{n!}$

Taylor approximations require both an expression and a point around which to expand.

 > $\mathrm{TaylorApproximation}\left({x}^{7}-5{x}^{5}+4{x}^{4}-7{x}^{2}+3,x=1,\mathrm{order}=3\right)$
 ${-}{1}{+}{11}{}{x}{-}{15}{}{{x}}^{{2}}{+}{{x}}^{{3}}$ (1.1)

Thus, around the point $x=1$ the polynomial ${x}^{7}-5{x}^{5}+4{x}^{4}-7{x}^{2}+3$ behaves like ${x}^{3}-15{x}^{2}+11x-1$.

 > $\mathrm{TaylorApproximation}\left({x}^{7}-5{x}^{5}+4{x}^{4}-7{x}^{2}+3,x=1,\mathrm{order}=3,\mathrm{output}=\mathrm{plot}\right)$
 > $\mathrm{TaylorApproximation}\left(\mathrm{sin}\left(x\right),x=1,\mathrm{output}=\mathrm{animation},\mathrm{order}=1..16\right)$

The derivative of the arctan function has singularities at $I$ and $-I$. Therefore, the radius of convergence of the Taylor approximation around the origin is $1$.

 > $\mathrm{TaylorApproximation}\left(\mathrm{arctan}\left(x\right),x=0,\mathrm{output}=\mathrm{animation},\mathrm{order}=1..20\right)$

You can compute and visualize Taylor approximations using the TaylorApproximationTutor command.

 > $\mathrm{TaylorApproximationTutor}\left(\right)$

Function Chart

The FunctionChart routine plots a function and shows regions of positive and negative sign, increasing and decreasing, and positive and negative concavity.  By default:

1.  Roots are marked by circles.
2.  Extreme points are marked by diamonds.
3.  Inflection points are marked by crosses.
4.  Regions of increase and decrease are marked by red and blue lines, respectively.

5.  Regions of positive and negative concavity are marked by azure and purple fill, respectively, with arrows pointing in the direction of the concavity.

 > $\mathrm{FunctionChart}\left({x}^{4}+2{x}^{3}-9{x}^{2}-3x+6,x=-5..4\right)$
 > $\mathrm{FunctionChart}\left(\mathrm{sin}\left(x\right),x=0..2\mathrm{π}\right)$
 > $\mathrm{FunctionChart}\left(\frac{{x}^{3}-2{x}^{2}-4x+2}{x-4},x=-3..3\right)$

You can also perform curve analysis using the CurveAnalysisTutor command.

 > $\mathrm{CurveAnalysisTutor}\left(\right)$

Newton's Method

Given a point $a$ and an expression $f\left(x\right)$, the $x$-intercept of the tangent line through ($a$, $f\left(a\right)$) can be used as an approximation to a root of the expression $f\left(x\right)$.  The equation of the tangent line is:

 > $\mathrm{Tangent}\left(f\left(x\right),x=a,\mathrm{output}=\mathrm{line}\right)$
 $\left(\frac{{ⅆ}}{{ⅆ}{a}}{}{f}\left({a}\right)\right){}{x}{+}{f}\left({a}\right){-}\left(\frac{{ⅆ}}{{ⅆ}{a}}{}{f}\left({a}\right)\right){}{a}$ (3.1)
 > $\mathrm{collect}\left(\mathrm{convert}\left(,\mathrm{D}\right),\mathrm{D}\left(f\right)\left(a\right)\right)$
 $\left({x}{-}{a}\right){}{\mathrm{D}}\left({f}\right)\left({a}\right){+}{f}\left({a}\right)$ (3.2)

Solving for zero:

 > $\mathrm{solve}\left(=0,x\right)$
 $\frac{{-}{f}\left({a}\right){+}{\mathrm{D}}\left({f}\right)\left({a}\right){}{a}}{{\mathrm{D}}\left({f}\right)\left({a}\right)}$ (3.3)
 > $\mathrm{expand}\left(\right)$
 ${-}\frac{{f}\left({a}\right)}{{\mathrm{D}}\left({f}\right)\left({a}\right)}{+}{a}$ (3.4)

As an example, consider the function $F\left(x\right)={x}^{2}-1$ and an initial point $x=2.0$.

 > $F:=x→{x}^{2}-1$
 ${F}{:=}{x}{→}{{x}}^{{2}}{-}{1}$ (3.5)
 > $\mathrm{aroot}:=2.0-\frac{F\left(2.0\right)}{\mathrm{D}\left(F\right)\left(2.0\right)}$
 ${\mathrm{aroot}}{:=}{1.250000000}$ (3.6)

Repeating this another $9$ times:

 > $\mathbf{for}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}i\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{to}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}5\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{do}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathrm{aroot}:=\mathrm{aroot}-\frac{F\left(\mathrm{aroot}\right)}{\mathrm{D}\left(F\right)\left(\mathrm{aroot}\right)}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{end do}$
 ${\mathrm{aroot}}{:=}{1.025000000}$
 ${\mathrm{aroot}}{:=}{1.000304878}$
 ${\mathrm{aroot}}{:=}{1.000000046}$
 ${\mathrm{aroot}}{:=}{1.000000000}$
 ${\mathrm{aroot}}{:=}{1.000000000}$ (3.7)

The routine NewtonsMethod performs the same process.

 > $\mathrm{NewtonsMethod}\left(F\left(x\right),x=2,\mathrm{output}=\mathrm{sequence}\right)$
 ${2}{,}{1.250000000}{,}{1.025000000}{,}{1.000304878}{,}{1.000000046}{,}{1.000000000}$ (3.8)
 > $\mathrm{NewtonsMethod}\left(F\left(x\right),x=2,\mathrm{output}=\mathrm{plot}\right)$
 > $\mathrm{NewtonsMethod}\left(\frac{\mathrm{sin}\left(x\right)}{x},x=1,\mathrm{output}=\mathrm{plot}\right)$

The root to which a sequence of Newton iterations converges to depends on the initial point.  For example,

 > $\mathrm{NewtonsMethod}\left(\frac{\mathrm{sin}\left(x\right)}{x},x=2,\mathrm{output}=\mathrm{plot}\right)$

In general, when the root is not a double root, Newton's method is very efficient.  In the following example with Digits set to $30$, Newton's method converges to the root after only $7$ iterations.

 > $\mathrm{Digits}:=30$
 > $\mathrm{NewtonsMethod}\left({x}^{4}-4{x}^{3}+4{x}^{2}-3x+3,x=1,\mathrm{output}=\mathrm{sequence},\mathrm{iterations}=10\right)$
 > $\mathrm{Digits}:=10$
 ${\mathrm{Digits}}{:=}{30}$
 ${1}{,}{1.33333333333333333333333333333}{,}{1.28318584070796460176991150443}{,}{1.28231623816647766759714731909}{,}{1.28231595363411166690275078928}{,}{1.28231595363408116582940754743}{,}{1.28231595363408116582940754709}{,}{1.28231595363408116582940754707}{,}{1.28231595363408116582940754707}{,}{1.28231595363408116582940754707}{,}{1.28231595363408116582940754707}$
 ${\mathrm{Digits}}{:=}{10}$ (3.9)

You can also learn about Newton's method using the NewtonsMethodTutor command.

 > $\mathrm{NewtonsMethodTutor}\left(\right)$
 > 

Main: Visualization