_Taylor

it.grypho.scala.leonardo.scalar._Taylor
case class _Taylor(e: _Expression, v: _Variable, point: _Expression, n: _Expression) extends _Functional

Taylor expansion of e in v about point, truncated after order n: taylor(e, v, point, n).

v is the expansion variable, not a binder: unlike _Derivative's or _Integral's variable it appears free in the result, which is a polynomial in (v - point) — the same role the output variable plays in _Laplace. It is nevertheless kept out of children and carried through rebuild, so substitute cannot rewrite the variable the expansion is taken in.

eval builds the series with taylorSeries and evaluates the result, so a bound v folds the polynomial to a number while a free one leaves it symbolic. It stays symbolic when n does not reduce to an integer in 0 .. MaxTaylorOrder, or when some coefficient cannot be differentiated (Gamma, fact, ... — see hasDerivative).

maclaurin(e, v, n) in the grammar is sugar for taylor(e, v, 0, n) and prints in that form, exactly as log(x) prints as log(x, 10).

Value parameters

e

the expression to expand

n

the truncation order

point

the centre of the expansion

v

the expansion variable

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