svanshaar wrote:
> I am trying to numerically evaluate the integral of bessel functions.
> I've tried constructing it various ways.  The one that makes most
> sense to me is:
> a=var('a')
> f=bessel_J(1,a)*bessel_J(0,0.1*a)*e^(-5*a)
> f.numerical_integral(a,0,infinity)
> 
> I get the error:  Cannot evaluate symbolic expression to a numeric
> value.
> 
> I also tried placing various arguments inside n() functions.  Then I
> get the error:  self must be a numeric expression
> 
> Obviously, if I don't have a variable in my expression, I wouldn't
> need Sage to help me integrate it.  I get the same errors with
> nintegral() instead of numerical_integral().
> 
> How do I construct this to get a numeric result?
> 

sage: def f(x): return bessel_J(1,x)*bessel_J(0,0.1*x)*e^(-5*x)
....:
sage: numerical_integral(f, 0, oo)
(0.019408449962002559, 1.5271811488988928e-10)

sage: numerical_integral(lambda x: 
bessel_J(1,x)*bessel_J(0,0.1*x)*e^(-5*x), 0>
(0.019408449962002559, 1.5271811488988928e-10)


You can also use scipy and several other systems to do the numeric 
integration.  The problem here is that bessel_J is not a symbolic 
function, and does not know how to deal with symbolic variables.  It 
would be great if someone submitted a patch to take care of this!

Thanks,

Jason


-- 
Jason Grout


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to