2008/10/21 Ondrej Certik <[EMAIL PROTECTED]>:
>
> Hi Pekeika!
>
> On Tue, Oct 21, 2008 at 7:27 PM, Pekeika <[EMAIL PROTECTED]> wrote:
>>
>> Good morning, I'm trying to do the following symbolic integration:
>>
>> Integral(exp(v**2+3*v+2),v).doit() The real polynomial I'm trying to
>> integrate is a lot bigger... and the whole function has 3 more
>> integration parameters; but I do believe the polynomial is the
>> problem. How can I make this integral work?
>
> What is the result you want to get? This is a Gaussian integral:
>
> http://en.wikipedia.org/wiki/Gaussian_integral
>
> so you need to specify the ranges of the variables and then it could
> be integrated as a definite integral, but it is not yet implemented in
> sympy, see here:
>
> http://code.google.com/p/sympy/issues/detail?id=841
>
> If you are interested in these kinds of integrations, let's get this
> implemented, see the issue above for hints. I'll help you with that if
> you have any questions.
>
> Ondrej
>
Hi,
the indefinite integral of exp(2nd order polynomial), could be
transformed into gaussian integral (integral(exp(u**2),u)) by
substitution and then expressed using error function. The algorithm
in sympy:
#suppose I want to compute integral(expr,x)
In [74]: expr = exp(x**2+3*x+2)
In [75]: exponent = expr.args[0]
In [76]: coeff = exponent.as_poly(x).coeffs
In [77]: t1 = sqrt(coeff[0])*x
In [78]: t2 = coeff[1]*x/(2*t1)
In [79]: square = t1+t2
In [80]: remainder = simplify(exponent-square**2)
#The exponent could be expressed as square**2+remainder,
#where remainder is constant. Now we can substitute for square
#and compute the integral
In [81]: jacobn = 1/square.diff(x)
In [82]: result = integrate(exp(-y**2),y).subs(y,square)*jacobn*exp(remainder)
In [83]: result
Out[83]:
⎽⎽⎽ -1/4
╲╱ π ⋅erf(3/2 + x)⋅ℯ
────────────────────────
2
Stepan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sympy" group.
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/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---