_ODE

it.grypho.scala.leonardo.ode._ODE
case class _ODE(rhs: _Expression, depVar: _Variable, indepVar: _Variable, t0: _Expression, y0: _Expression, target: _Expression) extends _Functional

Symbolic node for the solution value of a first-order initial-value problem.

Represents y(target) where y satisfies y' = rhs(t, y), y(t0) = y0.

Both depVar (the dependent variable y) and indepVar (the independent variable t) are binders: they are excluded from children so that substitute and dependsOn never recurse into them, matching the convention of scalar._Derivative and scalar._Limit. The expression positions rhs, t0, y0, and target are ordinary children and may hold free variables (e.g. a symbolic target keeps the result closed-form).

Evaluation strategy (two tiers, in order):

  1. Closed-form via solveODESymbolic: handles y' = a*y + b for constant (t-free) a, b; returns a symbolic expression that stays closed-form when t0/y0/target are free.
  2. Numeric RK4 via solveODE: folds t0/y0/target to concrete _Numbers and runs the integrator; returns Right(_Number(result)). When neither applies, eval returns Left(this) — the fixpoint convention shared with the transform nodes and the scalar._Functional hierarchy.

Round-trip: toString emits ode(rhs, depVar, indepVar, t0, y0, target), which re-parses to an equivalent node.

Value parameters

depVar

the dependent variable (the unknown function, e.g. y)

indepVar

the independent variable (what y is differentiated against, e.g. t)

rhs

the right-hand side f(t, y) of the ODE

t0

the initial time point

target

the point at which the solution is evaluated

y0

the initial value y(t0)

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class _Functional
trait _Expression
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

override def children: List[_Expression]

Sub-expressions subject to recursive structural traversal. Binder positions (e.g. the differentiation variable) are excluded.

Sub-expressions subject to recursive structural traversal. Binder positions (e.g. the differentiation variable) are excluded.

Attributes

Definition Classes
override def eval(env: Environment): Either[_Expression, _Value]

Reduces this expression in the given environment.

Reduces this expression in the given environment.

Value parameters

env

variable bindings and display precision

Attributes

Returns

Right(v) when all free variables resolved to concrete values; Left(e) when reduction is partial or impossible

Definition Classes
override def rebuild(c: List[_Expression]): _Expression

Reconstructs the same node shape with replacement sub-expressions.

Reconstructs the same node shape with replacement sub-expressions.

Value parameters

newChildren

replacements in the same order and count as children

Attributes

Definition Classes
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product

Inherited fields

lazy val freeVars: Set[String]

Cached set of free variable names; O(1) after the first access.

Cached set of free variable names; O(1) after the first access.

Attributes

Inherited from:
_Expression