I'm practising making Dynamics so I made a simple solution measurement converter but I'm having trouble getting a numerical output at basemL/baseL. It keeps coming out as fractional even though I've probably overdone using N. I've also tried doing this with With putting the entire Grid inside it but it still comes out as fractional.
DynamicModule[
{baseTsp=1, baseGal=1,basemL=N[Dynamic[baseTsp*157725491/32000000]], baseL=N[Dynamic[baseGal*473176473/125000]]},
Grid[{
{InputField[Dynamic@baseTsp, Number,ImageSize->{50,20}, Alignment->Center],
"Tsp (Solution) per",
InputField[Dynamic@baseGal, Number,ImageSize->{50,20}, Alignment->Center],
"Gallon (Base)"},
{InputField[basemL, Number,ImageSize->{70,20}, Alignment->Center,Enabled->False],
"mL (Solution) per",
InputField[baseL, Number,ImageSize->{70,20}, Alignment->Center,Enabled->False],
"mL (Base)"},
{InputField[N[basemL/baseL],Enabled->False],
"per 1000 mL"}
}, Alignment->Left]
]
How do I make it output as numerical?
Also if you have suggestions on how I can improve my code or better conventions using Dynamics please feel free to tell me.
{baseTsp=1, baseGal=1,basemL, baseL}andInputField[basemL=N[Dynamic[baseTsp*157725491/32000000]]forbasemLandbaseLbut it still comes out as fractional output atbasemL/baseL. – I should change my Username May 31 '17 at 00:04basemlwithin theInputFieldwrap the right hand side of the equal sign withN. That isInputField[Dynamic[basemL = N[baseTsp*157725491/32000000]] ...– Jack LaVigne May 31 '17 at 02:09