Usage

padepy.direct_algorithm

direct_algorithm.coefficients_for_numerator(p, q, var, obj, float_precision=False)

Function to calculate Maclaurin polynomial coefficients needed for numerator coefficients calculation.

Parameters:
  • p (int) – degree of the Padé approximant numerator.

  • q (int) – degree of the Padé approximant denominator.

  • var (sympy.core.symbol.Symbol) – function variable.

  • obj (list, sympy.core.mul.Mul, or sympy bulti-in function) – The obj can be a list of real number, a user defined function, or sympy bulti-in function like sin, cos, log, and exp.

  • float_precision (int) – floating point precision. Default value False for infinite (algebric) precicion.

Returns:

matrix of coefficients.

Return type:

sympy.matrices.dense.MutableDenseMatrix

direct_algorithm.denominator_coeffs(A, a, q, float_precision=False)

Function to solve the system Ab=a where b is the [p/q](x) Padé approximant denominator coefficients.

Parameters:
  • A (sympy.matrices.dense.MutableDenseMatrix) – qxq Hankel matrix.

  • a (sympy.matrices.dense.MutableDenseMatrix) – independent variables of system Ab=a.

  • q (int) – degree of the Padé approximant denominator.

  • float_precision (int) – floating point precision. Default value False for infinite (algebric) precicion.

Returns:

[p/q](x) Padé approximant denominator coefficients.

Return type:

sympy.matrices.dense.MutableDenseMatrix

direct_algorithm.hankel_matrix(p, q, var, obj, float_precision=False)

Function to calculate qxq Hankel matrix.

Parameters:
  • p (int) – degree of the Padé approximant numerator.

  • q (int) – degree of the Padé approximant denominator.

  • var (sympy.core.symbol.Symbol) – function variable

  • obj (list, sympy.core.mul.Mul, or sympy bulti-in function) – The obj can be a list of real number, a user defined function, or sympy bulti-in function like sin, cos, log, and exp.

  • float_precision (int) – floating point precision. Default value False for infinite (algebric) precicion.

Returns:

qxq Hankel matrix

Return type:

sympy.matrices.dense.MutableDenseMatrix

direct_algorithm.independent_vars(p, q, var, obj, float_precision=False)

Function to calculate the independent variables of system Ab=a, where A is the qxq Hankel matrix.

Parameters:
  • p (int) – degree of the Padé approximant numerator.

  • q (int) – degree of the Padé approximant denominator.

  • var (sympy.core.symbol.Symbol) – function variable.

  • obj (list, sympy.core.mul.Mul, or sympy bulti-in function) – The obj can be a list of real number, a user defined function, or sympy bulti-in function like sin, cos, log, and exp.

  • float_precision (int) – floating point precision. Default value False for infinite (algebric) precicion.

Returns:

matrix of coefficients.

Return type:

sympy.matrices.dense.MutableDenseMatrix

direct_algorithm.numerator_coeffs(p, q, var, obj, bn, float_precision=False)

Function to calculate the [p/q](x) Padé approximant numerator coefficients.

Parameters:
  • p (int) – degree of the Padé approximant numerator.

  • q (int) – degree of the Padé approximant denominator.

  • var (sympy.matrices.dense.MutableDenseMatrix) – function variable.

  • obj (list, sympy.core.mul.Mul, or sympy bulti-in function) – The obj can be a list of real number, a user defined function, or sympy bulti-in function like sin, cos, log, and exp.

  • bn – [p/q](x) Padé approximant denominator coefficients.

  • float_precision (int) – floating point precision. Default value False for infinite (algebric) precicion.

Returns:

[p/q](x) Padé approximant numerator coefficients.

Return type:

sympy.matrices.dense.MutableDenseMatrix

direct_algorithm.pade(p, q, var, obj, float_precision=0)

Function to calculate the [p/q](x) Padé approximant using the direct algorithm.

Parameters:
  • p (int) – degree of the Padé approximant numerator.

  • q (int) – degree of the Padé approximant denominator.

  • var (sympy.core.symbol.Symbol) – function variable.

  • obj (list, sympy.core.mul.Mul, or sympy bulti-in function type) – The obj can be a list of real number, a user defined function, or sympy bulti-in function like sin, cos, log, and exp.

  • float_precision (int) – floating point precision. Default value 0 for infinite (algebric) precicion.

Returns:

[p/q](x) Padé approximant.

Return type:

sympy.core.mul.Mul

padepy.baker_algorithm

baker_algorithm.pade(p, q, var, obj=[], float_precision=0, not_full_path=True)

Function to calculate the [p/q](x) Padé approximant using Baker’s recursive algorithm.

Parameters:
  • p (int) – degree of the Padé approximant numerator.

  • q (int) – degree of the Padé approximant denominator.

  • var (sympy.core.symbol.Symbol) – function variable.

  • obj (list, sympy.core.mul.Mul, or sympy bulti-in function type) – The obj can be a list of real number, a user defined function, or sympy bulti-in function like sin, cos, log, and exp. The default empty list allows to calculate the Padé approximants generic expressions.

  • float_precision (int) – floating point precision. Default value 0 for infinite (algebric) precicion.

  • not_full_path – if set to True the Padé approximants from [p+q/0](x)

to [0/p+q](x) will be ostructed. If False, from [p+q/0](x) to [p/q](x). :type not_full_path: bool

Returns:

The first return is the [p/q](x) Padé approximant. The second is a matrix with all Padé approximants contruct until [p/q](x), or all Padé aproximants from [p+q/0](x) to [0/p+q](x) if not_full_path set to True.

Return type:

tuple (sympy.core.mul.Mul, sympy.matrices.dense.MutableDenseMatrix)

padepy.maclaurin

maclaurin.coefficients(n, var, func)

Function to calculate the first n coefficients of the Maclaurin expansion.

Parameters:
  • n (int) – number of coefficients.

  • var (sympy.core.symbol.Symbol) – function variable.

  • func (sympy.core.mul.Mul or sympy bulti-in function type) – User defined function, or sympy bulti-in function like sin, cos, log, and exp.

Returns:

list with n coefficients.

Return type:

list

maclaurin.polynomial(p, q, var, obj, float_precision=0)

Function to calculate the Maclaurin polynomial of order n = p + q

Parameters:
  • p (int) – degree of the Padé approximant numerator.

  • q (int) – degree of the Padé approximant denominator.

  • var (sympy.core.symbol.Symbol) – function variable.

  • obj (list, sympy.core.mul.Mul, or sympy bulti-in function) – The obj can be a list of real number, a user defined function, or sympy bulti-in function like sin, cos, log, and exp.

  • float_precision (int) – floating point precision. Default value 0 for infinite (algebric) precicion.

Returns:

Maclaurin polynomial of order n = p + q.

Return type:

sympy.core.add.Add

maclaurin.rational_number(a, b)

Function to set rational number.

Parameters:
  • a (int) – numerator.

  • b (int) – denominator.

Returns:

a rational number.

Return type:

sympy.core.numbers.Rational