Integrating a Taylor series?



Your integral should return instantaneously.  I don't know why an earlier
correspondent claimed that this would take a long time and lots of memory.

The fact that Maxima runs forever on this simply indicates that there is a
bug. (Sorry!)

Here's a little more detail:

The correct answer is very simple.  taylor(f(x),x,a,1) returns

             f(a)+('at('diff(f(x),x,1),x = a))*(x-a)

f(a) is clearly independent of x, so integrate(f(a),x) =>x*f(a).

'at('diff(f(x),x,1),x = a) is *also* independent of x -- x in this
expression is a *dummy variable*, so this expression means the same thing
as 'at('diff(f(y),y,1),y = a).  So integrate('at('diff(f(x),x,1),x = a)
*(x-a) should be 'at('diff(f(x),x,1),x = a) *(x^2/2-a*x).

Instead, Maxima is apparently getting into an infinite loop.  This is a
bug. The simplest way I've found to elicit it is
integrate(at(diff(f(x),x),x=3),x).

A simple workaround is to rename all the dummy variables. Here's a simple
way to do that:

rename_dummies(expr) :=
    subst(nounify(at) =
                 lambda([ex,vareq],
                        subst(gensym(),lhs(vareq),at(ex,vareq))),
                    expr)$

So now you can do

     integrate( rename_dummies( taylor(f(x),x,a,1) ), x,a,a+h)

and get the correct answer instantaneously.

Bizarrely, Maxima is numbering gensyms starting at 34100, which makes the
answer ugly, but still correct.

                   -s

I'm running Maxima 5.28 on GCL 2.6.8 on Windows

On Sat, May 11, 2013 at 2:30 PM, Thomas D. Dean <tomdean at speakeasy.org>wrote:

> On 05/09/13 14:39, Dennis J. Darland wrote:
>
>> It might take a very long time, if you have enough memory!
>>
>>
> Core i7 O.C. 4.2GHz 16G RAM.
>
> > maxima
> Maxima 5.29.1 http://maxima.sourceforge.net
> using Lisp GNU Common Lisp (GCL) GCL 2.6.7 (a.k.a. GCL)
> ...
> (%i19) integrate(taylor(f(x),x,a,1),**x,a,a+h);
>
> has been running 2 days, using 100% of 1 CPU and 1G RAM.  What is a very
> long time?  How do I check to see if there is progress?
>
>
> Tom Dean
>
> ______________________________**_________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/**mailman/listinfo/maxima<http://www.math.utexas.edu/mailman/listinfo/maxima>;
>