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

• To: mathgroup at smc.vnet.net
• Subject: [mg74923] Re: NDSolve can't solve a complex ODE correctly?
• From: m.r at inbox.ru
• Date: Wed, 11 Apr 2007 02:00:40 -0400 (EDT)
• References: <evd3uh\$5ks\$1@smc.vnet.net>

```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

You can solve your equations exactly if you do it step by step:

sola = First@ DSolve[eqaz, a, t]
solapar = First@ Solve[{a[0] == 1, a'[0] == 6/10} /. sola]
solaz = First@ DSolve[eqb /. sola, az, t, GeneratedParameters -> C2]
solazpar = First@ Solve[az[0] == 5/10 /. solaz /. solapar]
Limit[a[t]/az[t] /. solaz /. solazpar /. sola /. solapar, t ->
Infinity] //
TrigToExp // FullSimplify

Out[10]= (6*Sqrt[3])/5

Maxim Rytin
m.r at inbox.ru

```

• Prev by Date: convergence conditions
• Next by Date: Re: Plot a simple function
• Previous by thread: Re: NDSolve can't solve a complex ODE correctly?
• Next by thread: Infinity appears as a factor in Integrate result!