Numerical Calculations with Units
Numerical Calculations with Units
The Wolfram Language's unit system utilizes various numerical methods, facilitating calculations using Quantity expressions within the Wolfram Language's numerical functions.
| N[quantity] | numerical approximation of the specified quantity |
| FindRoot[lhsrhs,{x,x0}] |
search for a numerical solution to an equation, starting with
|
| FindMaximum[f,{x,x0}] | search for a maximum of f, starting with |
Numerical functions that operate on Quantity expressions.
N[Quantity[20 + 29Sqrt[2], "Feet"]]For numerical functions like FindRoot and FindMaximum, if a variable is specified within a Quantity expression, then that variable is assumed to be a dimensionless value (representing the magnitude of its Quantity). If no unit is specifically associated with a variable, these functions will attempt to automatically determine the units associated with the variable, based on the expression and any specified start values.
FindRoot[Quantity[Cos[x], "Amperes"] == Quantity[x, "Amperes"], {x, 0}]FindRoot[(1/2) (t^2 (Quantity[(-9.8), ("Meters"/"Seconds"^2)]) + Quantity[200, "Meters"]), {{t, Quantity[1, "Seconds"]}}]FindMaximum[x * Quantity[Cos[x], "Miles"], {x, 2}]vel = Quantity[3000, "Feet" / "Seconds"];
grav = Quantity[1, "StandardAccelerationOfGravity"];FindMaximum[vel * t + 1 / 2(-grav)t ^ 2, {{t, Quantity[1, "Seconds"]}}]NSolve[vel * t + 1 / 2(-grav)t ^ 2 == 0, t, Reals]h = First[y[t] /. DSolve[{ y''[t] == -γ y'[t] - g, y[0] == Quantity[0, "Meters"], y'[0] == Quantity[10, "Meters" / "Seconds"]}, y, t]] /. {γ -> Quantity[1 / 10, 1 / "Seconds"], g -> Quantity[9.8, "Meters" / "Seconds" ^ 2]};FindMaximum[h, {{t, Quantity[1, "Seconds"]}}]Related Guides
-
▪
- Units