Command Line Calculator Help

 

Home

 

Command Line Calculator

Main

Help

History

Screen Shots

Download

 

Cocomo Calculator

Main

History

Download

 

Give Feedback

 

Content

·          Introduction

·          Commands

·           clc, clears main window

·           clv, clears variables

·           date calculations, calculates days and dates

·           functions, sets user defined function

·           hold, holds graph so that several curves can be plot to one graph

·           open, opens file – menu command

·           plot, plotting command

·           save, saves file – menu command

·           solve, solves function (finds root), Temporary removed to make more stable and reliable

·           variables, user defined variables

·           vars, shows user defined variables

·          Editing

·          Settings

·          Using history list

·          Variables and numbers

·          Supported function

 

 

Introduction

This program is command line calculator. It calculates mathematical sentences of unlimited length. Below is an example of this kind of mathematical sentence:

 

sin(8)*3^3+(6*exp(8)+543.7)/((sin(2)+1)*cos(0.11))

 

The main features are:

·          expression calculation like in the example above

·          plotting graphs

·          variables can be used

·          user can define own functions

·          saving and opening previous calculations

·          function solving, finding roots , Temporary removed to make more stable and reliable

 

Write your mathematical sentences on the the main screen and press enter. After pressing enter progam does following:

1. It checks the syntax, if there is an error it will pop a message box to user and tries to tell what is wrong.

2. Program writes sentence and result into history list, see Using history list paragraph how to use history list

3. Program writes result into main screen

 

You can use also mouse’s right button and normal copy and paste functions on the main screen.

 

NOTICE: Use "." mark instead of "," mark when writing decimal numbers!

 

 

Commands

clc

example clc.

Command clears main window.

 

clv

example clv a b

example clv all

Command clears one or more variables set by user. The first example above clears variables a and b from the memory. The second clears all variables from the memory.

 

NOTICE: There are two constant variables e and pi, which are set by the program everytime, when programs starts. If you clear these variables, they are temporary removed from the memory, but loaded again, when program is started again.

 

Date calculations (Under menu item View)

There are two types of calculation user can do: calculate how many days there are between two dates and calculate date, which is got when user adds or deletes days from a date.

 

See more from the user interface directly by choosing from menu: View and then date calculation.

 

NOTICE: Dates between 1. of January 1800 and 31. of December 9998 can be calculated.

 

 

Functions (Under menu item View)

From the menu item functions you can set upto 500 user defined functions. Functions can have several variables. One can see syntax from the example below.  Functions can call previously defined functions. You can write for example following onto functions page:

f1(d)=d+tan(d)/3

f2(x)=10+f1(x)*exp(x)

g(x,y,z)=z-0.5*x+sin(y)

 

Button Import, can be used to import functions from a file

Button Export, can be used to export functions into a file

Button OK, sets functions and closes window

Button Apply, sets functions, but does not close the window.

Button Cancel, cancels all changes back to configuration, which was before opening functions window.

 

Functions are saved into separate temp file. Functions are always automatically loaded when program starts and automatically saved when program is terminated.

 

When you remove functions, functions are released from the memory after you exit and start the program again. Although functions are removed right away from the function’s window when deleted.

 

NOTICE: Maximum number of user defined functions is 500

 

hold

example hold.

This command freezes graphics, so it is possible to plot upto 10 curves into one graph. Hold toggles graph holding on and off.

 

open (Under menu item File)

User can open from the menu previously saved expressions and variables. Open uses normal Windows open dialog.

 

plot

example plot(-2,0.5,10,x^2-3*x+9)

User can draw one variable curves with this command. The example above draws a line of function x^2-3*x+9 from point -2 to 10 with step 0.5. See also hold command.

 

save (Under menu item File)

User can save variables and expression into a file with this command. Save uses normal Windows save dialog.

 

roots

example roots (-x^3+18*x^2-12*x-140,-20,20,100,1e-13)

 

Finds roots of a function. In above command:

 

- function, which roots are to be studied -x^3+18*x^2-12*x-140, function can also be written in form -x^3+18*x^2=12*x+140, (for example)

- -20 start point of search area (value of x)

- 20 end point of search area (value of x)

- search area from -20 to 20 is divided to 100 intervals, each smaller interval is searched separately

- 1e-13 limit of error, when iteration is stopped, when function under study is closer to zero than 1e-13 iteration is stopped.

 

Program uses bisection method. Search interval, which is in above example from -20 to 20 is divided into smaller intervals. In the above example the set interval is divided to 100 smaller intervals and bisection method is applied into each of these smaller intervals.

 

Good way to find roots of a arbitrary function is first to draw it with [link plot command;Topic10] and then one can define easily search area and into how many smaller intervals search area should be divided. Notice this command produces more accurate results than the graph produced by plot command. Reason for this is the graphical component used. Notice also, that program can find max one root per interval. So for example in the above example program can find max 100 roots.

 

Status bar displays progress of iteration.

 

 

variables window (Under menu item View)

Variables have now been added also into own window. All other commands of variables work also, see: clv, clv all, vars and variables.

 

User can set or edit variables either in the main window or in the variable window. Both can be used at same time if needed. User can set variable just by writing:

 

a=9

 

into variable window and then pushing either OK or Apply button.

 

Button OK, sets variables and closes window

Button Apply, sets variables, but does not close the window.

Button Cancel, cancels all changes back to configuration, which was before opening variables window.

 

 

vars

example vars

Shows user defined variables

 

 

Editing

