eqiora.lang
Author Eqiora Modules, Components, expressions, and equations in Python.
View sourceExample: write equations in Python
Section titled “Example: write equations in Python”import eqiorafrom eqiora import lang as q
source = eqiora.Module("example")component = source.model("Balance")x = component.field("x", value_type=eqiora.ValueType.real(), role=eqiora.FieldRole.Variable)component.relation("balance", q.equation(x, 2))print(source.to_eqi())model = eqiora.compile(source=source)to_eqi() prints the generated source: a model with the relation x = 2.
Compiling the Module goes through the same compiler as a handwritten .eqi
file. Add every declaration before calling to_eqi() or compile. See
modeling for parameters, components, imports, and spatial
equations.
matrix_trace
Section titled “matrix_trace”Algebraic trace of a finite endomorphism or spatial tensor.
def matrix_trace(value: object) -> Expression: ...determinant
Section titled “determinant”Determinant of a real finite endomorphism.
def determinant(value: object) -> Expression: ...inverse
Section titled “inverse”Inverse of a finite map; execution fails if the map is singular or cannot be inverted reliably.
def inverse(value: object) -> Expression: ...transpose
Section titled “transpose”Transpose (algebraic dual), without complex conjugation.
def transpose(value: object) -> Expression: ...adjoint
Section titled “adjoint”Conjugate transpose in the declared orthonormal finite bases.
def adjoint(value: object) -> Expression: ...Apply a map to coordinates in its input basis.
def apply(left: object, right: object) -> Expression: ...compose
Section titled “compose”Compose two maps, left after right. The output space of right must be the input space of left.
def compose(left: object, right: object) -> Expression: ...Bilinearly pair dual and primal coordinates in the same basis.
def pair(left: object, right: object) -> Expression: ...tensor_product
Section titled “tensor_product”Ordered product of two atomic coordinate values or maps.
def tensor_product(left: object, right: object) -> Expression: ...permute_factors
Section titled “permute_factors”Swap the two factors of a tensor product; for a map, both endpoints are permuted.
def permute_factors(value: object, permutation: Sequence[int]) -> Expression: ...Observable
Section titled “Observable”Reference to an observable declared in a Component.
@finalclass Observable(Expression): def __init__(self, _token: Never, _component: object=..., _name: str='') -> None: ...variation
Section titled “variation”Directional variation of an energy functional with respect to selected bindings, holding others fixed.
def variation(value: Observable | Expression, *, wrt: Expression, direction: Expression, holding: Sequence[Expression]=()) -> Expression: ...contract
Section titled “contract”Contract explicitly paired tensor axes.
def contract(left: object, right: object, *, axes: Sequence[tuple[int, int]]) -> Expression: ...Right-handed cross product of Cartesian 3-vectors, without complex conjugation.
def cross(left: object, right: object) -> Expression: ...Cartesian curl: 3D vector, 2D vector-to-scalar, or 2D scalar-to-vector.
def curl(value: object) -> Expression: ...tangential_trace
Section titled “tangential_trace”Tangential trace n × value on the parent boundary; a scalar in 2D.
def tangential_trace(value: object, *, on: Support | None=None, from_: Support | None=None) -> Expression: ...Inequality
Section titled “Inequality”A non-strict mathematical condition with lhs greater than or equal to rhs.
@finalclass Inequality: def __init__(self, token: Never, lhs: Expression, rhs: Expression) -> None: ... @property def lhs(self) -> Expression: ... @property def rhs(self) -> Expression: ... def __bool__(self) -> bool: ...Complementarity
Section titled “Complementarity”Complementarity condition: two nonnegative operands, at least one of which is zero.
@finalclass Complementarity: def __init__(self, token: Never, lhs: Expression, rhs: Expression) -> None: ... @property def lhs(self) -> Expression: ... @property def rhs(self) -> Expression: ... def __bool__(self) -> bool: ...inequality
Section titled “inequality”Require lhs >= rhs; how it is enforced numerically is chosen separately.
def inequality(lhs: object, rhs: object) -> Inequality: ...complementarity
Section titled “complementarity”Require two operands to be nonnegative with at least one of them zero.
def complementarity(left: Expression, right: Expression) -> Complementarity: ...Equality comparison expression.
def equal(left: object, right: object) -> Expression: ...not_equal
Section titled “not_equal”Inequality comparison expression.
def not_equal(left: object, right: object) -> Expression: ...Less-than comparison expression.
def less(left: object, right: object) -> Expression: ...less_equal
Section titled “less_equal”Less-than-or-equal comparison expression.
def less_equal(left: object, right: object) -> Expression: ...greater
Section titled “greater”Greater-than comparison expression.
def greater(left: object, right: object) -> Expression: ...greater_equal
Section titled “greater_equal”Greater-than-or-equal comparison expression.
def greater_equal(left: object, right: object) -> Expression: ...logical_not
Section titled “logical_not”Logical NOT expression.
def logical_not(value: object) -> Expression: ...logical_and
Section titled “logical_and”Logical AND expression.
def logical_and(left: object, right: object) -> Expression: ...logical_or
Section titled “logical_or”Logical OR expression.
def logical_or(left: object, right: object) -> Expression: ...A periodic clock declared in a Component; equal periods do not make two clocks the same.
@finalclass Clock: ...Component
Section titled “Component”Author a public Component and bind an instance of it.
@finalclass Component: def set_notation(self, name: str, notation: Notation) -> None: ... def counts(self, space: FiniteSpace, components: Sequence[Expression | int]) -> Expression: ... def coordinates(self, space: FiniteSpace, components: Sequence[Expression | int | float | complex], *, dual: bool=False) -> Expression: ... def identity(self, space: FiniteSpace, *, dual: bool=False) -> Expression: ... def linear_map(self, source: FiniteSpace, target: FiniteSpace, rows: Sequence[Sequence[object]], *, source_dual: bool=False, target_dual: bool=False) -> Expression: ... def index(self, set: IndexSet, value: Expression | int) -> Expression: ... def sum(self, body: Callable[[Expression], object], *, over: IndexSet, name: str='i') -> Expression: ... def product(self, body: Callable[[Expression], object], *, over: IndexSet, name: str='i') -> Expression: ... def min(self, body: Callable[[Expression], object], *, over: IndexSet, name: str='i') -> Expression: ... def max(self, body: Callable[[Expression], object], *, over: IndexSet, name: str='i') -> Expression: ... def index_set(self, name: str, *, extent: int, doc: str | None=None) -> IndexSet: ... def event(self, name: str, guard: Expression | int | float, *, direction: Literal['any', 'rising', 'falling'], priority: int=0, doc: str | None=None) -> Event: ... def clock(self, name: str, *, period_s: Fraction | int, phase_s: Fraction | int=0, doc: str | None=None) -> Clock: ... def initial(self, *equations: tuple[object, object], left: object=None, right: object=None, doc: str | None=None) -> None: ... def volume(self, name: str, *, dimensions: int, doc: str | None=None) -> Support: ... def boundary(self, name: str, *, parent: Support, doc: str | None=None) -> Support: ... def complete_exterior(self, name: str, *, parent: Support, doc: str | None=None) -> BoundarySet: ... def boundaries(self, *members: Support) -> BoundarySelectionSet: ... @overload def parameter(self, name: str, *, value_type: Record | ImportedRecord, doc: str | None=None) -> RecordParameter: ... @overload def parameter(self, name: str, *, value_type: ValueType, doc: str | None=None) -> Expression: ... def coordinate(self, name: str, *, value_type: ValueType, on: Support, factor: Support, axis: int | None=..., doc: str | None=...) -> Expression: ... def let_alias(self, name: str, expression: Expression | int | float | complex, *, value_type: ValueType | None=None, on: Support | None=None, at: Clock | Event | None=None, doc: str | None=None) -> Expression: ... def property(self, name: str, *, contract: PropertyContract, doc: str | None=None) -> PropertyRequirement: ... @overload def field(self, name: str, *, on: Support | None=None, value_type: Record | ImportedRecord, role: FieldRole, at: Clock | None=None, spatial_regularity: SpatialRegularity=SpatialRegularity.Unspecified, doc: str | None=None) -> RecordField: ... @overload def field(self, name: str, *, on: Support | None=None, value_type: ValueType, role: FieldRole, at: Clock | None=None, spatial_regularity: SpatialRegularity=SpatialRegularity.Unspecified, doc: str | None=None) -> Expression: ... def observable(self, name: str, expression: Expression | int | float | complex, *, value_type: ValueType, on: Support | None=None, integrate_over: Support | None=None, doc: str | None=None) -> Observable: ... def relation(self, name: str, condition: Equation | Inequality | Complementarity, *additional_conditions: Equation | Inequality | Complementarity, on: Support | None=None, at: Clock | Event | None=None, doc: str | None=None) -> Relation: ... def law(self, name: str, *, on: Support, flux: Expression, source: Expression, storage: Expression | None=None, doc: str | None=None) -> Relation: ... def test(self, name: str, *, for_: Expression, dimension: Dimension | None=None, regularity: str | None=None, zero_on: Support | BoundarySelectionSet | None=None) -> Expression: ... def weak_form(self, name: str, relations: Sequence[Relation], *, equations: Sequence[tuple[object, object]], doc: str | None=None) -> None: ... def harmonic_form(self, name: str, relations: Sequence[Relation], *, angular_frequency: object, convention: str, normalization: str, excitations: Sequence[tuple[Expression, object]], amplitudes: Sequence[tuple[str, Expression, ValueType]], doc: str | None=None) -> None: ... def port(self, name: str, *, connector: Connector, on: Support | None=None, doc: str | None=None) -> Port | FieldPort: ... def connect(self, *ports: Port, over: BoundaryMember | None=None, doc: str | None=None) -> None: ... def connect_periodic(self, first: FieldPort, second: FieldPort, *, doc: str | None=None) -> None: ... def instance(self, name: str, *, component: Component | ComponentRef, bindings: Mapping[str, object], doc: str | None=None) -> Mapping[str, Expression | Port]: ... def clock_requirement(self, name: str, *, doc: str | None=None) -> Clock: ... def field_requirement(self, name: str, *, value_type: ValueType, role: FieldRole, on: Support | None=None, at: Clock | None=None, spatial_regularity: SpatialRegularity=SpatialRegularity.Unspecified, doc: str | None=None) -> Expression: ... def set_default(self, parameter: Expression, value: Expression | int | float | complex) -> None: ... def input(self, name: str, *, value_type: ValueType, on: Support | None=None, at: Clock | None=None, spatial_regularity: SpatialRegularity=SpatialRegularity.Unspecified, doc: str | None=None) -> Expression: ... def output(self, name: str, *, value_type: ValueType, on: Support | None=None, at: Clock | None=None, spatial_regularity: SpatialRegularity=SpatialRegularity.Unspecified, doc: str | None=None) -> Expression: ...Connector
Section titled “Connector”Scalar physical connector with across and through quantities, declared in one Module.
class Connector: def __init__(self, token: Never, owner: object, name: str, across: tuple[str, object], through: tuple[str, object], doc: tuple[str, ...]) -> None: ...BoundarySet
Section titled “BoundarySet”Requirement for the complete exterior boundary of a declared parent volume.
@finalclass BoundarySet(Support): def __init__(self, token: Never, component: Component, name: str, parent: Support) -> None: ... def member(self, name: str) -> BoundaryMember: ...BoundaryMember
Section titled “BoundaryMember”One named part of a complete exterior boundary.
@finalclass BoundaryMember(Support): def __init__(self, token: Never, boundary_set: BoundarySet, name: str) -> None: ...BoundarySelectionSet
Section titled “BoundarySelectionSet”An explicit finite set of boundaries with the same parent volume.
@finalclass BoundarySelectionSet: def __init__(self, token: Never, component: Component, parent: Support, members: Sequence[Support]) -> None: ...FieldConnector
Section titled “FieldConnector”Field connector pairing a trace and a flux of declared shape and frame.
class FieldConnector(Connector): def __init__(self, token: Never, owner: object, name: str, trace: tuple[str, object], flux: tuple[str, object], spatial_vector: bool, doc: tuple[str, ...]) -> None: ...FieldPort
Section titled “FieldPort”A field port on a boundary, or a finite family of such ports.
@finalclass FieldPort(Port): def __init__(self, token: Never, component: Component, name: str, connector: FieldConnector, support: Support, family: tuple[str, BoundarySet | BoundarySelectionSet] | None=None, selector: Support | None=None) -> None: ... def __getitem__(self, boundary: Support) -> FieldPort: ...Physical port whose declared quantities are available as attributes.
Use member(name) when a quantity name clashes with a Python attribute.
class Port: def __init__(self, token: Never, owner: object, name: str, connector: Connector) -> None: ... def __getattr__(self, name: str) -> Expression: ... def member(self, name: str) -> Expression: ...ComponentRef
Section titled “ComponentRef”Reference to a public Component of an imported module.
@finalclass ComponentRef: def __init__(self, token: Never, imported: ModuleRef, name: str, signature: Sequence[object], ports: Sequence[object], supports: Sequence[object]) -> None: ... @property def name(self) -> str: ...Equation
Section titled “Equation”An equation with ordered left and right sides; it has no Python truth value.
@finalclass Equation: def __init__(self, token: Never, lhs: Expression, rhs: Expression) -> None: ... @property def lhs(self) -> Expression: ... @property def rhs(self) -> Expression: ... def __bool__(self) -> bool: ...equation
Section titled “equation”Build an equation from two expressions or literals.
def equation(lhs: object, rhs: object) -> Equation: ...Expression
Section titled “Expression”A closed Eqiora expression. Python == does not build an equation; use equation.
class Expression: def __add__(self, other: Expression | float | int | complex, /) -> Expression: ... def __radd__(self, other: float | int, /) -> Expression: ... def __sub__(self, other: Expression | float | int | complex, /) -> Expression: ... def __rsub__(self, other: float | int, /) -> Expression: ... def __mul__(self, other: Expression | float | int | complex, /) -> Expression: ... def __rmul__(self, other: float | int, /) -> Expression: ... def __truediv__(self, other: Expression | float | int | complex, /) -> Expression: ... def __rtruediv__(self, other: float | int, /) -> Expression: ... def __pow__(self, exponent: int, /) -> Expression: ... def __bool__(self) -> bool: ... def __eq__(self, other: object) -> bool: ... def __ne__(self, other: object) -> bool: ... def __lt__(self, other: object) -> bool: ... def __le__(self, other: object) -> bool: ... def __gt__(self, other: object) -> bool: ... def __ge__(self, other: object) -> bool: ... def __neg__(self) -> Expression: ... def __getitem__(self, index: int | Expression | slice) -> Expression: ...Enum declared in a Module.
@finalclass Enum: @property def name(self) -> str: ... @property def members(self) -> tuple[str, ...]: ... @property def value_type(self) -> ValueType: ... def member(self, name: str) -> Expression: ...Record
Section titled “Record”A record type with ordered, typed fields, declared in one Module.
class Record: def __init__(self, token: Never=..., *, source: Module | None=None, name: str='', syntax_name: str | None=None, members: Sequence[tuple[str, ValueType]]=(), syntax: Sequence[object]=(), doc: tuple[str, ...]=()) -> None: ... @property def name(self) -> str: ... @property def members(self) -> Mapping[str, ValueType]: ... def __call__(self, /, **members: object) -> Expression: ...ImportedRecord
Section titled “ImportedRecord”Read-only description of a public Record from an import.
@finalclass ImportedRecord: @property def name(self) -> str: ... @property def members(self) -> Mapping[str, str]: ... def __call__(self, /, **members: object) -> Expression: ...RecordField
Section titled “RecordField”Handle to a Field of record type; every member shares the Field’s role and clock.
@finalclass RecordField(Expression): def __init__(self, component: Component, name: str, record: Record) -> None: ... def member(self, name: str) -> Expression: ...RecordParameter
Section titled “RecordParameter”Handle to a Parameter of record type; its members are ordinary typed expressions.
@finalclass RecordParameter(Expression): def __init__(self, component: Component, name: str, record: Record) -> None: ... def member(self, name: str) -> Expression: ...A crossing event declared in a Component.
@finalclass Event: ...MaterialComposition
Section titled “MaterialComposition”An immutable typed material composition declared in a Module.
@finalclass MaterialComposition: def __getitem__(self, name: str) -> PropertyRelease: ...Notation
Section titled “Notation”Validated notation for a declaration, given as one complete @{...} block.
@finalclass Notation: def __new__(cls, island: str) -> Notation: ... @property def canonical(self) -> str: ... def __str__(self) -> str: ...Operator
Section titled “Operator”Operator declared in a Module. Call it with named arguments.
class Operator: def __call__(self, /, **arguments: object) -> Expression: ...PropertyContract
Section titled “PropertyContract”A typed property contract declared in a Module.
class PropertyContract: def input(self, name: str) -> Expression: ...PropertyRequirement
Section titled “PropertyRequirement”A property requirement, applied by passing its inputs by name.
@finalclass PropertyRequirement(Expression): def __init__(self, _token: Never, component: object, name: str, contract: PropertyContract) -> None: ... def __call__(self, /, **arguments: object) -> Expression: ...PropertyRelease
Section titled “PropertyRelease”A constant scalar property release declared in a Module.
class PropertyRelease: ...Relation
Section titled “Relation”A relation declared in a Module.
@finalclass Relation: ...Module
Section titled “Module”An Eqiora module built in Python; it becomes immutable once emitted or compiled.
@finalclass Module: def dimension(self, name: str, value: Dimension, *, doc: str | None=None) -> Dimension: ... def set_notation(self, name: str, notation: Notation) -> None: ... def connector(self, name: str, *, across: tuple[str, ValueType], through: tuple[str, ValueType], doc: str | None=None) -> Connector: ... def field_connector(self, name: str, *, trace: tuple[str, ValueType], flux: tuple[str, ValueType], spatial_vector: bool=False, doc: str | None=None) -> FieldConnector: ... def operator(self, name: str, *, inputs: Mapping[str, ValueType], result_type: ValueType, body: Callable[..., object], doc: str | None=None) -> Operator: ... def record(self, name: str, *, members: Mapping[str, ValueType], doc: str | None=None) -> Record: ... def enum(self, name: str, *, members: Sequence[str], doc: str | None=None) -> Enum: ... def space(self, name: str, *, labels: Sequence[str] | None=None, factors: Sequence[FiniteSpace] | None=None, doc: str | None=None) -> FiniteSpace: ... def __init__(self, name: str, *declarations: _ModelDeclaration, package: str='eqiora.local_project') -> None: ... @classmethod def parse(cls, name: str, source: str, *, package: str='eqiora.local_project') -> Module: ... def import_module(self, alias: str, module: Module | None=None, *, path: str | PathLike[str] | None=None) -> ModuleRef: ... def component(self, name: str, *, doc: str | None=None) -> Component: ... def model(self, name: str, *, doc: str | None=None) -> Component: ... def property_contract(self, name: str, *, value_type: ValueType, inputs: Mapping[str, ValueType] | None=None, derivatives: Literal['value_only', 'first_partials', 'first_open_intervals']='value_only', branch: str | None=None, doc: str | None=None) -> PropertyContract: ... def property_table_release(self, name: str, *, implements: PropertyContract, data: str, axis_unit: Unit, source_unit: Unit, validity: tuple[object, object], citation: str, license: str, branch: str='single', doc: str | None=None) -> PropertyRelease: ... def property_release(self, name: str, *, implements: PropertyContract, value: Expression | int | float | complex | Sequence[object], source_unit: Unit, source_scale: int | float, citation: str, license: str, validity: Expression | bool | None=None, branch: str | None=None, outside: Literal['reject']='reject', doc: str | None=None) -> PropertyRelease: ... def material_composition(self, name: str, *, properties: Mapping[str, PropertyRelease], doc: str | None=None) -> MaterialComposition: ... def to_eqi(self) -> str: ... def write_eqi(self, path: str | PathLike[str]) -> None: ...ModuleError
Section titled “ModuleError”Raised when a Module draft is structurally invalid.
@finalclass ModuleError(ValueError): ...ModuleRef
Section titled “ModuleRef”An explicit module import; its Components are available as references.
@finalclass ModuleRef: def __init__(self, token: Never, owner: object, alias: str, target: Module) -> None: ... def property_contract(self, name: str) -> PropertyContract: ... def property_release(self, name: str) -> PropertyRelease: ... def dimension(self, name: str) -> Dimension: ... def record(self, name: str) -> ImportedRecord: ... def enum(self, name: str) -> Enum: ... def space(self, name: str) -> FiniteSpace: ... def component(self, name: str) -> ComponentRef: ... def operator(self, name: str) -> Operator: ... def connector(self, name: str) -> Connector | FieldConnector: ...Support
Section titled “Support”A volume or boundary support declared in a Module.
class Support: ...Construct an array with ordered channel components.
def array(values: Sequence[object]) -> Expression: ...Ordered enum cases; the compiler checks that every member is covered and branch types agree.
def case(value: object, arms: Sequence[tuple[Expression, object]]) -> Expression: ...coordinate
Section titled “coordinate”Spatial coordinate along axis.
def coordinate(axis: int) -> Expression: ...Return the bilinear dot product without complex conjugation.
def dot(left: Expression | float | int | complex, right: Expression | float | int | complex) -> Expression: ...Return the inner product, conjugating the first argument.
def inner(left: Expression | float | int | complex, right: Expression | float | int | complex) -> Expression: ...Divergence of an expression.
def div(value: Expression) -> Expression: ...Gradient of an expression.
def grad(value: Expression) -> Expression: ...integrate
Section titled “integrate”Integral over a volume or boundary Support declared in the Module.
def integrate(domain: Support, integrand: Expression | float | int | complex) -> Expression: ...if_else
Section titled “if_else”Conditional expression; both branches are type-checked and one is evaluated.
def if_else(condition: object, then_value: object, else_value: object) -> Expression: ...isotropic_lift
Section titled “isotropic_lift”Isotropic tensor lift of a scalar expression (the scalar times the identity).
def isotropic_lift(value: Expression) -> Expression: ...Mathematical constants for use in expressions.
math: _Mathnormal
Section titled “normal”Contraction of an expression with the outward boundary normal.
def normal(value: object, *, on: Support | None=None, from_: Support | None=None) -> Expression: ...ordinal
Section titled “ordinal”Integer ordinal of an index.
def ordinal(value: Expression) -> Expression: ...partial
Section titled “partial”Differentiate a real scalar polynomial with respect to one independent binding.
holding lists other independent bindings that are held fixed; the
compiler checks that they are distinct and that dimensions agree.
def partial(value: object, *, wrt: Expression, holding: Sequence[Expression]=()) -> Expression: ...evaluate
Section titled “evaluate”Build a point-evaluation expression with a dimensioned value for every support coordinate.
def evaluate(value: object, *, at: Sequence[tuple[Expression, object]], side: Literal['lower', 'upper'] | None=None) -> Expression: ...pullback
Section titled “pullback”Pull back a scalar through an explicit map between coordinate supports.
def pullback(value: object, *, from_: Sequence[Expression], at: Sequence[tuple[Expression, object]]) -> Expression: ...jacobian_determinant
Section titled “jacobian_determinant”Signed local Jacobian determinant of a coordinate map; it may be zero where the map is singular.
def jacobian_determinant(*, from_: Sequence[Expression], at: Sequence[tuple[Expression, object]]) -> Expression: ...volume_jacobian
Section titled “volume_jacobian”Absolute Jacobian determinant of an invertible volume map.
def volume_jacobian(*, from_: Sequence[Expression], at: Sequence[tuple[Expression, object]]) -> Expression: ...map_orientation
Section titled “map_orientation”Dimensionless local orientation (±1) of an invertible map.
def map_orientation(*, from_: Sequence[Expression], at: Sequence[tuple[Expression, object]]) -> Expression: ...Jacobian-vector product of a scalar along ordered input directions, each in its input’s units.
def jvp(value: object, *, wrt: Sequence[Expression], tangent: Sequence[object]) -> Expression: ...Vector-Jacobian product: pull a scalar output cotangent back to one input.
def vjp(value: object, *, wrt: Expression, cotangent: object) -> Expression: ...derivative
Section titled “derivative”Time derivative of a continuous State; the compiler checks the role and activation.
def derivative(value: Expression) -> Expression: ...Continuous time in seconds.
def time() -> Expression: ...Value of a State before the current tick; the compiler checks the clock and context.
def pre(value: Expression) -> Expression: ...Value of a State after the current tick; the compiler checks the clock and context.
def next(value: Expression) -> Expression: ...quantity
Section titled “quantity”Input quantity with a unit; the compiler converts it to coherent SI.
def quantity(value: int | float | Decimal, unit: Unit) -> Expression: ...quotient
Section titled “quotient”Integer quotient truncated toward zero; overflow and division by zero are errors.
def quotient(left: Expression | int, right: Expression | int) -> Expression: ...remainder
Section titled “remainder”Integer remainder; a nonzero result has the sign of the dividend.
def remainder(left: Expression | int, right: Expression | int) -> Expression: ...to_real
Section titled “to_real”Convert an integer to a real; binary64 rounding can lose precision for large values.
def to_real(value: Expression | int) -> Expression: ...to_integer
Section titled “to_integer”Convert a finite, integral, dimensionless real to a signed 64-bit integer.
def to_integer(value: Expression | float | int) -> Expression: ...frobenius
Section titled “frobenius”Frobenius contraction of two tensor expressions.
def frobenius(left: Expression, right: Expression) -> Expression: ...symmetric_part
Section titled “symmetric_part”Symmetric part of a tensor expression.
def symmetric_part(value: Expression) -> Expression: ...tensor_value
Section titled “tensor_value”Construct a spatially uniform tensor value in an explicit Cartesian frame.
The compiler checks the frame, shape, units, and scalar domain. Use
array for channel axes.
def tensor_value(*, frame: Support, components: Sequence[object] | Expression) -> Expression: ...Trace of an expression on a boundary.
def trace(value: object, *, on: Support | None=None, from_: Support | None=None) -> Expression: ...