diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2020-06-26 17:20:22 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2020-06-27 13:58:43 -0400 |
commit | e466113d70e9786259b3516b5951771b0706e5d8 (patch) | |
tree | 9abce5a134d5f437d8f1b6f70bba9669f191b82e /src/lp.rs | |
parent | b4e301a2a4e6e00a1b521cae8e1a015ab8fc2b54 (diff) | |
download | acap-e466113d70e9786259b3516b5951771b0706e5d8.tar.xz |
docs: Integrate KaTeX and add some formulas
Diffstat (limited to 'src/lp.rs')
-rw-r--r-- | src/lp.rs | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -1,4 +1,4 @@ -//! [L<sup>p</sup> spaces](https://en.wikipedia.org/wiki/Lp_space). +//! [`$L^p$` spaces](https://en.wikipedia.org/wiki/Lp_space). use crate::coords::Coordinates; @@ -25,9 +25,16 @@ pub use crate::chebyshev::Chebyshev as Linf; /// Compute the L<sup>∞</sup> distance between two points. pub use crate::chebyshev::chebyshev_distance as linf_distance; -/// Compute the [L<sup>p</sup> distance] between two points. +/// Compute the [`$L^p$` distance] between two points. /// -/// [L<sup>p</sup> distance]: https://en.wikipedia.org/wiki/Lp_space +/// ```math +/// \begin{aligned} +/// \mathrm{lp\_distance}(p, x, y) &= \|x - y\|_p \\ +/// &= \left( \sum_i |x_i - y_i|^p \right)^{1/p} +/// \end{aligned} +/// ``` +/// +/// [`$L^p$` distance]: https://en.wikipedia.org/wiki/Lp_space pub fn lp_distance<T, U>(p: T::Value, x: T, y: U) -> T::Value where T: Coordinates, |