[Maxima] Is integration and differentiation code sepparate?
kcrisman at gmail.com
Fri Nov 12 09:56:00 CST 2010
> I've been trying to automatically develop a large number of tests for Sage.
> Hopefully millions of them.
> Some of those tests actually test Maxima. I've only just started this, but the
> approach I've taken to date is:
> 1) Generate a "random" polynomial using a pseudo random number generator.
> 2) Simplify the polynomail, so the output is in a form that's reproducible.
> 3) Integrate the polynomial.
> 4) Differentiate the result from (3)
> 5) Simplify the result from (4)
> 6) Compare the results from (2) and (5).
> All being well, steps (2) and (5) should be equal.
> For simple polynomails, this does indeed seem to be the case. I've generated
> many thousands of them, sometimes with complex coefficients and complex powers,
> and all seems to be ok.
> I'm just wondering if there's any common code, which might actually mean the
> such tests are meaningless.
> I've found more complex cases (using sin, sinh, tan arctan etc) where the
> results of integrating a function, then differentiating it do NOT lead to back
> to the original function using Maxima.
> But I've tried the same equations in Mathematica too, and that also has
> problems, with the result appearing to be much more complicated than what I
> started with. Perhaps I'm just expecting too much. Perhaps this approach is not
> mathematically valid - I'm not a mathematician.
Just to say something (fairly) obvious to mathematicians, sometimes
there are antiderivatives that are equal up to a constant (or even
equal) which don't look anything alike - and which presumably it's
very hard to automatically check if they are equal up to a constant.
This happens particularly often with things involving combinations of
trig functions, but also with things like arcsinh/ln(stuff) and other
integrals of radicals... I bet looking at a good table of integrals
would show some of these things. So that even calc textbooks point
this out, that using different systems will give you different (but
both correct) answers.
With regards to your project, I don't know whether the
integration/differentiation code is separate in Maxima, but it IS
separate in Sage, because we use Pynac/Ginac for derivatives but
Maxima for integrals.
More information about the Maxima