pycollocation package

Submodules

pycollocation.boundary_value_problems module

Classes for constructing two-point boundary value problems.

@author : davidrpugh

class pycollocation.boundary_value_problems.BoundaryValueProblem[source]

Bases: object

Attributes

boundary_conditions Boundary conditions for the problem.
boundary_conditions[source]

Boundary conditions for the problem.

Getter:Return the boundary conditions for the problem.
Setter:Set new boundary conditions for the problem.
Type:dict
class pycollocation.boundary_value_problems.SymbolicBoundaryValueProblem(boundary_conditions, dependent_vars, independent_var, rhs, params)[source]

Bases: pycollocation.boundary_value_problems.BoundaryValueProblem, pycollocation.symbolics.SymbolicBoundaryValueProblemLike, pycollocation.differential_equations.SymbolicDifferentialEquation

Class for representing two-point boundary value problems.

Attributes

boundary_conditions Boundary conditions for the problem.
dependent_vars Model dependent variables.
independent_var Symbolic variable representing the independent variable.
params Dictionary of model parameters.
rhs Symbolic representation of the right-hand side of a system of differential/difference equations.

pycollocation.differential_equations module

Classes for constructing systems of ordinary differential equations.

@author : davidrpugh

class pycollocation.differential_equations.DifferentialEquation(dependent_vars, independent_var, rhs, params)[source]

Bases: pycollocation.models.ModelLike

Attributes

dependent_vars Model dependent variables.
independent_var Symbolic variable representing the independent variable.
params Dictionary of model parameters.
rhs Symbolic representation of the right-hand side of a system of differential/difference equations.
class pycollocation.differential_equations.SymbolicDifferentialEquation(dependent_vars, independent_var, rhs, params)[source]

Bases: pycollocation.differential_equations.DifferentialEquation, pycollocation.symbolics.SymbolicModelLike

Attributes

dependent_vars Model dependent variables.
independent_var Symbolic variable representing the independent variable.
params Dictionary of model parameters.
rhs Symbolic representation of the right-hand side of a system of differential/difference equations.

pycollocation.models module

class pycollocation.models.ModelLike[source]

Bases: object

Attributes

dependent_vars Model dependent variables.
independent_var Symbolic variable representing the independent variable.
params Dictionary of model parameters.
rhs Symbolic representation of the right-hand side of a system of differential/difference equations.
dependent_vars[source]

Model dependent variables.

Getter:Return the model dependent variables.
Type:list
independent_var[source]

Symbolic variable representing the independent variable.

Getter:Return the symbol representing the independent variable.
Type:sympy.Symbol
params[source]

Dictionary of model parameters.

Getter:Return the current parameter dictionary.
Setter:Set a new parameter dictionary.
Type:dict
rhs[source]

Symbolic representation of the right-hand side of a system of differential/difference equations.

Getter:Return the right-hand side of the system of equations.
Type:dict

pycollocation.orthogonal_polynomials module

Classes for solving models using collocation with orthogonal polynomials as the underlying basis functions.

@author: davidrpugh

class pycollocation.orthogonal_polynomials.OrthogonalPolynomialBasis[source]

Bases: object

Class for constucting orthogonal polynomial basis functions.

Attributes

degrees Degrees used when constructing the orthogonal polynomials.
domain Domain over which the approximated solution is valid.
kind Kind of polynomials to use when constructing the approximation.
degrees[source]

Degrees used when constructing the orthogonal polynomials.

Getter:Return the degrees attribute.
Type:dict
domain[source]

Domain over which the approximated solution is valid.

Getter:Return the domain attribute.
Type:list
kind[source]

Kind of polynomials to use when constructing the approximation.

Getter:Return the kind of orthogonal polynomials.
Type:string
class pycollocation.orthogonal_polynomials.OrthogonalPolynomialSolver(model)[source]

Bases: pycollocation.orthogonal_polynomials.OrthogonalPolynomialBasis, pycollocation.solvers.Solver

Attributes

coefficients Coefficients to use when constructing the approximating polynomials.
degrees Degrees used when constructing the orthogonal polynomials.
derivatives Derivatives of the approximating basis functions.
domain Domain over which the approximated solution is valid.
functions The basis functions used to approximate the solution to the model.
kind Kind of polynomials to use when constructing the approximation.
model Symbolic representation of the model to solve.
residual_functions Residual functions
result Result object

Methods

solve(kind, coefs_dict, domain[, method]) Solve a boundary value problem using orthogonal collocation.
solve(kind, coefs_dict, domain, method='hybr', **kwargs)[source]

Solve a boundary value problem using orthogonal collocation.

pycollocation.solvers module

class pycollocation.solvers.Solver(model)[source]

Bases: object

Base class for all Solvers.

Attributes

coefficients Coefficients to use when constructing the approximating polynomials.
derivatives Derivatives of the approximating basis functions.
functions The basis functions used to approximate the solution to the model.
model Symbolic representation of the model to solve.
residual_functions Residual functions
result Result object
coefficients[source]

Coefficients to use when constructing the approximating polynomials.

