rcalc documentation

Copyright (C) 2000 Free Software Foundation, Inc.

This program and the documentation are free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.

For more details see the file COPYING.

Table of contents

1. Introduction

2. Usage

3. Reference

1. Introduction

rcalc is a fast, simple, symbolic calculator for GNOME, featuring:

rcalc is therefore not like other calculator programs, such as xcalc, kcalc or gcalc. It currently supports simple operators such as /, *, +, - and ^ (`raise to the power of'), as well as more complex functions like the trigonometric functions (sin, cos, tan, asin, acos and atan), the hyperbolic functions (sinh, cosh, tanh, asinh, acosh and atanh), sqrt, log, ln, abs and int. It also has two built-in constants, pi and e.

rcalc is supposed to form part of the GNOME desktop environment and as such tries to conform to the general `look and feel' of other GNOME applications. The rcalc command interpreter tries to conform to the bash shell, and to some extent to Matlab's command interpreter. Hopefully this should all come together and make rcalc easy to use: tell me what you think!

rcalc is not meant to be a complete mathematical package; simply a fast-loading, simple and convenient scientific calculator. If you want a complete heavy-duty maths solution, look at bc or Dr Genius (both free), or Matlab (commercial).

1.1 Feedback

Check out the rcalc website, http://rcalc.sourceforge.net/ for updates. There are forums for general discussion, help requests and suggestions: please feel free to use them.

If you find a bug, please go to the rcalc bugs page and submit it if it is not there already.

If none of the above seem appropriate, then email me on <rcalc@inauspicious.org>.

2. Usage

2.1 Basics

When you start rcalc, you will be presented with a simple window containing a prompt (`rcalc> '); expressions are generally entered at this 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).

If you were to type in the above expression, you will see the following output:

rcalc> 3*sin(2*pi)
        Ans = 0.3283278207189595

The result of the calculation has been assigned to a variable called 'Ans'; indeed the results of all calculations are stored in Ans unless otherwise stated. This result can then be used in subsequent calculations, for example:

rcalc> Ans+1
        Ans = 1.328327820718959

The result may be stored in a variable other than 'Ans', for example:

rcalc> MyVariable = Ans*5
        MyVariable = 6.641639103594797

The result of the calculation has now been stored in 'MyVariable';' Ans' has been left untouched.

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, although whitespace in commands is not.

Variables are managed using the `ls' and `rm' commands in a similar manner to that in which files are managed in a shell, for example:

rcalc> ls
        Ans      = 1.328327820718959
        MyVariable = 6.641639103594797
rcalc> rm Ans
rcalc> ls
        MyVariable = 6.641639103594797

Continuing the theme of being shell-like, there is a `man' command; try typing `man man' at the prompt. Another shell-like feature is the ability to enter multiple commands/expressions on the same line: semicolons (;) are used to separate items, for example:

rcalc> a=0.223; Tb=0.044; 1/Tb*(1-Ta/Tb)
        Ta = 0.223
        Tb = 0.044
        Ans = -92.45867768595043

For those of you who have used Matlab, most of the shell-like commands have Matlab-like aliases, for example help, helpwin, who and clear. Please read the documentation, however, as some commands behave differently when their Matlab alias is used.

2.2 Configuration

To configure rcalc, select Preferences... from the File pull down menu. The window that appears has three sections, which can be navigated using the tabs at the top.

2.2.1 Behavior

This window allows you to configure the behavior of the terminal in which rcalc runs. You can set where the scrollbar will appear, the number of lines of text that will kept in memory for scrolling, whether the terminal will scroll to the cursor when a key is pressed or when text is output, whether the cursor will flash and whether an audible beep will be heard at certain occasions.

2.2.2 Appearance

This window allows you to set the font and colors used. Please note that the display may look strange if proportional fonts are used; rcalc is designed to use fixed-width (monospace) fonts such as Courier or Lucidatypewriter.

2.2.3 Calculations

This window is simply a graphical interface to the options provided by the mode command.

3. Reference

3.1 Commands

3.1.1 Exit, Quit

exit
quit

Exit the program.

3.1.2 Help, Man, Helpwin, ?

help [topic]
man <topic>
helpwin [topic]
? [topic]

Display help on topic, where topic is generally the name of a command or function. For a list of topics, try typing `ls commands' or `ls functions'. Help, helpwin or ? without a topic simply displays the introduction of the help file.

3.1.3 Ls, Who

ls [variables|functions|constants|commands]
who

List the items specified; if no arguments are supplied, ls will list the variables. Who is simply an alias of ls variables.

3.1.4 Rm, Clear

rm variable1 [variable2 ...]
clear [variable1 [variable2 ...]]

Remove the specified variables from memory. Clear with no arguments will delete all variables.

3.1.5 Mode, Deg, Rad

mode [deg|rad]
deg
rad

Display or set the calculation engine settings; this is equivalent to the calculations section of the preferences dialog. Currently, the only settings relate to the units of angles used by the trigonometric functions.

Mode with no arguments displays the current mode; with one argument it will set the unit of angles used. Deg is simply an alias of mode deg, and likewise rad is an alias of mode rad.

3.2 Functions

3.2.1 Int

int(x)

Returns the nearest integer to x, using rounding arithmetic.

3.2.2 Abs

abs(x)

Returns the absolute value of x.

3.2.3 Log, Ln

log(x)
ln(x)

Return the base-10 logarithm (log) or the natural logarithm (ln) of x.

3.2.4 Sqrt

sqrt(x)

Returns the square root of x.

3.2.5 Sin, Cos, Tan, ASin, ACos, ATan

sin(x)
cos(x)
tan(x)
asin(x)
acos(x)
atan(x)

Return the sine, cosine, tangent, arc sine, arc cosine or arc tangent of x, taking account of the specified units of angle (see mode).

3.2.6 Sinh, Cosh, Tanh, ASinh, ACosh, ATanh

sinh(x)
cosh(x)
tanh(x)
asinh(x)
acosh(x)
atanh(x)

Return the hyperbolic sine, hyperbolic cosine, hyperbolic tangent, inverse hyperbolic sine, inverse hyperbolic cosine or inverse hyperbolic tangent of x.

3.3 Constants

3.3.1 Pi

The ratio of a circle's circumference to its diameter: rcalc uses the math library definition, which on my machine is 3.14159265358979323846.

3.3.2 E

The base of natural logarithms: rcalc uses the math library definition, which on my machine is 2.7182818284590452354.