Re: 1) Numerical precision, 2) Bug in Plot?
- To: mathgroup at smc.vnet.net
- Subject: [mg29872] Re: [mg29856] 1) Numerical precision, 2) Bug in Plot?
- From: BobHanlon at aol.com
- Date: Sun, 15 Jul 2001 00:58:59 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 2001/7/14 2:11:21 AM, johannes.ludsteck at wiwi.uni-regensburg.de writes: >if I am right, it is simple to confuse >Mathematica. >I obtained a numerical solution for the following >simple differential equation: > >kd=k/.NDSolve[ > {k'[t]==Sqrt[0.2 Exp[0.01 t] k[t]]-0.2 k[t], > k[0]==1},k,{t,0,500},][[1]] > >Since I guessed that the growth rate of the >solution ks converges to a constant, I computed >an approximation to the growth rate of kd by >differentiating Log[kd] with respect to time: > >grkd[t_]:=Block[{z},D[Log[kd[z]],z]/.z->t] > >and plotted it for values of t near to the >supposed steady state: > >Plot[grkd[t],{t,300,500}] > >I was surprised when I looked at the plot because >of two problems. >The first one is that the graph is oscillatory >and I cannot figure out whether this is a problem >of numerical precision or a characteristic of the >solution. >The second one which probably is caused by a BUG >in Mathematica is that the y-axis grids have >identical numbers: 0.01, 0.01 0.01 which of >course, cannot be true, since the points are not >identical. > Since you are plotting a constant, Mathematica zoomed in until it was able to see variation (numerical quantum noise). The plot is zoomed in to so small of a range that all of the labels are identical to the precision of the labelling. Manually set the PlotRange to see the desired Plot. Plot[grkd[t], {t, 300, 500}, PlotRange -> {0.001, 0.012}, Frame -> True, Axes -> False]; Bob Hanlon Chantilly, VA USA