On 4/22/07, Ondrej Certik <[email protected]> wrote:
> As to the extensibility - I think it would be quite difficult to
> extend for example Maxima's limits facility (there are some limits
> that Maxima cannot do, but SymPy can), or Maxima's differential
> equations solver module. Either it would have to be done in LISP, or
> rewrite the whole module to python, neither of which I find easy. Or
> is there a better approach?
I had in mind the following iterative approach:
(1) Implement the basic limit formulas for products, sums, quotients, etc.,
in Python.
(2) This reduces computing limits of symbolic expressions to computing
the limits of the leaves in the tree, i.e., symbolic variables, constants, and
primitive functions (like sinh, exp, log, erf).
(3) Limits of symbolic variables and constants are trivial.
(4) For some special functions one writes an optional method _limit_
that computes the limit of that special function at a point from a given
direction. The default _limit_ method in the base class computes the
limit using maxima. So for each function for which you want better
speed or a different behavior from maxima, you just fill in the _limit_ method.
Exactly the steps above would also work for symbolic differentiation.
(Integration is a completely different story.)
Ondrej doesn't this will work (I totally disagree):
"I don't think that would work for limits (it should work for
differentiation though) except some simple cases. As an example, let's
take this limit, that Maxima cannot do:
limit((5**x+3**x)**(1/x), x, infty)
(if you type this in SymPy, you will get 5, because we use the Gruntz
algorithm, as described here:
http://sympy.googlecode.com/svn/trunk/doc/gruntz.pdf). The only thing
that occurs to me how to fix maxima is to match the expression and
return 5 immediatelly, or implement the whole algorithm from scratch,
but then you will just write the same code as we did for SymPy.
Integration is quite easy - just match the expression and return a
table integral. The general Risch algorithm is difficult, but I think
Axiom can do it."