MathGroup Archive 2003

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

Search the Archive

Simplifying a "fixed-point" inner loop

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43128] Simplifying a "fixed-point" inner loop
  • From: carlos at colorado.edu (Carlos Felippa)
  • Date: Wed, 13 Aug 2003 07:49:58 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

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.


  • Prev by Date: Nonlinear fit for a non-differentiable function
  • Next by Date: AW: NDSolve with a InterpolationFunction, Mathematica 5.0
  • Previous by thread: Re: Nonlinear fit for a non-differentiable function
  • Next by thread: Re: Simplifying a "fixed-point" inner loop