Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Scalar

Base class to works with scalar quantities.

abstract
namespace

Hierarchy

Implements

Index

Properties

quantity

quantity: "scalar" = "scalar"

Abstract type

type: "constant" | "variable" | "expression"

Static ZERO

ZERO: Constant = Scalar.constant(0)

Methods

Abstract add

  • Adds two Scalars together. If this and that are both constants then numerically adds the two and returns a new Scalar.Constant object otherwise creates an Expression out of them and returns the same.

    Parameters

    • that: Scalar

      The scalar to add this with.

    Returns Scalar

    The result of algebraic addition.

Abstract div

  • Divides this scalar by that. If this and that are both constants then numerically divides the two and returns a new Scalar.Constant object otherwise creates an Expression out of them and returns the same.

    Parameters

    • that: Scalar

      The scalar to divide this by.

    Returns Scalar

    The result of algebraic division.

Abstract mul

  • Multiplies two Scalars together. If this and that are both constants then numerically multiplies the two and returns a new Scalar.Constant object otherwise creates an Expression out of them and returns the same.

    Parameters

    • that: Scalar

      The scalar to multiply this with.

    Returns Scalar

    The result of algebraic multiplication.

Abstract pow

  • Raises this scalar to the power of that. If this and that are both constants then numerically evaluates the exponentiation and returns a new Scalar.Constant object otherwise creates an Expression out of them and returns the same.

    Parameters

    • that: Scalar

      The scalar to divide this by.

    Returns Scalar

    The result of algebraic division.

Abstract sub

  • Subtracts that from this. If this and that are both constants then numerically subtracts one from the other and returns a new Scalar.Constant object otherwise creates an Expression out of them and returns the same.

    Parameters

    • that: Scalar

      The scalar to subtract from this.

    Returns Scalar

    The result of algebraic subtraction.

Static constant

  • Creates a new Scalar.Constant object from a number if it has not been created before. Otherwise just returns the previously created object.

    This is the recommended way of creating Scalar.Constant objects instead of using the constructor.

    Parameters

    • value: number

      The fixed value the Scalar.Constant is supposed to represent.

    Returns Constant

  • Defines a named Scalar.Constant object from a number if it has not been created before. Otherwise just returns the previously created object.

    This is the recommended way of creating named Scalar.Constant objects instead of using the constructor.

    throws

    Throws an error if a Scalar.Constant with the same name has been defined previously.

    Parameters

    • value: number

      The fixed value the Scalar.Constant is supposed to represent.

    • name: string

      The string with which this object is identified.

    Returns Constant

  • Returns a previously declared named Scalar.Constant object.

    Parameters

    • name: string

      The name of the named Scalar.Constant object to be retrieved.

    Returns Constant

Static variable

  • Creates a new Scalar.Variable object if it has not been created before. Otherwise just returns the previously created object.

    Parameters

    • name: string

    Returns Variable

Generated using TypeDoc