Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168693
Image: ubuntu2004
f = x^2+2*x+1; f;
x^2 + 2*x + 1
f.plot(x,-20,20)
taylor(f, x, 0, 1)
2*x + 1
taylor(f, x, 0, 2)
x^2 + 2*x + 1
taylor(f, x, 0, 5)
x^2 + 2*x + 1
This is not surprising because f is a parabola. Thus, a Taylor polynomial can accurately plot it within two summations.
taylor(f, x, 1, 1)
4*x
taylor(f, x, 1, 2)
(x - 1)^2 + 4*x
(x-1)^2+4*x-(x^2+2*x+1) = 0. (This means that the second approximation is equal to f(x).
taylor(f, x, 1, 1)
4*x
h(x) = abs(4*x - f)
h(1)
0
h(5)
16
h(10)
81
h(100)
9801
This means that, as x is centered farther away from 1, the Taylor polynomial becomes less accurate.
j(x) = (1+x)^-1; j; j.plot(x,-1, 1)
x |--> 1/(x + 1)
taylor(j, x, 1, 1)
x |--> -1/4*x + 3/4
k(x) = (j+1/4*x-3/4); k
x |--> 1/4*x + 1/(x + 1) - 3/4
k(2)
1/12
k(3/2)
1/40
k(5/4)
1/144
k(9/8)
1/544
k(17/16)
1/2112
k(33/32)
1/8320
taylor(j, x, 1, 2)
x |--> 1/8*(x - 1)^2 - 1/4*x + 3/4
m(x) = 1/8*(x - 1)^2 - 1/4*x + 3/4 - j; m
x |--> 1/8*(x - 1)^2 - 1/4*x - 1/(x + 1) + 3/4
m(2)
1/24
m(3/2)
1/160
m(5/4)
1/1152
m(9/8)
1/8704
m(33/32)
1/532480
taylor(j, x, -9/10, 1)
x |--> -100*x - 80
n(x) = -100*x - 80 - j
n(2-9/10)
-4000/21
n(3/2-9/10)
-1125/8
n(5/4-9/10)
-3125/27
n(9/8-9/10)
-10125/98
n(17/16-9/10)
-36125/372
n(33/32-9/10)
-136125/1448
taylor(j, x, -9/10, 2)
x |--> 10*(10*x + 9)^2 - 100*x - 80
p(x) = 10*(10*x + 9)^2 - 100*x - 80 - j
p(2-9/10)
80000/21
p(3/2-9/10)
16875/8
p(5/4-9/10)
78125/54
p(9/8-9/10)
455625/392
p(17/16-9/10)
3070625/2976
p(33/32-9/10)
22460625/23168
p.plot(x,-1,3)
q(x) = arctan(x)
derivative(q,x,2)
x |--> -2*x/(x^2 + 1)^2
r(x) = -2*x/(x^2 + 1)^2; r; r.plot (x, 0, 1)
x |--> -2*x/(x^2 + 1)^2
K=-1.0
derivative(q,x,6)
x |--> -3840*x^5/(x^2 + 1)^6 + 3840*x^3/(x^2 + 1)^5 - 720*x/(x^2 + 1)^4
s(x) = -3840*x^5/(x^2 + 1)^6 + 3840*x^3/(x^2 + 1)^5 - 720*x/(x^2 +1)^4; s; s.plot(x,0,1)
x |--> -3840*x^5/(x^2 + 1)^6 + 3840*x^3/(x^2 + 1)^5 - 720*x/(x^2 + 1)^4
K=-120
derivative(q,x,11)
x |--> 3715891200*x^10/(x^2 + 1)^11 - 8360755200*x^8/(x^2 + 1)^10 + 6502809600*x^6/(x^2 + 1)^9 - 2032128000*x^4/(x^2 + 1)^8 + 217728000*x^2/(x^2 + 1)^7 - 3628800/(x^2 + 1)^6
t(x) = 3715891200*x^10/(x^2 + 1)^11 - 8360755200*x^8/(x^2 + 1)^10 + 6502809600*x^6/(x^2 + 1)^9 - 2032128000*x^4/(x^2 + 1)^8 + 217728000*x^2/(x^2 + 1)^7 - 3628800/(x^2 + 1)^6; t; t.plot(x,0,1)
x |--> 3715891200*x^10/(x^2 + 1)^11 - 8360755200*x^8/(x^2 + 1)^10 + 6502809600*x^6/(x^2 + 1)^9 - 2032128000*x^4/(x^2 + 1)^8 + 217728000*x^2/(x^2 + 1)^7 - 3628800/(x^2 + 1)^6
K=-4e6
taylor(q, x, 0, 1)
x |--> x
taylor(q, x, 0, 5)
x |--> 1/5*x^5 - 1/3*x^3 + x
taylor(q, x, 0, 10)
x |--> 1/9*x^9 - 1/7*x^7 + 1/5*x^5 - 1/3*x^3 + x
-(.5^2)/2
-0.125000000000000
abs(.5-arctan(.5))
0.0363523909991939
This K value works.
-1/2
-1/2
abs(1-arctan(1))
abs(-1/4*pi + 1)
This K value works.
-120*(.5^6)/720
-0.00260416666666667
abs(1/5*.5^5 - 1/3*.5^3 + .5 - arctan(.5))
0.000935724332527255
This K value works.
-120/720
-1/6
abs(1/5*1^5 - 1/3*1^3 + 1 - arctan(1))
abs(-1/4*pi + 13/15)
This K value works.
-4e6*(.5^11)/39916800
-0.0000489298991903159
abs(1/9*.5^9 - 1/7*.5^7 + 1/5*.5^5 - 1/3*.5^3 + .5 - arctan(.5))
0.0000366667928446973
This K value works.
-4e6/39916800
-0.100208433541767
abs(1/9*1^9 - 1/7*1^7 + 1/5*1^5 - 1/3*1^3 + 1 - arctan(1))
abs(-1/4*pi + 263/315)
This K value works.