Find the second degree Taylor polynomial of $f(x,y)=e^-x^2-y^2cos(xy)$ at $x_0=0$, $y_0=0$.
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I would like to either confirm my solution is correct, or find the error in it. I used the following MATLAB code to try to check my answer, but the solution it gave differs from mine.
f = exp(-(x^2+y^2))cos(xy);
taylor(f,[x,y],[0,0])
ans =
x^4/2 + (x^2*y^2)/2 - x^2 + y^4/2 - y^2 + 1
My solution:
The second degree Taylor polynomial at the point $(a,b)$ is given by
$$p_2(x,y)=f(a,b)+Df(a,b)left[beginarrayc
x-a\y-b
endarrayright]+frac12[x-ambox y-b]Hf(a,b)left[beginarrayc
x-a\y-b
endarrayright]$$
where $Df(a,b)$ is the Jacobian matrix and $Hf(a,b)$ is the Hessian matrix (i.e. first and second order partial derivatives, respectively). Thus, we begin by computing the partial derivatives:
beginequation*
beginsplit
fracpartial fpartial x(x,y)=-e^-x^2-y^2(ymbox sin(xy)+2xmbox cos(xy))\
fracpartial fpartial y(x,y)=-e^-x^2-y^2(xmbox sin(xy)+2ymbox cos(xy))\
fracpartial^2 fpartial x^2(x,y)=e^-x^2-y^2((4x^2-y^2-2)mboxcos(xy)+4xymbox sin(xy))\
fracpartial^2 fpartial y^2(x,y)=e^-x^2-y^2(4xymbox sin(xy)-(x^2-4y^2+2)mboxcos(xy))\
fracpartial^2 fpartial xpartial y(x,y)=fracpartial^2 fpartial ypartial x(x,y)=e^-x^2-y^2((2x^2+2y^2-1)mboxsin(xy)+3xymbox cos(xy))
endsplit
endequation*
Then, at the point $(x_0,y_0)=(0,0)$,
beginequation*
beginsplit
f(0,0)=1\
fracpartial fpartial x(0,0)=fracpartial fpartial y(0,0)=0\
fracpartial^2 fpartial x^2(0,0)=fracpartial^2 fpartial y^2(0,0)=-2\
fracpartial^2 fpartial xpartial y(0,0)=fracpartial^2 fpartial ypartial x(0,0)=0
endsplit
endequation*
Therefore, the second degree Taylor polynomial at the point $(0,0)$ is
beginequation*
beginsplit
p_2(x,y)=f(0,0)+Df(0,0)left[beginarrayc
x-0\y-0
endarrayright]+frac12[x-0mbox y-0]Hf(0,0)left[
beginarrayc
x-0\y-0
endarrayright]\
=1+[0mbox 0]left[
beginarrayc
x\y
endarrayright]+frac12[xmbox y]beginbmatrix
-2&0\0&-2
endbmatrixleft[
beginarrayc
x\y
endarrayright]=1-x^2-y^2
endsplit
endequation*
multivariable-calculus proof-verification matlab
add a comment |Â
up vote
2
down vote
favorite
I would like to either confirm my solution is correct, or find the error in it. I used the following MATLAB code to try to check my answer, but the solution it gave differs from mine.
f = exp(-(x^2+y^2))cos(xy);
taylor(f,[x,y],[0,0])
ans =
x^4/2 + (x^2*y^2)/2 - x^2 + y^4/2 - y^2 + 1
My solution:
The second degree Taylor polynomial at the point $(a,b)$ is given by
$$p_2(x,y)=f(a,b)+Df(a,b)left[beginarrayc
x-a\y-b
endarrayright]+frac12[x-ambox y-b]Hf(a,b)left[beginarrayc
x-a\y-b
endarrayright]$$
where $Df(a,b)$ is the Jacobian matrix and $Hf(a,b)$ is the Hessian matrix (i.e. first and second order partial derivatives, respectively). Thus, we begin by computing the partial derivatives:
beginequation*
beginsplit
fracpartial fpartial x(x,y)=-e^-x^2-y^2(ymbox sin(xy)+2xmbox cos(xy))\
fracpartial fpartial y(x,y)=-e^-x^2-y^2(xmbox sin(xy)+2ymbox cos(xy))\
fracpartial^2 fpartial x^2(x,y)=e^-x^2-y^2((4x^2-y^2-2)mboxcos(xy)+4xymbox sin(xy))\
fracpartial^2 fpartial y^2(x,y)=e^-x^2-y^2(4xymbox sin(xy)-(x^2-4y^2+2)mboxcos(xy))\
fracpartial^2 fpartial xpartial y(x,y)=fracpartial^2 fpartial ypartial x(x,y)=e^-x^2-y^2((2x^2+2y^2-1)mboxsin(xy)+3xymbox cos(xy))
endsplit
endequation*
Then, at the point $(x_0,y_0)=(0,0)$,
beginequation*
beginsplit
f(0,0)=1\
fracpartial fpartial x(0,0)=fracpartial fpartial y(0,0)=0\
fracpartial^2 fpartial x^2(0,0)=fracpartial^2 fpartial y^2(0,0)=-2\
fracpartial^2 fpartial xpartial y(0,0)=fracpartial^2 fpartial ypartial x(0,0)=0
endsplit
endequation*
Therefore, the second degree Taylor polynomial at the point $(0,0)$ is
beginequation*
beginsplit
p_2(x,y)=f(0,0)+Df(0,0)left[beginarrayc
x-0\y-0
endarrayright]+frac12[x-0mbox y-0]Hf(0,0)left[
beginarrayc
x-0\y-0
endarrayright]\
=1+[0mbox 0]left[
beginarrayc
x\y
endarrayright]+frac12[xmbox y]beginbmatrix
-2&0\0&-2
endbmatrixleft[
beginarrayc
x\y
endarrayright]=1-x^2-y^2
endsplit
endequation*
multivariable-calculus proof-verification matlab
What’s your question?
– amd
Jul 25 at 2:19
@amd "I would like to either confirm my solution is correct, or find the error in it."
– Atsina
Jul 25 at 2:23
The Matlab output that you've got is the fourth-degree Taylor approximation, not second-degree. Either add'Order',2
to the arguments or drop the higher-order terms yourself.
– amd
Jul 25 at 6:05
@amd Thank you!
– Atsina
Jul 25 at 15:26
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I would like to either confirm my solution is correct, or find the error in it. I used the following MATLAB code to try to check my answer, but the solution it gave differs from mine.
f = exp(-(x^2+y^2))cos(xy);
taylor(f,[x,y],[0,0])
ans =
x^4/2 + (x^2*y^2)/2 - x^2 + y^4/2 - y^2 + 1
My solution:
The second degree Taylor polynomial at the point $(a,b)$ is given by
$$p_2(x,y)=f(a,b)+Df(a,b)left[beginarrayc
x-a\y-b
endarrayright]+frac12[x-ambox y-b]Hf(a,b)left[beginarrayc
x-a\y-b
endarrayright]$$
where $Df(a,b)$ is the Jacobian matrix and $Hf(a,b)$ is the Hessian matrix (i.e. first and second order partial derivatives, respectively). Thus, we begin by computing the partial derivatives:
beginequation*
beginsplit
fracpartial fpartial x(x,y)=-e^-x^2-y^2(ymbox sin(xy)+2xmbox cos(xy))\
fracpartial fpartial y(x,y)=-e^-x^2-y^2(xmbox sin(xy)+2ymbox cos(xy))\
fracpartial^2 fpartial x^2(x,y)=e^-x^2-y^2((4x^2-y^2-2)mboxcos(xy)+4xymbox sin(xy))\
fracpartial^2 fpartial y^2(x,y)=e^-x^2-y^2(4xymbox sin(xy)-(x^2-4y^2+2)mboxcos(xy))\
fracpartial^2 fpartial xpartial y(x,y)=fracpartial^2 fpartial ypartial x(x,y)=e^-x^2-y^2((2x^2+2y^2-1)mboxsin(xy)+3xymbox cos(xy))
endsplit
endequation*
Then, at the point $(x_0,y_0)=(0,0)$,
beginequation*
beginsplit
f(0,0)=1\
fracpartial fpartial x(0,0)=fracpartial fpartial y(0,0)=0\
fracpartial^2 fpartial x^2(0,0)=fracpartial^2 fpartial y^2(0,0)=-2\
fracpartial^2 fpartial xpartial y(0,0)=fracpartial^2 fpartial ypartial x(0,0)=0
endsplit
endequation*
Therefore, the second degree Taylor polynomial at the point $(0,0)$ is
beginequation*
beginsplit
p_2(x,y)=f(0,0)+Df(0,0)left[beginarrayc
x-0\y-0
endarrayright]+frac12[x-0mbox y-0]Hf(0,0)left[
beginarrayc
x-0\y-0
endarrayright]\
=1+[0mbox 0]left[
beginarrayc
x\y
endarrayright]+frac12[xmbox y]beginbmatrix
-2&0\0&-2
endbmatrixleft[
beginarrayc
x\y
endarrayright]=1-x^2-y^2
endsplit
endequation*
multivariable-calculus proof-verification matlab
I would like to either confirm my solution is correct, or find the error in it. I used the following MATLAB code to try to check my answer, but the solution it gave differs from mine.
f = exp(-(x^2+y^2))cos(xy);
taylor(f,[x,y],[0,0])
ans =
x^4/2 + (x^2*y^2)/2 - x^2 + y^4/2 - y^2 + 1
My solution:
The second degree Taylor polynomial at the point $(a,b)$ is given by
$$p_2(x,y)=f(a,b)+Df(a,b)left[beginarrayc
x-a\y-b
endarrayright]+frac12[x-ambox y-b]Hf(a,b)left[beginarrayc
x-a\y-b
endarrayright]$$
where $Df(a,b)$ is the Jacobian matrix and $Hf(a,b)$ is the Hessian matrix (i.e. first and second order partial derivatives, respectively). Thus, we begin by computing the partial derivatives:
beginequation*
beginsplit
fracpartial fpartial x(x,y)=-e^-x^2-y^2(ymbox sin(xy)+2xmbox cos(xy))\
fracpartial fpartial y(x,y)=-e^-x^2-y^2(xmbox sin(xy)+2ymbox cos(xy))\
fracpartial^2 fpartial x^2(x,y)=e^-x^2-y^2((4x^2-y^2-2)mboxcos(xy)+4xymbox sin(xy))\
fracpartial^2 fpartial y^2(x,y)=e^-x^2-y^2(4xymbox sin(xy)-(x^2-4y^2+2)mboxcos(xy))\
fracpartial^2 fpartial xpartial y(x,y)=fracpartial^2 fpartial ypartial x(x,y)=e^-x^2-y^2((2x^2+2y^2-1)mboxsin(xy)+3xymbox cos(xy))
endsplit
endequation*
Then, at the point $(x_0,y_0)=(0,0)$,
beginequation*
beginsplit
f(0,0)=1\
fracpartial fpartial x(0,0)=fracpartial fpartial y(0,0)=0\
fracpartial^2 fpartial x^2(0,0)=fracpartial^2 fpartial y^2(0,0)=-2\
fracpartial^2 fpartial xpartial y(0,0)=fracpartial^2 fpartial ypartial x(0,0)=0
endsplit
endequation*
Therefore, the second degree Taylor polynomial at the point $(0,0)$ is
beginequation*
beginsplit
p_2(x,y)=f(0,0)+Df(0,0)left[beginarrayc
x-0\y-0
endarrayright]+frac12[x-0mbox y-0]Hf(0,0)left[
beginarrayc
x-0\y-0
endarrayright]\
=1+[0mbox 0]left[
beginarrayc
x\y
endarrayright]+frac12[xmbox y]beginbmatrix
-2&0\0&-2
endbmatrixleft[
beginarrayc
x\y
endarrayright]=1-x^2-y^2
endsplit
endequation*
multivariable-calculus proof-verification matlab
asked Jul 25 at 1:29


