SymbMath (an abbreviation for Symbolic Mathematics) is a
symbolic calculator that can solve symbolic math problems.

SymbMath is a computer
algebra system that can perform exact, numeric, symbolic and graphic
computation. It manipulates complicated formulas and returns answers in terms
of symbols, formulas, exact numbers, tables and graph.

SymbMath is an expert system
that is able to learn from user's input. If the user only input one formula
without writing any code, it will automatically learn many problems related to
this formula (e.g. it learns many integrals involving an unknown function f(x)
from one derivative f’).

SymbMath is a symbolic,
numeric and graphics computing environment where you can set up, run and
document your calculation, draw your graph.

SymbMath uses external functions as if standard
functions since the external functions in library are auto-loaded.

SymbMath is a programming language in which you can define
conditional, case, piecewise, recursive, multi-value functions and procedures,
derivatives, integrals and rules.

Please read all * files before
running SymbMath. Please copy-and-past examples in the Help window to practise.
The printed documents (100+ pages) is available from author.

If you get the SymbMath on ZIP
format (e.g. sm32a.zip), you should unzip it with parameter -d by

pkunzip -d sm32a
c:\symbmath

If you get the SymbMath with the install
file, you should install it byinstall

On the MS-DOS prompt to run it, typeSymbMath

SymbMath has two versions: Shareware
Version A, and Advanced Version C. The Shareware version lacks the solve(),
trig (except sin(x) and cos(x)), and hyperbolic functions, (lack 10% keywords).
You cannot input these lack functions in Shareware version.

You must provide the photocopy of
your license or license number for upgrades.

If you send the author your payment
by cheque, money order or bank draft that must be drawn in Australia, you will
get the latest version. If you sign the license (see the LICENSE file) and send
it to the author, you will be a legal user for upgrades. If you write a paper
about this software on publication, you will get a free upgrade.

Its two versions (Shareware and
Advanced) are available from the author. The Shareware version is available
from my web sites.

The Advanced version is
copy-protected, so you must insert the original SymbMath disk into drive A or B
before you run SymbMath. By default, it is drive B. If you use drive A, please
copy (or rename) the DRIVE.A file to the SYMBMATH.DRI file, or you edit
drive(2) into drive(1) in the SYMBMATH.DRI file.

In the following examples, a line of
"IN: " means input, which you type in the Input window, then leave
the Input window by pressing <Esc>, finally run the program by the
command "Run"; while a line of "OUT: " means output. You
will see both input and output are displayed on two lines with beginning of
"IN: " and "OUT: " in the Output window. You should not
type the word "IN: ". Some outputs may be omitted on the examples.

#
is a comment statement.

You can split a line of command into
multi-lines of command by the comma ,. The comma without any blank space must be
the last character in the line.

Note that you should not be suprised
if some functions in the following examples are not working when their
libraries are not in the default directory or missing.

SymbMath gives the exact value of
calculation when the switch numeric := off (default), or the approximate value
of numeric calculation when the switch numeric := on or by num().

Mathematical functions are usually
not evaluated until by num() or by setting numeric := on.

SymbMath can manipulate units as
well as numbers, be used as a symbolic calculator, and do exact computation.
The range of real numbers is from -infinity to +infinity, e.g. ln(-inf),
exp(inf+pi*i), etc. SymbMath contains many algorithms for performing numeric
calculations. e.g. ln(-9), i^i, (-2.3)^(-3.2), 2^3^4^5^6^7^8^9, etc.

Note that SymbMath usually gives a
principle value if there are multi-values, but the solve() and root() give all
values.

Example:

Exact and numeric calculations of
1/2 + 1/3.

IN:1/2+1/3#
exact calculation

OUT: 5/6

IN:num(1/2+1/3)#
numeric calculation

OUT: 0.8333333333

Evaluate the value of the function
f(x) at x=x0 by f(x0).

Example:

Evaluate sin(x) when x=pi, x=180
degree, x=i.

IN:sin(pi), sin(180*degree)

OUT: 0, 0

IN:sin(i), num(sin(i))

OUT: sin(i),
1.175201 i

Example:

Set the units converter from the
minute to the second, then calculate numbers with different units.

IN:minute:=60*second

IN:v:=2*meter/second

IN:t:=2*minute

IN:d0:=10*meter

IN:v*t+d0

OUT: 250 meter

Evaluate the expression value by

subs(y, x = x0)

Example:

Evaluate z=x^2 when x=3 and y=4.

IN:z:=x^2#
assign x^2 to z

IN:subs(z, x = 3)# evaluate z when x = 3

OUT: 9

IN:x:=4#
assign 4 to x

IN:z#
evaluate z

OUT: 16

Note that after assignment of x by
x:=4, x should be cleared from assignment by clear(x) before differentiation
(or integration) of the function of x. Otherwise the x values still is 4 until
new values assigned. If evaluating z by the subs(), the variable x is automatically
cleared after evaluation, i.e. the variable x in subs() is local variable. The
operation by assignment is global while the operation by internal function is
local, but operation by external function is global. This rule also applies to
other operations.

The complex numbers, complex
infinity, and most math functions with the complex argument can be calculated.

Example .

IN:sign(1+i), sign(-1-i), i^2

OUT: 1, -1, -1

Example:

IN:exp(inf+pi*i)

OUT: -inf

IN:ln(last)

