MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Simplifying a "fixed-point" inner loop

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43165] Re: [mg43128] Simplifying a "fixed-point" inner loop
  • From: Dr Bob <drbob at bigfoot.com>
  • Date: Fri, 15 Aug 2003 04:27:10 -0400 (EDT)
  • References: <200308131149.HAA28316@smc.vnet.net>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

I don't think this will speed things up, but the inner loop might be 
replaced by something like this:

r = 1;
deriv[[i, k]] = Catch@FixedPoint[
   If[r++ > rmax, Throw@Print@"Recursion OVF, j loop",
      Simplify@Normal@Series[# /. rep, {h, 0, order - i}]] &,
   derold]

Bobby

On Wed, 13 Aug 2003 07:49:58 -0400 (EDT), Carlos Felippa 
<carlos at colorado.edu> wrote:

> I am writing a module to get modified differential equations (MDEs).
> It gets exponentially slow as the truncation order grows.  Most
> of the work is spent in the r (recursion) inner loop shown below:
>
> <code removed>
> For [k=1, k<=n, k++, For [i=order-1, i>=1, i--,
> For [j=i+1, j<=order, j++, ykj=D[y[[k]],{t,j}];
> rep={ykj->deriv[[j,k]]}; derold=Simplify[deriv[[i,k]]];
> For [r=1, r<=rmax, r++,
> dernew=derold/.rep;
> dernew=Simplify[Normal[Series[dernew,{h,0,order-i}]]];
> If [dernew==derold, deriv[[i,k]]=dernew; Break[]];
> If [r==rmax, Print["Recursion OVF, j loop"];Return[Null]];
> derold=dernew;
> ];
> ];
> <code removed>
>
> Here deriv is a Table of symbolic function expressions and their
> derivatives.  On exit it will contain the MDE.  rmax is the
> recursion count limit to get a fixed-point match.
>
> Question: can the r-loop be replaced by a single Map or FixedPoint
> command, with some form of error check?  Thanks.
>
>



-- 
majort at cox-internet.com
Bobby R. Treat


  • Prev by Date: Improving Genetic Programming Efficiency
  • Next by Date: Re: Re: X-windows display of Mathematica graphics run remotely on Mac OS X machine
  • Previous by thread: Simplifying a "fixed-point" inner loop
  • Next by thread: AW: NDSolve with a InterpolationFunction, Mathematica 5.0