# Simple Operators

## sin

The sin operator apply the sine function on a quantity.
The operator only works on a real float scalar.
```  sin(q0)
```
The sin operator assumes the argument is in radians .
(see man sin on your Unix/Linux system )
```  Example:
if q0 is in degrees then
v0 = q0 * acos(0) / 90.0  ; converts to radians
sin(v0) ; gives the sine value of q0
```

## cos

The sin operator apply the cosine function on a quantity.
The operator only works on a real float scalar.
```  cos(q0)
```
The cos operator assumes the argument is in radians .
(see man cos on your Unix/Linux system )

## asin

The asin operator apply the arc sine function on a quantity.
The operator only works on a real float scalar.
```           ( asin(q0) for q0 = [-1 , 1]
asin(q0) = (
( 0  else
```
(see man asin on your Unix/Linux system )
```  Example:
q1 is "Cluster 3 ephemeris position"
v0 = sqrt(q1*q1 + q1*q120 + q1*q1)
p1y = asin(q1/v0) * 57.2957795
p1y is then the latitude in degrees
```

## acos

The acos operator apply the arc cosine function on a quantity.
The operator only works on a real float scalar.
```           ( acos(q0) for q0 = [-1 , 1]
acos(q0) = (
( 0  else
```
(see man acos on your Unix/Linux system )

## exp

The exp operator apply the exponential function (exp) on a quantity.
The exp operator only works on a real float scalar.
(see man exp on your Unix/Linux system )
```  Example:
q0 = "Cluster 1 efw E p3 10Hz any"
q1 = "Cluster 1 efw E p4 10Hz any"
v1 = (-(q0+q1)/2)
p6y = 200.0*exp(-(v1/0.9)) + 100.0*exp(-(v1/2.1)) + 2.0*exp(-(v1/12.0))
```

## log

The log operator apply the natural logarithm (log) on a quantity.
The log operator only works on a real float scalar.
If the user need the logarithm with base 10 (log10), the formulae
log10(x) = log(x)/log(10) can be used.
The log(10) has to be written as 2.30258509299405 .
(see man log on your Unix/Linux system )
```  Example:
p0y = log(q0)/2.30258509299405
```

## fabs

The fabs operator compute the absolute value of a quantity, ( |q0| ).
The fabs operator only works on a real float scalar.
(see man fabs on your Unix/Linux system )
```  Example:
p0y = fabs(q0)
```

## atan2

The atan2 operator has two arguments atan2(qy,qx)
The arguments has to be a real float scalars.
The atan2 operator returns the arc tangent function on the ratio qy/qx .
It works exactly as the atan2 function in C:
The atan2(y,x) function calculates the arc tangent of the two variables x and y.
It is similar to calculating the arc tangent of y / x,
except that the signs of both arguments are used to determine the quadrant of the result.

(see man atan2 on your Unix/Linux system ).
```  Example:
p8y = atan2(q0, -q0) * 180.0/3.14159
```

## sqrt

The sqrt operator apply the square root function on a quantity.
The operator only works on a real float scalar.
```	       ____
( \/ q0    for q0 > 0
sqrt(q0) = (
( 0  else
```
(see man sqrt)
To be implemented: "sqrt(q0) for q0 < 0"
```  Example:
sqrt(q2*q2 + q2*q2 + q2*q2)
```

## pow

The pow operator computes the value of a quantity raised to the power x/y
q0**(x/y)
The operator only works on a real float scalar.
```
(  0 for a = 0 or y = 0
pow(a,x,y) = (
(  else |a|^(x/y) = exp(ln(|a|)x/y)

```
usage in Calculator p0y = pow(q0,'x y') MARK: This is NOT equal to the pow() function in C.
```      p0y = pow(q0,'1 2')         { same as sqrt(q0) for q0 > 0 }
p4y = pow(q4,'2 1')      { same as q4 * q4  }

```

## const

The const operator returns with a constant value.
The operator returns with an optional 'value'.
The default return value of the const operator is 0.0.
The operator only works on a real float scalar.
```            ( const(q0) = 0.0
const(q0) = (
( const(q0,'value') = value
```

Updated Oct 22, 2013 by Bjřrn Lybekk