OUT: inf + pi*i

The built-in constants (e.g. inf,
zero, discont, undefined) can be used as numbers in calculation of expressions
or functions.

Some math functions are discontinuous at
x=x0, and only have one-sided function value. If the function f(x0) gives the
discont as its function value, you can get its one-sided function value by
f(x0-zero) or f(x0+zero).

SymbMath automatically simplifies the
output expression. You can further simplify it by using the built-in variable
last in a single line again and again until you are happy with the answer.

Expressions can be expanded by

expand(x)

expand := on

expandexp := on

Remember that the operation by
assignment is global while operation by function is local. So expand(x) only
expands the expression x, but the switch expand := on expands all expressions
between the switch expand := on and the switch expand := off. Second difference
betwen them is that the switch expand := on only expands a*(b+c) and (b+c)/p,
but does not expands the power (a+b)^2. The expandexp is exp expand.

Anytime when you find yourself using the
same expression over and over, you should turn it into a function.

Anytime when you find yourself using
the same definition over and over, you should turn it into a library.

You can make your defined function
as if the built-in function, by saving your definition into disk file as a
library with the function name plus extension as the filename. e.g. saving the factoria function
as the factoria file (see Section Libraries and Packages).

The argument in the definition
should be the pattern x_. Otherwise f() works only for a specific symbolic
value, e.g. x when defining f(x):=x^2. The pattern x_ should be only on the
left side of the assignment.

Once defined, functions can be used
in expressions or in other function definitions:

On the first definition by If(),
when f1() is called it gives 1 if x>0, or left unevaluated otherwise. On the
second definition by the If(), when f2() is called it gives x^2 if x>0, x if
x<=0, or left unevaluated otherwise. On the third definition by the
inequality, when f3() is called, it gives 1 for x>0, 0 for x<=0, or
x>0 for symbolic value of x. On the last definition, when f4() is called, it
is evaluated for any numeric or symbolic value of x.

You cannot differentiate nor integrate
the conditional function defined by If(), but you can do the conditional
functions defined by inequalities.

You can define a function evaluated
only for numbers by

f(x_) := If(isnumber(x) ,
x^2)

This definition is different from
the definition by f(x_) := x^2. On the latter, when f() is called, it gives
x^2, regardless whatever x is. On the former, when f() is called, it gives x^2
if x is a number, or left unevaluated otherwise.

Example:

evaluate to x^2 only
if x is number, by defining a conditional function.

By default, all variables within
procedure are global, except for variables declared by local(). The
multi-statement should be grouped by block(). The block() only outputs the
result of the last statement or the second last one as its value. The
multi-line must be terminated by a comma, (not by a comma and a blank space).
Local() must be the last one in block().

Example:

define a numeric
integration procedure ninte() and calculate integral of x^2 from x=1 to x=2 by
call ninte().

You can define transform rules. Defining
rules is similar to defining functions. In defining functions, all arguments
must be simple variables, but in defining rules, the first argument can be a
complicated expression.

You can finds real or complex limits, and
discontinuity or one-sided value.

First find the expression value by
subs(y, x = x0) or the function value by f(x0) when x = x0.

If the result is the discont (i.e.
discontinuity), then use the one-sided value x0+zero or x0-zero to try to find
the one-sided function or expression value.

For a function f(x), you can
evaluate the left- or right-sided function value, similar to evaluate the
normal function value:

f(x0-zero)

f(x0+zero)

For an expression y, you can
evaluate its one-sided expression value by

subs(y, x = x0-zero)

subs(y, x = x0+zero)

The discont (discontinuity) means
that the expression has a discontinuity and only has the one-sided value at
x=x0. You should use x0+zero or x0-zero to find the one-sided value. The value
of f(x0+zero) or f(x0-zero) is the right-sided or left-sided function value as
approaching x0 from positive (+inf) or negative (-inf) direction, respectively,
i.e. as x = x0+ or x = x0-.

If the result is undefined
(indeterminate forms, e.g. 0/0, inf/inf, 0*inf, and 0^0), then find its limit
by

lim(y, x = x0)

If the limit is discont, then you
can find a left- or right-sided limit when x approaches to x0 from positive
(+inf) or negative (-inf) direction at discontinuity by

lim(y, x = x0+zero)

lim(y, x = x0-zero)

Example:

Evaluate y=exp(1/x) at x=0, if the
result is discontinuity, find its left-sided and right-sided values (i.e. when
x approaches 0 from positive and negative directions).

If you differentiate f(x) by f’, x
must be a simple variable and f(x) must be unevaluated.

f'(x0) is the same as d(f(x0),x0),
but different from d(f(x), x=x0). f'(x0) first evaluates f(x0), then
differentiates the result of f(x0). But d(f(x), x=x0) first differentiates
f(x), then replace x with x0. Note that sin'(x^6) gives cos(x^6) as sin'(x^6)
is the same as d(sin(x^6), x^6). sin'(0) gives d(0,0) as sin(0) is evaluated to
0 before differentiation, you should use d(sin(x),x=0) which gives 1.

Example:

Differentiate the expression
f=sin(x^2+y^3)+cos(2*(x^2+y^3)) with respect to x, and with respect to both x
and y.

