_Complex

it.grypho.scala.leonardo.core._Complex
See the_Complex companion object
case class _Complex extends _Value

Concrete complex value re + im·i where im ≠ 0.

The imaginary part is never exactly 0 — the _Complex.of factory guarantees this invariant by collapsing to _Number in that case. Construction through of is the only public route; pattern matching _Complex(re, im) remains available.

Like _Number, a _Complex never rounds in eval; rounding is a display concern handled by toString / display(p). A rounded-away imaginary part causes the value to print as a plain real (e.g. exp(i·π)"-1.0"); a pure imaginary value prints as "bi" / "i" / "-i"; the full form is "(a + bi)".

Value parameters

im

imaginary part; guaranteed non-zero by the _Complex.of factory

re

real part

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait _Value
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
def display(precision: Int): String

Renders this complex number at precision decimal places for REPL display.

Renders this complex number at precision decimal places for REPL display.

Value parameters

precision

number of decimal places to show

Attributes

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

Returns Right(this) — a concrete complex value needs no further reduction.

Returns Right(this) — a concrete complex value needs no further reduction.

Attributes

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

Renders this complex number at Environment.DefaultPrecision decimal places. A rounded-away imaginary part yields a plain real string; a zero real part yields "bi" / "i" / "-i"; otherwise "(a ± bi)".

Renders this complex number at Environment.DefaultPrecision decimal places. A rounded-away imaginary part yields a plain real string; a zero real part yields "bi" / "i" / "-i"; otherwise "(a ± bi)".

Attributes

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