Expressions are generally entered at the rcalc prompt as you would write them down on paper.
The notable exception to this is that rcalc does not support implied multiplication: you cannot enter 3sin(2pi) as the parser will not recognize that you mean `three multiplied by the sine of two multiplied by pi'. The correct way to enter the above expression is 3*sin(2*pi).
You can assign any calculation result to a variable. To do this, just prepend your variable name and '=' to the expression, like this :
rcalc> MyVariable = 3*sin(pi/4)
The result can then be used in subsequent calculations, for example:
rcalc> e^MyVariable
Variable names, and indeed function, command and constant names, are case-insensitive: MyVariable, myvariable, MYVARIABLE and MyVaRiAbLe all refer to the same value. Any whitespace in expressions is ignored.
When defining a function, the variable is x. Currently, you can only define a function that uses only 1 variable (x), that is, you cannot define something like f(x,y)=cos(x) + sin(y). |
To create a new function, use the func command:
func [function_name](x)=[function_expression]
Examples:
rcalc> func g(x)=2*x
rcalc> func myfunction(x) = 2*x*x + 7*cos((sin(x))) - abs(x)
Then, you can use these functions just like other built-in functions:
rcalc> g( 5 * cos ( myfunction( 2-Ans ) ) )