Edit: I made a stupid mistake, see answer below
Whenever I execute wolframscript
code from the command line, my Print[]
output doesn't get evaluated, however if I run the exact same file with the Mathematica front end it works fine. I can't work out why this might be happening, it doesn't seem to be a situation where Evalute[]
helps.
Example:
M[a_, T_] := (4 \[Pi]^2 a^3)/(G T^2) /. {
G -> Quantity["GravitationalConstant"]
}
(* Assuming inclined around major axis, no change to major axis *)
m1 = M[a, T] /. {
T -> Quantity[15.7, "Years"],
a -> 0.183 * 60^-2 * \[Pi]/180 * Quantity[7.9, "Kiloparsecs"]
} // UnitConvert;
Print["Assuming inclined around major axis: M = " <> ToString[m1, InputForm]]
m1S = UnitConvert[m1, "SolarMass"];
Print["\t = " <> ToString[m1S, InputForm]]
Gives me to following output on the command line, which isn't what I expect:
But when I run it in Mathematica it gives me exactly what I expect
wolframscript --version
gives me WolframScript 1.2.0 for MacOSX-x86-64
. Mathematica 11.3 is installed.
Thanks for any advice.