Full Documentation at (http://engpy.blueprime.cloud/)
EngPy, Python for Engineers; Python for Engineering, a free and open-source Python library for Engineering computations.
EngPy is targeted at handling most engineering problems like calculus, transforms, graphs, complex algebraic expressions, Matrices manipulation, vector analysis, analyzing signals.
The library consists of three major datatypes:
This is the core datatype of EngPy. Most other parts of the library are based on this class. It is responsible for any algebraic manipulations.
- Simple Algebra: Addition, Subtraction, Multiplication, Division Substitution of Expressions; change of subject of formula, clear brackets, and fractions.
- Calculus: linear and partial differentiation, integration, gradient
- Trigonometry
- logarithmic Expressions
- Transforms: Laplace, Z-Transforms
- Visualization: Graphs
- Table of Values
- Complex Number Manipulation
- Solving Expressions
- Support the engpy AI Implementation for manipulating expressions
Expr can be imported from engpy:
>>> from engpy import ExprSee the doc file or Expr's documentation.
To interact with Expr instances as discrete objects, use the engpy.interface module.
The interface module bridges between the Expr class and Expr datatypes.
For example, the expression 2xcos3(2θ) - 7y^2sin(2ω) - ln(sqrt(z +3)); s = y - cos(5z) can be passed directly as a string into the Expr constructor:
>>> from engpy import Expr
>>> w = Expr('2xcos3(2theta) - 7y^2sin(2omega) - ln(sqrt(z +3)); s = y - cos(5z)')
>>> s = w - 'cos(5z)'
>>> w
2xcos3(2θ) - 7y^2sin(2ω) - ln(sqrt(z + 3))
>>> s
2xcos3(2θ) - 7y^2sin(2ω) - ln(sqrt(z + 3)) - cos(5z)OR, in discrete form
>>> from interface import *
>>> o,x,t,y,z = Var('omega', 'x', 'theta','y','z')
>>> w = 2*x*cos(2*t)**3 - 7*y**2*sin(2*o) - ln(sqrt(z + 3))
>>> w
2xcos3(2θ) - 7y^2sin(2ω) - ln(sqrt(z + 3))
>>> s = w - cos(5*z)
>>> s
2xcos3(2θ) - 7y^2sin(2ω) - ln(sqrt(z + 3)) - cos(5z)Note that to cast an Expr object to it's string representation, you can use:
str(expr): will return the expression in its simplest lowest form.format(expr): will return the expression in its normal form.repr(expr): will return the expression in the most readable form.
It's recommended to use format() or repr() as they faster than str(). Only use str() when necessary.
This class handles all matrix operations and manipulations. It rests on the Expr Class.
Supported operations are:
- Simple Matrix Algebra: Addition, Subtraction, Multiplication, Division Substitution of Matrices
- Determinant, Minors, Cofactors, Adjoin, transpose, rank
- Reduction: echelon, canonical, triangular decomposition
- Row and column Transformation operations
- Decomposition: Triangular, Symmetric, hermitian decomposition
- Matrix Geometry: eigenvalues, modal, spectral, nullspace algebraic multiplicity, geometric multiplicity of a Matrix
- Differentiation
- Solving and comparing Matrices
The matrix datatype comes in two implementations; classes Matrix and Matrix_.
Both can be imported from engpy:
>>> from engpy import Matrix
# OR
>>> from engpy import Matrix_See the Matrix_doc file or EngPy Arrays documentation to learn its usage.
This datatype handles vector analysis and operations:
- Simple Vector Algebra: Addition, Subtraction, Substitution, Modulus of Vectors
- Angles between Vectors
- Multiplication of Vector: Dot, and scalar product
- Vector Calculus: Differentiation and Integration
- Vector Operations: Tangents, normals, grad, directional derivatives, div, curl
- Validating properties: solenoidal, irrotational, coplanar, orthogonality
- Scalar, Vector Triple product
Vector Class can also be imported from engpy:
>>> from engpy import VectorNote: All these three datatypes work with python operators: +, -, /, *, ~ e.g MatObj1 + MatObj2.