Reverse Polish Notation (math package)
This commit is contained in:
@@ -6,70 +6,52 @@ Please note that you cannot copy a single function from the package, as some fun
|
||||
|
||||
## Functions
|
||||
|
||||
### fun -double !sin -double &input
|
||||
# Trigonometry
|
||||
|
||||
Gets the sin of input.
|
||||
fun -double !sin -double &input: Gets the sin of input.
|
||||
|
||||
### fun -double !cos -double &input
|
||||
fun -double !cos -double &input: Gets the cos of input.
|
||||
|
||||
Gets the cos of input.
|
||||
fun -double !tan -double &input: Gets the tan of input.
|
||||
|
||||
### fun -double !tan -double &input
|
||||
fun -double !asin -double &input: Finds the angle *x* in the range [-pi/2, pi/2] such that sin(x) equals the input.
|
||||
|
||||
Gets the tan of input.
|
||||
fun -double !acos -double &input: Finds the angle *x* in the range [0, pi] such that cos(x) equals the input.
|
||||
|
||||
### fun -double !asin -double &input
|
||||
fun -double !atan -double &input: Finds the angle *x* in the range [-pi/2, pi/2] such that tan(x) equals the input.
|
||||
|
||||
Finds the angle *x* in the range [-pi/2, pi/2] such that sin(x) equals the input.
|
||||
fun -double !atan2 -double &y -double &x: Finds the angle in the range (-pi, pi] between the positive x axis and the point (x,y). This is equivalent to atan(y/x) for positive values of x.
|
||||
|
||||
### fun -double !acos -double &input
|
||||
# Exponents and Logarithms
|
||||
|
||||
Finds the angle *x* in the range [0, pi] such that cos(x) equals the input.
|
||||
fun -double !intexp -double &base -int &power: Returns base^power, for positive integer values of power. Returns 1 if power is non-positive (and thus is inaccurate for negative values of power).
|
||||
|
||||
### fun -double !atan -double &input
|
||||
fun -double !exp -double &input: Finds exp($input), where exp(x)=e^x; e is Euler's number = 2.718281828...
|
||||
|
||||
Finds the angle *x* in the range [-pi/2, pi/2] such that tan(x) equals the input.
|
||||
fun -double !ln -double &in: Finds the natural log (log_e) of $input, i.e. finds x such that e^x = $input; e is Euler's number = 2.718281828...
|
||||
|
||||
### fun -double !atan2 -double &y -double &x
|
||||
fun -double !sqrt -double &input: Returns the positive value *x* that satisfies x^2 = input. Throws an error if input is negative.
|
||||
|
||||
Finds the angle in the range (-pi, pi] between the positive x axis and the point (x,y). This is equivalent to atan(y/x) for positive values of x.
|
||||
# Integer Operations
|
||||
|
||||
### fun -double !intexp -double &base -int &power
|
||||
fun -double !mod -double &in -double &modulus: Returns *n* such that *n* is congruent to the input modulo $modulus, where *n* is at least 0 and less than $modulus.
|
||||
|
||||
Returns base^power, for positive integer values of power. Returns 1 if power is non-positive (and thus is inaccurate for negative values of power).
|
||||
fun -double !abs -double &in: Returns the absolute value of the input.
|
||||
|
||||
### fun -double !exp -double &input
|
||||
fun -int !factorial -int &in: Returns the factorial of the input.
|
||||
|
||||
Finds exp($input), where exp(x)=e^x, e is Euler's number = 2.718281828...
|
||||
# Constants
|
||||
|
||||
### fun -double !ln -double &in
|
||||
fun -double !pi: Returns pi to the maximum accuracy that doubles can store.
|
||||
|
||||
Finds the natural log (log_e) of $input, i.e. finds x such that e^x = $input, e is Euler's number = 2.718281828...
|
||||
fun -double !e: Returns e to the maximum accuracy that doubles can store.
|
||||
|
||||
### fun -double !sqrt -double &input
|
||||
# Misc
|
||||
|
||||
Returns the positive value *x* that satisfies x^2 = input. Throws an error if input is negative.
|
||||
fun -double !random -int &seed: Gets a random double in the domain [0,1), using a LCG. A seed is required.
|
||||
|
||||
### fun -double !mod -double &in -double &modulus
|
||||
fun -double !rpn -list &rpn: Calculates a function in reverse polish notation. The list should have a form similar to `[3, 5, '+', 2, '-']`, i.e. only numbers and the `+`, `-`, `*`, `/` characters. **Requires the lists package to use**.
|
||||
|
||||
Returns *n* such that *n* is congruent to the input modulo $modulus, where *n* is at least 0 and less than $modulus.
|
||||
fun -double !itod -int &input: Returns the input as a double.
|
||||
|
||||
### fun -double !abs -double &in
|
||||
|
||||
Returns the absolute value of *n*.
|
||||
|
||||
### fun -double !random -int &seed
|
||||
|
||||
Gets a random double in the domain [0,1), using a LCG. A seed is required.
|
||||
|
||||
### fun -double !pi
|
||||
|
||||
Returns pi to the maximum accuracy that doubles can store.
|
||||
|
||||
### fun -double !itod -int &input
|
||||
|
||||
Returns the input as a double.
|
||||
|
||||
### fun -int !dtoi -double &input
|
||||
|
||||
Returns the input as an integer.
|
||||
fun -int !dtoi -double &input: Returns the input as an integer.
|
||||
Reference in New Issue
Block a user