ModelExpression

Symbolica documentation for getting started, symbolic expressions, numerical evaluation, pattern matching, and APIs in Python and Rust.

ModelExpression

class ModelExpression

A named symbolic expression awaiting numerical model evaluation.

These records describe internal parameters or couplings passed to a custom Model.recompute_with callback.

Examples

from symbolica import S, E
from symbolica.community import hepkit as hep
model = hep.Model.phi4()
process = model.process(["phi", "phi"], ["phi", "phi"])
requests = []
def evaluate(request):
    requests.append(request)
    return hep.EvaluatedValues(
        couplings={"SCALAR_COUPLING": (0.0, -1.0)},
    )
updated_model = model.recompute_with(evaluate)
request = requests[0]
item = request.couplings[0]
formula = item.expression
name = item.name

Attributes

Name Description
expression Return the symbolic expression text.
name Return the name assigned to the expression.

expression

ModelExpression.expression: Expression

Return the symbolic expression text.

Examples

Using the setup in the ModelExpression class example:

formula = item.expression

name

ModelExpression.name: builtins.str

Return the name assigned to the expression.

Examples

Using the setup in the ModelExpression class example:

formulas = {item.name: item.expression for item in request.couplings}