On 11/12/2011 03:39 PM, William Stein wrote:
> 
> I wonder if Sage should not call Maxima for definite integrals -- only
> call Maxima for finding a primitive, then do the rest itself?
> 
> Here's a version of the integrate function that does what I'm speculating 
> about:
> 
> def integrate2(f, x, a, b):
>     g = integrate(f, x)
>     return g(x=b) - g(x=a)
> 
> Here is some sample usage:
> 
> sage: integrate2(1/(sqrt(x)*((1+sqrt(x))^2)),   x, 1, 9)
> 1/2
> 
> sage: integrate2(x^3,   x, 2, pi)
> 1/4*pi^4 - 4
> 

This was my fix for a different issue,

  sage: u = SR.symbol('u', domain='real')
  sage: f = function('f', x, u)
  sage: g(x) = integrate(f, u, 0, sqrt(x))
  ...
  RuntimeError: ECL says: Error executing code in Maxima: defint: upper
  limit of integration must be real; found sqrt(x)

This is a simple case where assume(x>0) saves you, but I deduce that
Maxima will bail whenever it can't prove to itself that the bounds are real.

With a real-life expression, I get the mysterious,

  RuntimeError: ECL says: Error executing code in Maxima: defint: upper
  limit of integration must be real; found errexp1

-- 
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