RLPlot formulas and and functions

RLPlot uses a common parser for spread sheet cells, function plotting and curve fitting. This parser interprets formulas which are readable to humans and executes them on the computer. Spread sheet formulas are preceeded by a '=' sign. For example '=1+2' assigns a value of 3 to the current cell and '=b3+2' assings the value of cell b3 to the cell and increments it by 2. Funcion plots accept formulas with several expressions on a line separated by ';' or on different lines. By default the last expression is used as result. In this case you may explicitly state 'y= ...' to determine which expression gives the result.

Operators

^   exponentiation
*   multiplication
/   division
+   addition
-   subtraction
==   logical equal
<   logical less than
>   logical greater than
!=, <>   logical not equal
<=   logical less or equal
>=   logical greater or equal
&&   logical AND
||   logical OR
++   increment
--   decrement
+=   add value
-=   subtract value
*=   multiply with value
/=   divide by value


Conditional assignment

A conditional assignment has the following syntax exp1 ? exp2 : exp3 .
This means that the whole expression evaluates to exp2 if exp1 is true, and to exp3 if exp1 is false.


Select cases 'where'

Functions operating on ranges or arrays can be modified by adding a 'where' clause. The most common use of this clause is probably the count() function. A dummy variable, $$, is introduced which represents each element of the array. This clause is available for all functions operating on ranges and arrays.

Examples:

=count(a1:b20 where $$>0)
count all values in a1:b20 wich are higher than 0.0
=count(a1:b20 where $$>=10 && $$ <20)
count all values in a1:b20 wich are between 10 and 20
=mean(a1:b20 where $$!=0)
calculate the mean of all values in a1:b20 wich are not zero


String Operations

Strings can be concatenated using a '+' sign. This may also be used to combine strings and values.

Examples:

=a3/b1*100+" %"
="Value is "+a2


Arithmetic Functions

abs(expr)
absolute value of 'expr'
acos(expr)
arccosine of 'expr'
asin(expr)
arcsine of 'expr'
atan(expr)
arctangent of 'expr'
cos(expr)
cosine of 'expr'
cosh(expr)
hyperbolic cosine of 'expr'
exp(expr)
exponential of 'expr'
floor(expr)
truncate 'expr'
log(expr)
natural logarithm of 'expr', same as 'ln(expr)'
log10(expr)
base-10 logarithm of 'expr'
rand()
return a random number in the range 0.0 - 1.0
sign(expr)
sign (1, 0, or -1) of 'expr'
sin(expr)
sine of 'expr'
sinh(expr)
hyperbolic sine of 'expr'
sqrt(expr)
square root of 'expr'
srand(expr>
use 'expr' as new seed for random numbers
tan(expr)
tangent of 'expr'
tanh(expr)
hyperbolic tangent of 'expr'


String Functions

asc(string)

returns a value representing the character code corresponding to the first letter of string.

call(range[;parameters])
executes the script in 'range'. An optional string defining 'parameters' may be specified. 'Call' uses the same name space as the calling process and variables of the calling process are global to the called script.
See also exec()
chr(value)
returns a string containing the character associated with the character code value. If value is not a valid number ? is returned.
eval(expr)
evaluates the expression expr and returns the result.
examples: eval("1+2") returns 3 a=2;eval("a*4") returns 8 eval('"hello"+" world"') returns "hello world"
exec(range[;parameters])
executes the script in 'range'. An optional string defining 'parameters' may be specified. 'Exec' creates a new instance of the parser and variables of the calling process are hidden. see also call()example:  exec(c1:e10; "x=4")
ltrim(string)
removes leading white space from string.
rtrim(string)
removes trailing white space from string.
strlen(string)
returns the length of string.
example: strlen("hello") returns 5.
strpos(needle; haystack)
returns the position of the first occurence of needle in haystack, -1 on error. example: strpos("r"; "world") returns 2.
strrepl(search; replace; haystack)
replaces all occurences of search with replace in haystack. example: strrepl("a"; "e"; "hallo") returns "hello".
substr(text; pos1; pos2)
returns a string containing the characters of text from pos1 through pos2. example: substr("hello"; 2; 3) returns "ll".
tolower(string)
convert string to lower case.
toupper(string)
convert string to upper case.
trim(string)
removes leading and trailing white space from string.
ucfirst(string)
make first character of string upper case.
ucword(string)
make first character of every word upper case.
Nach oben scrollen