What is a Taylor Expansion?
The Taylor expansion is a way to represent a function (or a multivariable function) as an infinite series based on its derivatives at a specific point
.
Taylor Expansion for Single-Variable Functions
General formula:
Or in summation form:
Where:
is the
-th derivative of
at the point
is the factorial of
Taylor Expansion for Multivariable Functions
For a function , the Taylor expansion around the point
is written as:
General formula:
Simple example:
For , the second-order Taylor expansion at
is:
Specific Examples
Single-variable function:
Let , Taylor expansion around
:
Two-variable function:
Let , Taylor expansion around
:
Calculations:
,
,
,
Result:
Python: Taylor Expansion Computation
Using sympy
:
import sympy as sp
# Declare variables and function
x, y = sp.symbols('x y')
f = x**2 + x*y + y**2
# Expansion point (0, 0)
a, b = 0, 0
# Taylor expansion to order 2
taylor_expansion = sp.series(f, x=x, y=y, x0=a, y0=b, n=3).removeO()
print("Second-order Taylor expansion:\n", taylor_expansion)
Advanced Examples: Higher-Degree Multivariable Functions
Example 1: , Taylor expansion around
up to second order:
Formula:
Calculations:
,
,
,
Result:
Example 2: , Taylor expansion around
to second order.
Formula:
Calculations:
,
,
,
,
Result:
Discover more from Science Comics
Subscribe to get the latest posts sent to your email.