Re: NDSolve can't solve a complex ODE correctly?

*To*: mathgroup at smc.vnet.net*Subject*: [mg74906] Re: NDSolve can't solve a complex ODE correctly?*From*: dh <dh at metrohm.ch>*Date*: Tue, 10 Apr 2007 06:04:05 -0400 (EDT)*References*: <evd3uh$5ks$1@smc.vnet.net>

Hi barrow, you are fooling yourself. Every numerical solution has small numerical errors. What you see are exatcly these errors of the order of 10^-6. You can see this by plotting e.g.: Plot[Evaluate[{a[t]/az[t]}/.sol]-2.07846,{t,1000,2000}, PlotStyle\[Rule]{Hue[1]}]; hope this helps, Daniel Barrow wrote: > Dear all, > I have two coupled ordinary differential equations which satisfied > by two functions, a(t) and az(t). It can be shown analitically that as > t approaches infinity, a(t) approaches az(t). But the numerical > solution given by Mathematica doesn't agree this. > Here is my code: > ----------------------- > lam = 1; > eqb = ((a'[t]/a[t])^2 + 2a'[t]*az'[t]/a[t]/az[t] == lam); > eqaz = (3(a'[t]/a[t])^2 + 2(a''[t]/a[t] - (a'[t]/a[t])^2) == lam); > sol = NDSolve[{eqb, eqaz, a[0] == 1, az[0] == .5, a'[0] == .6}, {a[t], > az[t]}, {t, 0, 2000}, MaxSteps -> 20000]; > Plot[Evaluate[{a[t]/az[t]} /. sol], {t, 0, 2000}, PlotStyle -> > {Hue[1]}]; > ---------------------------------- > The result of the plot is an oscillation around 2.07846 which is > really strange. > Is there anything I didn't noticed about NDSolve or any method to > improve my coding? > Thanks very much! > Cheers. Barrow > >