Other classes will be different, but Integral is going to have a special structure whenever I finish the Risch Algorithm (because it can prove that integrals "can't be done"). Actually, it is more difficult than that, because it can only do it in the elementary transcendental case, and additionally, there will be an option to integrate to only return an elementary result or else an elementary integral (i.e., return Integral(exp(-x**2), x) instead of erf()).
So what I plan to do is to create a new class, NonElementaryIntegral, which will derive from Integral(). integrate() (i.e., risch_integrate() will be merged into integrate()) will return this whenever it can prove that an integral is non-elementary. The class will be similar to Integral, except it will have a no-op .doit(), as well as some other things (I'm also thinking it should pretty print differently, though I don't know how; any ideas?). By default, integrate() will always try to return an expression that does not have an Integral or NonElementaryIntegral, but you can do integrate(elementary=True), which will force it to only consider elementary antiderivatives (for example, if you want to verify that some integral is indeed nonelementary). There will still be cases where it will return an unevaluated Integral, which are namely the cases where the integrand is not elementary transcendental. The example you give below is actually such a case, because there is no way for the Risch Algorithm to handle symbolic powers of x. Other cases will include algebraic functions, or expressions contain special functions. These will fall back to heurisch() (the current algorithm), and if it can't do it, an unevaluated Integral will be returned as it is now. Anyway, this is something to consider here. Aaron Meurer On Feb 25, 2011, at 1:14 PM, smichr wrote: > I wonder if evaluate=None could be given to an expression like > > integrate(exp(x**n),x) -> Integral(exp(x**n), x, evaluate=None) > > to act as a flag indicating that the user wants the integral evaluated > but, in its present state, it can't be done. Then, when subs are made > if the integral can be done the evaluated form is returned. Because of > issue 2049 the assigning of evaluate=True to Integrals after making a > subs was stopped. This led to a failure in the relativity demo file. > But if the None were stored with the Integral obtained from integrate > then subs would have permission to try the integral again. > > So either integrate(unknown integral) or Integral(func, evaluate=None) > would return an expression which, when subs were made, would attempt a > doit. > > -- > 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. > -- 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.
