I have a very simple function to plot, which I thought I could define as:
fba[a_] := h c / a
Where h is actually h-bar, the reduced Planck constant and c is the speed of light.
I did figure out how to get h and c in the formula correctly, using ctrl-=, but they create Quantities in terms of units of themselves, and I want them in SI units, and I also want the output in SI units, so this is what I did ...
fba[a_] :=
UnitConvert[
UnitConvert[Quantity[1, "SpeedOfLight"],
"SI"] UnitConvert[Quantity[1, "ReducedPlanckConstant"], "SI"]/a,
"SI"]
It seems like there must be a better way, no?
Anyway, to create a basic plot, I tried this:
a1 = Quantity[10^(-10), "Meters"]
a2 = Quantity[10^(-3), "Meters"]
Plot[fba[a], {a, a1, a2}, PlotTheme -> "Web", FrameLabel -> Automatic]
But the plot is displayed in eV units, not in SI units (which should be Joules). What am I doing wrong?
Also, what I really want is a LogPlot, but if I try it, I get all these unit conversion related errors.
What am I missing?
Update: I forgot to say that the above also does not show the units (Meters) on the x-axis. How do I get it to do that?
I did try the following for a semi-log (y) plot, and it did work (although the units are still not what I'm looking for) ...
Plot[fba[a], {a, a1, a2}, PlotTheme -> "Web", FrameLabel -> Automatic, ScalingFunctions -> {None, "Log"}]
But if I try to get log axes on both x and y with ScalingFunctions -> {"Log", "Log"}, then it is giving me unit conversion errors again.
This shouldn't be so hard to figure out (?)