Atsina
513113
513113
What’s your question?
– amd
Jul 25 at 2:19
@amd "I would like to either confirm my solution is correct, or find the error in it."
– Atsina
Jul 25 at 2:23
The Matlab output that you've got is the fourth-degree Taylor approximation, not second-degree. Either add'Order',2
to the arguments or drop the higher-order terms yourself.
– amd
Jul 25 at 6:05
@amd Thank you!
– Atsina
Jul 25 at 15:26
add a comment |Â
What’s your question?
– amd
Jul 25 at 2:19
@amd "I would like to either confirm my solution is correct, or find the error in it."
– Atsina
Jul 25 at 2:23
The Matlab output that you've got is the fourth-degree Taylor approximation, not second-degree. Either add'Order',2
to the arguments or drop the higher-order terms yourself.
– amd
Jul 25 at 6:05
@amd Thank you!
– Atsina
Jul 25 at 15:26
What’s your question?
– amd
Jul 25 at 2:19
What’s your question?
– amd
Jul 25 at 2:19
@amd "I would like to either confirm my solution is correct, or find the error in it."
– Atsina
Jul 25 at 2:23
@amd "I would like to either confirm my solution is correct, or find the error in it."
– Atsina
Jul 25 at 2:23
The Matlab output that you've got is the fourth-degree Taylor approximation, not second-degree. Either add
'Order',2
to the arguments or drop the higher-order terms yourself.– amd
Jul 25 at 6:05
The Matlab output that you've got is the fourth-degree Taylor approximation, not second-degree. Either add
'Order',2
to the arguments or drop the higher-order terms yourself.– amd
Jul 25 at 6:05
@amd Thank you!
– Atsina
Jul 25 at 15:26
@amd Thank you!
– Atsina
Jul 25 at 15:26
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
I leave your answer's critique to someone with less tired eyes. I will tell you this much. There is an easier way to calculate: just substitute into known Taylor series for the exponential and cosine,
$$f(x,y) = e^-x^2-y^2cos(xy) = (1-x^2-y^2+cdots)(1-frac12(xy)^2+ cdots )$$
But, $(xy)^2$ is order $4$ so the answer is merely,
$$f(x,y) = e^-x^2-y^2cos(xy) = 1-x^2-y^2+cdots $$
The above is the Taylor expansion of $f$ at $(0,0)$ to order $2$.
Oh...duh. Thank you.
– Atsina
Jul 25 at 2:34
Glad to help, also now that I look at your answer, glad we agree on the final result. Of course, your approach is logical it's just not as lazy as mine.
– James S. Cook
Jul 25 at 15:22
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
I leave your answer's critique to someone with less tired eyes. I will tell you this much. There is an easier way to calculate: just substitute into known Taylor series for the exponential and cosine,
$$f(x,y) = e^-x^2-y^2cos(xy) = (1-x^2-y^2+cdots)(1-frac12(xy)^2+ cdots )$$
But, $(xy)^2$ is order $4$ so the answer is merely,
$$f(x,y) = e^-x^2-y^2cos(xy) = 1-x^2-y^2+cdots $$
The above is the Taylor expansion of $f$ at $(0,0)$ to order $2$.
Oh...duh. Thank you.
– Atsina
Jul 25 at 2:34
Glad to help, also now that I look at your answer, glad we agree on the final result. Of course, your approach is logical it's just not as lazy as mine.
– James S. Cook
Jul 25 at 15:22
add a comment |Â
up vote
1
down vote
accepted
I leave your answer's critique to someone with less tired eyes. I will tell you this much. There is an easier way to calculate: just substitute into known Taylor series for the exponential and cosine,
$$f(x,y) = e^-x^2-y^2cos(xy) = (1-x^2-y^2+cdots)(1-frac12(xy)^2+ cdots )$$
But, $(xy)^2$ is order $4$ so the answer is merely,
$$f(x,y) = e^-x^2-y^2cos(xy) = 1-x^2-y^2+cdots $$
The above is the Taylor expansion of $f$ at $(0,0)$ to order $2$.
Oh...duh. Thank you.
– Atsina
Jul 25 at 2:34
Glad to help, also now that I look at your answer, glad we agree on the final result. Of course, your approach is logical it's just not as lazy as mine.
– James S. Cook
Jul 25 at 15:22
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
I leave your answer's critique to someone with less tired eyes. I will tell you this much. There is an easier way to calculate: just substitute into known Taylor series for the exponential and cosine,
$$f(x,y) = e^-x^2-y^2cos(xy) = (1-x^2-y^2+cdots)(1-frac12(xy)^2+ cdots )$$
But, $(xy)^2$ is order $4$ so the answer is merely,
$$f(x,y) = e^-x^2-y^2cos(xy) = 1-x^2-y^2+cdots $$
The above is the Taylor expansion of $f$ at $(0,0)$ to order $2$.
I leave your answer's critique to someone with less tired eyes. I will tell you this much. There is an easier way to calculate: just substitute into known Taylor series for the exponential and cosine,
$$f(x,y) = e^-x^2-y^2cos(xy) = (1-x^2-y^2+cdots)(1-frac12(xy)^2+ cdots )$$
But, $(xy)^2$ is order $4$ so the answer is merely,
$$f(x,y) = e^-x^2-y^2cos(xy) = 1-x^2-y^2+cdots $$
The above is the Taylor expansion of $f$ at $(0,0)$ to order $2$.
answered Jul 25 at 2:30


