0
$\begingroup$

I try to use walfram mathematica to compute a double integral, my code is

Integrate[0.5*exp[-90*(x - 0.5)^2 - 45*(y + 0.1)^4] + exp[-45*(x + 0.4)^2 - 60*(y - 0.5)^2], {x, -1, 1}, {y, -1, 1}]

while the output is just a simplify, not a result. Then I try to use walfram alpha online with the same code, but it gives the anwser. I'm really confused!

enter image description here

$\endgroup$
0

1 Answer 1

2
$\begingroup$

Mathematica functions start with capital letter, chnage exp ->Exp

Rationalize the integrand before using symbolic Integrate

Integrate[Rationalize[0.5*Exp[-90*(x - 0.5)^2 - 45*(y + 0.1)^4] + 
Exp[-45*(x + 0.4)^2 - 60*(y - 0.5)^2]], {x, -1, 1}, {y, -1, 1}] 
%//N (*0.125844*) 

NIntegrate[ 0.5*Exp[-90*(x - 0.5)^2 - 45*(y + 0.1)^4] + 
Exp[-45*(x + 0.4)^2 - 60*(y - 0.5)^2] , {x, -1, 1}, {y, -1, 1}] 
(*0.125844*)
$\endgroup$
2
  • $\begingroup$ Thanks! The change of code is right. But I have done a numerical computation, it seems 0.125844 is the right result, not 0.06046...I'm confused again... $\endgroup$
    – Vanellope
    Commented Apr 23 at 8:55
  • $\begingroup$ See my update... $\endgroup$ Commented Apr 23 at 9:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.