Standard windows pop-up menu commands work with main window and with function window. By clicking right mouse button you will pop-up menu which have normal copy and paste commands. You can use these commands in a normal way. Paste is allowed only on the last line.

 

 

Settings

You can find settings from the menu marked Settings. From the settings page you can set degree mode either to degrees, radians or grad. From the settings page you can also set font size from 8 to 24. You can close the settings page from the upper right corner cross

 

 

Using history list

Into history list is stored already written sentences and results.  When pressing space bar you get history list visible. Then use up and down arrows and enter to choose sentence or result, which you want to get back to main window. After pressing enter program moves sentence or result automatically back to main window. You can also use mouse and by double clicking with left mouse button move sentence or result back to main screen.

 

One can also take more than one item from history list into main window. One can for example take an item from history list then press "+"-sign and then take another item from the history list and so on. And after this by pressing enter one can calculate all items together.

 

 

Variables and numbers

You can use variables. Variables are not case sensitive. Following example assigns number 5 to p:

 

p=5

 

Napier's number e and pi are predefined and loaded every time program starts. User can write over these definitions, but when program is started again, original values are defined to e and pi. Values are:

 

pi=3.14159265358979324

e=2.71828182845904524

 

Program automaticaly puts answer of a calculation into variable ans, if user is not using variable. This can be used later in other calculations.

 

Program supports decimal numbers in the following interval (80 bits):

maximum 1e4932

minimum -1e-4931

 

Program supports also octal, hex and binary numbers. Writing

 

#o45 is same than octal number "45"

#hff is same than hex number "ff"

#b100110 is same than binary number "100110"

 

One can mix octal, hex, binary and decimal numbers in calculation, see example below:

 

#hff+234234-#b100101 will yield 234452.

 

You can use what ever numbers in in-build functions and in user defined functions. All results are given in decimal format. If you want result in some other format use conversions functions explained below.

 

To convert decimal numbers to hex, octal and binary numbers use [link functions;Topic20] d2h (decimal to hex), d2o (decimal to octal) and d2b (decimal to binary)

 

NOTICE: Maximum number of user defined variables is 1000

 

NOTICE: Variable names must start with letter, but after that variable name can contain also digits

 

 

Supported functions

In the list below is shown supported functions. For example calculating Cosine from 7 write: cos(7). Functions are not case sensitive.

 

Function      Description                    Example

!                               Factorial                                               5!                            

^                              Raised to the power of                    3^2

*                              Multiply by                                           4*54

/                               Divide by                                             54/7

\                               Integer divide by                                                               34\7

+                              Add                                                        5+78

-                               Subtract                                                34-8.9

%                            Percent                                                 5%89

min                         Minimum value                                  min(7,4,78)

max                        Maximum value                                                                 max(8347,334,-34)

sin                          Sine                                                      sin(5)

cos                         Cosine                                                  cos(4.3)

tan                          Tangent                                               tan(1.2)

asin                        Arc sine                                                asin(0.8)

acos                      Arc cosine                                           acos(0.2)

atan                       Arc tangent                                          atan(0.3)

sec                         Secant                                                  sec(8)

csc                         Cosecant                                             csc(9)

cot                          Cotangent                                            cot(71)

sinh                        Hyperbolic sine                                 sinh(11)

cosh                      Hyperbolic cosine                                                            cosh(1.2)

tanh                        Hyperbolic tangen                           tanh(11)

coth                        Hyperbolic cotangent                     coth(0.1121)

sech                      Hyperbolic secant                                                            sech(11.21)

csch                       Hyperbolic cosecant                       csch(8)

asinh                     Hyperbolic arc sine                         asin(0.76)

acosh                    Hyperbolic arc cosine                    acosh(1.23)

atanh                     Hyperbolic arc tangent                   atanh(0.12)

acoth                     Hyperbolic arc cotangent              acoth(1.198)

asech                    Hyperbolic arc secant                    asech(0.98)

acsch                    Hyperbolic arc cosecant               acsch(0.742)

abs                        Absolute value                                  abs(-3)

exp                         e to the power of                                                                exp(71.8)

exp2                      2 to the power of                                                                exp2(32)

exp10                    10 to the power of                              exp10(76)

log                          Natural log                                          log(231)

log2                       Log base 2                                          log2(998)

log10                     Log base 10                                       log10(43)

ceil                         Round up                                             ceil(1.3)

rnd                          Random number                                                               rnd() or rnd(3)

int                            Truncate to an integer                     int(3.7)

frac                         Decimal part                                       frac(2.4)

sgn                         Sign of expression                           sgn(-765)

sqr                          Square root                                         sqr(887)

perm                      Permutation perm(n,k)                     perm(23,7)

comb                     Combination comb(n,k)                  comb(12,7)

d2r                          Degrees to radians                          d2r(360)

r2d                          Radians to degrees                        r2d(6.28)

d2h                         Decimal to hex                                   d2h(3564564629)

d2b                        Decimal to binary                                                             d2b(3985308508345039)

mod                       Modulo mod(n,k)                                                               mod(7824,6)

not                   Bitwise not                              not(674)

and                  Bitwise and                             674 and 543

or                     Bitwise or                                674 or #b110110 or #bfff121

xor                   Bitwise exclusive or                26741 xor 543

eqv                  Bitwise Equivalence                121 eqv 9976

imp                  Bitwise Implication,                 766 imp #b100110

b2l                   Bitwise left                               b2l(765,2,8,1)

b2r                   Bitwise right                            b2l(7165,2,16,3)