James S. Cook
12.8k22668
12.8k22668
Oh...duh. Thank you.
– Atsina
Jul 25 at 2:34
Glad to help, also now that I look at your answer, glad we agree on the final result. Of course, your approach is logical it's just not as lazy as mine.
– James S. Cook
Jul 25 at 15:22
add a comment |Â
Oh...duh. Thank you.
– Atsina
Jul 25 at 2:34
Glad to help, also now that I look at your answer, glad we agree on the final result. Of course, your approach is logical it's just not as lazy as mine.
– James S. Cook
Jul 25 at 15:22
Oh...duh. Thank you.
– Atsina
Jul 25 at 2:34
Oh...duh. Thank you.
– Atsina
Jul 25 at 2:34
Glad to help, also now that I look at your answer, glad we agree on the final result. Of course, your approach is logical it's just not as lazy as mine.
– James S. Cook
Jul 25 at 15:22
Glad to help, also now that I look at your answer, glad we agree on the final result. Of course, your approach is logical it's just not as lazy as mine.
– James S. Cook
Jul 25 at 15:22
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2861941%2ffind-the-second-degree-taylor-polynomial-of-fx-y-e-x2-y2cosxy-at-x-0%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
What’s your question?
– amd
Jul 25 at 2:19
@amd "I would like to either confirm my solution is correct, or find the error in it."
– Atsina
Jul 25 at 2:23
The Matlab output that you've got is the fourth-degree Taylor approximation, not second-degree. Either add
'Order',2
to the arguments or drop the higher-order terms yourself.– amd
Jul 25 at 6:05
@amd Thank you!
– Atsina
Jul 25 at 15:26