Integrating a Taylor series?



We must be talking about different things. (Well, clearly Maxima isn't
doing automatic numerical differentiation for one thing.)  What exactly is
the calculation you're performing that takes huge amounts of time for 30
terms?

Try, for example, integrate(taylor(exp(x),x,0,100),x) or even
integrate(taylor(exp(x),x,
1
,100),x)
.  These take something < 10 mS on my laptop.

Messier cases, with parameters and thus increasingly large coefficients,
take longer.  For example,

    integrate(taylor(sin(exp(x+a)-b),x,0,100),x)$

takes about 8 seconds -- for *100* terms.  But still not an enormous amount
of time and space.

          -s



On Sun, May 12, 2013 at 1:14 AM, Dennis J. Darland <
student at dennisdarland.com> wrote:

> **
>
> There is a big difference between 1 and 10 terms.
>
> I typically use 30 using automatic numeric differentiation.
>
> Check the sode link below.
>
>
>
> -
>
> Dennis J. Darland
>
> student at dennisdarland.com
>
> http://dennisdarland.com/
>
> http://dennisdarland.com/philosophy/
>
> http://sode.sourceforge.net/
>
>
>
> On Saturday, May 11, 2013 03:09:47 PM you wrote:
>
> 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
>
>
>
>
>