Hi all,

First I must say that SymPy is a great tool, I came across it few weeks ago 
and...

Yesterday I was assigned a task to compute analytical expressions for some 
integrals and evaluate them.
Specifically:
1. exp(-0.5*(-x**2/2 + x**4/10)), x goes from -infinity to infinity, or 
from infinity to a finite value
2. exp(-0.5*(-x**2/2 + x**4/10)) * (-x**2/2 + x**4/10), same range
3. exp(-0.5*(-x**2/2 + x**4/10 - x/20)), same range
4. exp(-0.5*(-x**2/2 + x**4/10 - x/20)) * (-x**2/2 + x**4/10 - x/20), same 
range

Using mathematica, an analytic expresion for the first two can be found 
(using Integrate). The latter two are harder and can be obtained only 
numerically.
Using NIntegrate, the exact values can be obtained (for example in the 
range (-infinity, -3) or (3, infinity).
Matlab can also compute these numerically, using quadgk (Gauss-Kronrod 
method supporting infinites).

As for the issues I was facing:
1. First, the integrate function was failing because of the fraction values 
in the integrand (Coersion exception or so). It was fixed by installing the 
latest 0.7.5.

2. Using integrate, it only display the expression, even when specifying a 
range as tuple. 
For example (assume x is a symbol):
integrate(exp(-0.5*(-x**2 / 2 + x**4 / 10)), (x, -float("inf"), -3))
The resulting expression is displayed as two integrals, each with a 
different range.
Changing to -oo doesn't matter much.

3. Only using Integral(expression + parameters) gives the correct textual 
expression (instead of integrate).

4. Evaluating the 1st and 3rd integrals with evalf() (of Integral) over the 
range (-infinity, -3) yields negative values which are clearly incorrect. 
Just as a testing example.

Any idea or maybe my usage is incorrect?

Thanks!,
Moti.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/b11925fe-267c-4bea-8189-e4deccddecbb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to