The gradient ▽f of a function f is often used for a locally linear approximation of f around x0.
D1x,yf(1,2)1!δ=[614][x−1y−2]=6(x−1)+14(y−2)
D3x,yf[:,:,1]=∂H∂x=[∂3f∂x3∂3f∂x2∂y∂3f∂x∂y∂x∂3f∂x∂y2]
D3x,yf[:,:,2]=∂H∂y=[∂3f∂y∂x2∂3f∂y∂x∂y∂3f∂y2∂x∂3f∂y3]
D3x,yf[:,:,2]=[0006]
The second order partial derivatives are given by
∂2f∂x2=e−(x2+y2).2x(2x.cos(xy)+y.sin(xy))−e(x2+y2)(2.cos(xy)−2xy.sin(xy)+y2.cos(xy))
Find the linear approximation to the function f(x,y)=2−sin(−x−3y) at the point (0 , π), and then use your answer to estimate f(0.001,π).
Linear approximation at (0,π) is
f(0,π)+D1x,yf(0,0)1!δ
Find the second order Taylor series expansion for f(x,y)=(x+y)2 about (0,0)
D2x,yf(1,1)2!δ2=12[x−1y−1][2226][x−1y−1]=x2+3y2−4x−8y+2xy+6
D2x,yf(1,−2)2!δ2=12[x−1y+2][−4220][x−1y+2]=−2x2+12x−3y+4xy−8
f(x)≈f(x0)+(▽xf)(x0)(x−x0)
Here (▽xf)(x0) is the gradient of f with respect to x, evaluated at x0.
The following Figure illustrates the linear approximation of a function f at an input x0. The original function is approximated by a straight line.This approximation is locally accurate, but the farther we move away from x0, the worse the approximation gets.This is a special case of multivariate Taylor series expansion of f at x0, where we consider only the first two terms.
Multivariate Taylor Series: Definition
We consider a function
f:RD→R
x→f(x),x∈RD
that is smooth at x0. When we define the difference vector δ=x−x0, the multivariate Taylor series of f at x0 is defined as
f(x)=∑∞k=0Dkxf(x0)k!δk
where Dkxf(x0) is the k−th derivative of f with respect to x, evaluated at x0.
Taylor Polynomial: Definition
The Taylor polynomial of degree n of f at x0 contains the first n+1 components of the Taylor series and is defined as
Tn(x)=∑nk=0Dkxf(x0)k!δk
Note that both Dkxf and δk are k−th order tensors.i.e., k dimensional arrays. The kth order tensor δk∈RD×D×…×D is obtained as a k fold outer product denoted by ⨂, of the vector δ∈RD. For example
δ2=δ⨂δ=δδT,δ2[i,j]=δ[i][δ[j]
In general we obtain the terms
Dkxf(x0)δk=∑Di1=1⋯∑Dik=1Dkxf(x0)[i1,…,ik]δ[i1]⋯δ[ik]
Lets write down the first few terms of Dkxf(x0)δk of the Taylor Series expansion for k=0,…,3 and δ=x−x0.
Example: ( university question)
Consider the function f(x,y)=x2+2xy+y3. Find the Taylor series expansion of f at (x0,y0)=(1,2)
Note that we are looking for a Taylor series expansion, which itself is a linear combination of Polynomials.To express the polynomial of degree 3 , the Taylor series expansion must contain terms of 4th or higher order.
f(1,2)=13
∂f∂x=2x+2y=∂f∂x(1,2)=6
∂f∂y=2x+3y2=∂f∂y(1,2)=14
Therefore we obtain
D1x,yf(1,2)=▽x,yf(1,2)=[∂f∂x∂f∂y]=[614]∈R1×2
Note that this contains only linear terms.i.e., first-order polynomials.
The second order partial derivatives are given by
∂2f∂x2=2⇒∂2f∂x2(1,2)=2
∂2f∂y2=6y⇒∂2f∂y2(1,2)=12
∂2f∂y∂x=2⇒∂2f∂y∂x(1,2)=2
∂2f∂x∂y=2⇒∂2f∂x∂y(1,2)=2
H=[2226y]∈R2×2
So the Hessian at (1,2) is
H(1,2)=[22212]∈R2×2Therefore the next term of the Taylor series expansion is given by
D2x,yf(1,2)2!δ2=12δTH(1,2)δ
=12[x−1y−2][22212][x−1y−2]=(x−1)2+2(x−1)(y−2)+6(y−2)2
This is a second order polynomial
The third order derivatives are obtained as
D3x,yf=[∂H∂x∂H∂y]∈R2×2×2
D3x,yf[:,:,2]=∂H∂y=[∂3f∂y∂x2∂3f∂y∂x∂y∂3f∂y2∂x∂3f∂y3]
Since most of the terms are constant in second order Hessian, the only non zero third order partial derivative is
∂3f∂y3=6⇒∂3f∂y3(1,2)=6All other derivatives will vanish
D3x,yf[:,:,1]=[0000]D3x,yf[:,:,2]=[0006]
D3x,yf(1,2)3!δ3=(y−2)3
Overall, the exact Taylor series expansion of f at (x0,y0)=(1,2) is
f(x,y)=f(1,2)+D1x,yf(1,2)δ+D2x,yf(1,2)2!δ2+D3x,yf(1,2)3!δ3
=13+6(x−1)+14(y−2)+(x−1)2+2(x−1)(y−2)+6(y−2)2+(y−2)3
=13+6x−6+14y−28+x2+1−2x+2xy−4x−2y+4+6y2+24−24y+y3−8+12y−6y2
=x2+2xy+y3+(6x−6x)+(14y−2y−24y+12y)+(13−6−28+1+4+24−8)
=x2+2xy+y3
Find the second order Taylor series expansion for f(x,y)=e−(x2+y2)cos(xy) about (0,0).
f(0,0)=1
First order partial derivatives
∂f∂x=−2xe−(x2+y2)cos(xy)−ye−(x2+y2)sin(xy)
∂f∂x=−e−(x2+y2)(2x.cos(xy)+y.sin(xy))
∂f∂x(0,0)=0
∂f∂y=−2ye−(x2+y2)cos(xy)−xe−(x2+y2)sin(xy)
∂f∂y=−e−(x2+y2)(2y.cos(xy)+x.sin(xy))
∂f∂y(0,0)=0
D1x,yf(0,0)=▽x,yf(0,0)=[∂f∂x∂f∂y]=[00]∈R1×2
D1x,yf(0,0)1!δ=[00][xy]=0∂2f∂x2=e−(x2+y2).2x(2x.cos(xy)+y.sin(xy))−e(x2+y2)(2.cos(xy)−2xy.sin(xy)+y2.cos(xy))
∂2f∂x2=e−(x2+y2)((4x2−y2−2)cos(xy)+4xy.sin(xy))
∂2f∂x2(0,0)=−2
similarly
∂2f∂y2=e−(x2+y2)((4xy.sin(xy)−(x2−4y2+2)cos(xy))
∂2f∂y2(0,0)=−2
∂2f∂x∂y=∂2f∂y∂x=e−(x2+y2)((2x2+2y2−1)sin(xy)+3xy.cos(xy))
∂2f∂x∂y=∂2f∂y∂x(0,0)=0
D2x,yf(0,0)2!δ2=12[xy][−200−2][xy]=−x2−y2the second degree Taylor polynomial at point (0,0) is
f(0,0)+D1x,yf(0,0)1!δ+D2x,yf(0,0)2!δ2
=1+0−x2−y2
=1−x2−y2
f(0,π)=2−sin(0−3π)=2+sin(3π)=2
First order partial derivatives
∂f∂x=cos(−x−3y)
∂f∂x(0,π)=cos(−3π)=−1
∂f∂y=3cos(−x−3y)
∂f∂y(0,π)=3.cos(−3π)=−3
D1x,yf(0,0)1!δ=[−1−3][xy−π]=−x−3y+3πf(0,π)+D1x,yf(0,0)1!δ
=2−x−3y+3π
value at f(0.001,π) is
2−0.001−3π+3π
=1.999
f(0,0)=0
First order partial derivatives
∂f∂x=2(x+y)
∂f∂x(0,0)=0
∂f∂y=2(x+y)
∂f∂y(0,0)=0
D1x,yf(0,0)1!δ=[00][xy]=0Second order partial derivatives
∂2f∂x2=2
∂2f∂x2(0,0)=2
∂2f∂y2=2
∂2f∂y2(0,0)=2
∂2f∂x∂y=2
∂2f∂x∂y(0,0)=2
∂2f∂y∂x=2
∂2f∂y∂x(0,0)=2
D2x,yf(0,0)2!δ2=12[xy][2222][xy]=x2+2xy+y2the second order Taylor series expansion about(0,0) is
f(0,0)+D1x,yf(0,0)1!δ+D2x,yf(0,0)2!δ2=0+0+x2+2xy+y2
=x2+2xy+y2Compute the Taylor series expansion of f(x,y)=x2+2xy+y3 at (x0,y0)=(1,1)
f(1,1)=4
First order partial derivatives
∂f∂x=2x+2y
∂f∂x(1,1)=4
∂f∂y=2x+3y2
∂f∂y(1,1)=5
D1x,yf(1,1)1!δ=[45][x−1y−1]=4x+5y−9Second order partial derivatives
∂2f∂x2=2
∂2f∂x2(1,1)=2
∂2f∂y2=6y
∂2f∂y2(1,1)=6
∂2f∂x∂y=2
∂2f∂x∂y(1,1)=2
∂2f∂y∂x=2
∂2f∂y∂x(1,1)=2
the second order Taylor series expansion about(1,1) is
f(1,1)+D1x,yf(1,1)1!δ+D2x,yf(1,1)2!δ2=4+(4x+5y−9)+x2+3y2−4x−8y+2xy+6
=x2+3y2−3y+2xy+1Compute the Taylor series expansion of f(x,y)=x2y+3y−2 at (x0,y0)=(1,−2)
f(x,y)=x2y+3y−2
f(1,−2)=−10
First order partial derivatives
∂f∂x=2xy
∂f∂x(1,−2)=−4
∂f∂y=x2+3
∂f∂y(1,−2)=4
D1x,yf(1,1)1!δ=[−44][x−1y+2]=−4x+4y+12Second order partial derivatives
∂2f∂x2=2y
∂2f∂x2(1,−2)=−4
∂2f∂y2=0
∂2f∂y2(1,−2)=0
∂2f∂x∂y=2x
∂2f∂x∂y(1,−2)=2
∂2f∂y∂x=2x
∂2f∂y∂x(1,−2)=2
the second order Taylor series expansion about(1,-2) is
f(1,−2)+D1x,yf(1,−2)1!δ+D2x,yf(1,−2)2!δ2=−10+(−4x+4y+12)−2x2+12x−3y+4xy−8
=−2x2+8x+y−6
Comments
Post a Comment