
Optimizing For loop statement
Posted:
Feb 20, 2013 10:26 PM


Hello, here below you can find a piece of Mathematica code: ... For[i=3,i<=n,i++, s=sigma[a,b,c] vol=ReplacePart[vol,{{i,1}>x[[i]],{i,2}>s}]; Clear[b]; b=Interpolation[vol]; ]; where sigma is a module which take as input parameters two scalars (a,c) and one interpolating function (b). What I need is to update the data (vol), on which the interpolating function is built, according to the new result of the module sigma which takes, itsself, the interpolating function as input parameter. I see that the For loop statement is really timeconsuming, and I would like to know if it is possible to ptimize it. thanks a lot Paolo

