@sym: taylor (f) ¶@sym: taylor (f, x) ¶@sym: taylor (f, x, a) ¶@sym: taylor (f, [x, y]) ¶@sym: taylor (f, [x, y], [a, b]) ¶@sym: taylor (…, key, value) ¶Symbolic Taylor polynomial.
If omitted, x is chosen with symvar and a
defaults to zero.
The degree of the polynomial is controlled via the order of the remainder with a key/value pair which defaults to 6:
syms x
f = exp(x);
taylor(f, x, 0, 'order', 6)
⇒ (sym)
5 4 3 2
x x x x
─── + ── + ── + ── + x + 1
120 24 6 2
The degree of the returned Taylor polynomial will be (at most)
one less than ’order’. In the above example, using big O notation,
f == p + O(x^6).
Two-dimensional expansion:
syms x y
f = exp(x*y);
taylor(f, [x,y] , [0,0], 'order', 7)
⇒ (sym)
3 3 2 2
x ⋅y x ⋅y
───── + ───── + x⋅y + 1
6 2
As an alternative to passing a, you can also set the expansion point using a key/value notation:
syms x
f = exp(x);
taylor(f, 'expansionPoint', 1, 'order', 4)
⇒ (sym)
3 2
ℯ⋅(x - 1) ℯ⋅(x - 1)
────────── + ────────── + ℯ⋅(x - 1) + ℯ
6 2
See also: @@sym/diff.
Package: symbolic