0
$\begingroup$

I am trying to plot a few functions which have very large numeric outputs. One can however scale the outputs to make the values small. I will paste the function here

Mhawk1[tt_, minit_] = (
  500000000 (30/(37 \[Pi]))^(
   1/3) ((412016053 minit^3 \[Pi])/3750000000000000000000000000 - (
     134745444 tt)/5)^(1/3))/3337^(2/3);

I write one more function that plots the above function till for a given value of minit for values of tt such that the argument inside the radical is greater than or equal to zero.

mhawkplot[minit_] := 
 LogLogPlot[
  Mhawk1[tt, minit], {tt, 0, (412016053 minit^3 \[Pi])/
   101059083000000000000000000000000000}, ImageSize -> Large, 
  PlotRange -> All]

I have to now compare these plots for various values of minit. For example $10^10$ and $10^11$. But the plot for the larger of these two values does no start from $tt = 0$ and does not end where the function becomes zero as well.

p1 = mhawkplot[10^10];

p2 = mhawkplot[10^11];

Show[p1, p2]

Gives the following output enter image description here

Is there a way to do this better? Any help is greatly appreciated. Thanks.

$\endgroup$
2
  • 1
    $\begingroup$ A LogLog plot can not start at zero in x and y. Zero would be at -Infinity $\endgroup$ Commented May 21 at 9:41
  • $\begingroup$ @DanielHuber but is there a way to make the lines start closer to the axes? If do not use a LogLogPlot but just Plot, is there a way to make both graphs appear clearly? Because even that is not happening here. $\endgroup$
    – QFTheorist
    Commented May 21 at 9:44

2 Answers 2

1
$\begingroup$

You may give explicit values for start and end of the plot. But note that Mhawk1 becomes complex for larger values and can therefore not been plotted for all arguments.

Mhawk1[tt_, 
   minit_] = (500000000  (30/(37  \[Pi]))^(1/
        3)  ((412016053  minit^3  \[Pi])/
         3750000000000000000000000000 - (134745444  tt)/5)^(1/3))/
   3337^(2/3);
mhawkplot[minit_, start_, end_] := 
  LogLogPlot[Mhawk1[tt, minit], {tt, start, end}, ImageSize -> Large, 
   PlotRange -> All];

p1 = mhawkplot[10^10, 10, 10^8]
p2 = mhawkplot[10^11, 10, 10^8]
Show[p1, p2]

enter image description here

If you want to end the plot on the x axis, you have to restrict the x and y axes.

$\endgroup$
1
$\begingroup$

Two or three things can fix this: Solving for the value of tt that gives the desired lower bound (none is stated, except a desire that they be the same). (2) Prevent the plotter from a slight offset in from the end points of the plot domain. (3) Finally, set the PlotRange to have the desired lower bound. (Without this, there is a slight difference in the levels of the lower end points, because of the numerical sensitivity of a very steep graph to small changes in the abscissa.)

mhawk1[tt_, 
   minit_] = (500000000  (30/(37  \[Pi]))^(1/
        3)  ((412016053  minit^3  \[Pi])/
         3750000000000000000000000000 - (134745444  tt)/5)^(1/3))/
   3337^(2/3);

mhawkplot[minit_] := LogLogPlot[mhawk1[tt, minit]
  , {tt, 0, t /. First@Solve[mhawk1[t, minit] == 10^6, t]}
  (*,ImageSize->Large*)
  , PlotRange -> {All, {10^6, All}}
  , Method -> {"BoundaryOffset" -> False}]
    
p1 = mhawkplot[10^10];

p2 = mhawkplot[10^11];

Show[p1, p2]

enter image description here

$\endgroup$
1
  • $\begingroup$ +1 Also, the plot iterator should not start at zero for a LogLogPlot. Use {tt, 10, (412016053 minit^3 \[Pi])/ 101059083000000000000000000000000000} or some other non-zero value. $\endgroup$
    – Bob Hanlon
    Commented May 21 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.