Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #12534
| From | barandiaran.juan@gmail.com |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Find all roots of an interpolating function (solution of a |
| Date | 2012-12-03 08:31 +0000 |
| Message-ID | <k9ho08$po$1@smc.vnet.net> (permalink) |
| Organization | Time-Warner Telecom |
Hi,
I'm trying to find all the roots of the solution to a differential equation.
Using NSolve or Reduce I don't get the roots, so I'm using an iterative method which I found in physicsforums.com.
This method solves my problem, but you have to choose the increment and thus in some cases it might give headaches. I wonder if there is any more general approach.
Following is a sample code:
IN:= data = NDSolve[{1.09 x''[t] - 0.05 x'[t] + 1.1759 Sin[x[t]] == 0,
x[0] == Pi/3, x'[0] == 0}, x, {t, 0, 50}]
OUT:= {{x->InterpolatingFunction[{{0.,50.}},<>]}}
IN:=sol = NSolve[x'[t] == 0 /. data , t]
OUT:=NSolve::ifun: Inverse functions are being used by NSolve, so some solutions may not be found; use Reduce for complete solution information. >>
OUT:={{t->InverseFunction[InterpolatingFunction[{{0.,50.}},<>],1,1][0.]}}
IN:=sol = Reduce[x'[t] == 0 /. data , t]
OUT:=Reduce::inex: Reduce was unable to solve the system with inexact coefficients or the system obtained by direct rationalization of inexact numbers present in the system. Since many of the methods used by Reduce require exact input, providing Reduce with an exact version of the system may help. >>
OUT:=Reduce[{InterpolatingFunction[{{0.,50.}},<>][t]==0},t]
IN:=
dt=0.1;
tmin=0.;
tmax=50.;
Union[Table[t/.FindRoot[x'[t]==0/.data ,{t,tInit,tmin,tmax}],{tInit,tmin+dt,tmax-dt,dt}],SameTest->(Abs[#1-#2]<10^-2&)]
OUT:={0., 3.26812, 6.58301, 9.95657, 13.4054, 16.9538, 20.6403, 24.533, \
28.7857, 34.2571}
Thanks and best regards,
JBB
Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread
Find all roots of an interpolating function (solution of a barandiaran.juan@gmail.com - 2012-12-03 08:31 +0000 Re: Find all roots of an interpolating function (solution of a JBB <barandiaran.juan@gmail.com> - 2012-12-18 07:35 +0000 Re: Find all roots of an interpolating function (solution of a JBB <barandiaran.juan@gmail.com> - 2012-12-18 07:35 +0000
csiph-web