Problem Setting
I have defined the following functions.
atomNumber[R_, d_, n_] := 2*n*volume[R, d]
volume[R_, d_ ] := Pi R^2 d
\[Gamma]Fn[x_] := 2/x^2 (1 - Exp[-x^2] (BesselI[0, x^2] + BesselI[1, x^2]))
\[Eta]Eval[\[Lambda]_, d_, R_, rc_, n_] :=
\[Lambda] *((atomNumber[R, d, n])^2/d^2) \[Gamma]Fn[R/(Sqrt[2] rc)] (1 - Exp[-d^2/(4*rc^2)])
\[Del]Fn[\[Omega]_, m_] := Sqrt[Quantity["ReducedPlanckConstant"]/(\[Omega]*m)]
The inputs to all these functions should eventually be physical units. I then combine these functions towards the following:
coherence[\[Omega]_, d_, R_, rc_, \[Lambda]_, n_, T_, m_] :=
4*\[Eta]Eval[\[Lambda], d, R, rc, n]*T*(\[Del]Fn[\[Omega], m])^2
If I provide units and evaluate the functions separately, everything works fine, so there is no issue with any definition here.
Goal
I two variables: $r_c$ (rc) and $\lambda$ (\[Lambda]), all other inputs are parameters. I want to find all tuples $(r_c, \lambda)$ for which the following inequality holds:
coherence[\[Omega]_, d_, R_, rc_, \[Lambda]_, n_, T_, m_] <= 1
In particular, I want to use Manipulate to find these tuples for different parameter values, i.e. I want to have slides where I can change $\omega, d, R$ given the right physical units and then get a plot for the tuples.
My solution
I use RegionPlot for the inequality and Manipulate for the parameter slide. That leads to
Manipulate[
RegionPlot[
coherence[\[Omega]Paper Quantity[40, "Terahertz"],
d Quantity[0.25, "Millimeters"], R Quantity[3.6, "Micrometers"],
rc, \[Lambda], n Quantity[176.2 * 10^(27), "Meters"^(-3)],
T Quantity[350, "Femtoseconds"],
m Quantity[6, "AtomicMassUnit"]] < 1, {rc ,
Quantity[10^-9, "Meters"], Quantity[10^-1, "Meters"]}, {\[Lambda],
Quantity[10^-10, ("Seconds")^-1],
Quantity[10^-1, ("Seconds")^-1]},
PlotRange -> All], {\[Omega]Paper, 20, 60}, {d, 0.01, 1}, {R, 0.01,
10}, {n, 100, 200}, {T, 300, 400}, {m, 1, 10}]
Here, I specified my variables $r_c$ and $\lambda$ and provided slides for all other parameters. However, I get an empty plot not showing anything.
Can anybody help me with this? I suspect that the problem has something to do with the Quantities package and my misuse thereof.
Additional Input
This is the list of hard-coded parameters I use:
\[Omega] = Quantity[40, "Terahertz"]
R = Quantity[3.6, "Micrometers"]
d = Quantity[0.25, "Millimeters"]
n = Quantity[176.2 * 10^(27), "Meters"^(-3)]
rc = Quantity[10^(-7), "Meters"]
\[Lambda] = Quantity[10^(-17), "Seconds"^(-1)]
T = Quantity[350, "Femtoseconds"]
m = Quantity[6, "AtomicMassUnit"]
This shows that coherence works:
testCoherence = coherence[\[Omega], d, R, rc, \[Lambda], n, T, m]
Out: 2.28009*10^-15
This is an example of RegionPlot without Manipulate, which also shows an empty plot:
RegionPlot[
Evaluate[coherence[\[Omega]Paper, d, R, rc, \[Lambda], n, T, m]] <
1, {rc , Quantity[10^-9, "Meters"],
Quantity[10^-1, "Meters"]}, {\[Lambda],
Quantity[10^-10, ("Seconds")^-1], Quantity[10^-1, ("Seconds")^-1]},
PlotRange -> Automatic]
RegionPlotfor your data with hard coded parameters of your choice as a starting point? $\endgroup$volume$\endgroup$