Liking cljdoc? Tell your friends :D

diman.exponents

Contains functions. These are:

  • allexpt-times-expt
  • ref-expt-plus-expt-allmatch

How to use

Loading

(:require [diman.exponents :refer [allexpt-times-expt
                                   ref-expt-plus-expt-allmatch]])

Examples

Taking exponent of all the notations within a sub-formula

For (def subform1 "[M^(2)]"), to square it, ie., perform "[M^(2)]^2"

=> (allexpt-times-expt subform1 "2")
("4.0")

For (def subform2 "[M^(2/3)*cd^(1)*mol^(-2)]") with exponent "(2)")

=> (allexpt-times-expt subform2 "3")
("2.0" "3.0" "-6.0")

NOTE:

  • Function returns a list of exponents
  • list length of corresponds to the number of notations in the expression

Adding exponents among components with same notations

For an expression (def expr "0.5*a^(1)*t^(2)") resulting in a dimensional formula with components "[M^(0)*L^(1)*T^(-2)]" and "[T^(2)]". The 'longer' sub-formula is taken as the reference. Since all its components are separated by the multiplier * operator any exponents of common notations must be added. That is, "[M^(0)*L^(1)*T^(-2)] * [T^(2)] = [M^(0)*L^(1)*T^(-2+2)]".

Thus, for list of sub-formulae(def lform '("[M^(0)*L^(1)*T^(-2)]" "[T^(2)]")

=> (ref-expt-plus-expt-allmatch (first formcomps) (last formcomps))
[("M" "L" "T") ("0" "1" "0")]

returns a list of notations which is the same as the original reference sub-formula (first argument) but updated exponent values as a result of adding the exponents in in components with common notations in the next sub-formula (second argument).

Contains functions.
These are:

- `allexpt-times-expt`
- `ref-expt-plus-expt-allmatch`

## How to use
### Loading
```
(:require [diman.exponents :refer [allexpt-times-expt
                                   ref-expt-plus-expt-allmatch]])
```

### Examples
#### Taking exponent of all the notations within a sub-formula
For `(def subform1 "[M^(2)]")`, to square it, ie., perform "[M^(2)]^2"
```
=> (allexpt-times-expt subform1 "2")
("4.0")
```
For `(def subform2 "[M^(2/3)*cd^(1)*mol^(-2)]")` with exponent "(2)")
```
=> (allexpt-times-expt subform2 "3")
("2.0" "3.0" "-6.0")
```
**NOTE**:

- Function returns a list of exponents
- list length of corresponds to the number of notations in the expression

#### Adding exponents among components with same notations
For an expression `(def expr "0.5*a^(1)*t^(2)")` resulting in a
dimensional formula with components `"[M^(0)*L^(1)*T^(-2)]"` and `"[T^(2)]"`.
The 'longer' sub-formula is taken as the reference. Since all its components are
separated by the multiplier `*` operator any exponents of common notations must be
added. That is, `"[M^(0)*L^(1)*T^(-2)] * [T^(2)] = [M^(0)*L^(1)*T^(-2+2)]"`.

Thus, for list of sub-formulae`(def lform '("[M^(0)*L^(1)*T^(-2)]" "[T^(2)]")`
```
=> (ref-expt-plus-expt-allmatch (first formcomps) (last formcomps))
[("M" "L" "T") ("0" "1" "0")]
```
returns a list of notations which is the same as the original reference sub-formula
(first argument) but updated exponent values as a result of adding the exponents in
in components with common notations in the next sub-formula (second argument).
raw docstring

allexpt-times-exptclj

(allexpt-times-expt subform its_expt)
(allexpt-times-expt subform its_expt lst_subform_expts prod)

Returns multiplied list of exponents in the sub-formula.

Returns multiplied list of exponents in the sub-formula.
sourceraw docstring

ref-expt-plus-expt-allmatchclj

(ref-expt-plus-expt-allmatch ref_subform next_subform)
(ref-expt-plus-expt-allmatch ref_notn_expt_updated next_notn_expt lst_x lst_e)

Returns updated reference sub-formula such that ALL exponents of the corresponding notations are updated. The updated reference is returned as a list whose first is list of notations and last is list of exponents.

Returns updated reference sub-formula such that ALL exponents of the
corresponding notations are updated. The updated reference is returned
as a list whose first is list of notations and last is list of exponents.
sourceraw docstring

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

× close