qpmr.numerical_methods package#

Submodules#

qpmr.numerical_methods.mueller_method module#

Newton’s method#

Notes

  1. vectorized version easily obtainable

qpmr.numerical_methods.mueller_method.mueller(f, x0, x1=None, x2=None, tol=1e-06, max_iter=100)#

Attemts to approximate solution of f(x)=0 via Newton’s method

Parameters:
  • f (callable) – function f(x)

  • f_prime (callable) – derivative of f(x)

  • x0 (float | array) – initial guess for solution of f(x)=0

  • m (float | array) – multiplicity to recover quadratic convergence, default 1.0

  • tol (float) – positive number which defines stopping criteria |f(x)| < eps, default 1e-6

  • max_iter (int) – maximum number of iterations, default 100

  • x1 (float | ndarray[tuple[Any, ...], dtype[_ScalarT]])

  • x2 (float | ndarray[tuple[Any, ...], dtype[_ScalarT]])

Returns:

tuple containing

  • x (ndarray): roots with increased precission

  • converged (bool): True if successful, False otherwise

Return type:

float

qpmr.numerical_methods.newton_method module#

Newton’s method#

Notes

  1. vectorized version easily obtainable

qpmr.numerical_methods.newton_method.newton(f, f_prime, x0, m=1.0, tol=1e-06, max_iter=100)#

Attemts to approximate solution of f(x)=0 via Newton’s method

Parameters:
  • f (callable) – function f(x)

  • f_prime (callable) – derivative of f(x)

  • x0 (float | array) – initial guess for solution of f(x)=0

  • m (float | array) – multiplicity to recover quadratic convergence, default 1.0

  • tol (float) – positive number which defines stopping criteria |f(x)| < eps, default 1e-6

  • max_iter (int) – maximum number of iterations, default 100

Returns:

tuple containing

  • x (ndarray): roots with increased precission

  • converged (bool): True if successful, False otherwise

Return type:

float

qpmr.numerical_methods.newton_method.numerical_newton(func, x0, tolerance=1e-07, max_iterations=100)#

Numerical newton method

Implementation of original numerical method from QPmR v2

Parameters:
  • func (callable) – vectorized quasi-polynomical function which maps Complex -> Complex

  • x0 (ndarray) – initial guesses for roots

  • tolerance (float) – required tolerance, default 1e-7

  • max_iterations (int) – maximum iterations, default 100

Returns:

tuple containing

  • x (ndarray): roots with increased precission

  • converged (bool): True if successful, False otherwise

Return type:

tuple[ndarray[tuple[Any, …], dtype[_ScalarT]], bool]

qpmr.numerical_methods.secant_method module#

Secant method#

qpmr.numerical_methods.secant_method.secant(func, x0, x1=None, tolerance=1e-08, max_iterations=100)#

Secant method

Parameters:
  • func (callable) – vectorized quasi-polynomical function which maps Complex -> Complex

  • x0 (ndarray) – initial guess 0 for roots

  • x1 (ndarray) – initial guess 1 for roots, default None

  • tolerance (float) – required tolerance, default 1e-7

  • max_iterations (int) – maximum iterations, default 100

Returns:

tuple containing

  • x (ndarray): roots with increased precission

  • converged (bool): True if successful, False otherwise

Return type:

tuple[ndarray[tuple[Any, …], dtype[_ScalarT]], bool]

Module contents#

Numerical methods for increasing roots precission