Ask Your Question
1

How to do numerical integral where the answer still have variables in it?

asked 2018-02-21 22:13:07 +0200

Sarah gravatar image

updated 2018-02-22 00:09:27 +0200

I typed in

"numerical_integral(lambda d:exp(-(h-1)^2-(d-2)^2), 0,Infinity)"

and got

"unable to simplify to float approximation"

Are there anyway to compute the integral numerically and still leave a variable in the answer? Thanks,

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-02-22 01:09:03 +0200

tmonteil gravatar image

updated 2018-02-22 01:10:25 +0200

The general answer is no. In your case, you can easily isolate h and d since $exp(x+y)=exp(x)+exp(y)$. Note also that the integral can be computed symbolically:

sage: var('d h')
(d, h)
sage: integral(exp(-(h-1)^2-(d-2)^2), d,0,Infinity)
1/2*sqrt(pi)*erf(2)*e^(-h^2 + 2*h - 1) + 1/2*sqrt(pi)*e^(-h^2 + 2*h - 1)
edit flag offensive delete link more

Comments

since exp(x+y)=exp(x)+exp(y)

Huh ? I didn't know that.

I'll have to get back to high school. Damn...

More seriously, this is the typo of the death...

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2018-02-23 07:51:36 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2018-02-21 22:13:07 +0200

Seen: 203 times

Last updated: Feb 22 '18