The Davison-Essex
and the Riemann-Liouville definitions are different in the following aspect: in
the D-E formula, differentiation is performed first, then integration; in the
R-L formula it is the other way around. The D-E definition implemented, thus,
maps constants to zero, imitating integer order differentiation, while the R-L
definition does not. This property of the D-E definition makes it suitable to
work with initial value problems for fractional differential equations.

The equations can be operated (e.g. +, -,
*, /, ^, expand(), d(), integrate()). The operation is done on both sides of
the equation, as by hand. You can find roots of a polynomial, algebraic
equations, systems of equations, differential and integral equations.

You can get the left side of the
equation by

left(left_side =
right_side)

or get the right
side by

right(left_side =
right_side)

You can assign equations to
variables.

Example:

IN:eq1:= x + y = 3

IN:eq2:= x - y = 1

IN:eq1+eq2

OUT: 2 x = 4

IN:last/2

OUT: x = 2

IN:eq1-eq2

OUT: 2 y = 2

IN:last/2

OUT: y = 1

Example:

Solve an equation sqrt(x+2*k) -
sqrt(x-k) = sqrt(k), then check the solution by substituting the root into the
equation.

IN:eq1 := sqrt(x + 2*k) - sqrt(x - k) = sqrt(k)

OUT: eq1 := sqrt(x +
2*k) - sqrt(x - k) = sqrt(k)

IN:eq1^2

OUT: ((2*k + x)^0.5
- ((-k) + x)^0.5)^2 = k

IN:expand(last)

OUT: 2*x + k +
(-2)*(2*k + x)^0.5*((-k) + x)^0.5 = k

IN:last-k-2*x

OUT: (-2)*(2*k +
x)^0.5*((-k) + x)^0.5 = (-2)*x

IN:last/(-2)

OUT: (2*k +
x)^0.5*((-k) + x)^0.5 = x

IN:last^2

OUT: (2*k + x)*((-k)
+ x) = x^2

IN:expand(last)

OUT: (-2)*k^2 + k*x
+ x^2 = x^2

IN:last-x^2+2*k^2

OUT: k*x = 2*k^2

IN:last/k

OUT: x = 2*k

IN:subs(eq1, x = right(last))

OUT: k^0.5 = k^0.5

You can solve algebraic equations
step by step, as above. This method is useful in teaching, e.g. showing
students how to solve equations.

solve a polynomial
and systems of linear equations on one step. It is recommended to set the
switch expand:=on when solve the complicated equations. All of the real and
complex roots of the equation will be found by solve(). The function solve()
outputs a list of roots when there are multi-roots. You can get one of roots
from the list, (see Chapter 4.9 Arrays, Lists, Vectors and Matrices).

Example:

Solve a+b*x+x^2 = 0 for x, save the root
to x.

IN:solve(a+b*x+x^2 = 0, x)# solve or re-arrange the equation for x

OUT: x = [-b/2 +
sqrt((b/2)^2 - a),-b/2 - sqrt((b/2)^2 -
a)]

IN:x := right(last)# assign two roots to x

OUT: x := [-b/2 +
sqrt((b/2)^2 - a),-b/2 - sqrt((b/2)^2 -
a)]

IN:x[1]#
the first root

OUT: -b/2 +
sqrt((b/2)^2 - a)

IN:x[2]#
the second root

OUT: -b/2 -
sqrt((b/2)^2 - a)

Example:

Solve x^3 + x^2 + x + 5 = 2*x + 6.

IN:num(solve(x^3+x^2+x+5 = 2*x+6, x))

OUT: x = [1, -1, -1]

The function solve() not only solves
for a simple variable x but also solves for an unknown function, e.g. ln(x).

You can compute partial, finite or infinite
sums and products. Sums and products can be differentiated and integrated. You
construct functions like Taylor polynomials or finite Fourier series. The
procedure is the same for sums as products so all examples will be restricted
to sums. The general formats for these
functions are:

sum(y,x)

sum(y)

sum(expr, x , xmin ,
xmax)

sum(expr, x , xmin ,
xmax , dx)

prod(expr, x , xmin ,
xmax)

prod(expr, x , xmin ,
xmax , dx)

The expression expr is evaluated at
xmin, xmin+dx, ...up to the last entry
in the series not greater than xmax, and the resulting values are added or
multiplied.The part "step dx"
is optional and defaults to 1.The
values of xmin, xmax and dx can be any real number.

Here are some examples:

sum(j, j , 1 , 10,1)

for 1 + 2 + .. + 10.

sum(3^j, j , 0 , 10 , 2)

for 1 + 3^2 + ... +
3^10.

Here are some sample Taylor
polynomials:

sum(x^j/j!, j , 0 , n)

for exp(x).

sum((-1)^j*x^(2*j+1)/(2*j+1)!, j , 0
, n)

for sin(x) of degree
2*n+2.

Remember, the 3 keywords (from, to
and step) can be replaced by the comma ,.

to find the Taylor
series at x=0. The argument (order) is optional and defaults to 5.

Example:

Find the power series expansion for
cos(x) at x=0.

IN:series(cos(x), x)

OUT: 1 - 1/2 x^2 +
1/24 x^4

The series expansion of f(x) is
useful for numeric calculation of f(x). If you can provide derivative of any
function of f(x) and f(0), even though f(x) is unknown, you may be able to
calculate the function value at any x, by series expansion. Accuracy of calculation
depends on the order of series expansion. Higher order, more accuracy, but
longer calculation time.

