MathGroup Archive 2005

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

Search the Archive

Re: Why IntervalBisection can't operate on InterpolatingFunction


An example of what I would do if I were you :

In[1]:=
sol=NDSolve[y''[x] == -y[x] && y[0] == 0 && y'[0] == 1.,y[x],{x,0,30}]

Out[1]=
{{y[x] -> InterpolatingFunction[{{0.,30.}},<>][x]}}

In[2]:=
t=Table[FindRoot[(y[x]/.sol[[1]]) == 0,{x,u}],{u,0,30,0.1}];

In[3]:=
Union[t,SameTest -> (Abs[(x/.#2)-(x/.#1)] < 10^-5&)]

Out[3]=
{{x -> -0.007339502277553871}, {x -> -3.623051082982261*^-21},
{x -> 3.1415927483622084}, {x -> 6.283185408412805},
{x -> 9.4247780931598}, {x -> 12.566370764359306},
{x -> 15.707963453833294}, {x -> 18.849556119270865},
{x -> 21.991148799043714}, {x -> 25.132741498078957},
{x -> 28.274334175842473}, {x -> 31.43186632880639},
{x -> 33.01000282339253}}


v.a.


  • Prev by Date: Re: FromDigits[{135,21}] -> 1371 (??!!)
  • Next by Date: Re: Graphics'Master in 5.1
  • Previous by thread: Why IntervalBisection can't operate on InterpolatingFunction
  • Next by thread: Maxima & Minima