On Wed, Dec 3, 2008 at 12:44 AM, Stan Schymanski <[EMAIL PROTECTED]> wrote:
>
> Dear all,
>
> I would like to evaluate a symbolic equation containing an integral
> numerically:
> ((integrate(250*cos(pi*x/180)^1.8 + 170.35,x,0,18)/a_v)(a_v=1)).n()
> does not work. Is there a way of doing this? The real equation is a
> lot longer than the above, so I am looking for a simple automatic way.
> Usually, if I substitute all symbolic variables with numerical values,
> the function just evaluates to a number, but if I have a symbolic
> integral in there, it does not work.
>
> Thanks for your help!
I'm just going to try to clarify your question. You want to be able
to take, e.g., f defined below:
sage: f = integrate(cos(x)^1.3,x,0,18) + 2/3
sage: f
integrate(cos(x)^1.30000000000000, x, 0, 18) + 2/3
and do
sage: f.n()
and get back a floating point number. This is surprisingly not
implemented in Sage, but it isn't.
(That's basically because Maxima itself doesn't seem to have such
functionality.)
Of course you can compute integrals numerically as illustrated below:
sage: var('a_v')
sage: ((numerical_integral(250*cos(pi*x/180)^1.8 +
170.35,0,18)[0]/a_v)(a_v=1)).n()
7435.27958156403
This should be enough "power" for you to hopefully be able to solve
the problem you
have. But obviously it would be desirable that float(foo) would work
when foo is a
symbolic expression involving formal integrals. It probably gets old,
but that's the
sort of thing we'll almost certainly fix in the pynac based symbolics...
-- William
--~--~---------~--~----~------------~-------~--~----~
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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---