You can define a list by putting its
elements between two square brackets. e.g. [1,2,3]

You can define lists another way,
with the command:

[ list(f(x), x from xmin
to xmax step dx) ]

This is similar to the sum
command,but the result is a list:

[f(xmin), f(xmin+dx),
..., f(xmin+x*dx), ...]

which continues
until the last value of xmin + x*dx<= xmax.

You also can assign the list to a
variable, which variable name become the list name:

a := [1,2,3]# define the list of a

b := [f(2), g(1),
h(1)]# assumes f,g,h defined

c := [[1,2],3,[4,5]]# define the list of c

Lists are another kind of value in
SymbMath, and they can be assigned to variables just like simple values. (Since
variables in SymbMath language are untyped, you can assign any value to any
variable.).

If you have assigned a list to a variable
x, you can access the j-th element by the list index x[j]. The first element of
x is alwaysx[1].If the x[j] itself is a list, then its j-th
element is accessed by repeating the similar step.But you can not use the list
index unless the list is already assigned to x.

e.g.

IN:x := [[1,2],3,[4,5]]# define the x list

IN:x[1], x[2]#
take its first and 2nd element

OUT: [1, 2], 3

IN:x#
access the entire list of x

OUT: [[1, 2], 3,
[4,5]]

IN:member(x, 2)#
same as x[2]

OUT: 3

An entire sub-list of a list xcan be accessed with the command x[j], which
is the list:

Lists can be added, subtracted, multiplied,
and divided by other lists or by constants.When two lists are combined, they are combined term-by-term, and the combination
stops when the shortest list is exhausted.When a scalar is combined with a list, it is combined with each element
of the list.Try:

a := [1,2,3]

b := [4,5,6]

a + b

a / b

3 * a

b - 4

Example 4.9.2.4.1.

Two lists are added.

IN:[a1,a2,a3] + [b1,b2,b3]

OUT: [a1 + b1, a2 +
b2, a3 + b3]

IN:last[1]

OUT: a1 + b1

If L is a list, thenf(L) results in a list of the values, even
though f() is the differentiation or integration function (d() or integrate()).

IN:sqrt([a, b, c])

OUT: [sqrt(a),
sqrt(b), sqrt(c)]

IN:d([x, x^2, x^3], x)

OUT: [1, 2*x, 3*x^2]

If you use a list as the value of a
variable in a function, SymbMath will try to use the list in the calculation.

You can sum all the elements in a
list x by

listsum(x)

Example:

IN:listsum([a,b,c]^2)

OUT: a^2 + b^2 + c^2

This function takes the sum of the
squares of all the elements in the list x.

You can do other statistical
operations (see Section 4.10. Statistics) on the list, or plot the list of
numeric data (see Section 5. Plot).

You can find the length of a list
(the number of elements in a list) with:

If you want to look at a table of values
for a formula, you can use the table command:

table(f(x), x)

table(f(x),
x from xmin to xmax)

table(f(x), x from xmin
to xmax step dx)

It causes a table of values for f(x)
to be displayed with x=xmin, xmin+dx, ..., xmax.If xmin, xmax, and step omit, then xmin=-5,
xmax=5, and dx=1 for default. You can specify a function to be in table(),

Example:

Make a table of x^2.

IN:table(x^2, x)

OUT:

-5,25

-4,16

-3,9

-2,4

::

::

Its output can be written into a
disk file for interfacing with other software (e.g. the numeric computation
software).

One of the most important feature of
SymbMath is its ability to deduce and expand its knowledge. If you provide it
with the necessary facts, SymbMath can solve many problems which were unable to
be solved before. The followings are several ways in which SymbMath is able to
learn from your input.

Finding derivatives is much easier than
finding integrals. Therefore, you can find the integrals of a function from the
derivative of that function.

If you provide the derivative of a
known or unknown function, SymbMath can deduce the indefinite and definite
integrals of that function. If the function is not a simple function, you only
need to provide the derivative of its simple function. For example, you want to
evaluate the integral of f(a*x+b), you only need to provide f’.

If you know a derivative of an
function f(x) (where f(x) is a known or unknown function), SymbMath can learn
the integrals of that function from its derivative.

Example:

check SymbMath whether or not it had
already known integral of f(x)

IN:integrate(f(x), x)

OUT: integrate(f(x),
x)

IN:integrate(f(x), x, 1, 2)

OUT: integrate(f(x),
x, 1, 2)

As the output displayed only what
was typed in the input without any computed results, imply that SymbMath has no
knowledge of the indefinite and definite integrals of the functions in
question. Now you teach SymbMath the derivative of f(x) on the first line, and
then run the program again.

IN:f'(x_) := exp(x)/x

IN:integrate(f(x), x)

OUT: x*f(x) - e^x

IN:integrate(f(x), x, 1, 2)

OUT: e - f(1) +
2*f(2) - e^2

As demonstrated, you only supplied
the derivative of the function, and in exchange SymbMath logically deduced its
integral.

Another example is

IN:f'(x_) := 1/sqrt(1-x^2)

IN:integrate(f(x), x)

OUT: sqrt(1 - x^2) +
x*f(x)

IN:integrate(k*f(a*x+b), x)

OUT: k*(sqrt(1 - (b
+ a*x)^2) + (b + a*x)*f(b + a*x))/a

