Find the second degree Taylor polynomial of $f(x,y)=e^-x^2-y^2cos(xy)$ at $x_0=0$, $y_0=0$.

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite
1












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*







share|cite|improve this question



















  • 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














up vote
2
down vote

favorite
1












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*







share|cite|improve this question



















  • 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












up vote
2
down vote

favorite
1









up vote
2
down vote

favorite
1






1





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*







share|cite|improve this question











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*









share|cite|improve this question










share|cite|improve this question




share|cite|improve this question









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
















  • 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










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$.






share|cite|improve this answer





















  • 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










Your Answer




StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
);
);
, "mathjax-editing");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "69"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















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






























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$.






share|cite|improve this answer





















  • 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














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$.






share|cite|improve this answer





















  • 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












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$.






share|cite|improve this answer













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$.







share|cite|improve this answer













share|cite|improve this answer



share|cite|improve this answer











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
















  • 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












 

draft saved


draft discarded


























 


draft saved


draft discarded














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













































































Comments

Popular posts from this blog

What is the equation of a 3D cone with generalised tilt?

Color the edges and diagonals of a regular polygon

Relationship between determinant of matrix and determinant of adjoint?