Examples:  Taylor Polynomials 

 

 

Example 1. 

 

> `:=`(f, exp(x)); 1
 

exp(x) (1)
 

> `:=`(P5, `+`(1, x, `/`(`*`(`^`(x, 2)), `*`(factorial(2))), `/`(`*`(`^`(x, 3)), `*`(factorial(3))), `/`(`*`(`^`(x, 4)), `*`(factorial(4))), `/`(`*`(`^`(x, 5)), `*`(factorial(5))))); 1
 

`+`(1, x, `*`(`/`(1, 2), `*`(`^`(x, 2))), `*`(`/`(1, 6), `*`(`^`(x, 3))), `*`(`/`(1, 24), `*`(`^`(x, 4))), `*`(`/`(1, 120), `*`(`^`(x, 5)))) (2)
 

> plot([f, P5], x = -1 .. 1); 1
 

Plot_2d
 

> plot([f, P5], x = -2 .. 2); 1
 

Plot_2d
 

> plot([f, P5], x = -5 .. 5); 1
 

Plot_2d
 

 

Example 2. 

 

> `:=`(f, sin(x)); 1
 

sin(x) (3)
 

> `:=`(P1, x); 1
 

x (4)
 

> plot([f, P1], x = -1 .. 1); 1
 

Plot_2d
 

> plot([f, P1], x = -2 .. 2); 1
 

Plot_2d
 

> `:=`(P3, `+`(x, `-`(`/`(`*`(`^`(x, 3)), `*`(factorial(3))))))
 

`+`(x, `-`(`*`(`/`(1, 6), `*`(`^`(x, 3))))) (5)
 

> plot([f, P3], x = -1 .. 1); 1
 

Plot_2d
 

> plot([f, P3], x = -2 .. 2); 1
 

Plot_2d
 

> `:=`(P5, `+`(x, `-`(`/`(`*`(`^`(x, 3)), `*`(factorial(3)))), `/`(`*`(`^`(x, 5)), `*`(factorial(5)))))
 

`+`(x, `-`(`*`(`/`(1, 6), `*`(`^`(x, 3)))), `*`(`/`(1, 120), `*`(`^`(x, 5)))) (6)
 

> plot([f, P5], x = -1 .. 1); 1
 

Plot_2d
 

> plot([f, P5], x = -2 .. 2); 1
 

Plot_2d
 

> `:=`(P7, `+`(x, `-`(`/`(`*`(`^`(x, 3)), `*`(factorial(3)))), `/`(`*`(`^`(x, 5)), `*`(factorial(5))), `-`(`/`(`*`(`^`(x, 7)), `*`(factorial(7)))))); 1
 

`+`(x, `-`(`*`(`/`(1, 6), `*`(`^`(x, 3)))), `*`(`/`(1, 120), `*`(`^`(x, 5))), `-`(`*`(`/`(1, 5040), `*`(`^`(x, 7))))) (7)
 

> plot([f, P7], x = -1 .. 1); 1
 

Plot_2d
 

> plot([f, P7], x = -2 .. 2); 1
 

Plot_2d
 

 

Example 3. 

 

> `:=`(f, `/`(1, `*`(x))); 1
 

`/`(1, `*`(x)) (8)
 

> `:=`(P5, `+`(2, `-`(x), `*`(`^`(`+`(x, `-`(1)), 2)), `-`(`*`(`^`(`+`(x, `-`(1)), 3))), `*`(`^`(`+`(x, `-`(1)), 4)), `-`(`*`(`^`(`+`(x, `-`(1)), 5))))); 1
 

`+`(2, `-`(x), `*`(`^`(`+`(x, `-`(1)), 2)), `-`(`*`(`^`(`+`(x, `-`(1)), 3))), `*`(`^`(`+`(x, `-`(1)), 4)), `-`(`*`(`^`(`+`(x, `-`(1)), 5)))) (9)
 

> plot([f, P5], x = .5 .. 1.5); 1
 

Plot_2d
 

 

Example 4. 

 

> `:=`(f, sqrt(x)); 1
 

`*`(`^`(x, `/`(1, 2))) (10)
 

> `:=`(P4, `+`(3, `*`(`/`(1, 6), `+`(x, `-`(9))), `-`(`*`(`/`(1, 216), `*`(`^`(`+`(x, `-`(9)), 2)))), `*`(`/`(1, 3888), `*`(`^`(`+`(x, `-`(9)), 3))), `-`(`*`(`/`(5, 279936), `*`(`^`(`+`(x, `-`(9)), 4)))...
 

`+`(`/`(3, 2), `*`(`/`(1, 6), `*`(x)), `-`(`*`(`/`(1, 216), `*`(`^`(`+`(x, `-`(9)), 2)))), `*`(`/`(1, 3888), `*`(`^`(`+`(x, `-`(9)), 3))), `-`(`*`(`/`(5, 279936), `*`(`^`(`+`(x, `-`(9)), 4))))) (11)
 

> plot([f, P4], x = 8 .. 10); 1
 

Plot_2d
 

> plot([f, P4], x = 7 .. 11); 1
 

Plot_2d
 

> plot([f, P4], x = 5 .. 13); 1
 

Plot_2d
 

 

Example 5. 

 

> `:=`(f, ln(x)); 1
 

ln(x) (12)
 

> `:=`(P4, `+`(x, `-`(1), `-`(`*`(`/`(1, 2), `*`(`^`(`+`(x, `-`(1)), 2)))), `*`(`/`(1, 3), `*`(`^`(`+`(x, `-`(1)), 3))), `-`(`*`(`/`(1, 4), `*`(`^`(`+`(x, `-`(1)), 4)))))); 1
 

`+`(x, `-`(1), `-`(`*`(`/`(1, 2), `*`(`^`(`+`(x, `-`(1)), 2)))), `*`(`/`(1, 3), `*`(`^`(`+`(x, `-`(1)), 3))), `-`(`*`(`/`(1, 4), `*`(`^`(`+`(x, `-`(1)), 4))))) (13)
 

> plot([f, P4], x = .5 .. 1.5); 1
 

Plot_2d
 

> plot([f, P4], x = .5 .. 2); 1
 

Plot_2d
 

>