# Why my Function Has no Output Plot?

Below is my commands on a mathematica script to plot a function. In order to see why the function has issue to be plotted, I have tried to plot the intermediate functions one-by-one. It seems that my line 4 (and/or possibly line 2) is problematic. What am I missing for the plot? Your help is greatly appreciated.

yfunc[M_] := (M /(10^12));

sigmafunc[M_] := (16.9*(yfunc[M])^0.41)/(
1 + 1.102*(yfunc[M])^0.20 + 6.22*(yfunc[M])^0.333);

xfunc[M_] := 1.686/sigmafunc[M];

funcsigma[M_] :=
0.322*Sqrt[(2*0.707)/\[Pi]]*(1 + (0.707*(xfunc[M])^2)^-0.3)*
xfunc[M]*Exp[-((0.707*(xfunc[M])^2)/2)];

LogLogPlot[dsigmadM, {M, 10^8, 10^16}, PlotRange -> {10^(-10), 10},
GridLines -> Automatic]

• Try LogPlot[dsigmadM[M], {M, 7, 17}, PlotRange -> {0.0001, 10}, GridLines -> Automatic] and report back. – J. M. will be back soon Apr 5 '16 at 0:28
• I have tried that too. It still doesn't work! – Benjamin Apr 5 '16 at 0:28
• Ah, then do this: Remove[dsigmadM]; dsigmadM[M_] := (Log[10]*10^M)^-1*sigmafunc'[M]; – J. M. will be back soon Apr 5 '16 at 0:30
• Still not working. – Benjamin Apr 5 '16 at 0:34
• Did you try clearing/removing dsigmadM[] (actually all your symbols) before executing that definition? – J. M. will be back soon Apr 5 '16 at 0:48

Besides the plot command (as pointed out by J.M.), you also have a problem with the derivative. Here's one way to fix it:

yfunc[M_] := 10^(12 - M);

sigmafunc[
M_] := (16.9*(yfunc[M])^0.41)/(1 + 1.102*(yfunc[M])^0.20 +
6.22*(yfunc[M])^0.333);

xfunc[M_] := 1.686/sigmafunc[M];

dsigmadM[M_] := (Log[10]*10^M)^(-1)*D[sigmafunc[x], x] //. x -> M;

funcsigma[M_] :=
0.322*Sqrt[(2*0.707)/π]*(1 + (0.707*(xfunc[M])^2)^-0.3)*
xfunc[M]*Exp[-((0.707*(xfunc[M])^2)/2)];


• The reason you can't get LogPlot is because the function takes on negative values. – bill s Apr 5 '16 at 0:56
• Thanks everyone for your comments. I had an inconsistency in the definition of one of my intermediate (namely first) function in the script. I had a "-" typo which had resulted in undefined values. However, the main issue was that I should have compensated the factor $10^{12}$ which I had introduced (in a wrong manner) in the first equation. This is now edited as can be seen from the very last definition just before plotting command. But, even if I had those correctly typed, yet I noticed that the comment made by Bill is significant. Thanks for everyone's help. – Benjamin Apr 5 '16 at 3:42