Re: How can I "perturbate" a NDSolve expresion?
- To: mathgroup at smc.vnet.net
- Subject: [mg102566] Re: How can I "perturbate" a NDSolve expresion?
- From: dh <dh at metrohm.com>
- Date: Fri, 14 Aug 2009 05:59:25 -0400 (EDT)
- References: <h4h1u6$iba$1@smc.vnet.net>
Iván Lazaro wrote: > Hi all! > > I'm trying to make a perturbation to a equation while NDSolve is doing his > job. > > Suppose the equation is x'[t]=A*F(x[t]); where A is a parameter matrix, and > x'[t] are n-dimensional variables; i need that when integration time is, for > example, 10, the parameters change in some amount. Another posibility is > that each time step I generate a random number, and if it is less than > 0.001, the parameters change in some amount. > > Is it possible using NDSolve, or I have to write the integrator routine? > > Thanks! > Hi Ivan, simply set: ======================= a[t_] := If[RandomReal[] < 0.001, RandomReal[], 0]; NDSolve[{x1'[t] == (Sin[t] + a[t])*x2[t], x2'[t] == (Cos[t] - a[t]*x1[t]^2)*x1[t], x1[0] == 1, x2[0] == 0}, {x1[t], x2[t]}, {t, 0, 10}] ======================== Daniel