Class Variable

java.lang.Object
org.wpilib.math.autodiff.Variable
All Implemented Interfaces:
AutoCloseable

public class Variable extends Object implements AutoCloseable
An autodiff variable pointing to an expression node.
  • Field Details

  • Constructor Details

    • Variable

      public Variable()
      Constructs a linear Variable with a value of zero.
    • Variable

      public Variable(double value)
      Constructs a Variable from a floating point type.
      Parameters:
      value - The value of the Variable.
    • Variable

      public Variable(int value)
      Constructs a Variable from an integral type.
      Parameters:
      value - The value of the Variable.
    • Variable

      public Variable(Variable.Handle handleTypeTag, long handle)
      Constructs a Variable from the given handle.

      This constructor is for internal use only.

      Parameters:
      handleTypeTag - Handle type tag.
      handle - Variable handle.
  • Method Details

    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • setValue

      public void setValue(double value)
      Sets Variable's internal value.
      Parameters:
      value - The value of the Variable.
    • value

      public double value()
      Returns the value of this variable.
      Returns:
      The value of this variable.
    • type

      public ExpressionType type()
      Returns the type of this expression (constant, linear, quadratic, or nonlinear).
      Returns:
      The type of this expression.
    • getHandle

      public long getHandle()
      Returns internal handle.
      Returns:
      Internal handle.
    • times

      public Variable times(Variable rhs)
      Variable-Variable multiplication operator.
      Parameters:
      rhs - Operator right-hand side.
      Returns:
      Result of multiplication.
    • times

      public Variable times(double rhs)
      Variable-Variable multiplication operator.
      Parameters:
      rhs - Operator right-hand side.
      Returns:
      Result of multiplication.
    • div

      public Variable div(Variable rhs)
      Variable-Variable division operator.
      Parameters:
      rhs - Operator right-hand side.
      Returns:
      Result of division.
    • div

      public Variable div(double rhs)
      Variable-Variable division operator.
      Parameters:
      rhs - Operator right-hand side.
      Returns:
      Result of division.
    • plus

      public Variable plus(Variable rhs)
      Variable-Variable addition operator.
      Parameters:
      rhs - Operator right-hand side.
      Returns:
      Result of addition.
    • plus

      public Variable plus(double rhs)
      Variable-Variable addition operator.
      Parameters:
      rhs - Operator right-hand side.
      Returns:
      Result of addition.
    • minus

      public Variable minus(Variable rhs)
      Variable-Variable subtraction operator.
      Parameters:
      rhs - Operator right-hand side.
      Returns:
      Result of subtraction.
    • minus

      public Variable minus(double rhs)
      Variable-Variable subtraction operator.
      Parameters:
      rhs - Operator right-hand side.
      Returns:
      Result of subtraction.
    • unaryMinus

      public Variable unaryMinus()
      Unary minus operator.
      Returns:
      Result of unary minus.
    • unaryPlus

      public Variable unaryPlus()
      Unary plus operator.
      Returns:
      Result of unary plus.
    • abs

      public static Variable abs(Variable x)
      Math.abs() for Variables.
      Parameters:
      x - The argument.
      Returns:
      Result of abs().
    • acos

      public static Variable acos(Variable x)
      Math.acos() for Variables.
      Parameters:
      x - The argument.
      Returns:
      Result of acos().
    • asin

      public static Variable asin(Variable x)
      Math.asin() for Variables.
      Parameters:
      x - The argument.
      Returns:
      Result of asin().
    • atan

      public static Variable atan(Variable x)
      Math.atan() for Variables.
      Parameters:
      x - The argument.
      Returns:
      Result of atan().
    • atan2

      public static Variable atan2(double y, Variable x)
      Math.atan2() for Variables.
      Parameters:
      y - The y argument.
      x - The x argument.
      Returns:
      Result of atan2().
    • atan2

      public static Variable atan2(Variable y, double x)
      Math.atan2() for Variables.
      Parameters:
      y - The y argument.
      x - The x argument.
      Returns:
      Result of atan2().
    • atan2

      public static Variable atan2(Variable y, Variable x)
      Math.atan2() for Variables.
      Parameters:
      y - The y argument.
      x - The x argument.
      Returns:
      Result of atan2().
    • cbrt

      public static Variable cbrt(Variable x)
      Math.cbrt() for Variables.
      Parameters:
      x - The argument.
      Returns:
      Result of cbrt().
    • cos

      public static Variable cos(Variable x)
      Math.cos() for Variables.
      Parameters:
      x - The argument.
      Returns:
      Result of cos().
    • cosh

      public static Variable cosh(Variable x)
      Math.cosh() for Variables.
      Parameters:
      x - The argument.
      Returns:
      Result of cosh().
    • exp

      public static Variable exp(Variable x)
      Math.exp() for Variables.
      Parameters:
      x - The argument.
      Returns:
      Result of exp().
    • hypot

      public static Variable hypot(double x, Variable y)
      Math.hypot() for Variables.
      Parameters:
      x - The x argument.
      y - The y argument.
      Returns:
      Result of hypot().
    • hypot

      public static Variable hypot(Variable x, double y)
      Math.hypot() for Variables.
      Parameters:
      x - The x argument.
      y - The y argument.
      Returns:
      Result of hypot().
    • hypot

      public static Variable hypot(Variable x, Variable y)
      Math.hypot() for Variables.
      Parameters:
      x - The x argument.
      y - The y argument.
      Returns:
      Result of hypot().
    • hypot

      public static Variable hypot(double x, double y, Variable z)
      Math.hypot() for Variables.
      Parameters:
      x - The x argument.
      y - The y argument.
      z - The z argument.
      Returns:
      Result of hypot().
    • hypot

      public static Variable hypot(double x, Variable y, double z)
      Math.hypot() for Variables.
      Parameters:
      x - The x argument.
      y - The y argument.
      z - The z argument.
      Returns:
      Result of hypot().
    • hypot

      public static Variable hypot(double x, Variable y, Variable z)
      Math.hypot() for Variables.
      Parameters:
      x - The x argument.
      y - The y argument.
      z - The z argument.
      Returns:
      Result of hypot().
    • hypot

      public static Variable hypot(Variable x, double y, double z)
      Math.hypot() for Variables.
      Parameters:
      x - The x argument.
      y - The y argument.
      z - The z argument.
      Returns:
      Result of hypot().
    • hypot

      public static Variable hypot(Variable x, double y, Variable z)
      Math.hypot() for Variables.
      Parameters:
      x - The x argument.
      y - The y argument.
      z - The z argument.
      Returns:
      Result of hypot().
    • hypot

      public static Variable hypot(Variable x, Variable y, double z)
      Math.hypot() for Variables.
      Parameters:
      x - The x argument.
      y - The y argument.
      z - The z argument.
      Returns:
      Result of hypot().
    • hypot

      public static Variable hypot(Variable x, Variable y, Variable z)
      Math.hypot() for Variables.
      Parameters:
      x - The x argument.
      y - The y argument.
      z - The z argument.
      Returns:
      Result of hypot().
    • log

      public static Variable log(Variable x)
      Math.log() for Variables.
      Parameters:
      x - The argument.
      Returns:
      Result of log().
    • log10

      public static Variable log10(Variable x)
      Math.log10() for Variables.
      Parameters:
      x - The argument.
      Returns:
      Result of log10().
    • max

      public static Variable max(double a, Variable b)
      Math.max() for Variables.

      Returns the greater of a and b. If the values are equivalent, returns a.

      Parameters:
      a - The a argument.
      b - The b argument.
      Returns:
      Result of max().
    • max

      public static Variable max(Variable a, double b)
      Math.max() for Variables.

      Returns the greater of a and b. If the values are equivalent, returns a.

      Parameters:
      a - The a argument.
      b - The b argument.
      Returns:
      Result of max().
    • max

      public static Variable max(Variable a, Variable b)
      Math.max() for Variables.

      Returns the greater of a and b. If the values are equivalent, returns a.

      Parameters:
      a - The a argument.
      b - The b argument.
      Returns:
      Result of max().
    • min

      public static Variable min(double a, Variable b)
      min() for Variables.

      Returns the lesser of a and b. If the values are equivalent, returns a.

      Parameters:
      a - The a argument.
      b - The b argument.
      Returns:
      Result of min().
    • min

      public static Variable min(Variable a, double b)
      min() for Variables.

      Returns the lesser of a and b. If the values are equivalent, returns a.

      Parameters:
      a - The a argument.
      b - The b argument.
      Returns:
      Result of min().
    • min

      public static Variable min(Variable a, Variable b)
      min() for Variables.

      Returns the lesser of a and b. If the values are equivalent, returns a.

      Parameters:
      a - The a argument.
      b - The b argument.
      Returns:
      Result of min().
    • pow

      public static Variable pow(double base, Variable power)
      Math.pow() for Variables.
      Parameters:
      base - The base.
      power - The power.
      Returns:
      Result of pow().
    • pow

      public static Variable pow(Variable base, double power)
      Math.pow() for Variables.
      Parameters:
      base - The base.
      power - The power.
      Returns:
      Result of pow().
    • pow

      public static Variable pow(Variable base, Variable power)
      Math.pow() for Variables.
      Parameters:
      base - The base.
      power - The power.
      Returns:
      Result of pow().
    • signum

      public static Variable signum(Variable x)
      Math.signum() for Variables.
      Parameters:
      x - The argument.
      Returns:
      Result of signum().
    • sin

      public static Variable sin(Variable x)
      Math.sin() for Variables.
      Parameters:
      x - The argument.
      Returns:
      Result of sin().
    • sinh

      public static Variable sinh(Variable x)
      Math.sinh() for Variables.
      Parameters:
      x - The argument.
      Returns:
      Result of sinh().
    • sqrt

      public static Variable sqrt(Variable x)
      Math.sqrt() for Variables.
      Parameters:
      x - The argument.
      Returns:
      Result of sqrt().
    • tan

      public static Variable tan(Variable x)
      Math.tan() for Variables.
      Parameters:
      x - The argument.
      Returns:
      Result of tan().
    • tanh

      public static Variable tanh(Variable x)
      Math.tanh() for Variables.
      Parameters:
      x - The argument.
      Returns:
      Result of tanh().
    • totalNativeMemoryUsage

      public static long totalNativeMemoryUsage()
      Returns the total native memory usage of all Variables in bytes.
      Returns:
      The total native memory usage of all Variables in bytes.