Liking cljdoc? Tell your friends :D
Clojure only.

diman.analyze

Contains function. These are

  • dimnames
  • consistent?

How to use

Loading

(:require [diman.analyze :refer [dimnames consistent?]])

Examples

Consider the case

(def varpars [{:symbol "x", :dimension "length"},
              {:symbol "v", :dimension "velocity"}
              {:symbol "t", :dimension "time"}
              {:symbol "a", :dimension "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)*M^(0)*L^(2)] + [T^(1)] + [T^(0)*M^(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) + length^(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
Contains function.
These are

- `dimnames`
- `consistent?`

## How to use
### Loading
```
(:require [diman.analyze :refer [dimnames consistent?]])
```
### Examples
Consider the case
```
(def varpars [{:symbol "x", :dimension "length"},
              {:symbol "v", :dimension "velocity"}
              {:symbol "t", :dimension "time"}
              {:symbol "a", :dimension "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)*M^(0)*L^(2)] + [T^(1)] + [T^(0)*M^(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) + length^(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
```
raw docstring

consistent?clj

(consistent? varpar_def eqn)
source

dimnamesclj

(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.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close