VIII Infinite series
Usage Overview
Functions | Brief Usage Descriptions and Examples |
---|---|
ism | Find \(\sum_a^bf(n)\) by "ism;f(n);n;a;b;c", where "c" is optional for "b = c". Determine convergence by "ism;f(n);n;1;oo;cv/ac" ("ac" for absolute convergence). Examples lim;n**(-2)*exp(n);n;oo || ism;1/n**2;n;1;oo || ism;1/n;n;1;oo;cv || ism;n**(-1.5);n;1;oo || ism;(-1)**n;n;0;oo || ism;(-1)^n/n;n;1;oo;ac ||. |
ses | Taylor series expansion and approximation by "ses;f(x);x;center;nterm;p/n;x0", where "center;nterm;p/n;x0" are optional, default "center = 0", default "nterm = 6" (number of terms), default direction "p" for "+", "n" for "-", and "x0" for approximating f(x) at x = x0. Examples ses;sin(2*x);x || ses;exp(-x**2);x;0;7 || ses;tan(x);x;0;10;p;0.1 || plt;exp(x);1+x+x**2/2;1+x+x**2/2+x**3/6 ||. |
Table of Contents
1 Infinite Sequence and Series
Infinite Sequence and Series
Limits of infinite sequences and series: [ lim; f(n); n; oo ], [ lim(f(n), n, oo) ]Sequences are fundamental for studying infinite series, and the limiting behavior of an infinite sequence is the key to understanding convergence of infinite series.
Infinite sequence A sequence can be considered as a function whose domain is the set of positive integers.
Examples
(1) It is known the sequence \(a_n=(1+\frac{1}{n})^n\) approaches a limit \(e\) as \(n\) tends to infinity. ||
lim;(1+1/n)**n;n;oo ||.
(2) The sequences \(n^{-1},n^{-1}\ln n, ne^{-n}\) converge to 0 as \(n\) tends to infinity by lim;n**(-1);n;oo ||
lim;log(n)/n;n;oo || lim;n/exp(n);n;oo || lim(1/n,n,oo) || lim(log(n),n,oo) || lim(n/exp(n),n,oo) ||.
(3) The sequences \((-1)^n,e^nx^{-n},\sqrt{n-1},1.2^n,\sin(n)\) diverges as \(n\) tends to infinity by lim;(-1)**n;n;oo || lim;exp(n)/x**n;n;oo || lim;(n-1)**(1/2);n;oo || lim;1.2**n;n;oo || lim;sin(n);n;oo ||.
You may notice that "lim" is used for finding the limit of an infinite sequence by its nth term, a function of a natural number n. If the limit exists, the sequence converges as n tends to infinity "oo".
Examples lim;((n+1)/(2*n-1))**n;n;oo || lim;log(n**3)/n;n;oo || lim;log(n**2)**2/n;n;oo || lim;2**n/5**n;n;oo || lim;1/n**3;n;oo || lim;1/n**(1/2);n;oo || lim;(n**3)**(1/n);n;oo || lim;(4*n**3)**(1/n);n;oo || lim;n**5/exp(n);n;oo || lim;exp(n)/n**n;n;oo || lim;n**n/3**n;n;oo || lim;(n**2+(-1)**n)/(n**2+1);n;oo || lim;(1+n**2)/(2*n+5);n;oo || lim;n*sin(1/n);n;oo || lim;(2**n+3**n)**(1/n);n;oo || lim;(5**n+4**n)**(1/n);n;oo || lim;(6**n-2**n)**(1/n);n;oo || lim;(1+1/n**2)**n;n;oo || lim;(1+1/n**2)**(n**3);n;oo ||.
Finding sum of a finite number of terms: [ism; f(n); n; n1; m; M], [ism(f(n), n, n1, m, M)]
Sigma notation is used to write a sum of many terms in a compact form. For example, a sum of \(n\) terms of numbers is \(a_1+a_2+\cdots+a_{n-1}+a_n=\sum_{i=1}^na_i\), where \(a_i\) is the \(i\)th term, the numbers of \(i\) from 1 to \(n\) are the lower and upper limits of the summation, and \(i\) is a summation index, which tells where the sum begins and ends. This index is also called dummy variable because any variable such as \(i,j,k\) can be used as an index. The lower limit can start with any integer (not necessarily with 1).
In the sum \(\sum_{j=5}^{9}(j-3)^2\) = (5-3)² + (6-3)² + (7-3)² + (8-3)² + (9-3)² = 90, where \((j-3)^2\) is called a general term. In the sum \(\sum_{i=1}^n(2x+\frac{4i^2}{n^2})\), \(i\) varies in each term, but \(x\) and \(n\) remain the same. Check ism;(j-3)**2;j;5;m;9 ||.
Attention Use "ism; f(n); n; n1; m; M" or "ism(f(n), n, n1, m, M)" to compute the sum of f(n) from n = n1 to m = M, where n1 and M must be positive integers and n1 < M. If M is not provided, you may get the sum from n1 to m, which is a symbolic formula for the sum.
Properties of summation
Linearity \(\sum_{i=1}^n(a_i\pm b_i)=\sum_{i=1}^na_i\pm \sum_{i=1}^nb_i\)
Constant multiple \(\sum_{i=1}^nca_i=c\sum_{i=1}^na_i\)
Constant sum \(\sum_{i=1}^nk=nk\).
Power sums The following examples of power sums are often used to calculate other relevant sums.
\(\sum_{i=1}^ni=1+2+3+\cdots+(n-1)+n=\frac{n(n+1)}{2}\)
\(\sum_{i=1}^ni^2=1^2+2^2+3^2+\cdots+(n-1)^2+n^2=\frac{n(n+1)(2n+1)}{6}\)
\(
\sum_{i=1}^ni^3=1^3+2^3+3^3+\cdots+(n-1)^3+n^3=\frac{n^2(n+1)^2}{4}=\bigl[\frac{n(n+1)}{2}\bigr]^2\).
\(\sum_{i=1}^n i^4=\frac{n^5}{5}+\frac{n^4}{2}+\frac{n^3}{3}-\frac{n}{30}\).
These properties can be proven by mathematical induction.
Examples
(1) Check the above formula by ism;a;i;1;n || ism;i;i;1;n || ism;i**2;i;1;n || ism;i**3;i;1;n || ism;i**4;i;1;n ||.
(2) ism;5;i;1;n;10 || ism;-1;i;1;n;100 || ism;i;i;1;n;100 || ism;i;i;1;n;1000 || ism;i**2;i;1;n;100 || ism;i**2;i;1;n;500 || ism;i**3;i;1;n;100 || ism;i**3;i;1;n;500 || ism;i**4;i;1;n;400 || ism;i**4;i;1;n;1000 ||.
Change of index The following two sums have different summation index and limits, but the their sums are the same.
\(\sum_{i=m}^{m+n}f(i)=
f(m)+f(m+1)+\cdots+f(m+n), \sum_{i=1}^nf(i+m)=f(m)+f(m+1)+\cdots + f(m+n)\). Thus, \(\sum_{i=m}^{m+n}f(i)= \sum_{i=1}^nf(i+m)\).
For example, \(\sum_{i=5}^{20}\frac{1}{(i-5)^2+1}=\sum_{j=0}^{15}\frac{1}{j^2+1}\) by letting \(j=i-5\).
Telescoping sum \(\sum_{i=1}^n(a_i-a_{i-1})=a_n-a_0\) because all but the first and last terms cancel out. We say the sum telescopes to \(a_n-a_0\). For example, \(\sum_{i=1}^n[(i+1)^3-i^3]=(n+1)^3-1^3\).
Sum of geometric series If \(r\ne 1, \sum_{i=1}^nr^{i-1}=\frac{r^n-1}{r-1}\). To see this result, multiplying the sum by a constant makes a telescoping sum \((r-1)\sum_{i=1}^nr^{i-1}=\sum_{i=1}^n(r^i-r^{i-1})=r^n-1\).
If \(a≠0,|r|<1\), then \(\sum_{i=0}^nar^i=\frac{a(1-r^{n+1})}{1-r}\). As \(n\to∞,r^{n+1}\to 0\), and thus, \(\sum_{i=0}^{∞}ar^i=\frac{a}{1-r}\).
Examples
(1) ism;1/i-1/(i+1);i;1;n;100 || ism;(1/(2*n+1)-1/(2*n+3);n;0;m;50 || ism(1/(2*n+1)-1/(2*n+3),n,0,m) ||.
(2) ism;(-1)**i;i;0;n;10 || ism;(-1)**i;i;0;n;101 || ism;2**i;i;1;n ||
ism;5**i;i;1;n || ism;(-3)**i;i;1;n || ism;(-4)**i;i;1;n || ism;0.5**i;i;1;n || ism;0.3**i;i;1;n || ism;1.2**i;i;1;n || ism;(-8.2)**i;i;1;n || ism;0.2**i;i;0;n;20 || ism;0.3**i;i;0;n;50 ||
ism;(-0.6)**i;i;0;n;50 || ism;(-0.8)**i;i;0;n;500 ||.
Finding sums of infinite series: [ ism; f(n); n; n1; oo] or [ ism(f(n), n, n1, oo) ]
An infinite series is a sum of infinitely many terms, whose nth partial sum forms an infinite sequence. The sum of the series is defined as the limit of its nth partial sum as n tends to infinity. If the limit exists, the infinite series converges; if the limit does not exist, the series diverges.
Finding infinite sum Use "ism; f(n); n; n1; oo" to determine the sum of an infinite series, where "ism" (infinite sum) is the operation name, "f(n)" the expression of the nth term (a function of a natural number "n"), and "n1; oo" means the sum from "n1" to infinity "oo". If a series converges, you may get a finite number for the sum. But if you don't get a finite number from the program, you may want to use a method to test if a series converges or diverges (see next section "Tests for Convergence")
Attention Also use "ism(f(n), n, n1, oo)" to find the sum of an infinite series, and you get the same result as "ism; f(n); n; n1; oo".
Examples
(1) The geometric series \(\displaystyle\sum_{n=0}^∞0.6^n\) = 2.5 converges. Check ism;0.6**n;n;0;oo || ism(0.6**n,n,0,oo) ||.
(2) The geometric series \(\displaystyle\sum_{n=0}^∞1.5^n=∞\) diverges. Check ism;1.5**n;n;0;oo || ism(1.5**n,n,0,oo) ||.
(3) Show \(\displaystyle\sum_{n=0}^∞ne^{-n}=\frac{1}{e(1-e^{-1})^2}\) by ism;n*exp(-n);n;0;oo || ism(n*exp(-n),n,0,oo) ||.
Examples
(1) Harmonic series diverges. Check ism;1/n;n;1;oo || shows \(\displaystyle\sum_{n=1}^∞\frac{1}{n}=∞\).
(2) p-series converges for p > 1. Check ism;1/n**2;n;1;oo || ism;n**(-1.5);n;1;oo || ism;1/n**2.5;n;1;oo ||.
(3) p-series diverges for p < 1. Check ism;1/n**(1/2);n;1;oo || ism;n**(-2/3);n;1;oo || ism;1/(n+n**(1/2));n;1;oo ||.
(4) Geometric series converges for r < 1. Check ism;(1/2)**n;n;1;oo || ism;1/3**n;n;0;oo || ism;1/1.5**n;n;1;oo ||.
(5) Geometric series converges for r > 1. Check ism;2**n;n;1;oo || ism;3**n;n;0;oo || ism;2.5**n;n;1;oo ||.
(6) Alternating series. Check ism;(-1)**n*(1/n);n;1;oo || ism;(-1)**n*1/n**2;n;1;oo || ism;(-1)**n*n**(-1/2);n;1;oo ||.
(7) Telescope series. Check ism;1/(n*(n+1));n;1;oo || ism;1/(n**2-1);n;2;oo || ism;1/((2*n+1)*(2*n+3));n;0;oo ||.
(8) Check other series ism;(-1)**n;n;0;oo || ism;n**2/exp(n);n;0;oo || ism;n**3/exp(n);n;0;oo || ism;log(n)/n**2;n;1;oo || ism;2*n/(1+n);n;0;oo || ism;n**2/2**n;n;0;oo || ism;2**(1/n);n;1;oo || ism;(1+1/n)**n;n;1;oo ||.
Examples
(1) ism;1/gamma(n+1);n;0;oo || shows \(\sum_0^∞\frac{1}{n!}=e\).
(2) ism;2**n/gamma(n+1);n;0;oo || shows \(\sum_0^∞\frac{2^n}{n!}=e^2\).
(3) ism;(-3)**n/gamma(n+1);n;0;oo || shows \(\sum_0^∞\frac{(-3)^n}{n!}=e^{-3}\).
(4) ism;(-1)**n/gamma(2*n+2);n;0;oo || shows \(\sum_0^∞\frac{(-1)^n}{(2n+1)!}\) = sin(1).
(5) ism;(-1)**n*2**(2*n+1)/gamma(2*n+2);n;0;oo || shows \(\sum_0^∞\frac{(-1)^n2^{2n+1}}{(2n+1)!}\) = sin(2).
(6) ism;(-1)**n*2**(2*n)/gamma(2*n+1);n;0;oo || shows \(\sum_0^∞\frac{(-1)^n2^{2n}}{(2n)!}\) = cos(2).
(7) ism;3**(2*n)/gamma(2*n+1);n;0;oo || shows \(\sum_0^∞\frac{3^{2n}}{(2n)!}\) = cosh(3).
Tests for Convergence: [ ism; f(n); n; n1; oo; cv] or [ ism(f(n), n, n1, oo, cv) ]
It is known that the geometric series \(\displaystyle\sum_{n=0}^{\infty}cr^n\) converges for \(|r| < 1\), and the p-series \(\displaystyle\sum_{n=0}^{\infty}\frac{1}{n^p}\) converges for \(p> 1\). There are several methods for testing if a series converges. Apply the "lim" module to the ratio test, root test, and limit comparison test, and use the "itg" module to do integral test.
Add a keyword "cv" (converge or diverge) and use "ism; f(n); n; n1; oo; cv" to determine if a series converges or diverges. Also use "ism(f(n), n, n1, oo, cv)" to get the same results. You get "True" if a series converges, and "False" otherwise.
Examples
(1) Geometric series \(\sum_{n=0}^{\infty}0.4^n\) converges by ism;0.4**n;n;0;oo;cv ||, \(\sum_{n=0}^{\infty}1.7^n\) diverges
by ism(1.7**n,n,0,oo,cv) ||, \(\sum_{n=0}^{\infty}1^n\) diverges by ism;1;n;0;oo;cv ||, and \(\sum_{n=0}^{\infty}4(\frac{2}{3})^n\) converges by
ism(4*(2/3)**n,n,0,oo,cv) ||.
(2) p-series \(\sum_{n=0}^{\infty}\frac{1}{n^{0.7}}\) diverges by ism;n**(-0.7);n;0;oo;cv ||,
\(\sum_{n=0}^{\infty}\frac{1}{n^{1.6}}\) converges by ism;n**(-1.6);n;0;oo;cv ||, and \(\sum_{n=0}^{\infty}\frac{1}{n}\) diverges by ism;1/n;n;0;oo;cv ||.
(3) Check others ism;(2*n+1)/(n+3);n;0;oo;cv || ism;2*n/((n+1)*(2*n+1));n;0;o;cv || ism;1/(n**0.5+(n-1)**0.5);n;1;oo;cv ||
ism;1/gamma(n);n;1;oo;cv || ism;1/(n*log(n));n;1;oo;cv || ism;n**n/exp(n);n;1;oo;cv || ism;n**n/exp(n**2);n;1;oo;cv ||
ism;(-1)**n*2**(2*n)/(gamma(n+1)**2*4**n);n;0;oo;cv ||.
Ratio test
Example To test the convergence of \(\displaystyle\sum_{n=0}^{\infty}\frac{n^5}{e^n}\), type lim;((n+1)**5/exp(n+1))/(n**5/exp(n));n;oo ||, and the limit is 1/e (less than 1). So the series converges.
Examples If ratio test involves factorials, first simplify the ratio, and then apply the "lim" module.
(1) For \(\sum\frac{e^n}{n!}\), the ratio is \(\frac{e}{n+1}\), and the limit is 0 by lim;e/(n+1);n;oo ||. The series converges by the ratio test.
(2) For \(\sum\frac{n^n}{n!}\), the ratio is \(\frac{(n+1)^n}{n^n}\), and the limit is e > 1 is lim;(1+1/n)**n;n;oo ||. The series diverges by the ratio test.
(3) The ratio for \(\sum\frac{(2n+2)!}{(2n)!}\) is \(\frac{2n+3}{(2n+2)(2n+1)}\), and the limit is 0 by lim;(2*n+3)/((2*n+2)*(2*n+1));n;oo ||. The series converges by the ratio test.Root test
Example Does the series \(\displaystyle\sum_{n=0}^{\infty}(\frac{n^2+1}{2n^2+3n})^n\) converge? The root test by lim;(n**2+1)/(2*n**2+3*n);n;oo || finds the limit 1/2 (less than 1), so it converges.
limit comparison test
Example To determine the convergence of \(\displaystyle\sum_{n=0}^{\infty}\frac{n^2+2}{3n^4+n^3-5}\), compare it to the p-series with \(a_n=\frac{1}{n^2}\) (converges), type lim;((n**2+1)/(3*n**4+n**3-5))/(1/n**2);n;oo ||, and you will see the limit is 1/3. Thus, the series converges.
Integral test
Examples Determine the convergence of \(\displaystyle\sum_{n=0}^{\infty}\frac{1}{n(\ln n)^3}\) by itg;1/(n*log(n)**3);n;2;oo ||, and you will see the result \(\frac{1}{2\ln^22} < 1\). So the series converges.
Absolute convergence: [ ism; f(n); n; n1; oo; ac] or [ ism(f(n), n, n1, oo, ac) ]
A series \(\sum a_n\) converges absolutely if the positive series \(\sum|a_n|\) converges; a series \(\sum a_n\) converges conditionally if \(\sum a_n\) converges but \(\sum|a_n|\) diverges. Absolute convergence can be used to determine the convergence of an infinite series with both positive and negative terms.
Absolute convergence theorem ensures that if \(\sum|a_n|\) converges, then \(\sum a_n\) also converges.
Add keyword "ac" (absolutely convergent) and use "ism; f(n); n; n1; oo; ac" or ism(f(n), n, n1, oo, ac) to determine if a series converges absolutely, and you will get "True" or "False" as a result.
Examples These series \(\displaystyle\sum_{n=1}^∞\frac{(-1)^n}{n},\quad\sum_{n=1}^∞\frac{(-1)^n}{\ln(n+1)},\quad\sum_{n=1}^∞\frac{(-1)^n}{\sqrt{n}}\) are conditionally convergent by by direct comparing them with \(\frac{1}{n}\); the series \(\displaystyle\sum_{n=1}^∞\frac{(-1)^n}{2^n},\quad\sum_{n=1}^∞\frac{(-1)^n}{n^4}\) are absolutely convergent.
Examples Verify the results by ism;(-1)**n*1/n;n;1;oo;ac || ism;(-1)**n/log(n+1);n;1;oo;ac || ism;(-1)**n*1/n**0.5;n;1;oo;ac || ism;(-1)**n*2**(-n);n;0;oo;ac || ism;(-1)**n*n**(-4);n;1;oo;ac ||.
Radius and interval of convergence: [ism; f(x,n); n; n1; oo], [ism(f(x,n), n, n1, oo)]
Using the ratio test, you can also determine the radius and interval of convergence of a series.
The radius R can be infinity, 0 or a positive number. It is known that the radius of convergence for sin(x), cos(x), and ex is R = \(\infty\),
which implies their series expansion converges at every value of x.
Example The radius and convergence interval of \(\displaystyle\sum_{n=0}^{\infty}\frac{x^n}{n^2}\) is \(R=1, |x|< 1\). To see the result, use the ratio test, and you get the ratio (abs(x)**(n+1)/(n+1)**2)/(abs(x)**n/n**2) || lim;(abs(x)**(n+1)/(n+1)**2)/(abs(x)**n/n**2);n;oo ||, which gives a limit \(|x|\). By the ratio test, if \(|x| < 1\), the series converges. Check the endpoint, you will find if \(x=\pm1\), the series \(\sum\frac{1}{n^2}\) converges, and thus the convergence interval is [-1, 1].
Use "ism; f(x,n); n; n1; oo" to determine on which interval a series F(x) converges. Be sure to check the endpoints of the interval.
Examples
(1) If \(\displaystyle\sum_{n=0}^∞\frac{x^{2n}}{n!}\), find the interval of convergence for \(x\). The ratio for the test is
\(\frac{x^2}{n+1}\), and the limit is 0 by lim;x**2/(n+1);n;oo ||. Thus, the convergence interval is \(x∈(-∞,∞)\).
(2) If \(\displaystyle\sum_{n=0}^∞5(\frac{x}{4})^n\),
find the convergence interval for \(x\). The ratio for the test is \(|\frac{x}{4}|\), and the limit is \(|\frac{x}{4}|\) by lim;abs(x/4);n;oo ||.
Since \(|\frac{x}{4}| < 1, -4 < x < 4\) by slv;abs(x)/4<1;x ||. Check the endpoint \(x=\pm 4\), and you will see the convergence interval is (-4, 4).
(3) Repeat the above two examples. (1) by ism;x^(2*n)/gamma(n+1);n;0;oo ||, you get the sum is \(e^{x^2}\), indicating the series converge for all \(x\).
(2) by ism;5*(x/4)^n;n;0;oo ||, you get the sum converges to \(\frac{4}{4-x}\) for \(|x|<4\). Since the series diverges for \(x=±4\), the convergence interval is (-4, 4).
Power Series Expansion
Power series expansion: [ses; f(x); x; c; n; p/n], [ ses(f(x), x, c, n, p/n) ]Convergent power series can be treated as they were polynomials, so we can do composition, substitution, addition, subtraction, multiplication, division, differentiation and integration to power series to create new power series.
For example, a geometric series ( a special power series) \(f(x)=\frac{1}{1-x}=\sum_{n=0}^{\infty}x^n\) can be used to create the functions like \(\frac{1}{3-x},\frac{1}{2x+3},\frac{1}{1+x},\frac{1}{1+x^2},\frac{1}{(1-x)^2}\),\(\ln(1+x),\tan^{-1}(x),\ln(1-x),\ln\frac{1+x}{1-x},\frac{e^x}{1-x},\frac{\sin(x)}{1-x},\frac{x^2}{1-x}\), and so on. These functions can be expanded into an infinite series.
Examples \(\frac{1}{1-x}=\sum_{n=0}^{\infty}x^n⇒\frac{1}{1+x}=\frac{1}{1-(-x)}=\sum_{n=0}^{\infty}(-1)^nx^n=1-x+x^2-x^3+x^4-x^5+\cdots\). Check ses;1/(1+x);x;0;10 ||. It is known that the series converges for \(|x|<1\). Check ism;x**n;n;0;oo || ism;(-x)**n;n;0;oo ||.
Examples
(1) \(\sum_0^∞ax^n=\frac{a}{1-x}\) for \(|x|<1\) by ism;a*x**n;n;0;oo ||.
(2) \(\sum_0^∞\frac{(-1)^nx^{n+1}}{n+1}=\ln(1+x)\) for \(|x|<1,x=1\) by ism;(-1)**n*x**(n+1)/(n+1);n;0;oo ||.
(3) \(\sum_0^∞x^{2n}=\frac{1}{1-x^2}\) for \(|x|<1\) by ism;x**(2*n);n;0;oo ||.
(4) \(\sum_0^∞\frac{x^n}{n!}=e^x\) for all \(x\) by ism;x**n/gamma(n+1);n;0;oo ||.
(5) \(\sum_0^∞\frac{(-1)^nx^{2n+1}}{(2n+1)!}=\sin x\) for all \(x\) by
ism;(-1)**n*x**(2*n+1)/gamma(2*n+2);n;0;oo ||.
(6) \(\sum_0^∞\frac{(-1)^nx^{2n}}{(2n)!}=\cos\) for all \(x\) by ism;(-1)**n*x**(2*n)/gamma(2*n+1);n;0;oo ||.
(7) \(\sum_0^∞\frac{(-1)^nx^{2n+1}}{(2n+1)}=\tan^{-1}x\) for \(|x|<1\) by ism;(-1)**n*x**(2*n+1)/(2*n+1);n;0;oo ||.
(8) \(\sum_0^∞\frac{x^{2n+1}}{(2n+1)!}=\sinh x\) for all \(x\) by ism;x**(2*n+1)/gamma(2*n+2);n;0;oo ||.
Binomial series can be used to derive \(\sqrt{1+x}, \sqrt{1-x}, \frac{1}{\sqrt{1-x^2}},\sin^{-1}x\), etc. The series \(e^x\) can be used to form new functions like \(e^{-x},e^{-\frac{x^2}{2}}, \sinh(x)\),\(\cosh(x),e^x\sin(x),e^{\cos(x)},\frac{\sin(x)}{e^x},...\)
Examples Check the above examples by ses;(1+x)**(1/2);x;0;10 || ses;(1+x)**(1/2);x;0;10 || ses;(1-x**2)**(1/2);x;0;10 || ses;asin(x);x;0;10 || ses;exp(-x);x;0;10 || ses(exp(-x**2/2),x,0,10) || ses(sinh(x),x,0,10) || ses(cosh(x),x,0,10) || ses(exp(x)*sin(x),x,0,10) || ses(exp(x)*cos(x),x,0,10) || ses(sin(x)/exp(x),x,0,10) ||.
Use "ses; f(x); x; c; n; p/n" to expand a function f(x) about center x = c up to n = 20 terms and verify their terms and coefficients by setting center equal to 0 (default). The default number of terms n is 6. The last term "p/n" is optional, representing the direction (positive or negative), where 'p' = '+' and 'n' = '-'. The default is positive.
Attention Use "ses(f(x), x, c, n, p/n)" to expand f(x) as a power series, and you get the same results as "ses; f(x); x; c; n; p/n".
Examples ses;1/(1-x**2);x;0 || ses;1/(1+x**3);x;0 || ses;(1+x)**0.3;x;0 || ses;4/(2*x+3);x;0 || ses;tan(x);x;0 || ses;sec(x);x;0 || ses;sin(x)/exp(x);x;0;10 || ses;exp(-x**2);x;0;10 || ses;cos(x);x;1;10;n || ses;tan(x);x;pi/4;5;n ||.
Attention Combine "dif" or "itg" with "ses" modules to generate a power series representation of functions involving integrals and derivatives. The combination "dif(ses(f(x), x, c, n, p/n), x)" differentiates the series expansion of f(x) up to nth term, and "itg(ses(f(x), x, c, n, p/n), x, a, b)" integrates the series expansion of f(x) about center c.
Examples
(1) Expand the function defined by \(\int_0^xe^{-\frac{t^2}{2}}dt\). Expand \(e^{-\frac{t^2}{2}}\) by
ses;exp(-t**2/2);t;0;10 ||, and integrate the resulting series by itg(ses(exp(-t**2/2),t,0,10),t,0,x) ||.
(2) Differentiate the expansion of cos(x) by dif(ses(cos(x),x,0,10),x) ||.
For a convergent series whose infinite sum is unknown, we can use their partial sum to approximate the value of its infinite sum (or the limit), and calculate the size of the approximation errors.
The code pattern "ses; f(x); x; c; n; p; x0" can help such an approximation to the desired degree of accuracy, where n represents the number of terms, and "x0" is a particular value the variable "x" takes. Substituting x = x0 in the nth partial sum, you will get an approximation.
Attention Use "ses(f(x), x, c, n, p, x0)" to get the same result as "ses; f(x); x; c; n; p; x0".
In general, the more terms are used for the sum, the more accurate the approximation. The closer the value "x0" is to the center "c", the more accurate the approximation.
Examples Find the number of nonzero terms so that the error of approximating cos(0.3) is less than 0.0005 (correct to three decimal places). Since \(\cos(x)=\sum_{n=0}^{\infty}\frac{(-1)^{n}x^{2n}}{(2n)!}\) is an alternating series, the error is less than the (n+1)th term. Try cos(0.3) || ses;cos(x);x;0;1;p;0.3 || ses;cos(x);x;0;3;p;0.3 || ses;cos(x);x;0;5;p;0.3, and find 2 terms suffices. Or simply check a few terms to see which one is less than 0.0005 by 0.3**2/gamma(3) || 0.3**4/gamma(5), and also find n = 2 terms.
Examples To approximate \(\tan^{-1}\frac{1}{3}\) using the first two nonzero terms by the series \(\sum_{n=0}^{\infty}\frac{(-1)^nx^{2n+1}}{2n+1}\), you get the result about 0.320988 by ses;atan(x);x;0;5;p;1/3. Compare to the value 0.321751 by atan(1.0/3) ||, calculate the error of the third nonzero term by (1/3)**5/5, which is less than 1/1215.
Examples Also see the error of approximating \(\sqrt[6]{70}=2(1+\frac{3}{32})^{\frac{1}{6}}\) by the binomial series \(2(1+x)^{\frac{1}{6}}\) with n = 5 by the code ses;2*(1+x)**(1/6);x;0;5;p;3/32 || 70.0**(1/6)-2.0300945887963 ||.
Examples To approximate \(\int_0^1\frac{1-\cos(x)}{x}dx\), write \(\frac{1-\cos(x)}{x}=\frac{x}{2!}-\frac{x^3}{4!}+ \frac{x^5}{6!}-\frac{x^7}{8!}+\cdots\), and integrate it term by term to have \([\frac{x^2}{2(2!)}-\frac{x^4}{4(4!)}+\frac{x^6}{6(6!)}-\frac{x^8}{8(8!)}+\cdots]|_0^1\). If the first 2 nonzero terms are used, the sum is about 25/96 by 1/4+1/(4*gamma(5)) ||, and the error for the approximation is less than 1/4320 by 1/(6*gamma(7)) ||.
2 Taylor Polynomial and Taylor Series
Relations of power series and Taylor series Functions that have power series representations can be used to generate new power series representations for other functions of some special forms. Taylor series expansion provides a general approach for finding a power series representation for any function. The power series generated by Taylor series expansion of a function at a center is called Taylor series.
All Taylor series are in form of power series. Taylor series centered at 0 is also called Maclaurin series. If a function has a power series representation, the power series is also a Taylor series. So if we want to represent a function by a power series, the Taylor series is the unique solution.
Taylor and Maclaurin series To find Taylor series expansion for a given function, differentiate the function repeatedly, set \(x=c\), solve the coefficient for each term \(a_n=\frac{f^{(n)}(c)}{n!}\), express the function as a sum of the nth partial sum (called Taylor polynomial) and a remainder, and show the remainder term approaches 0 as \(n\) tends to infinity.
Using a Taylor series representation of a known function, we can derive the power series presentation of an unknown function. In case the remainder does not converge to 0, the function cannot be represented by a power series. However, if the nth derivative is bounded for all n, the function can be represented by a power series.
Examples Functions that cannot be differentiated infinitely many times will have itself as Taylor expansion. Check the functions \(x,x^3,(x+5)^6\) at a center by ses;x;x;0;3 || ses;(x-1)**2;x;0;4 || ses;x**3;x;1;6 || ses;(x+1)**6;x;0;8 || ses;(x-1)**4;x;0;6 ||.
Examples Although it is not possible (and not necessary) to display infinitely many terms, you can check the partial sum of a Taylor series expansion of a given function. The code ses;exp(x);x;0;20 || expands \(e^x\) centered at 0 up to its first 20 terms. Check if the series converges exactly to the function by ism;x**n/gamma(n+1);n;0;oo ||.
Examples Find the Taylor or Maclaurin series for the following functions. || ses;sin(x);x;0;10 || ses;cos(x);x;0;15 || ses;1/(1-x)**2;x;0;20 || ses;sinh(x);x;0;20 || ses;cosh(x);x;0;20 || ses;atan(x);x;0;15 || ses;log((1+x)/(1-x));x; 0;15 ses;1/(1-x**2)**(1/2);x;0;10 || ses;x**(1/2);x;1;10 || ses;x*exp(x);x;0;10 || ses;exp(x);x;1;5 || ses;exp(x);x;3 || ses;exp(x);x;-2;5 || ses;sin(x);x;pi/6 || ses;sin(x);x;-pi/3 || ses;csc(x);x;pi/4 || ses;exp(-x**2/2);x;0 || ses;sin(3*x);x;0 || ses;cos(x/2);x;0 || ses;tan(x);x;pi/6 || ses;log(x);x;3 || ses;x**(1/2);x;0 || ses;x**(1/2);x;2;8 || ses;sin(x)/x;x;0 || ses;(1-cos(x))/x;x;0 || ses;sin(x**2);x;pi/5 || ses;sin(x)/exp(x);x;0 || ses;exp(sin(x));x;0 || ses;asin(x);x;0 || ses;atan(x);x;2 || ses;cos(x)**2;x;pi/3 || ses;log(x);x;2;10;n || ses;2**x;x;0 || ses;3**x;x;1;5;n || ses;(2/3)**x;x;1;5;n || ses;log(x);x;1 || ses;1/x;x;1 ||.
Example Find the Maclaurin series for \(∫\sqrt{1+x^2}dx\) by itg(ses((1+x**2)**(1/2),x,0,7),x) ||.
Approximation by Taylor polynomials: [ses; f(x); x; c; n; p/n; x0], [ses(f(x), x, c, n, p/n, x0)]One of the most important applications of Taylor series is to use it to approximate function values. If a function f is represented by its Taylor series, the remainder Rn(x) = f(x) - Tn(x) approaches 0 as n tends to infinity, where Tn(x) is the nth order Taylor polynomial centered at x = c.
In most cases, the exact value of the remainder (error) is not known, but it depends on the size of the (n+1)th derivative, and an upper bound of the remainder can be thought of as the size of the approximation errors. The accuracy of the approximation depends on the order of a Taylor polynomial and how close the point is to the center. Linear and quadratic approximation can be considered as a special case of approximation by Taylor polynomials.
To use the module "ses" for approximating a function at a given value x = x0 that is very close to the center, calculate the absolute difference as the possible size of the errors.
Example To approximate \(e^{\frac{2}{3}}\) correctly to the three decimal places, we need to write \(e^x=\sum_{n=0}^{\infty}\frac{x^n}{n!}\), and substitute \(x=\frac{2}{3}\) to have \(e^{\frac{2}{3}}=1+\frac{2}{3}+\frac{1}{2!}(\frac{2}{3})^2+\frac{1}{3!}(\frac{2}{3})^3+\frac{1}{4!}(\frac{2}{3})^4 +\cdots\), which is not an alternating series. But the error or remainder \(R_n(x)=\frac{f^{(n+1)}(c)}{(n+1)!}(\frac{2}{3})^{n+1}=\frac{e^c}{(n+1)!} (\frac{2}{3})^{n+1}<\frac{3}{(n+1)!}(\frac{2}{3})^{n+1}\) because \(0 < c < \frac{2}{3}\). So check the results by 16/(27*gamma(5)) || 32/(81*gamma(6)) || 64/(243*gamma(7)), and find that 5 terms suffice and the error is less than 0.000366. Another method for this approximation is to directly calculate the difference between exp(2.0/3) and ses;exp(x);x;0;5;p;2/3 || ses;exp(x);x;0;6;p;2/3 || ses;exp(x);x;0;7;p;2/3 ||.
Example To approximate cos(63°), the value |cos(63°) - T5(63°)| indicates the size of error in approximating cos(63°) by the 5th order Taylor polynomial of cos(x + π/3) centered at 0 (note that we need to convert degrees to radians before using the module for approximation). Enter cos(63.0*pi/180) || and you get cos(0.35π) ≈ cos(1.099557) = 0.453991; enter ses;cos(x+pi/3);x;0;6;p;pi/60 and you get 0.45399049974 ||.
Example To approximate ln(2) ≈ 0.69315 by \(\ln(1+x)\) or \(\ln\frac{x+1}{1-x}\), solve \(1+x=2⇒x=1\) and \(\frac{x+1}{1-x}⇒x= \frac{1}{3}\), type ses;log(1+x);x;0;10;p;1 || or || ses;log((1+x)/(1-x));x;0;5;p;1/3 ||, and compare the results from the two approximation approaches.
Examples Estimate atan(1/3) by ses;atan(x);x;0;7;p;1/3 ||
Examples To approximate \(\int_0^1\sin(x^2)dx\), use the following methods.
(1) Find its Taylor polynomial by
ses;sin(x**2);x;0;10 ||, and then integrate the resulting polynomial by itg;x**2-x**6/6;x;0;1 ||, or use more terms by itg;x**2-x**6/6+x**10/120;x;0;1 ||
to achieve the desired accuracy. It is about 0.31.
(2) Use the combination itg(ses(sin(x**2),x,0,10),x) || and 1**3/3-1**7/42 ≈ 0.31 ||.
(3) Use nit;sin(x**2);x;0;1;30 ||, which is about 0.31.
Example Estimate \(∫_0^1e^{-x^3}dx\). First find the antiderivative by itg(ses(exp(-x**3),x,0,7),x) ||. The result is about 1-1/4+1/14 ≈ 0.82. Or by nit;exp(-x**3);x;0;1;30 ||. It is about 0.81.
Graph Taylor and Maclaurin polynomials Use the "plt" module to visualize how Taylor polynomials approximate a function well over larger and larger intervals as the order n increases.
Examples Linear and quadratic approximation for ln(x) by Taylor polynomials T1(x) = x - 1 and T2(x) = x - 1 - 0.5(x - 1)2 centered at 1 by plt;log(x);x-1;x-1-(x-1)**2/2 ||. Check the graphs of T3(x) and T5(x) relative to ex by plt;exp(x);1+x+x**2/2+x**3/6;1+x+x**2/2+x**3/6+x**4/24+x**5/120 ||.
Examples plt;cos(x);1-x**2/2+x**4/24;1-x**2/2+x**4/24-x**6/720 || plt;sin(x);x-x**3/6+x**5/120;x-x**3/6+x**5/120-x**7/5040 || plt;1/(1-x);1+x+x**2+x**3+x**4;1+x+x**2+x**3+x**4+x**5+x**6+x**7+x**8;itv=(0,1) ||.