klampt.math.rootfind module

Python interface to C++ nonlinear, multidimensional root finding routines

klampt.math.rootfind.setFTolerance(tolf)[source]

Sets the termination threshold for the change in f.

Return type:

None

Parameters:

tolf (float) –

klampt.math.rootfind.setXTolerance(tolx)[source]

Sets the termination threshold for the change in x.

Return type:

None

Parameters:

tolx (float) –

klampt.math.rootfind.setVectorField(pVFObj)[source]

Sets the vector field object.

Return type:

int

Parameters:

pVFObj (object) –

Returns:

0 if pVFObj = NULL, 1 otherwise.

Return type:

status (int)

See vectorfield.py for an abstract base class that can be overridden to produce one of these objects.

klampt.math.rootfind.findRoots(startVals, iter)[source]

Performs unconstrained root finding for up to iter iterations

Return type:

object

Parameters:
  • startVals (object) –

  • iter (int) –

Returns:

where status indicates

the return code, as follows:

  • 0: convergence reached in x

  • 1: convergence reached in f

  • 2: divergence

  • 3: degeneration of gradient (local extremum or saddle point)

  • 4: maximum iterations reached

  • 5: numerical error occurred

and x is the final point and n is the number of iterations used

Return type:

status,x,n (tuple of int, list of floats, int)

klampt.math.rootfind.findRootsBounded(startVals, boundVals, iter)[source]

Same as findRoots, but with given bounds (xmin,xmax)

Return type:

object

Parameters:
  • startVals (object) –

  • boundVals (object) –

  • iter (int) –

klampt.math.rootfind.destroy()[source]

destroys internal data structures

Return type:

None