Numerical representation
Robert Kern
robert.kern at gmail.com
Mon Mar 7 19:34:34 EST 2011
On 3/7/11 2:52 PM, Jon Herman wrote:
> It really is exactly the same process, but sure. Below is my Matlab translation
> of the python code I posted earlier, it functions at the increased accuracy I've
> shown above.
>
> k(:,1)=feval(deq, ti, x, mu);
>
> for n = 2:1:13
> nn=n-1;
> Xtemp1 = 0.0;
> for j = 1:1:nn
> Xtemp1 = Xtemp1 + beta(n,j) * k(:,j);
> end
> x=xwrk+ dt * Xtemp1;
> ti=twrk+alph(n)*dt;
> k(:,n)=feval(deq, ti, x, mu);
> end
>
> Xtemp2=0.0;
> for l = 1:1:13
> Xtemp2=Xtemp2+ch(l)*k(:,l);
> end
>
>
> x=xwrk + dt * Xtemp2;
> t=twrk+dt;
You may want to try printing out values in both implementations to see where
they start to diverge.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list
mailing list