IN:integrate(x*f(a*x^2+b), x)

OUT: sqrt(1-(a*x^2 +
b)^2) + (a*x^2 + b)*f(a*x^2 + b)

The derivative of the function that
you supplied can be another derivative or integral.

You supply a simple indefinite integral,
and in return, SymbMath will perform the related complicated integrals.

Example:

Check whether SymbMath has already
known the following integrals or not.

IN:integrate(f(x), x)

OUT: integrate(f(x),
x)

IN:integrate((2*f(x)+x), x)

OUT: integrate((2*f(x)+x),
x)

IN:integrate(integrate(f(x)+y), x), y)

OUT: integrate(integrate(f(x)+y),
x), y)

Supply, like in the previous
examples, the information: integral of f(x) is f(x) - x; then ask the
indefinite integral of 2*f(x)+x, and a double indefinite integral of 2*f(x) +
x, and a double indefinite integral of respect to both x and y. Change the
first line, and then run the program again.

SymbMath can learn complicated derivatives
from a simple derivative, even though the function to be differentiated is an
unknown function, instead of standard function.

Example :

Differentiate f(x^2)^6, where f(x)
is an unknown function.

IN:d(f(x^2)^6, x)

OUT: 12 x f(x^2)^5
f'(x^2)

Output is only the part derivative.
f'(x^2) in the output suggest that you should teach SymbMath f'(x_). e.g. the
derivative of f(x) is another unknown function df(x), i.e. f'(x_) = df(x),
assign f'(x_) with df(x) and run it again.

The difference between learning and
programming is as follows: the learning process of SymbMath is very similar to
the way human beings learn, and that is accomplished by knowing certain rule
that can be applied to several problems. Programming is different in the way
that the programmer have to accomplish many tasks before he can begin to solve
a problem. First, the programmer defines many subroutines for the individual
integrands (e.g. f(x), f(x)+y^2, 2*f(x)+x, x*f(x), etc.), and for individual
integrals (e.g. the indefinite integral, definite integral, the indefinite
double integrals, indefinite triple integrals, definite double integrals,
definite triple integrals, etc.), second, write many lines of program for the
individual subroutines, (i.e. to tell the computer how to calculate these
integrals), third, load these subroutines, finally, call these subroutines.
That is precisely what SymbMath do not ask you to do.

In one word, programming means that
programmers must provide step-by-step procedures telling the computer how to
solve each problems. By contrast, learning means that you need only supply the
necessary facts (usually one f’ and/or one integral of f(x)), SymbMath will
determine how to go about solutions of many problems.

If the learning is saved as a
library, then you do not need to teach SymbMath again when you run SymbMath
next time.

SymbMath is an interpreter, and runs a
SymbMath program in the Input window, which is written by any editor in the
text (ASCII) file format.

SymbMath language is a procedure
language, which is executed from top to bottom in a program, like BASIC,
FORTRAN, or PACSAL. It also is an expression-oriented language and functional
language.

The SymbMath program consists of a
number of statements. The most useful statement contains expressions, the
expression includes data, and the most important data is functions.

The structure of SymbMath language
is:

data -> expression
-> statement -> program

Note that upper and lower case
letters are different in SymbMath language, (e.g. abc is different from ABC)
until the switch lowercase := on.

In the following examples, a line of
"IN: " means input, which you type in the Input window, then leave
the Input window by <Esc>, finally run the program by the command
"Run"; while a line of "OUT:" means output. You will see both
input and output are displayed on two lines with beginning of "IN: "
and "OUT: " in the Output window. You should not type the word
"IN: ". Some outputs may be omit on the examples.

#
is a comment statement.

You can split a line of command into multi-lines
of command by the comma ,. The comma without any blank space must be the last
character in the line.

The data types in SymbMath language is the
numbers, constants, variables, functions, equations, arrays, array index,
lists, list index, and strings. All data can be operated. It is not necessary
to declare data to be which type, as SymbMath can recognise it.

The range of the output real numbers
is the same as input when the switch numeric := off, but when the switch
numeric := on, it is

-inf, -1.E300 to -1.E-300, 0,
1.E-300 to 1.E300, inf.

It means that the number larger than
1.e300 is converted automatically to inf, the absolute values of the number
less than 1.e-300 is converted to 0, and the number less than -1e300 is
converted to -inf.

For examples:

-------------------------------------------

NumbersType

23integer

2/3rational

0.23real

2.3E2real

2+3*icomplex

2.3+icomplex

---------------------------------------------

That "a" and "b"
are the same means a-b = 0, while that they are different means a-b <> 0.

For the real numbers, the upper and
lower case letters E and e in exponent are the same, e.g. 1e2 is the same as
1E2.

Notice that the discont and
undefined constants are different. If the value of an expression at x=x0 is
discont, the expression only has the one-sided value at x=x0 and this one-sided
value is evaluated by x=x0+zero or x=x0-zero. If the value of an expression at
x=x0 is undefined, the expression may be evaluated by the function lim().

The sequence of characters is used as the
name of variables. Variable names can be up to 128 characters long. They must
begin with a letter and use only letters and digits.SymbMath knows upper and lower case distinctions
in variable names, so AB, ab, Ab and aB are the different variables. They are
case sensitive until the switch lowercase is set to on (i.e. lowercase := on).

