Skip to content

ConvergenceError

Defined in: packages/math-analysis/src/convergence-error.ts:20

An iterative routine hit its iteration limit before meeting its tolerance.

Thrown only by routines that return a bare value, where a caller has no way to notice the shortfall. Routines returning a ConvergenceResult report it in converged instead and never throw this.

Catching it is rarely the right response: it almost always means the input was outside the regime the routine covers, or maxIterations was set too low for the accuracy asked of it. Raise one, or loosen the other.

regularizedIncompleteGamma(3, 20, { maxIterations: 2 });
// ConvergenceError: regularizedIncompleteGamma: no convergence after 2 iterations
```;
## See
[Convergence and iteration limits](https://anthochamp.pages.grenadine.io/node-essentials/topics/math/calculus/convergence/)
## Extends
- `Error`
## Constructors
### Constructor
> **new ConvergenceError**(`routine`, `iterations`): `ConvergenceError`
Defined in: packages/math-analysis/src/convergence-error.ts:21
#### Parameters
##### routine
`string`
Name of the routine that gave up, so the message names a call site.
##### iterations
`number`
Iterations that ran before the limit was reached.
#### Returns
`ConvergenceError`
#### Overrides
`Error.constructor`
## Properties
### cause?
> `optional` **cause?**: `unknown`
Defined in: node\_modules/.store/typescript-npm-6.0.3-585eecd158/package/lib/lib.es2022.error.d.ts:24
#### Inherited from
`Error.cause`
***
### iterations
> `readonly` **iterations**: `number`
Defined in: packages/math-analysis/src/convergence-error.ts:26
Iterations that ran before the limit was reached.
***
### message
> **message**: `string`
Defined in: node\_modules/.store/typescript-npm-6.0.3-585eecd158/package/lib/lib.es5.d.ts:1075
#### Inherited from
`Error.message`
***
### name
> **name**: `string`
Defined in: node\_modules/.store/typescript-npm-6.0.3-585eecd158/package/lib/lib.es5.d.ts:1074
#### Inherited from
`Error.name`
***
### routine
> `readonly` **routine**: `string`
Defined in: packages/math-analysis/src/convergence-error.ts:23
Name of the routine that gave up, so the message names a call site.
***
### stack?
> `optional` **stack?**: `string`
Defined in: node\_modules/.store/typescript-npm-6.0.3-585eecd158/package/lib/lib.es5.d.ts:1076
#### Inherited from
`Error.stack`
## Methods
### isError()
> `static` **isError**(`error`): `error is Error`
Defined in: node\_modules/.store/typescript-npm-6.0.3-585eecd158/package/lib/lib.esnext.error.d.ts:21
Indicates whether the argument provided is a built-in Error instance or not.
#### Parameters
##### error
`unknown`
#### Returns
`error is Error`
#### Inherited from
`Error.isError`