sympde.core package¶
Submodules¶
sympde.core.algebra module¶
- class sympde.core.algebra.CrossBasic(*args)[source]¶
Bases:
CalculusFunction- default_assumptions = {}¶
- name = 'Cross'¶
- nargs = Naturals0¶
- class sympde.core.algebra.Cross_2d(*_args)[source]¶
Bases:
CrossBasic- default_assumptions = {}¶
- class sympde.core.algebra.Cross_3d(*_args)[source]¶
Bases:
CrossBasic- default_assumptions = {}¶
- class sympde.core.algebra.DotBasic(*args)[source]¶
Bases:
CalculusFunction- default_assumptions = {}¶
- name = 'Dot'¶
- nargs = Naturals0¶
- class sympde.core.algebra.InnerBasic(*args)[source]¶
Bases:
CalculusFunction- default_assumptions = {}¶
- name = 'Inner'¶
- nargs = Naturals0¶
- class sympde.core.algebra.Inner_2d(*_args)[source]¶
Bases:
InnerBasic- default_assumptions = {}¶
- class sympde.core.algebra.Inner_3d(*_args)[source]¶
Bases:
InnerBasic- default_assumptions = {}¶
sympde.core.basic module¶
- class sympde.core.basic.BasicMapping(label, shape=None, *, offset=0, strides=None, **kw_args)[source]¶
Bases:
IndexedBaseRepresents a basic class for mapping.
- default_assumptions = {'commutative': True}¶
- is_commutative = True¶
sympde.core.utils module¶
- sympde.core.utils.expand_name_patterns(names, *, seq=None)[source]¶
Expand names according to the given pattern or list of patterns, following exactly the same rules of Sympy’s “symbols” function.
Parameters¶
- names: str or iterable
Variable name, or name pattern, or list of name patterns, or list of [list of …] name patterns.
- seq: bool
Set to True if an iterable container is needed for a single name.
Results¶
- res: str or iterable
Single name string, or list of [list of …] name strings (having the same type as the input parameter ‘names’).
See also¶
https://docs.sympy.org/latest/modules/core.html#sympy.core.symbol.symbols
Notes¶
This code is extracted from Sympy’s “symbols” function, but it only generates variables’ names without creating new objects, which can be instantiated at a later stage. This creates a very clear logical separation between 1) names’ generation, and 2) objects’ instantiation, plus it allows one to reuse the same name expansion rules in different locations of the library, for generating different objects. Further, since separate functions take on conceptually different tasks, it is much easier to test them individually.
This approach would also be beneficial to Sympy’s “symbols”, as it would allow for other Python libraries based on Sympy (like SymPDE) to be compliant with Sympy’s name expansion rules without duplicating its code. Hence, in the future we would like to propose the integration of this function into Sympy.