Hi,

> > On Sun, Sep 8, 2013 at 5:48 PM, Aaron Meurer <[email protected]>
> > wrote:
> >> Another idea would be to implement a basic table lookup for such
> >> integrals (https://code.google.com/p/sympy/issues/detail?id=1393).
> >> This would be the least powerful, as it would only work for
> >> expressions exactly of the form we put in the table, but it would
> >> be fast, and wouldn't require figuring out how to make thing work
> >> with the heurisch or Meijer G algorithms.
> >
> > Can the Meijer G be used to integrate any function, or is the the
> > most general algorithm still the Risch one? I read this:
> 
> It depends on what you mean by "general". In my view, the two
> algorithms handle different classes of integrals with different
> advantages, and therefore they will both always be needed.

Yep, this is also my current understanding.

> Here's a list of facts for each algorithm
> 
> # Meijer G
> 
> Advantages:
> 
> - Can handle a large class of special functions.
> - Works particularly well with definite integrals (but it also can
> compute indefinite integrals).
> - Can compute convergence conditions for definite integrals
> - Can split indefinite integrals into conditions as well (for
> instance, integrate(1/sqrt(x**2 - 1), meijerg=True)).
> 
> Disadvantages:
> - Is only a heuristic, so while it is smarter than a basic table
> lookup, it still requires some level of pattern matching.
> - As with any such algorithm, it can be highly dependent on the form
> of the expression.
> - As such, won't recognize particularly complicated integrands.
> - The indefinite integrator is not particularly strong, at least
> compared to the definite one.
>
> # Risch
> 
> Advantages:
> 
> - Is a complete algorithm, so if an expression fits in the class it
> recognizes (and the cases are all implemented), it will compute the
> answer.
> - Works with arbitrarily complicated expressions.
> - Can prove that elementary integrals do not exist.
> - Because the algorithm is complete, rather than relying on a pattern
> matching heuristic, it doesn't rely on the form of the input
> expression. It may end up changing the format of the output, but if an
> answer exists, it will find one no matter what the input looks like
> (unless the input is in some form that it hasn't been programmed to
> recognize, e.g., currently Risch in SymPy doesn't handle hyperbolic
> trig functions even though it could, because they are just
> exponentials).
> 
> Disadvantages:
> 
> - Only works with a relatively small class of expressions (elementary
> functions, plus there are some extensions for a few special
> functions).
> - Adding more cases requires quite a bit of work.
> - Doesn't work for definite integrals directly.

This seems more or less accurate.

Maybe we should put such list into the documentation?

There is a recent extension to Risch to work with much more
of the simpler special functions, see the work of Clemens Raab,
for example "Generalization of Risch’sSpecial Functions".
They can also do definite integration now.
 
> In general, Meijer G works well for a very large class of functions,
> but not very complicated combinations of them, whereas Risch works
> well for a small class of functions, but they can be arbitrarily
> complex.  That's why on the outset, Meijer G will seem to be more
> powerful, because if you plug in every integral in an integration
> table, it will catch more of them. But if you test the integrator in a
> slightly different way, namely, by taking some random expression,
> differentiating it, and passing it in, you'll have better luck with
> the Risch algorithm (assuming the original expression was elementary).
> 
> I didn't mention heurisch, but it falls somewhere in between. It still
> uses pattern matching and can be highly sensitive to the form of the
> input, but it's based on some of the theory of the Risch algorithm, so
> it can work with reasonably complicated expressions, assuming the
> answer looks like what it expects it to. It doesn't work so well with
> special functions because it works best with functions whose
> derivatives can be expressed in terms of itself.
> 
> >
> > http://docs.sympy.org/dev/modules/integrals/g-functions.html
> >
> > and it shows how to do the (0, oo) integrals, but not the general
> > antiderivatives.
> 
> Yes, it can do antiderivatives, and as I showed in that example above,
> it can handle at least some algebraic functions.
> 
> By the way, the best resource to find some formula, unless you have
> one of those table books, is the Wolfram functions site. It's a little
> hard to navigate, though (I wonder if you have a copy of Mathematica
> if there is an easier way to do a table lookup within the software).
> 
> > I found some formulas how to integrate G functions, but I don't
> > know if it is implemented in sympy. I.e. are there functions that
> > cannot be expressed using the G function?
> 
> Tom or Raoul would have to give a more specific answer, but I believe
> that there are functions that can't be expressed in terms of the
> Meijer G-function.

Yes, there are a few although most common special function fit
into the MeijerG framework. One of the simpler examples is AFAIR
the Hermite polynomials where the G parameter get singular.
(I'd have to recheck the formulae to give the full example
if desired.)


-- Raoul

Attachment: signature.asc
Description: PGP signature

Reply via email to