Re: Errors in Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg69153] Re: [mg69099] Errors in Mathematica
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Thu, 31 Aug 2006 04:39:10 -0400 (EDT)
- Reply-to: hanlonr at cox.net
- Sender: owner-wri-mathgroup at wolfram.com
Clear[P,Q,A,n];
eqn1={P'[x]==Q[x],Q'[x]==10^-10,A'[x]==-A[x]/236,
P[10^-6]==0,Q[10^-6]==0,A[10^-6]==-10^-4};
sol1=DSolve[eqn1,{P[x],Q[x],A[x]},x]//Flatten
{P[x] -> (1000000000000*x^2 - 2000000*x + 1)/20000000000000000000000,
Q[x] -> (1000000*x - 1)/10000000000000000, A[x] -> -(E^(1/236000000 - x/236)/10000)}
P[x_]=P[x]/.sol1;
Q[x_]=Q[x]/.sol1;
A[x_]=A[x]/.sol1;
n[x_]=Exp[-A[x]];
eqn1//Simplify
{True,True,True,True,True,True}
Plot[{P[x],Q[x]}, {x,0, 10},
PlotStyle->{Red,Blue}];
Series[A[x],{x,0,2}]//Normal//N
-8.977305410058963*^-10*x^2 + 4.2372881535478307*^-7*x - 0.0001000000004237288
Series[n[x],{x,0,2}]//Normal//N
8.97910100581415*^-10*x^2 - 4.2377119035521287*^-7*x + 1.0001000050005904
#[1000.]&/@{P,Q,A,n}
{0.000049999999900000004, 9.99999999*^-8, -1.4446716365974027*^-6, 1.0000014446726802}
Bob Hanlon
---- Chris <fronsdal at physics.ucla.edu> wrote:
> NDSolve[{P'[x] == Q[x], Q'[x] == 10^(-10) ,
> P[10^(-6)]==0, Q[10^(-6)] == 0,
> n[x] == Exp[-A[x]] ,
> A'[x] == -A[x]/236,
> A[10^(-6)]== -.0001},
> {P,Q,A,n}, {x, 10^(-6),1000},
> MaxSteps rightarrow Infinity]
> Plot[Evaluate[P[x]/. %], {x,10^(-6), 10}]
>
> Here 2 equations link the functions P and Q.
> Two other equations link the functions n and A.
> There is no coupling between the two sets, and yet:
>
> Note the denominator 236 that appears in the second set.
> As this number is changed the solution for P[x], and in particular the
> value P[6] changes.
> Of course this should not happen.
> There is a discontinuity between 236 and 237 and another between 274
> and 275.
> After that, further increase has no effect on P[6].
>
> The problem goes away if the small numbers are increased.
> It also goes away if the exponential function is replaced by unity or
> some elementary function.
>
> If the small numbers are made much smaller it causes Mathematica to
> shut down.
>
> Can anyone tell me how to handle this?
>
--
Bob Hanlon
hanlonr at cox.net