Contains function. These are
dimnames
consistent?
(:require [diman.analyze :refer [dimnames consistent?]])
Consider the case
(def varpars [{:symbol "x", :quantity "length"},
{:symbol "v", :quantity "velocity"}
{:symbol "t", :quantity "time"}
{:symbol "a", :quantity "acceleration"}])
(def lhs "x^(1)")
(def rhs {:term1 "x^(1)", :term2 "v^(2)", :term3 "t^(1)", :term4 "0.5*a^(1)*t^(2)"})
(def eqn {:lhs lhs, :rhs rhs})
Then using (require '[diman.formula :refer [formula-term formula-eqn-side]])
The formula for the right hand side of the equation is
=> (formula-eqn-side varpars rhs)
"[L^(1)] + [T^(-2)*L^(2)] + [T^(1)] + [T^(0)*L^(1)]"
The rhs of our example equation as dimension names is
=> (dimnames (formula-eqn-side varpars rhs))
"length^(1) + time^(-2)*length^(2) + time^(1) + length^(1)"
and for lhs
=> (dimnames (formula-eqn-side varpars lhs))
"length^(1)"
Notice that names of the dimensions with exponent value = 0 is not seen.
To check if the lhs and rhs of the dimensional formula are the same do
=> (consistent? varpars eqn)
true
Contains function. These are - `dimnames` - `consistent?` ## How to use ### Loading ``` (:require [diman.analyze :refer [dimnames consistent?]]) ``` ### Examples Consider the case ``` (def varpars [{:symbol "x", :quantity "length"}, {:symbol "v", :quantity "velocity"} {:symbol "t", :quantity "time"} {:symbol "a", :quantity "acceleration"}]) (def lhs "x^(1)") (def rhs {:term1 "x^(1)", :term2 "v^(2)", :term3 "t^(1)", :term4 "0.5*a^(1)*t^(2)"}) (def eqn {:lhs lhs, :rhs rhs}) ``` Then using ```(require '[diman.formula :refer [formula-term formula-eqn-side]])``` The formula for the right hand side of the equation is ``` => (formula-eqn-side varpars rhs) "[L^(1)] + [T^(-2)*L^(2)] + [T^(1)] + [T^(0)*L^(1)]" ``` #### Dimension names of an equation side The rhs of our example equation as dimension names is ``` => (dimnames (formula-eqn-side varpars rhs)) "length^(1) + time^(-2)*length^(2) + time^(1) + length^(1)" ``` and for lhs ``` => (dimnames (formula-eqn-side varpars lhs)) "length^(1)" ``` Notice that names of the dimensions with exponent value = 0 is not seen. #### Consistency check To check if the lhs and rhs of the dimensional formula are the same do ``` => (consistent? varpars eqn) true ```
(dimnames eqn_form)
(dimnames eqn_form lst_subform lst_ans)
Returns names of the contents of the dimensional formula.
Returns names of the contents of the dimensional formula.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close