Quantcast
Channel: Active questions tagged units - Mathematica Stack Exchange
Viewing all articles
Browse latest Browse all 41

Clear Guidelines for Symbolic Calculation With Units?

$
0
0

The following notebook performs a relatively simple physical calculation interacting position, velocity and acceleration of two charged point particles according to Weber electrodynamics.It is simple enough that the correctness of the physical dimensions is apparent by inspection.

Having read the Symbolic Calculations with Units section on Differentiation it wasn't clear to me what restrictions might apply during evaluation. This resulted in a number of failed attempts to get a dynamical system formulated.

So what guidelines am I violating here?

QuantityVector[name_String, components_List, unit_, vars_List : {}] :=  Module[{syms},   If[Length[vars] > 0,    syms = Quantity[Symbol[name <> #][Sequence @@ vars], unit] & /@      components,    syms = Quantity[Symbol[name <> #], unit] & /@ components];  syms]Q = Quantity[QM, "Coulombs"];q = Quantity[qM, "Coulombs"];Txhertz = Quantity[TxhertzM, "Seconds^-1"];Rxhertz = Quantity[RxhertzM, "Seconds^-1"];rVec = QuantityVector["Txr", {"x", "y", "z"}, "Meters", {t}] -   QuantityVector["Rxr", {"x", "y", "z"}, "Meters", {t}]vVec = D[rVec, t]aVec = D[vVec, t]rUnitVec = rVec/Norm[rVec]c = Quantity["SpeedOfLight"];(*Speed of light in m/s*)epsilon0 = Quantity["ElectricConstant"];weberForce[   t_] = (Q q rUnitVec)/(4 Pi epsilon0 Norm[rVec]^2)*(1 + (1/        c^2) (vVec . vVec - 3/2 ((rUnitVec) . vVec)^2 +        Norm[rVec] rUnitVec . aVec));(weberForce[t] /. {      Txrx -> Function[0 #],      Txry -> Function[0 #],      Txrz -> Function[Quantity[100, "Meters"] + Sin[# Txhertz]]      } /.    {     Rxrx -> Function[0 #],     Rxry -> Function[0 #],     Rxrz -> Function[Sin[# Rxhertz]]     } /. {t -> Quantity[1/10^9, "Second"], TxhertzM -> 1.3*10^9,     RxhertzM -> 1.3*10^8, qM -> 1, QM -> 1})[[3]]

Result:$$\frac{(100\text{m}+0.833924) \left(\frac{1}{4 \pi | 100\text{m}+0.833924| ^2}\text{C}^2\;\text{/(}\text{m}^2\varepsilon _0)\right) \left(\left(1/\text{c}^2\right) \left(4.78933\times 10^{16}\text{m}^2 \; /\text{s}^2+\frac{1}{2} (-3) \left(\frac{(100\text{m}+0.833924) \left(2.18845\times 10^8\text{m}/\text{s}\right)}{| 100\text{m}+0.833924| }+0\text{m}\right)^2+(| 100\text{m}+0.833924| \text{m}) \left(\frac{(100\text{m}+0.833924) \left(-1.62622\times 10^{18}\text{m}/\text{s}^2\right)}{| 100\text{m}+0.833924| }+0\text{m}\right)\right)+1\right)}{| 100\text{m}+0.833924| }$$


Viewing all articles
Browse latest Browse all 41

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>