Variables can be used to store the
results of calculations. Once a variable is defined, it can be used in another
formula. Having defined X as above, you could define Y := ASIN(X). You can also
redefine a variable by storing a new value in it.If you do this, you will lose the original
value entirely.

Assign a result to a variable, just
put

<var-name> :=expression

e.g.x := 2 + 3# assign value to x

Variables can be used like constants
in expressions.

For example:

a := 2 + 3

b := a*4

If an undefined variable is used in
an expression, then the expression returns a symbolic result (which may be
stored in another variable).Pick an
undefined variable name, say x, and enter:

y := 3 + x# formula results since x undefined

x := 4# Now x is defined

y# y returns 7, but its value is still the
formula 3 + x

x := 7# revalue x

y# new value for y

Note that in symbolic computation,
the variable has not only a numeric value but also a symbolic value.

Symbolic values for variables are
useful mostly for viewing the definitions of functions and symbolic
differentiation and integration.

Watch out for infinite recursion
here.Defining

x := x+3

when x has no
initial value, it will not cause an immediate problem, but any future reference
to xwill result in an infinite
recursion !

A value can be assigned to the
variable, by one of three methods:

(1) the assignment :=,

(2) the user-defined function f(),

(3) subs(y, x = x0).

e.g.

y:=x^2

x:=2# assignment

y

f(2)# if f(x) has
been defined, e.g. f(x_):=x^2.

subs(x^2, x = 2)# evaluate x^2 when x =
2.

The variable named last is the
built-in as the variable last is always automatically assigned the value of the
last output result.

The usual used independent variable
is x.

By default, |x| < inf and all
variables are complex, except that variables in inequalities are real, as usual
only real numbers can be compared. e.g. x is complex in sin(x), but y is real
in y > 1.

You can restrict the domain of a
variable by assuming the variable is even, odd, integer, real number, positive
or negative (see Chapter Simplification and Assumption).

These are two types of functions: internal
and external. The internal function is compiled into the SymbMath system. The
external function is the library written in SymbMath language, which is
automatically loaded when it is needed. (See Chapter Library and Package). The
usage of both types are the same. You can change the property or name of the
external function by modifying its library file, or you add a new external
function by creating its library file, but you cannot change the internal
function.

Different versions of SymbMath have
different number of standard mathematical functions. The Advanced Version C has
all of them. See the following table in detail for other versions. All below
standard functions, (except for random(x), n!, fac(n) and atan2(x,y)), can be
differentiated and integrated symbolically.

If a second argument x is omitted in
the functions d(y) and integrate(y), they are implicit derivatives and
integrals. If f(x) is undefined, d(f(x), x) is differentiation of f(x). These
are useful in the differential and integral equations. (see later chapters).

For examples:

integrate(integrate(F,x), y) is
double integral of F with respect to both variables x and y.

You can define the new functions, which
include the standard functions, calculus functions, and algebraic operators.

Define a new function f(x) by

f(x_) := x^2

and then call f(x)
as the standard functions. The function name can be any name, except for some
keywords. (for the maximum number of arguments, see ChapterSystem Limits).

Clears a variable or function from
assignment by

clear(x)# clear x from assignment.

clear(f(x))# clear f(x) from assignment.

clear(a>0)# clear a>0 from assignment.

Variables can be used in function
definitions. It leads to an important difference between functions and
variables.When a variable is defined,
all terms of the definition are evaluated.When a function is defined, its terms are not evaluated; they are
evaluated when the function is evaluated. That means that if a component of the
function definition is changed, that change will be reflected the next time the
function is evaluated.

A procedure is similar to a function, but
the right side of assignment in its definition is multi statements grouped by
block(). The block(a,b,c) groups a,b,c and only returns the last argument as
its value, or returns the second last argument as its value if the last
argument is local(). It is used as grouper in definition of a procedure. All
variables in block are local.

e.g. f(x_):=block(p:=x^6,p)

Remember that you can split a line
of program into multi-lines program at comma,.

An equation is an equality of two sides
linked by an equation sign =, e.g. x^2+p = 0, where the symbol = stands for an
equation. Note that the symbols "=", "==" and
":=" are different: ":=" is the assignment, "=="
is the equal sign, but "=" is the equation sign.

A string is a sequence of characters
between two quotation marks. e.g. "1234567890". Note that 1234 is
number but "1234" is string. The number can be calculated and only
has 11 of max digits, while string cannot be calculated and has 64000 of max
characters long.

Note that the output of strings in
SymbMath is without two quotation marks. This makes text output to graph and
database more readable.

Strings can be stored in variables,
concatenated, broken, lengthen, and converted to numbers if possible.

The expressions (i.e. expr) are made up of
operators and operands. Most operator are binary, that is, they take two
operands; the rest are unitary and take only one operand. Binary operators use
the usual algebraic form, e.g. a+b.

There are two kinds of expressions:
numeric and Boolean. The numeric expression is combination of data and algebraic
operators while the Boolean expression is combination of data and relational
operators and logic operators. These two kinds of expressions can be mixed, but
the numeric expression has higher priority than Boolean operators. x*(x>0)
is different from x*x>0. x*x>0 is the same as (x*x)>0.

Before you can write loops, you must be
able to write statements that evaluate to 1 or 0, and before you can do that,
you must be able to write useful statements with logical values. In
mathematics, these are relational statements.

