On 03/17/2010 11:40 AM, Nick Alexander wrote:

On 17-Mar-10, at 10:18 AM, Mike Hansen wrote:

On Wed, Mar 17, 2010 at 5:21 AM, Pablo Angulo <pablo.ang...@uam.es>
wrote:
Sorry to come back to this (two weeks) old topic, but what do you think
about raising an exception whenever a symbolic integral (or any symbolic
computation) fails? Otherwise, is there a simple way to distinguish a
succesful integration from failed ones that are just indicated (e.g.,
integrate(e^(x*sin(x)), x))?

You can check whether or not you get an unevaluated integral like this:

sage: f = integrate(x^2, x)
sage: isinstance(f.operator(),
sage.symbolic.integration.integral.IndefiniteIntegral)
False
sage: f
1/3*x^3
sage: f = integrate(e^(x*sin(x)), x)
sage: isinstance(f.operator(),
sage.symbolic.integration.integral.IndefiniteIntegral)
True
sage: f
integrate(e^(x*sin(x)), x)

Using isinstance is such a strong code smell. Maybe we should add some
interrogation routines, is_definite_integral/is_indefinite_integral/...?


Are you saying every symbolic expression should have an is_indefinite_integral method? That seems a little clumsy to me; I must be misunderstanding what you are proposing. What other interrogation methods should be added if that is what you are proposing. Obviously a person could get carried away, adding an is_addition, for example.

Thanks,

Jason



--
Jason Grout

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to