1

There's a similar question here on Mathematica Stack Exchange, however it was left unanswered and the context is not the same.

I have this code

Bcgc = 5.5;
xo = 0.00105;
lambda = 0.2063;
b = 0;

Qs = ((xo/x)^(lambda/2)E^(-b^2/2Bcgc))^2;

Plot[Qs, {1/x, 10^2, 10^8}]

I want to make a plot of exactly what shows above, Qs x 1/x. However, when I run the plot, it shows this error: Raw object 100.` cannot be used as an iterator.

Ways to fix it?

  • 3
    related: https://mathematica.stackexchange.com/q/44940/9490 A basic solution for your problem would be Plot[Evaluate[Qs], {x, 1/10^2,1/10^8},ScalingFunctions->{"Reciprocal"}] – Jason B. Jun 07 '22 at 18:59
  • ParametricPlot[{1/x,Qs},{x,0,Infinity}] perhaps? – Craig Carter Jun 07 '22 at 23:04

1 Answers1

4

The first argument of the "range" argument in Plot has to be a "raw" variable, i.e., not a composite expression like 1/x. But if you define $y = 1/x$, and replace x with 1/y wherever it occurs (using the ReplaceAll operator /.), you can get what you want:

Plot[Qs /. x -> (1/y), {y, 10^2, 10^8}, AxesLabel -> {1/x, "Qs"}]

enter image description here

Michael Seifert
  • 15,208
  • 31
  • 68