SymbMath uses the logical operators:AND, and OR.You can combine comparison operators with them to any level of
complexity. In contrast to Pascal, logical operators in SymbMath have a lower
order or precedence than the comparisons, so a < bandc
> d works as expected.The result of
combining logical values with

logical operators is
another logical value (1 or 0).Bit
operations on integers can be performed using the same operations, but result
is integers.

SymbMath uses the
"short-circuit" definition of AND and OR when the arguments are
Boolean.Here are tables that show how
AND and OR are defined:

a and b

--------------------------------------------------------

b10

a

110

000

------------------------------------------------------

a or b

--------------------------------------------------------

b10

a

111

010

------------------------------------------------------

Short-circuit evaluation is used
because often one condition must be tested before another is meaningful.

The result of Boolean expression
with logic operators is either 1 or 0. Boolean expression like (1 < 3 or 1
> 4) return a real value 1 or 0.Numeric expressions can replace Boolean ones, provided they evaluate to 1
or 0.The advantage here is that you can
define the step function that is 0 for x < a and 1 for x > a by entering:

A function call activates the function
specified by the function name. The function call must have a list of actual
parameters if the corresponding function declaration contains a list of formal
parameters. Each parameter takes the place of the corresponding formal
parameter. If the function is external, the function call will automatically
load the library specified by its function name plus extension when needed.

The assignment in SymbMath language is
similar to assignment in such language as PASCAL.

An assignment operator is:=

The assignment statement specifies
that a new value of expr2 be assigned to expr1, and saved into memory. The form
of the assignment statements is

expr1 := expr2;

You can use assignment for storing
result.

You can assign the result of
calculation or any formula to a variable with a command like:X := SIN(4.2).

The assignments are useful for long
calculations.You can save yourself a
lot of recalculations by always storing the results of your calculations in
your own variables instead of leaving them in the default variable last.

You can destroy the assignment to X with the
command clear(X). If X stored a large list, you could regain a considerable
amount of memory by clearing X. Also, since a variable and a function can have
the same name, you can clear a variable p, not a function p(x).

The assignment operator is also used
in the definition of a function or procedure.

Variables can be used in function
definitions, and that leads to an important difference between functions and
variables.When a variable is defined,
all terms of the definition are evaluated.When a function is defined, its terms are not evaluated; they are
evaluated when the function is evaluated.That means that if a component of the function definition is changed,
that change will be reflected the next time the function is evaluated.

e.g.

IN:p:=2+3#
2+3 is evaluated at the time of assignment, p is assigned with 5.

OUT: p := 5

IN:p(x):=2+3#
2+3 is evaluated when the value of p(x) is requested,

# p(x) is
assigned with 2+3.

OUT: p(x) := 2+3

If the left hand side of the
assignment is a variable, it is the immediate assignment (i.e. expr2 is
evaluated at the time of assignment); if the left hand side is a function, it
is the delayed assignment (i.e. expr2 is evaluated when the value of expr1 is
requested).

You can force all the components of
a function to be evaluated when the function is defined by preceding the
function with the command eval():

f(x_) := eval(2+3)# f(x_) is assigned with 5

Note that not only a variable but also
any expression can be assigned. e.g. x := 2, sin(x)/cos(x) := tan(x), a>0 :=
1.

If(condition , x , y)
gives x if condition evaluates to 1, y if it evaluates to 0, or no output if it
evaluates to neither 1 or 0. The 2 words (then and else) can be replaced by
comma ,.

It is useful in definition of the
use-defined function to left the function unevaluated if the argument of the
function is not number. e.g. define f(x_) := If(isnumber(x), 1), then call
f(x), f(10) gives 1, and f(a) gives f(a).

The filename is any MS-DOS file
name. If the file is not in the current directory, the filename should include
the directory. e.g.

readfile("directory\filename")

e.g. read a file named "int.sm":

readfile("int.sm")

It seems to copy the file into the
user program.

After a file is read, you can call
any part of this package from a second package, as it seems the part of the
first program has already been in the second program. you can read many files
into the SymbMath program at a time. However, all names of the variables are public
and name conflicts must be avoided.

Note that the file must be closed by
the closefile() command when writing a file with the openfile() command, but
the file is automatically closed after reading the file. There must be the end
statement at the end of file for reading.

SymbMath can read expressions from a
disk file, then manipulate the expression, and finally write the result into
another disk file.

The all above statements are simple
statements. The sequence statement specifies that its component statements are
to be executed in the same sequence as they are written. They are separated by
the separators (comma ","). e.g.

A library is a file of an external
function, which filename is its function name within 8 letters plus extension .
e.g. the library named sin is a file of the sin(x) function definition.

The library (the * file) is similar
to the MS-DOS *.BAT file. You do not need to load or read the library by any
command. SymbMath automatically load the library when it is needed. For
example, when you use the sin(x) function first time, the library sin will be
auto-loaded. The library must be in the default directory, otherwise the
library is not loaded and the function is not working. Only the assignments in
the library can be loaded, and others in the library will be omitted, but all
of these assignments will be not evaluated when they are loaded. You can clear
the library sin from memory by clear(sin(x)).

You can have libraries (external
functions) as many as your disk space available. You should use the "one
function per file" convenience.

Note that all names of the variables
in libraries and packages are public (global) except for those declared by
local() and name conflicts must be avoided.

