profiles.density.PseudoIsothermalDensityProfile.substitute_expression#
- PseudoIsothermalDensityProfile.substitute_expression(expression: Any) Any #
Replace symbolic parameters with numerical values in an expression.
This method takes a symbolic expression that may include parameter symbols and substitutes them with the numerical values assigned at instantiation.
- Parameters:
expression (
str
orExpr
) – The symbolic expression to substitute parameter values into.- Returns:
The expression with parameters replaced by their numeric values.
- Return type:
Notes
Only parameters defined in
self.__parameters__
are substituted.If an expression does not contain any parameters, it remains unchanged.
This method is useful for obtaining instance-specific symbolic representations.
Example
from sympy import Symbol expr = Symbol("a") * Symbol("x") coords = MyCoordinateSystem(a=3) print(coords.substitute_expression(expr)) 3 * x