Ask Your Question

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

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 close merge delete

## 1 answer

Sort by » oldest newest most voted

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)

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

## Your Answer

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

Add Answer

## Stats

Asked: 2018-02-21 15:13:07 -0500

Seen: 37 times

Last updated: Feb 21 '18