1 | initial version |
One can obtain an exact value of the integral:
var('y a N')
assume(N>0)
I1=integrate(exp(-1/2*(y-a)^2/N)*y^2,(y,-oo,oo))
I2=integrate(exp(-1/2*(y+a)^2/N)*y^2,(y,-oo,oo))
I=(I1+I2).simplify_full()
print I
print I(a=3.0,N=0.7).n()
#2*(sqrt(2)*a^2 + sqrt(2)*N)*sqrt(pi)*sqrt(N)
#40.6855961680184
2 | No.2 Revision |
One can obtain an exact value of the integral:
var('y a N')
assume(N>0)
I1=integrate(exp(-1/2*(y-a)^2/N)*y^2,(y,-oo,oo))
I2=integrate(exp(-1/2*(y+a)^2/N)*y^2,(y,-oo,oo))
I=(I1+I2).simplify_full()
I=(I1+I2).factor()
print I
print I(a=3.0,N=0.7).n()
#2*(sqrt(2)*a^2 #2*(a^2 + sqrt(2)*N)*sqrt(pi)*sqrt(N)
N)*sqrt(pi)*sqrt(2)*sqrt(N)
#40.6855961680184
3 | No.3 Revision |
One can obtain an exact value of the integral:integral (with factor a^2+N):
var('y a N')
assume(N>0)
I1=integrate(exp(-1/2*(y-a)^2/N)*y^2,(y,-oo,oo))
I2=integrate(exp(-1/2*(y+a)^2/N)*y^2,(y,-oo,oo))
I=(I1+I2).factor()
print I
print I(a=3.0,N=0.7).n()
#2*(a^2 + N)*sqrt(pi)*sqrt(2)*sqrt(N)
#40.6855961680184