A package is the SymbMath program
file which filename has notextension .
It is recommended that its filename has the extension .SM.

A package is similar to a library,
but the package must be read by a command

readfile("filename")

The filename can be any MS-DOS
filename. It is recommended that the filename is same function name used in
your program, plus the extension .sm. e.g. int.sm is the filename of the
integral package as the name of integral function is integrate(). If the file
is not in the current directory, the filename should include the directory.
e.g.

readfile("directory\filename")

After reading the package, you can
call the commands in the package from your program.

The readfile() command must be in a
single line anywhere.

Many packages can be read at a time.

You can convert a package of f.sm
into a library by renaming f.sm to f for auto loading, or a library f to a
package by renaming f to f.sm for not auto loading.

You can get help for all libraries
by the library Index command in the Help menu. You first open the library index
window by this command, then open a library by selecting its library name in
the library index window.

There are many libraries and
packages. The following are some of them.

When a program is run in the Input window,
SymbMath first automatically reads (or runs) the initial package
"init.sm". The commands in the "init.sm" package seems to
be the SymbMath system commands. You can read other packages (e.g. f.sm) in the
initial package "init.sm", so the commands in the package
"f.sm" seems to be in SymbMath system. You do this by adding the
readfile("f.sm") into the init.sm file:

You can run SymbMath from another software
as a engine. Anthoer software sends a text file to SymbMath, then run SymbMath
in background, get result back from SymbMath.

Interface
with other software, (e.g. CurFit, Lotus 123) is similar to interface with the
software PlotData in the plotdata package "plotdata.sm".

After load the file
"plotdata.sm", the functions

plotdata(y, x)

plotdata(y, x from xmin
to xmax)

plotdata(y, x from xmin
to xmax step dx)

plot a function of y
by mean of the software PlotData. The plotdata() first opens a file
"SymbMath.Out" for writing, then write the data table of the y
function into the file "SymbMath.Out", then close the file, and
finally call the software PlotData to plot. These are done automatically by
plotdata(). After it exits from PlotData, it automatically return to SymbMath.

When SymbMath is interfaced with the
software PlotData, SymbMath produces the data table of functions, and PlotData
plots from the table. So SymbMath seems to plot the function. This interface
can be used to solve equations graphically.

Example:

plot x^2 by
interfacing software PlotData.

IN:readfile("plotdata.sm")

IN:plotdata(x^2, x)

in the software
PlotData, you just select the option to read the file "SymbMath.Out"
and to plot. PlotData reads the data in the SymbMath format without any
modification (and in many data format).

On
both monochrome and color systems, you can draw lines and graphs with different
line styles.(Since the line segments
used to draw graphs are usually very short, different line styles may not be
distinguished in graphs, but they will be distinguished on long lines.)Linestyles are indicated by integers in the
range 0..3, and are set by the command:

setlinestyle(style,u,thickness)

where style, u and thickness are integers.

You
can set the text style by

settextstyle(font,direction,size)

where font, direction and size are integers.

You
can add labels to your graphs by

writes(s)

You
can put alphanumeric labels anywhere on your graphic screens. They can be horizontal
or vertical, and they can be printed in various sizes. To print a stringshorizontally on the screen with the lower-left corner at the screen
coordinates (x,y), use two commands:

moveto(x,y),
writes(s)

To write vertically bottom to top, use two
commands:

settextstyle(1,2,2),
writes(s)

If
SymbMath attempts to graph a point (x,y) which is outside the the screen
coordinate, it ignores the point and continues.No error message is generated, and even functions which are undefined on
part of the graphing domain can be graphed.

You
can get the max x and max y on your graphics screen

coordinates by

getmaxx

getmaxy

You
can get the current point(x, y) on your graphics screen coordinates by

getx

gety

You
can get the background color and foregroud color on your graphics screen by

getbkcolor

getcolor

You
can read a character from the keyboard or pause by the command:

readchar

You
can clear graph by

cleardevice

SymbMath
auto goes back the text mode at the end of run. You can force it goes back the
text mode by the command:

You can plot a function of y = f(x) on the
xy-plane by external function:

plot(f(x),x)

plot(f(x),x,xmin,xmax)

plot(f(x),x,xmin,xmax,ymin,ymax)

plot(f(x),x,xmin,xmax,ymin,ymax,color)

f(x) can be either a
functionwith bound variable x or an
expression involving x.For example, you
could graph the parabola with the command plot(x^2,x).

The xmin and xmax are range of
x-axis, the ymin and ymax are range of y-axis. The default values are xmin=-5,
xmax=5, ymin=-5, and ymax=5. The values of xmin, xmax, ymin, ymax are real
numbers, such thatxmin < xmaxandymin < ymax.Thses values tell
SymbMath that the visible screen corresponds to a portion of the xy-plane
withxmin <= x <= xmaxandymin <= y <= ymax.

The operator plot() plots one point
(x,f(x)) for each pixel on the x-axis, and connects successive points.To omit the connections and just plot the
points, use the command:

dotplot(f(x),x)

To plot only every 20th point, which
is useful for rapidly graphing complicated functions, use

sketch(f(x),x)

If you want your circles and squares
to look correct --that is, if you want one vertical unit to be really the same
distance as one horizontal unit--you should select window parameters so that
the horizontal axis is 1.4 times as long as the vertical axis.