Skip to content

ConvergenceResult

ConvergenceResult<T> = object

Defined in: packages/math-analysis/src/convergence-result.ts:22

What an iterative routine produced, and whether it actually got there.

converged is the point of the type. A routine that stopped because it ran out of iterations still has a best-so-far answer worth returning, and returning it bare would make that indistinguishable from an answer that met its tolerance. Check converged before trusting value.

Routines that return a bare number throw ConvergenceError instead, because there a caller has no way to notice the shortfall.

const result = continuedFractionEval(fraction, { maxIterations: 5 });
if (!result.converged) {
// result.value is the best estimate after 5 steps, not the answer.
}
```;
## See
[Convergence and iteration limits](https://anthochamp.pages.grenadine.io/node-essentials/topics/math/calculus/convergence/)
## Type Parameters
### T
`T`
## Properties
### converged
> **converged**: `boolean`
Defined in: packages/math-analysis/src/convergence-result.ts:33
Whether the tolerance was met. `false` means the iteration limit was
reached first and [ConvergenceResult.value](#value) is unconverged.
***
### iterations
> **iterations**: `number`
Defined in: packages/math-analysis/src/convergence-result.ts:27
How many iterations ran before stopping.
***
### value
> **value**: `T`
Defined in: packages/math-analysis/src/convergence-result.ts:24
Best estimate available when the iteration stopped.