From e466113d70e9786259b3516b5951771b0706e5d8 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Fri, 26 Jun 2020 17:20:22 -0400 Subject: docs: Integrate KaTeX and add some formulas --- src/lp.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/lp.rs') diff --git a/src/lp.rs b/src/lp.rs index 80a6f8a..4afd209 100644 --- a/src/lp.rs +++ b/src/lp.rs @@ -1,4 +1,4 @@ -//! [Lp 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 distance between two points. pub use crate::chebyshev::chebyshev_distance as linf_distance; -/// Compute the [Lp distance] between two points. +/// Compute the [`$L^p$` distance] between two points. /// -/// [Lp 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(p: T::Value, x: T, y: U) -> T::Value where T: Coordinates, -- cgit v1.2.3