Skip to content

Commit

Permalink
latexify rightmost column
Browse files Browse the repository at this point in the history
  • Loading branch information
breandan committed Apr 11, 2023
1 parent 8d83ce6 commit d4c7316
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,26 +108,26 @@ For more information, explore the [tutorial](samples/notebooks/hello_kotlingrad.

Kotlin∇ operators are [higher-order functions](https://en.wikipedia.org/wiki/Higher-order_function), which take at most two inputs and return a single output, all of which are functions with the same numerical type, and whose shape is denoted using superscript in the rightmost column below.

| Math | Infix <sup>&dagger;</sup> | Prefix | Postfix<sup>&Dagger;</sup> | Operator Type Signature |
|:------------------------------------------------------------------:|:-------------------------------:|:--------------------------------:|:-----------------------------------:|:----------------------------------------------------------------------------------------------------------------:|
| $$\mathbf{A}(\mathbf{B})$$<br>$$\mathbf{A}\circ\mathbf{B}$$ | `a(b)`<br>`a of b` | | | (`a`: ℝ<sup>τ</sup>→ℝ<sup>π</sup>, `b`: ℝ<sup>λ</sup> → ℝ<sup>τ</sup>) → (ℝ<sup>λ</sup>→ℝ<sup>π</sup>) |
| $$\mathbf{A}\pm\mathbf{B}$$ | `a + b`<br>`a - b` | `plus(a, b)`<br>`minus(a, b)` | | (`a`: ℝ<sup>τ</sup>→ℝ<sup>π</sup>, `b`: ℝ<sup>λ</sup> → ℝ<sup>π</sup>) → (ℝ<sup>?</sup>→ℝ<sup>π</sup>) |
| $$\mathbf{A}\mathbf{B}$$ | `a * b`<br>`a.times(b)` | `times(a, b)` | | (`a`: ℝ<sup>τ</sup>→ℝ<sup>m×n</sup>, `b`: ℝ<sup>λ</sup>→ℝ<sup>n×p</sup>) → (ℝ<sup>?</sup>→ℝ<sup>m×p</sup>) |
| $$\frac{\mathbf{A}}{\mathbf{B}}$$<br>$$\mathbf{A}\mathbf{B}^{-1}$$ | `a / b`<br>`a.div(b)` | `div(a, b)` | | (`a`: ℝ<sup>τ</sup>→ℝ<sup>m×n</sup>, `b`: ℝ<sup>λ</sup>→ℝ<sup>p×n</sup>) → (ℝ<sup>?</sup>→ℝ<sup>m×p</sup>) |
| $$\pm\mathbf{A}$$ | | `-a`<br>`+a` | `a.neg()`<br>`a.pos()` | (`a`: ℝ<sup>τ</sup>→ℝ<sup>π</sup>) → (ℝ<sup>τ</sup>→ℝ<sup>π</sup>) |
| $$\sin{a}$$<br>$$\cos{a}$$<br>$$\tan{a}$$ | | `sin(a)`<br>`cos(a)`<br>`tan(a)` | `a.sin()`<br>`a.cos()`<br>`a.tan()` | (`a`: ℝ→ℝ) → (ℝ→ℝ) |
| $$\ln{a}$$ | | `ln(a)`<br>`log(a)` | `a.ln()`<br>`a.log()` | (`a`: ℝ<sup>τ</sup>→ℝ<sup>m×m</sup>) → (ℝ<sup>τ</sup>→ℝ<sup>m×m</sup>) |
| $$\log_{b}a$$ | `a.log(b)` | `log(a, b)` | | (`a`: ℝ<sup>τ</sup>→ℝ<sup>m×m</sup>, `b`: ℝ<sup>λ</sup>→ℝ<sup>m×m</sup>) → (ℝ<sup>?</sup>→ℝ) |
| $$\mathbf{A}^b$$ | `a.pow(b)` | `pow(a, b)` | | (`a`: ℝ<sup>τ</sup>→ℝ<sup>m×m</sup>, `b`: ℝ<sup>λ</sup>→ℝ) → (ℝ<sup>?</sup>→ℝ<sup>m×m</sup>) |
| $$\sqrt{A}$$<br>$$\sqrt[3]{A}$$ | `a.pow(1.0/2)`<br>`a.root(3)` | `sqrt(a)`<br>`cbrt(a)` | `a.sqrt()`<br>`a.cbrt()` | (`a`: ℝ<sup>τ</sup>→ℝ<sup>m×m</sup>) → (ℝ<sup>τ</sup>→ℝ<sup>m×m</sup>) |
| $$\frac{da}{db},\frac{\partial{a}}{\partial{b}}$$ <br> $$D_b{a}$$ | `a.d(b)`<br>`d(a) / d(b)` | `grad(a)[b]` | | (`a`: C(ℝ<sup>τ</sup>→ℝ)<sup>*</sup>, `b`: C(ℝ<sup>λ</sup>→ℝ)) → (ℝ<sup>?</sup>→ℝ) |
| $$\nabla{a}$$ | | `grad(a)` | `a.grad()` | (`a`: C(ℝ<sup>τ</sup>→ℝ)) → (ℝ<sup>τ</sup>→ℝ<sup>τ</sup>) |
| $$\nabla_{\mathbf{B}}a$$ | `a.d(b)`<br>`a.grad(b)` | `grad(a, b)`<br>`grad(a)[b]` | | (`a`: C(ℝ<sup>τ</sup>→ℝ<sup>π</sup>), `b`: C(ℝ<sup>λ</sup>→ℝ<sup>ω</sup>)) → (ℝ<sup>?</sup>→ℝ<sup>π×ω</sup>) |
| $$\nabla\cdot{\mathbf{A}}$$ | | `divg(a)` | `a.divg()` | (`a`: C(ℝ<sup>τ</sup>→ℝ<sup>m</sup>)) → (ℝ<sup>τ</sup>→ℝ) |
| $$\nabla\times{\mathbf{A}}$$ | | `curl(a)` | `a.curl()` | (`a`: C(ℝ<sup>3</sup>→ℝ<sup>3</sup>)) → (ℝ<sup>3</sup>→ℝ<sup>3</sup>) |
| $$\mathcal{J}(\mathbf{A})$$ | | `grad(a)` | `a.grad()` | (`a`: C(ℝ<sup>τ</sup>→ℝ<sup>m</sup>)) → (ℝ<sup>τ</sup>→ℝ<sup>m×τ</sup>) |
| $$\mathbf{H}(a)$$ | | `hess(a)` | `a.hess()` | (`a`: C(ℝ<sup>τ</sup>→ℝ)) → (ℝ<sup>τ</sup>→ℝ<sup>τ×τ</sup>) |
| $$\Delta{a},\nabla^{2}a$$ | | `lapl(a)` | `a.lapl()` | (`a`: C(ℝ<sup>τ</sup>→ℝ)) → (ℝ<sup>τ</sup>→ℝ<sup>τ</sup>) |
| Math | Infix <sup>&dagger;</sup> | Prefix | Postfix<sup>&Dagger;</sup> | Operator Type Signature |
|:------------------------------------------------------------------:|:-------------------------------:|:--------------------------------:|:-----------------------------------:|:-------------------------------------------------------------------------------:|
| $$\mathbf{A}(\mathbf{B})$$<br>$$\mathbf{A}\circ\mathbf{B}$$ | `a(b)`<br>`a of b` | | | $$(\texttt{a}: ℝ^{τ}→ℝ^{π}, \texttt{b}: ℝ^{λ} → ℝ^{τ}) → (ℝ^{λ}→ℝ^{π})$$ |
| $$\mathbf{A}\pm\mathbf{B}$$ | `a + b`<br>`a - b` | `plus(a, b)`<br>`minus(a, b)` | | $$(\texttt{a}: ℝ^{τ}→ℝ^{π}, \texttt{b}: ℝ^{λ} → ℝ^{π}) → (ℝ^{?}→ℝ^{π})$$ |
| $$\mathbf{A}\mathbf{B}$$ | `a * b`<br>`a.times(b)` | `times(a, b)` | | $$(\texttt{a}: ℝ^{τ}→ℝ^{m×n}, \texttt{b}: ℝ^{λ}→ℝ^{n×p}) → (ℝ^{?}→ℝ^{m×p})$$ |
| $$\frac{\mathbf{A}}{\mathbf{B}}$$<br>$$\mathbf{A}\mathbf{B}^{-1}$$ | `a / b`<br>`a.div(b)` | `div(a, b)` | | $$(\texttt{a}: ℝ^{τ}→ℝ^{m×n}, \texttt{b}: ℝ^{λ}→ℝ^{p×n}) → (ℝ^{?}→ℝ^{m×p})$$ |
| $$\pm\mathbf{A}$$ | | `-a`<br>`+a` | `a.neg()`<br>`a.pos()` | $$(\texttt{a}: ℝ^{τ}→ℝ^{π}) → (ℝ^{τ}→ℝ^{π})$$ |
| $$\sin{a}$$<br>$$\cos{a}$$<br>$$\tan{a}$$ | | `sin(a)`<br>`cos(a)`<br>`tan(a)` | `a.sin()`<br>`a.cos()`<br>`a.tan()` | $$(\texttt{a}: ℝ→ℝ) → (ℝ→ℝ)$$ |
| $$\ln{a}$$ | | `ln(a)`<br>`log(a)` | `a.ln()`<br>`a.log()` | $$(\texttt{a}: ℝ^{τ}→ℝ^{m×m}) → (ℝ^{τ}→ℝ^{m×m})$$ |
| $$\log_{b}a$$ | `a.log(b)` | `log(a, b)` | | $$(\texttt{a}: ℝ^{τ}→ℝ^{m×m}, \texttt{b}: ℝ^{λ}→ℝ^{m×m}) → (ℝ^{?}→ℝ)$$ |
| $$\mathbf{A}^b$$ | `a.pow(b)` | `pow(a, b)` | | $$(\texttt{a}: ℝ^{τ}→ℝ^{m×m}, \texttt{b}: ℝ^{λ}→ℝ) → (ℝ^{?}→ℝ^{m×m})$$ |
| $$\sqrt{A}$$<br>$$\sqrt[3]{A}$$ | `a.pow(1.0/2)`<br>`a.root(3)` | `sqrt(a)`<br>`cbrt(a)` | `a.sqrt()`<br>`a.cbrt()` | $$(\texttt{a}: ℝ^{τ}→ℝ^{m×m}) → (ℝ^{τ}→ℝ^{m×m})$$ |
| $$\frac{da}{db},\frac{\partial{a}}{\partial{b}}$$ <br> $$D_b{a}$$ | `a.d(b)`<br>`d(a) / d(b)` | `grad(a)[b]` | | $$(\texttt{a}: C(ℝ^{τ}→ℝ)^{*}, \texttt{b}: C(ℝ^{λ}→ℝ)) → (ℝ^{?}→ℝ)$$ |
| $$\nabla{a}$$ | | `grad(a)` | `a.grad()` | $$(\texttt{a}: C(ℝ^{τ}→ℝ)) → (ℝ^{τ}→ℝ^{τ})$$ |
| $$\nabla_{\mathbf{B}}a$$ | `a.d(b)`<br>`a.grad(b)` | `grad(a, b)`<br>`grad(a)[b]` | | $$(\texttt{a}: C(ℝ^{τ}→ℝ^{π}), \texttt{b}: C(ℝ^{λ}→ℝ^{ω})) → (ℝ^{?}→ℝ^{π×ω})$$ |
| $$\nabla\cdot{\mathbf{A}}$$ | | `divg(a)` | `a.divg()` | $$(\texttt{a}: C(ℝ^{τ}→ℝ^{m})) → (ℝ^{τ}→ℝ)$$ |
| $$\nabla\times{\mathbf{A}}$$ | | `curl(a)` | `a.curl()` | $$(\texttt{a}: C(ℝ^{3}→ℝ^{3})) → (ℝ^{3}→ℝ^{3})$$ |
| $$\mathcal{J}(\mathbf{A})$$ | | `grad(a)` | `a.grad()` | $$(\texttt{a}: C(ℝ^{τ}→ℝ^{m})) → (ℝ^{τ}→ℝ^{m×τ})$$ |
| $$\mathbf{H}(a)$$ | | `hess(a)` | `a.hess()` | $$(\texttt{a}: C(ℝ^{τ}→ℝ)) → (ℝ^{τ}→ℝ^{τ×τ})$$ |
| $$\Delta{a},\nabla^{2}a$$ | | `lapl(a)` | `a.lapl()` | $$(\texttt{a}: C(ℝ^{τ}→ℝ)) → (ℝ^{τ}→ℝ^{τ})$$ |

ℝ can be a `Double`, `Float` or `BigDecimal`. Specialized operators are defined for subsets of ℝ, e.g., `Int`, `Short` or `BigInteger` for subsets of ℤ, however differentiation is [only defined](https://en.wikipedia.org/wiki/Differentiable_function) for continuously differentiable functions on ℝ.

Expand Down

0 comments on commit d4c7316

Please sign in to comment.