Method on @sym: taylor (f)
Method on @sym: taylor (f, x)
Method on @sym: taylor (f, x, a)
Method on @sym: taylor (f, [x, y])
Method on @sym: taylor (f, [x, y], [a, b])
Method on @sym: taylor (…, key, value)

Symbolic Taylor series.

If omitted, x is chosen with symvar and a defaults to zero.

Key/value pairs can be used to set the order:

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

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