MathGroup Archive 2006

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

Search the Archive

Re: Loop and Lost values - The Sequel


To my mind the trouble is that, implicitly,
you test floating point values for equality,
which is usually not recommended.

Assuming the equation depends on t1,
you could, for example, proceed this way :


t1[i_Integer] = 94.8+0.001*i;

Do[eq = {x'[t]==0.001*x[t]*t1[i], x[0]==1};
   sol = NDSolve[eq,{x},{t,0,10}];
   xt[i] = Interpolation[Table[{t,x[t]/.sol//First},{t,0,10}]],
{i,0,199}];

Do[Print[{t1[i], xt[i][3.2]}], {i,0,9}]


{94.8,1.3544}
{94.801,1.3544}
{94.802,1.35441}
{94.803,1.35441}
{94.804,1.35442}
{94.805,1.35442}
{94.806,1.35443}
{94.807,1.35443} 
{94.808,1.35444} 
{94.809,1.35444}


hth

V.Astanoff


  • Prev by Date: Re: Count Function
  • Next by Date: Sphere
  • Previous by thread: Loop and Lost values - The Sequel
  • Next by thread: Re: Transformstion to canonical form