I'm a new user, and am trying to build a simple Boyle's law system in Mathematica. I want to include the units of the values, as I may need to perform some conversions later. If my quantities are a discrete list, they work fine. I cannot seem to get it to work for a slider. Can you help? I need this for work, and it's quite urgent. I've searched for a while before posting this question. Here's my code:
Manipulate[
Text@Style[
Grid[{
{Row[{"Total fill volume is ", totalVolume}]},
{Row[{"Delivery rate is ", deliveryRate}]},
{Row[{"Product duration is ",
duration[totalVolume, deliveryRate]}]},
{Row[{}]},
{Row[{"Initial pressure is ", initialPressureG}]},
{Row[{"Drop in pressure is ", pressureDrop, "%"}]}
}, Alignment -> Left]
]
,
{{totalVolume, Quantity[30, "ml"], "Total fill volume"},
Quantity[{30, 45, 60, 90}, "ml"]},
{{deliveryRate, Quantity[1, "ml/day"], "Delivery rate"},
Quantity[{0.5, 1, 2, 3}, "ml/day"]},
{initialPressureG, 0, 100},
{{pressureDrop, 40, "Pressure drop"}, 0, 100, 5}
]
Instead of initialPressureG
being a slider from 0
to 100
, I want it to be a slider from 0psi
to 100psi
. Am I doing something stupidly wrong?
duration
in your post. $\endgroup${Row[{"Initial pressure is ", initialPressureG, " Psi"}]}
? $\endgroup$lbf/(in)^2
instead ofpsi
useQuantityForm[QuantityUnit@Quantity@"psi", "Abbreviation"]
instead of " psi". If you wish, you can also change the control to{initialPressureG, QuantityMagnitude[Quantity[0, "psi"]], QuantityMagnitude[Quantity[100, "psi"]]}
$\endgroup$duration
do? If I use your option of changing the control, if and when I want to extract the value of what the user sets on the slider, would it have the dimension "psi"? Or would I have to set that separately in a calculation? $\endgroup$duration
, i meant that your posted code does not include the definition of the function `duration; so your code does not evaluate when we copy/paste it into a notebook. $\endgroup$