# Equation Expressions in Kst

Kst equations are expressed in terms of built in operators, functions, constants, scalars and vectors in the current Kst session.

Some rules should be noticed when you enter equation expressions in either UI textbox or KstScript:

- Vector names must be included in square brackets like this: [VectorName].

- Scalar names should also be included in square brackets: [ScalarName]

- Numbers don't need to be included in square brackets. PI and e should be counted as numbers, and all other built-in constants listed in table G.2 are scalars. i.e. you should include them in square brackets.

- Values in scientific notation must be entered in the form: mEx or mex, where m is the mantissa and x is the exponent.

  For example, one way to enter the value 15000 in scientific notation is `1.5E4`.

The following is a list of all built-in operators, functions and constants used to express Equations in Kst.

## Operators

### Arithmetic Operators

+

  Addition operator

-

  Subtraction operator

*

  Multiplication operator

/

  Division operator

%

  Reminder operator

^

  Raise to power operator

### Logical and Relational Operators

Logical operators are used to evaluate expressions to true(1) or false(0) value. In &kst;, 0 is false, and all other numbers represent true value.

&

  Bitwise And operator

  It compares the corresponding bits of two operands in their binary representation of equal length. If both values of the pair are 1, the resulting bit value is 1, 0 otherwise.

|

  Bitwise Or operators.

  It compares the corresponding bits of two numbers in their binary representation of equal length. If both values of the pair are 0, the resulting bit is 0, 1 otherwise.

&&

  Logical operator And.

  It takes two numbers as boolean variables, and results 1 (true) if both operands are non-zero, 0 (false) otherwise. See an example below.

  Expression | Results
  --- | ---
  1 && 3 | 1
  3 && 0 | 0

||

  Logical Or operators

  It takes two operands and results 0 (false) if both operands are 0, 1 (true) otherwise. See an example below

  Expression | Results
  --- | ---
  2 || 0 | 1
  2 || 1 | 1
  0 || 0 | 0

!

  Logical not

<

  Less than

<=

  Less than and equal to

==

  Equal to

>

  Greater than

>=

  Greater than and equal to

!=

  Not equal to

## Built-in Functions

### Kst Built-in Function

Function | Description
--- | ---
ABS() | returns the absolute value of the argument
SQRT() | returns the square root value of the argument
CBRT() | returns the cubic root value of the argument
SIN() | sine function
COS() | cosine function
TAN() | tangent function
ASIN() | acrsine function
ACOS() | arccosin function
ATAN() | arctangent function
SEC() | secant function
CSC() | cosecant function
COT() | cotangent function
SINH() | hyperbolic sine function
COSH() | hyperbolic cosine function
TANH() | hyperbolic tangent function
EXP() | exponential function
LN() | natural logarithmic function
LOG() | base 10 logarithmic function

## Built-in Constants

### Kst Built-in Constants

Name | Value | Description
--- | --- | ---
PI or C_PI or CONST_PI | 3.14159 |
e | 2.71282 |
C_D2R | 0.0174533 | 1 deg = 0.0174533 rad; conversion factor for degrees to radians
C_R2D | 57.2958 | 1 rad = 57.2958 deg; conversion factor for radians to degrees