On Feb 26, 2011, at 11:45 AM, Vinzent Steinberg wrote:

> On 25 Feb., 21:33, "Aaron S. Meurer" <[email protected]> wrote:
>> 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?).  
> 
> Isn't "elementary" just a matter of choice which functions you define
> to be elementary? In this case, I'm not sure about such a separation.
> 
> Vinzent

Yes, what you say is correct, but there is a pretty standard definition of 
elementary, which basically means any combination of rational functions, 
algebraic functions, logarithms, and exponentials (note that trigonometric 
functions fit this definition because they are expressible as complex 
exponentials or logarithms).  Actually, any other set of "elementary functions" 
will have to be built off of these.  So for example, you can add erf() as an 
elementary function, but you cannot consider the above minus logarithms to be a 
set of elementary functions (at least not for the purposes of the Risch 
Algorithm).  So you can think of the standard set of elementary functions to be 
the base set, or the default one.

Actually, this reminds me of another planned option to integrate, which will be 
to consider elementary extensions like this.  It will require more 
implementation, but I plan to let you do something like integrate(exp(-x**2), 
extension=[erf(x)]), and it will give you the result in terms of erf(), even if 
you also choose elementary=True, because the extension argument will add erf to 
the list of elementary functions.  This will also let you integrate in terms of 
erf(), and you could ask, for example, if 1/erf(x) has an antiderivative 
expressible in terms of erf(x) and the standard elementary functions (the 
answer is no). I think I will have it so that if you integrate in terms of an 
elementary function that it will automatically add that function as an 
extension.

I think maybe I will add some attribute to NonElementaryIntegral that tells you 
what extension the integral is nonelementary over, and maybe add some method to 
try integrating over some new extension.  

Of course, understand that not all functions can be added as elementary 
functions (at least not for the cases that the Risch Algorithm can handle).  
Essentially, the derivative of the function needs to be expressible as a 
polynomial of the function with elementary coefficients.  Also, if the order of 
that polynomial is greater than one, more algorithms may need to be implemented 
(of course, any function defined in terms of a standard nonelementary integral 
like erf() of Li() will work fine; indeed, any NonElementaryIntegral will work 
just fine).  And presently, no algebraic functions will be supported.  

Aaron Meurer

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

Reply via email to