src/newton.rs

changeset 46
90cc221eb52b
parent 37
d7cd14b8ccc0
--- a/src/newton.rs	Fri Dec 06 14:27:14 2024 -0500
+++ b/src/newton.rs	Fri Dec 06 14:57:11 2024 -0500
@@ -4,6 +4,10 @@
 
 use alg_tools::types::*;
 
+/// Approximately solves $f(x)=b$ using Newton's method in 1D.
+///
+/// The function `g` should return $(f'(x), f(x))$.
+/// The initial iterate will be `x`, and exactly `iters` iterations are taken.
 #[inline]
 pub fn newton_sym1x1<F : Float>(
     g : impl Fn(F) -> (F, F),
@@ -17,6 +21,11 @@
     x
 }
 
+/// Approximately solves $f(x)=b$ using Newton's method in "D.
+///
+/// The function `g` should return $(∇f(x), f(x))$.
+/// The Hessian $A=∇f(x)$ should be symmetric and given in the form $[A_{11}, A_{12}, A_{22}]$.
+/// The initial iterate will be `[x1, x2]`, and exactly `iters` iterations are taken.
 #[inline]
 pub fn newton_sym2x2<F : Float>(
     g : impl Fn(F, F) -> ([F; 3], [F; 2]),

mercurial