Welcome to pyCollocation’s documentation!¶
Contents:
License¶
The MIT License (MIT)
Copyright (c) 2015 David R. Pugh
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
pycollocation¶
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.
- 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
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
- 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.
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
pycollocation.symbolics module¶
Classes for constructing symbolic models.
@author : davidrpugh
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
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