Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: LogLog plot of NDSolve solution

  • To: mathgroup at smc.vnet.net
  • Subject: [mg52584] Re: [mg52557] LogLog plot of NDSolve solution
  • From: DrBob <drbob at bigfoot.com>
  • Date: Fri, 3 Dec 2004 03:53:41 -0500 (EST)
  • References: <200412020721.CAA05780@smc.vnet.net>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

>> What am I missing?

First of all, your post is missing most of the details we'd need (the code you tried) in order to tell what you did wrong.

Second, I'd recommend using the "Copy as InputForm" palette next time:

http://eclecticdreams.net/DrBob/copy_as_inputform.htm

Third, here's a working LogLogPlot:

Dodelson := Derivative[1][\[CapitalChi]][
     x] - (x/H)*(255/
      (Subscript[\[Tau], n]*x^5))*
     (12 + 6*x + x^2)*(E^(-x) -
      \[CapitalChi][x]*(1 + E^(-x)))
f = \[CapitalChi] /. First[NDSolve[
       {Dodelson == 0 /.
         {H -> 1.13,
          Subscript[\[Tau], n] ->
           886.7}, \[CapitalChi][1.293] ==
         0.25}, \[CapitalChi], {x, 0.1,
        1.3}, MaxSteps -> 10^6]];
plot = LogLogPlot[f@x, {x, 0.1, 1.3}];

It gives error messages, but only because Log[f[x]] isn't real for x < 0.88 or so, when f[x] is negative. Here's the first data point on the graph above:

E^First[Cases[plot, Line[a_] -> a, Infinity]];
First[%]

{0.8838322898494186, 0.08540796127338049}

This gives no errors:

LogLogPlot[f@x, {x, 0.88, 1.3}];

But these may be more informative:

Plot[f@x, {x, 0.5, 0.7}, PlotRange -> All]
Plot[f@x, {x, 0.6, 0.8}, PlotRange -> All]
Plot[f@x, {x, 0.8, 1.3}, PlotRange -> All]
Plot[Exp@f@x, {x, .3, 1.3}, PlotRange -> All];

We might call the last one an ExpPlot, rather than a LogPlot.

And here's a little more detail:

Plot[f@x, {x, 0.7, 0.8}, PlotRange -> All];
FindRoot[f@x, {x, 0.75}]
LogPlot[Abs@f@x, {x, 0.3, 1.3}, PlotRange -> All]
{x -> 0.751965}

(That's a LogAbsPlot, I guess.)

The last two plots, along with the result of FindRoot, may be all you need.

Bobby

On Thu, 2 Dec 2004 02:21:06 -0500 (EST), Adam Getchell <agetchell at physics.ucdavis.edu> wrote:

> Hello all,
>
> I'm solving an ODE via NDSolve (neutron abundance for Big Bang
> Nucleosynthesis -- from "Modern Cosmology", S. Dodelson). The result
> comes out as an InterpolatingFunction, which plots fine using Plot.
> However, if I wish to do a Log-Log plot, neither LogLogPlot nor
> LogLogListPlot work. What am I missing?
>
> \!\(Dodelson := \(\[CapitalChi]'\)[
>         x] - \(x\/H\) \(255\/\(\(\[Tau]\_n\) x\^5\)\) \((12 + 6  x +
>             x\^2)\) \((\[ExponentialE]\^\(-x\) - \[CapitalChi][
>                 x] \((1 + \[ExponentialE]\^\(-x\))\))\)\)
>
> In[329]:=
> \!\(\(\(\[IndentingNewLine]\)\(ans =
>     NDSolve[{Dodelson \[Equal]
>             0 /. {H \[Rule] 1.13, \[Tau]\_n \[Rule] 886.7}, \[CapitalChi][
>             1.293] \[Equal]  .25}, \[CapitalChi], {x,  .1, 1.3},
>       MaxSteps \[Rule] 10\^6]\)\)\)
>
> Using the Evaluate trick suggested by
> http://www.nhn.ou.edu/~morrison/Mathematica/TipSheets/2Dgraphics.pdf
> doesn't work.
>
> This example doesn't cover LogLogPlots:
> http://documents.wolfram.com/v4/MainBook/3.8.2.html
>
> Other search results on Google haven't turned up anything so far.
>
> Thanks,
>
> --Adam Getchell
>
>
>
>
>



-- 
DrBob at bigfoot.com
www.eclecticdreams.net


  • Prev by Date: Re: ReplacePart position
  • Next by Date: Re: Re: Inserting user material in the HelpBrowser
  • Previous by thread: LogLog plot of NDSolve solution
  • Next by thread: Re: LogLog plot of NDSolve solution