Getter:Return the coefficients attribute.
Type:dict
derivatives[source]

Derivatives of the approximating basis functions.

Getter:Return the derivatives attribute.
Type:dict
functions[source]

The basis functions used to approximate the solution to the model.

Getter:Return the functions attribute.
Type:dict
model[source]

Symbolic representation of the model to solve.

Getter:Return the current model.
Setter:Set a new model to solve.
Type:models.Model
residual_functions[source]

Residual functions

Getter:Return the current residual functions.
result[source]

Result object

Getter:Return the current result object.
Type:optimize.Result

pycollocation.symbolics module

Classes for constructing symbolic models.

@author : davidrpugh

class pycollocation.symbolics.SymbolicBase[source]

Bases: object

class pycollocation.symbolics.SymbolicBoundaryValueProblemLike[source]

Bases: pycollocation.symbolics.SymbolicModelLike

class pycollocation.symbolics.SymbolicModelLike[source]

Bases: pycollocation.symbolics.SymbolicBase

pycollocation.version module

pycollocation.visualizers module

Base class for all Visualizer objects.

class pycollocation.visualizers.Visualizer(solver)[source]

Bases: object

Base class for all Visualizer objects.

Attributes

interpolation_knots Interpolation knots to use when computing the solution.
normalized_residuals Absolute values of the solution residuals normalized by the value of the solution.
residuals Solution residuals.
result An instance of the optimize.optimize.OptimizeResult class that stores the raw output of a solvers.Solver object.
solution Solution to the model represented as a Pandas DataFrame.
interpolation_knots[source]

Interpolation knots to use when computing the solution.

Getter:Return the array of interpolation knots.
Setter:Set a new array of interpolation knots.
Type:numpy.ndarray
normalized_residuals[source]

Absolute values of the solution residuals normalized by the value of the solution.

Getter:Return the normalized solution residuals.
Type:pandas.DataFrame
residuals[source]

Solution residuals.

Getter:Return the solution residuals.
Type:pandas.DataFrame
result[source]

An instance of the optimize.optimize.OptimizeResult class that stores the raw output of a solvers.Solver object.

Getter:Return the result attribute.
Type:optimize.optimize.OptimizeResult
solution[source]

Solution to the model represented as a Pandas DataFrame.

Getter:Return the DataFrame representing the current solution.
Type:pandas.DataFrame

Module contents

Objects imported here will live in the pycollocation namespace

class pycollocation.SymbolicBoundaryValueProblem(boundary_conditions, dependent_vars, independent_var, rhs, params)

Bases: pycollocation.boundary_value_problems.BoundaryValueProblem, pycollocation.symbolics.SymbolicBoundaryValueProblemLike, pycollocation.differential_equations.SymbolicDifferentialEquation

Class for representing two-point boundary value problems.

Attributes

boundary_conditions Boundary conditions for the problem.
dependent_vars Model dependent variables.
independent_var Symbolic variable representing the independent variable.
params Dictionary of model parameters.
rhs Symbolic representation of the right-hand side of a system of differential/difference equations.
class pycollocation.OrthogonalPolynomialSolver(model)

Bases: pycollocation.orthogonal_polynomials.OrthogonalPolynomialBasis, pycollocation.solvers.Solver

Attributes

coefficients Coefficients to use when constructing the approximating polynomials.
degrees Degrees used when constructing the orthogonal polynomials.
derivatives Derivatives of the approximating basis functions.
domain Domain over which the approximated solution is valid.
functions The basis functions used to approximate the solution to the model.
kind Kind of polynomials to use when constructing the approximation.
model Symbolic representation of the model to solve.
residual_functions Residual functions
result Result object

Methods

solve(kind, coefs_dict, domain[, method]) Solve a boundary value problem using orthogonal collocation.
solve(kind, coefs_dict, domain, method='hybr', **kwargs)

Solve a boundary value problem using orthogonal collocation.

class pycollocation.Visualizer(solver)

Bases: object

Base class for all Visualizer objects.

Attributes

interpolation_knots Interpolation knots to use when computing the solution.
normalized_residuals Absolute values of the solution residuals normalized by the value of the solution.
residuals Solution residuals.
result An instance of the optimize.optimize.OptimizeResult class that stores the raw output of a solvers.Solver object.
solution Solution to the model represented as a Pandas DataFrame.
interpolation_knots

Interpolation knots to use when computing the solution.

Getter:Return the array of interpolation knots.
Setter:Set a new array of interpolation knots.
Type:numpy.ndarray
normalized_residuals

Absolute values of the solution residuals normalized by the value of the solution.

Getter:Return the normalized solution residuals.
Type:pandas.DataFrame
residuals

Solution residuals.

Getter:Return the solution residuals.
Type:pandas.DataFrame
result

An instance of the optimize.optimize.OptimizeResult class that stores the raw output of a solvers.Solver object.

Getter:Return the result attribute.
Type:optimize.optimize.OptimizeResult
solution

Solution to the model represented as a Pandas DataFrame.

Getter:Return the DataFrame representing the current solution.
Type:pandas.DataFrame