1
$\begingroup$

I would like to plot the following function

Plot[(1/x (0.01/(0.01 + x^2) - (10/(10 + x^2))^2)), {x, 0, 10}, 
 Frame -> True, PlotRange -> All]

which is very peaked at 0.01 in log scale, to show it up to higher values, i.e.:

LogPlot[-(1/x (0.01/(0.01 + x^2) - (10/(10 + x^2))^2)), {x, 0, 100}, 
 Frame -> True, PlotRange -> {10^-9, 10}]

However, since function is negative, I must add a minus sign to the function. I would like to get something like the log plot above, but with the y-axis going downwards and with negative values, looking similar to the plot below

LogPlot[-(1/x (0.01/(0.01 + x^2) - (10/(10 + x^2))^2))^-1, {x, 0, 10},
  Frame -> True, PlotRange -> {0.1, 10^3}]

but with the right scaling for log axis and negative value sin stead of positive ones, is it possible?

Thanks in advance

$\endgroup$
  • 2
    $\begingroup$ Do you require something like the following? f[x_] := (1/x (0.01/(0.01 + x^2) - (10/(10 + x^2))^2)); myTicks = N[Table[{10^i, -10^i}, {i, -9, 1}]]; LogPlot[-f[x], {x, 0, 100}, Frame -> True, PlotRange -> {10^-9, 10}, FrameTicks -> {Automatic, myTicks, None, None}] $\endgroup$ – Boson Mar 21 '14 at 17:06
  • $\begingroup$ Not, exactly, but I see the solution, because this does the work myTicks = N[Table[{10^-i, -10^i}, {i, -9, 1}]]; LogPlot[- f[x], {x, 0, 100}, Frame -> True, PlotRange -> {10^-9, 10}] LogPlot[-f[x]^-1, {x, 0, 100}, Frame -> True, PlotRange -> {1/10, 10^9}, FrameTicks -> {Automatic, myTicks, None, None}] $\endgroup$ – pablo Mar 21 '14 at 17:34
3
$\begingroup$

It seems something like this does the work. Taking the inverse, just produce the negative value for the log. Then, relabeling the ticks (but using also the inverse, solves the work)

myTicks = 
 N[Table[{10^-i, -10^i}, {i, -9, 1}]]; LogPlot[-f[x], {x, 0, 100}, 
 Frame -> True, PlotRange -> {10^-9, 10}]
LogPlot[-f[x]^-1, {x, 0, 100}, Frame -> True, 
 PlotRange -> {1/10, 10^9}, 
 FrameTicks -> {Automatic, myTicks, None, None}]

Thanks to Boson which helped here.

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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