home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
utility
/
sm22a.zip
/
SYMBMATH.DO3
< prev
next >
Wrap
Text File
|
1993-04-20
|
30KB
|
922 lines
SymbMath 2.2: A Symbolic Calculator with Learning
(Version 2.2)
by Dr. Weiguang HUANG
Dept. Analytical Chemsitry, University of New South Wales,
Kensington, Sydney, NSW 2033, Australia
Phone: 61-2-697-4643
Fax: 61-2-662-2835
E-mail: w.huang@unsw.edu.au
Copyright (C) 1990-1993
April 15, 1993
This is Part Three of SymbMath manual. The SymbMath manual has
three parts in the files SymbMath.DOC, SymbMath.DO2 and SymbMath.DO3.
11. Inside SymbMath
As an expert system, SymbMath consists of three major
components: a knowledge base, an inference engine, and a global data
base. The knowledge base is a set of rules, the inference engine is a
rule interpreter for utilizing the knowledge base in the solution of
the problem, and the global data base is a working memory for keeping
track of the problem status, the data from the data file for the
particular problem, and the solution of sub-problems. In addition, it
contains a natural language interface for input and output natural
languages (e.g. mathematical formulas, chemical reactions).
User Library disk
/|\ | /|\
| | |
\|/ \|/ \|/
------------------------------
| Natural Language Interface |
------------------------------
/|\
|
\|/
------------------------------
------->| Inference Engine |<----------
| ------------------------------ |
\|/ \|/
------------------ --------------------
| Knowledge Base | | Global Data Base |
------------------ --------------------
/|\
|
--------------------
| Data File |
--------------------
Figure 11.1 Base structure of SymbMath
Table 11.1 Characteristics of SymbMath
--------------------------------------------------------------------
Function: Symbolic computation.
Domain: Mathematics, chemistry.
Search direction: Forward chaining.
Control mechanism: Guessing and test, pattern match.
Search space transformations: Break into sub-problems.
Knowledge base representation: Rules.
Developer interface: Learning, programming, library.
User interface: Pull-down menu, pop-up menu, multi-windowed
text editor, help, windows.
System interface: numeric computation software, graphic
software (e.g. PlotData), etc.
Input format: Math formulas, numbers, BASIC or FORTRAN
codes, chemical symbols and reactions.
Output format: Math notation, BASIC or FORTRAN codes,
chemical reaction equations.
Input from: Keyboard, disk.
Output to: Screen, disk, printer.
Tool language: Prolog.
Computer: IBM PC.
Memory: 420 KBytes.
Operating system: MS-DOS.
---------------------------------------------------------------------
12. System limits
1. The maximum character of a symbol is 64000.
2. The maximum character of an expression is 64000.
3. The range of the input real numbers is
-inf, -(10^307)^(10^307) to -(10^-307)^(10^-307), 0, (10^-307)^(10^-307)
to (10^307)^(10^307), inf.
4. The range of the output real numbers is the same as input
when the switch Numerical=Off, but when the switch Numerical=On, it is
-inf, -1.E307 to -1.E-307, 0, 1.E-307 to 1.E307, inf.
5. The maximum digit of the input numbers is 64000.
6. The maximum digit of the stored numbers is 16.
7. The maximum digit of the output numbers is 11.
8. The maximum digit of the rational numbers is 16.
9. The maximum arguments of the user-defined function with
pattern is 5.
10. The maximum arguments of the user-defined rule is 2 and the
maximum number of the pattern is 1.
13. Keywords
SymbMath has three versions: Shareware Version A, Student
Version B and Advanced Version C. The shareware version lacks the
solve(), dsolve(), trig (except sin(x)), and hyerbolic functions on
input, and the student version lacks the hyerbolic and dsolve()
functions on input. You cannot input these lacked functions, but all
versions can output all functions.
Upper- and lower-case letters are different until the switch
lowercase is set to on (i.e. lowercase=on).
All keywords are lower-case letters until the switch lowercase
is set to on.
The following special symbols (about 130 words) only include
the keywords in the SymbMath system and the initialization package
init.sm.
13.1 Keywords in Functional Order
---------------------------------------------------------------------
1. Built-in constants: i, e, pi, inf, zero, constant, discont,
undefined, complex_inf.
2. Built-in variables: last.
3. Negative and positive: -, +.
4. Algebraic operators: +, -, *, /, ^, **, ().
5. Relational operators: ==, >, >=, <, <=, <>.
6. Logic operators: and, or.
6. Algebraic functions: -x, sqrt(x), n!, fac(n), mod(x,y), div(x,y).
7. Complex functions: re(x), im(x), abs(x), arg(x), sgn(x).
8. Exponential functions: exp(x), ln(x), ei(n,x), gamma(n,x).
9. Trig functions: sin(x), cos(x), tan(x), csc(x), sec(x), cot(x),
asin(x), acos(x), atan(x), acot(x), asec(x), acsc(x),
atan2(x,y).
10. Hyperbolic functions: sinh(x), cosh(x), tanh(x), csch(x), sech(x),
coth(x), asinh(x), acosh(x), atanh(x), acoth(x), acsch(x),
asech(x).
11. Assignments: =, :=.
12. Equation: ===.
13. User-defined functions: f(x_):=x^2, f(x_):=if(isnumber(x),x^2).
14. User-defined rules: d(si(x_),x_):=sin(x)/x.
15. Calculus functions:
d(y,x), d(y,x,order), d(y, x=x0), d(y, x=x0, order),
inte(f,x), inte(f,x,xmin,xmax),
dsolve(d(y)/d(x)===f(x,y), y),
subs(y, x=x0), lim(y, x=x0),
sum(f, x,xmin,xmax,dx), prod(f, x,xmin,xmax,dx),
16. Transformation functions: expand(expr), factor(expr),
solve(x^2===a,x), coef(expr,x), left(x===a), right(x===a),
float(x), ratio(x), round(x), trunc(x),
table(p[x], x,xmin,xmax,dx).
17. Numeric computation: num(expr).
18. Test function: isodd(x), iseven(x), isinteger(x), isreal(x),
isnumber(x), islist(x), isfree(y,x).
19. Table: table(f, x,xmin,xmax,dx).
20. List: [a,b], list(f, x,xmin,xmax,dx), length([a]).
21. Element of list: f[1], last[1].
22. Switches: numerical, output, expand, expexpand, lnexpand, lowercase,
=, on, off, basic, fortran, prolog, twodim.
23. Commands: system(dos), clear(x), block(), null.
24. Separators: "," , from, to, step.
25. Assume: assume(a>0), isreal(x)=1.
26. Rule: if(test, then), if(test, then, else).
27. Loop: do(expr, x,xmin,xmax,dx), repeat(expr, test).
28. Input: include('filename').
29. Output: openfile('filename'), closefile('filename').
30. Plot: plot(x^2,x).
31. Comment: #.
32. Action: done, cleared, assumed.
--------------------------------------------------------------------
13.2 Keywords in Alphabetical Order
----------------------------------------------------------------------
abs(x) acos(x) acosh(x) acot(x) acoth(x)
acsc(x) acsch(x) arg(x) asec(x) asech(x)
asin(x) asinh(x) assume(x>0) assumed atan(x)
atan2(x,y) atanh(x)
basic block()
clear(x) cleared closefile() coef(f,x) complex_inf
constant cos(x) cosh(x) cot(x) coth(x)
csc(x) csch(x)
d() div(x,y) discont do() done
dsolve(eq,y)
E e ei(n,x) end exp(x)
expand(f) expand expexpand
fac(x) factor(expr) float(x) fortran from
gamma(n,x)
i if() im(x) include('file') inf
inte() iseven(x) isfree(y,x) isinteger(x) islist(x)
isodd(x) isreal(x) isnumber(x)
last left(x===a) length([a]) lim() list()
ln(x) lnexpand lowercase
mod(x,y)
null num(expr) numerical
off on openfile() output
pi plot() prod() prolog
ratio(x) re(x) repeat() right(x===a) round(x)
sec(x) sech(x) sgn(x) sin(x) sinh(x)
solve(eq,x) sqrt(x) subs(f,x=x0) sum() step
system(dos)
table() tan(x) tanh(x) to trunc(x)
twodim
undefined
zero
+ - * / ^
** () [] = :=
== === > >= <
<= <> ! # ,
-----------------------------------------------------------------------
13.3 Glossary
--------------------------------------------------------------------
* abs
abs(x) is the absolute value function of x. x can be complex numbers.
Absolute value of the complex number x is defined by
sqrt(re(x)^2+im(x)^2). The results are in the range 0 to inf.
e.g. abs(-1) gives 1, abs(-i) gives -1.
See also: sgn, re, im.
* acos
acos(x) is the arc cosine function of x. The inverse function of
cos(x). The result is given in radians.
See also: cos.
* acosh
acosh(x) is the inverse hyerbolic cosine function of x.
The inverse function of cosh(x).
See also: cosh.
* acot
acot(x) is the arc cotangent function of x. The inverse function
of cot(x). The result is given in radians. acot(x)=atan(1/x).
See also: cot, atan.
* acoth
acoth(x) is the inverse hyperbolic cotangent function of x. The
inverse function of coth(x). acoth(x)=atanh(1/x).
See also: coth, atanh.
* acsc
acsc(x) is the arc cosecant function of x. The inverse function of
csc(x). The result is in radians. acsc(x)=asin(1/x).
See also: csc, asin.
* acsch
acsch(x) is the inveres hyperbolic cosecant function of x. The
inverse function of csch(x). acsch(x)=asinh(1/x).
See also: csch, asinh.
* arg
arg(x) gives the argument of x. It gives the phase angle of x in
radians. Its result is in the range > -pi to <= pi. arg(x)=
atan2(re(x),im(x)). x can be complex number. For real x, arg(x)=0.
See also: abs, sgn, atan2.
* asec
asec(x) is the arc secant function of x. The inverse function of
sec(x). The result is given in radians. asec(x)=acos(1/x).
See also: sec, acos.
* asech
asech(x) is the inverse hyperbolic secant function of x. The inverse
function of sech(x). asech(x)=acosh(1/x).
See also: sech, acosh.
* asin
asin(x) is the arc sine function of x. The inverse function of
sin(x). The result is given in radians.
See also: sin.
* asinh
asinh(x) is the inverse hyperbolic sine function of x. The inverse
function of sinh(x).
See also: sinh.
* assume
assume(x > 1), or assume(x < 1), assumes a variable x > 1, or x < 1.
All variables are assumed as complex by default.
e.g. assume(x>0), assume(x<0), or isreal(x) := 1.
See aslo: sgn, isodd, iseven, isinteger, isreal, isnumber.
* assumed
assumed points out that the variable has been assumed.
See also: assume.
* atan
atan(x) is the arc tangent function of x. The inverse function of
tan(x). The result is given in radians.
See also: tan.
* atan2
atan2(x,y) returns the radian angle of (x,y).
atan2(x,y) = sgn(y)*pi/2 if x=0
= atan(y/x) if x>0
= atan(y/x)+pi if x<0, y>=0
= atan(y/x)-pi if x<0, y<0 .
Thus atan2(x,y) takes its value larger than -pi less or equal to pi.
* atanh
atanh(x) is the inverse hyperbolic tangent function of x. The inverse
function of tanh(x).
See also: tanh.
* basic
basic is a value of the switch output. It sets output in BASIC format.
e.g. output=basic.
See also: output, on, off, fortran, prolog.
* block
block(a,b,c) return only the last argument.
e.g. block(a,b,c) gives c.
* clear
clear(expr) clears values and definitions for the variable, function or
expression expr from memory.
e.g. clear(p), clear(f(x)).
* cleared
It says that the variable, function or expression has been cleared
from memory.
See also: clear.
* closefile
closefile('filename') closes the file 'filename' and return the output
to screen. The filename is any MS-DOS file name.
See also: openfile, include.
* coef
coef(expr,form) gives the coefficient of form in the polynomial expr.
It picks only terms that contain the particular form specified. x is
not considered part of x^6.
e.g. coef(2*x^6+x+4, x^6) gives 2, coef(2*x^6+x+4, x) gives 1.
* complex_inf
The complex infinite, both real and imaginary parts of complex numbers
are infinity, as the built-in constant. complex_inf=inf+inf*i,
inf-inf*i, -inf+inf*i, or -inf-inf*i.
See also: inf.
* constant
The indefinite integral constant.
* cos
cos(x) is the cosine function of x. The angle x is measured in radians
(multiply by degree to convert from degrees). x can be complex numbers.
See also: acos, sec.
* cosh
cosh(x) is the hyerbolic cosine function of x.
cosh(x)=(exp(x)+exp(-x))/2. x can be complex numbers.
See also: acosh.
* cot
cot(x) is the cotangent function of x. The angle x is measured in radians.
(multiply by degree to convert from degrees). cot(x)=1/tan(x).
See also: acot, tan.
* coth
coth(x) is the hyerbolic cotangent function of x. coth(x)=1/tanh(x).
See also: acoth, tanh.
* csc
csc (x) is the cosecant function of x. The angle x is measured in
radians (multiply by degree to convert from degrees). csc(x)=1/sin(x)
x can be complex numbers.
See also: acsc, sin.
* csch
csch(x) is the hyperbolic cosecant function of x. csch(x)=1/sinh(x).
x can be complex numbers.
See also: acsch, sinh.
* d
d() gives the partial derivative.
d(f, x) differentiate y with respect to x.
e.g. d(x^2/d(x)) gives 2*x.
d(f, x, n) gives the n-th order derivative of f with respect
to an undefined variable x.
d(f, x=c) gives the derivative of f with respect to an
undefined variable x at x=c.
d(f, x=c, n) gives the n-th order derivative of f with respect
to an undefined variable x at x=c.
d(y) implicit differentiation, used in differential
equations, e.g. x*d(x)+y*d(y) === 0.
* degree
degree gives the number of radians in one degree. degree=pi/180.
You can multipy by degree to convert from degree to radians.
e.g. 45*degree, sin(45*degree).
See also: pi.
* discont
The discontinuity. If the function value is discont, the function has
a discontinuity and only has the one-sided limit at x=c. Users should
evaluate its left-sided limit or right-sided limit by x=c-zero or
x=c+zero.
* do
do(expr, x,xmin,xmax,dx) evaluates expr with the x looping from xmin
to xmax on step dx.
e.g. x=1, do(x=x+1, j,1,5,1) gives x=5.
* done
It indicates that the action has been done.
* dsolve
dsolve(d(y)/d(x)===f(x,y), y) solves the first order variables
separable and linear differential equations. The d(y)/d(x) must be
alone on the left hand side of the equations.
e.g. dsolve(d(y)/d(x) === x*y + 1, y).
See also: solve, nsolve.
* E
E is the exponential part of a floating point number. e.g. 1.1E2 is the
same as 1.1*10^2.
See also: e, exp.
* e
(1) e is the exponential constant (baes of natural logarithms),
e=2.718..., the built-in constant, e is converted to 2.718... when the
switch Numerical=On. e^x is the same as exp(x).
e.g. e^2, e^x.
(2) e is the exponential part of a floating point number, the same as E.
e.g. 1.1e2 is the same as 1.1E2.
See also: E, exp.
* ei
ei(n,x) is the exponential integral function En(x),
ei(n,x)=inte(t^n*e^t, t,-inf,x), d(ei(n,x),x)=x^n*e^x, ei(-1, x)=ei(x),
ei(0,x)=e^x.
ei(x) is the exponential integral function Ei(x),
ei(x) = inte(e^t/t, t,-inf,x), d(ei(x),x)=e^x/x,
See also: gamma.
* erf
erf(x) is the error function of x. It is the probability integral
function or the integral of the Gaussian distribution. erf(x)=
2/sqrt(pi)*inte(exp(-t^2),t,0,z).
* exp
exp(x) is the exponential function of x (base of e). The same as e^z,
e=2.718... It is the inverse to ln(x). x can be complex numbers.
See also: ^.
* expand
expand(expr) expands out products and positive powers in expr.
expand works only on positive integer powers.
e.g. expand((a+b)^2) gives a^2 + 2*a*b + b^2.
See also: factor.
the switch of expansion.
expand=on e.g. c*(a+b) to c*a+c*b.
expand=off disable expansion, this is default.
* expexpand
The switch of exponential expansion.
expexpand=on e.g. c^(a+b) to c^a*c^b.
expexpand=off disable exponential expansion, this is default.
* fac
fac(n) is the factorial function of n. The same as n!.
e.g. fac(3) gives 6.
See also: n!.
* factor
factor(expr) factorises from expr.
e.g. factor(a^2 + 2*a*b + b^2) gives (a+b)^2.
See also: expand, Expand, ExpExpand, LnExpand.
* float
float(x) converts x to the floating-point number.
e.g. float(1/2) gives 0.5.
See also: ratio.
* fortran
fortran is the value of the switch Output. It forces the output in
Fortran format.
e.g. output=fortran.
See also: output, basic, twodim, prolog, on, off.
* from
The separator, the same as the comma (,).
* gamma
gamma(n,x) is the incomplete gamma function, gamma(n,x)=
inte(t^n*e^(-t), t,0,x), d(gamma(n,x),x)=x^n*e^(-x).
gamma(n,0)=0, gamma(n,inf)=gamma(n+1)=n!.
gamma(n) is the gamma function Γ(n), gamma(n)=inte(t^(n-1)*e^(-t), t,0,inf).
gamma(n,x) is similar to gamma(n), but its power term is t^n, instead
of t^(n-1). gamma(n)=(n-1)!.
See also: ei.
* i
i represents the imaginative unit of the complex numbers, i=sqrt(-1),
as the built-in constant.
e.g. 1+2*i.
See also: re, im.
* if
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.
if(condition, x) gives x if condition evaluates to 1, or no
output otherwise.
It is useful in definition of the use-defined function to left the
function unevaluted 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).
See also: :=, =.
* im
im(x) gives the imaginative part of the complex number x.
e.g. im(1+2*i) gives 2.
See also: re, abs, sgn, arg.
*include
include('filename') includes (or runs) the file 'filename'. The filename
is any MS-DOS file name.
See also: openfile, closefile.
* inf
inf is a positive infinity, as the built-in constant.
e.g. inf+2*inf gives inf, 1/inf gives 0.
See also: complex_inf.
* inte
The integral function.
inte(f,x) find the indefinite integral of f with respect
to an undefined variable x.
inte(f,x,xmin,xmax) find the definite integral of f with respect to
an undefined variable x taken from x=a to x=b.
inte(y) implicit integration, used to integrate the
differential equations.
See also: ninte.
* iseven
iseven(x) gives 1 if x is an even integer, or 0 otherwise.
You can assume x is even by iseven(x) := 1.
e.g. iseven(2) gives 1, iseven(3) gives 0.
See also: isodd, isinteger, islist, isreal, isnumber, isfree, sgn.
* isfree
isfree(y,x) gives 1 if y is free of x, or 0 otherwise.
You can assume y is free of x by iseven(y,x) := 1.
e.g. isfree(a*b,x) gives 1, isfree(x*y,x) gives 0.
See also: isodd, isinteger, islist, isreal, isnumber, isfree, sgn.
* isinteger
isinteger(x) gives 1 if x is an integer, or 0 otherwise.
You can assume x is integer by isinteger(x) := 1.
e.g. isinteger(2) gives 1, isinteger(3.2) gives 0.
See also: iseven, islist, isodd, isreal, isnumber, isfree, sgn.
* islist
islist(x) gives 1 if x is a list, or 0 otherwise.
You can assume x is a list by islist(x) := 1.
e.g. islist([a]) gives 1, islist(3.2) gives 0.
See also: iseven, isinteger, isodd, isreal, isnumber, isfree, sgn.
* isodd
isodd(x) gives 1 if x is an odd integer, or 0 otherwise.
You can assume x is odd by isodd(x) := 1.
e.g. isodd(3) gives 1, isodd(2) gives 0.
See also: iseven, isinteger, islist, isreal, isnumber, isfree, sgn.
* isreal
isreal(x) gives 1 if x is real, or 0 otherwise.
You can assume x is real by isreal(x) := 1.
e.g. isreal(2.2) gives 1, isreal(a) gives 0.
See also: iseven, isodd, isinteger, islist, isnumber, isfree, sgn.
* isnumber
isnumber(x) gives 1 if x is a number, or 0 otherwise.
You can assume x is a number by isnumber(x) := 1.
e.g. isnumber(2.2) gives 1, isnumber(a) gives 0.
See also: iseven, isodd, isinteger, islist, isreal, isfree, sgn.
* last
last represents the last output, as the built-in variable.
last[1] the first element of the last output list.
* left
left(x===a) gives the left hand side of an equation.
e.g. left(x+y===2) gives x+y.
See also: righ.
* length
length([a]) gives the length of a list (the number of member in the
list).
e.g. length([a]) gives 1, length([a,b,c]) gives 3.
See also: list.
* lim
lim(expr, x=x0) finds the limiting value of expr when x
approaches x0.
lim(expr, x=x0+zero) finds the right-sided limit as x approches x0
from the positive (+inf) direction (x -> x0+).
lim(expr, x=x0-zero) finds the left-sided limit as x approches x0
from the negative (-inf) direction (x -> x0-).
e.g. lim(sin(x)/x, x=0) gives 1.
Note that the correct answers are only for the indeterminate forms:
0/0, inf/inf, 0*inf, 0^0, inf^0.
See also: subs.
* list
list(f,x,xmin,xmax,dx) produces a list of f when x runs from xmin
to xmax on step dx.
e.g. list(x^2, x,1,3,1) gives [1,4,9].
See also: table, length.
* ln
ln(x) is the natural logarithmic function of x. Its base is e. It is
the inverse to exp(x). Warming that if it has multi-values, the ln(x)
only gives a principle value (P.V.) and other values are
P.V.+2*k*pi*i (where k=0, 1, 2,..., -1, -2, ...).
If x is complex number (x=A+B*i) then
ln(x)=ln(abs(x))+i*atan2(A,B).
See also: exp.
* lnexpand
The switch of the logarithmic expansion.
lnexpand=on log expansion, e.g. ln(a*b) is expanded into
ln(a)+ln(b).
lnexpand=off disable log expansion, this is default.
See also: expexpand, expand.
* lowercase
The swicth of the case conversion.
lowercase=on converts the letters to lower-case letters, e.g.
SIN(x) is converted to sin(x).
lowercase=off disables the case convertion, this is default.
It only effects the input.
* mod
mod(m,n) gives the remainder on division of m by n.
See also: div.
* n!
n! gives the factorial of n. The same as fac(n).
e.g. 3! gives 6.
See also: fac.
* num
num(expr) gives the numerical value of expr. It converts all numbers
to real form.
e.g. num(pi) gives 3.1416.
See also: numerical.
* numerical
The switch of numerical calculation.
numerical=on numerical computation.
numerical=off disable numerical computation, this is default.
See also: num.
* null
null is a symbol used to indicate the absence of an expression or a
result. When it appreas as an output expression, no output is printed.
e.g. block(output=on, null).
* off
When the switch is set to off, it is inactive.
e.g. numerical=off, output=off, expand=off.
* on
When the switch is set to on, it is active.
e.g. numerical=on, expand=on, expexpand=on, lnexpand=on, lowercase=on,
output=on.
* openfile
openfile('filename') opens the disk file 'filename' for writing. The
filename is any MS-DOS file name. After doing something, the file must
be closed by closefile('filename').
See also: closefile, include.
* output
The switch of the output format,
e.g. output=basic, output=fortran, output=twodim, output=on, output=off.
* pi
pi=3.1416..., as the built-in constant, pi is converted to 3.1416...
when the switch numerical=on.
* plot
plot(f,x,xmin,xmax,dx) generates a plot of f as a function of x from
xmin to xmax with step dx.
plot(f,x,xmin,xmax) plots a function with default step (xmax-xmin)*
0.05 (20 plot points).
plot(f,x) plots a function with the default range (-6 to 6)
and the default step (20 plot points).
* prod
prod(f,x,xmin,xmax,dx) evaluates the product of f when x runs from
xmin to xmax with step dx.
prod(f,x,xmin,xmax) with the default step dx = 1.
* prolog
prolog is the value of the switch output. It forces the output in the
Prolog format.
See also: output, basic, fortran.
* random
random(0) gives a uniformly distributed pseudorandom real in
the range 0 to 1.
random(n) gives a uniformly distributed pseudorandom integer
in the range 0 to n. (n < 36000).
e.g. random(0) gives 0.11111, random(5) gives 2.
* ratio
ratio(x) converts x to a rational number.
e.g. ratio(0.2) gives 1/5.
See also: float, num.
* re
re(x) gives the real part of the complex number x.
e.g. re(1+2*i) gives 1.
See also: im(x), abs(x), sgn(x).
* repeat
repeat(expr,test) repeats expr until test gives 1.
e.g. x=1, repeat(x=x+1, x>5) gives x=6.
See also: do.
* right
right(x===a) gives the right hand side of an equation.
e.g. right(x+y === 3) gives 3.
See also: left, solve.
* round
round(x) converts x to the rounded integer closest to x.
e.g. round(2.4) gives 2, round(2.5) gives 3.
See also: trunc.
* sec
sec(x) is the secant function of x. The angle x is measured in
radians (multiply by degree to convert from degrees). sec(x)=1/cos(x).
See also: asec, cos.
* sech
sech(x) is the hyperbolic secant function of x. sech(x)=1/cosh(x).
See also: asech, cosh.
* sgn
sgn(x) is the sign function of x. Its value is 1, 0 or -1.
/ 1 if re(x) > 0, or re(x) = 0 and im(x) > 0;
sgn(x) = 0 if x=0;
\ -1 otherwise.
You can assume x is positive or negative by sgn(x) := 1 or
sgn(x) := -1.
e.g. sgn(2) gives 1, sgn(1+i) gives 1.
See also: abs, re, im.
* sin
sin(x) is the sine function of x. The angle x is measured in radians.
(multiply by degree to convert from degrees).
See also: asin, csc.
* sinh
sinh(x) is the hyperbolic sine function of x.
sinh(x)=(exp(x)-exp(-z))/2.
See also: asinh, acsch.
* solve
solve(x^2===0, x) solves a polynomial ordered up to 4.
solve([expr1===expr2,expr3===expr4], [x,y]) solves systems of linear
equations.
It gives all symbolic solutions.
e.g. solve(x^2+5*x+6===0, x), solve([x+y===3, x-y===1], [x,y]).
See also: nsolve.
* sqrt
sqrt(x) is the square root function of x. It is the same as x^0.5.
It only gives the principal value (P.V.) (sgn(sqrt(x)) >= 0).
e.g. sqrt(4) gives 2, sqrt(2*i) gives 1+i.
See also: ^.
* subs
subs(expr, x=x0) substitutes x in expr by x0.
e.g. subs(x^2, x=a) gives a^2.
See also: lim.
* sum
sum(f,x,xmin,xmax,dx) evaluates the sum of f when x runs from xmin
to xmax with step dx.
sum(f,x,xmin,xmax) with the default step dx = 1.
e.g. sum(2^n,n,1,5,1.1), sum(x^n,n,1,5).
See also: prod, list, table.
* step
step is the separator, the same as the comma (,).
See also: from, to, ,
* system
system(DOS) executes the operating system (DOS) command.
e.g. system(dir).
* table
table(f,x,xmin,xmax,dx) produces a table of the function values when
x runs from xmin to xmax with step dx.
table(f,x,xmin,xmax) with the default step dx = 1.
table(y[x],x,xmin,xmax,dx) transforms a list y into a table.
e.g. table(x^2,x,1,4,1).
See also: list, plot.
* tan
tan(x) is the tangent function of x. The angle x is measured in
radians (multiply by degree to convert from degrees).
See also: atan, cot.
* tanh
tanh(x) is the hyperbolic tangent function of x.
See also: atanh, coth.
* to
to is the separator, the same as the comma (,).
See also: from, step, ,.
* trunc
trunc(x) converts x to the truncated integer.
e.g. trunc(2.9) gives 2.
See also: round.
* twodim
towdim is a value of the switch output. It forces output in two
dimension format.
e.g. output=twodim.
See also: output, off, on, basic, fortran, prolog.
* undefined
The built-in constant. It indicates that the value of the expression
is undefined.
e.g. the indeterminate forms: 0/0, inf/inf, 0*inf, 0^0.
Users should try again by lim(f, x=x0).
* zero
The right-hand sided value at x=0, as the built-in constant. -zero
is the left-sided limit from the negative direction. e.g. 1+zero is
to approach to 1 from the positive (+infinity) direction (the right-
hand sided value), and 1-zero is to approach to 1 from the negative
(-infinity) direction (the left-hand sided value), i.e. limit as
zero -> 0.
e.g. exp(1/(0+zero)) gives inf, exp(1/(0-zero)) gives 0.
+ add or positive sign.
- subtract or negative sign.
* multiply.
/ divide.
^ power in BASIC, the same as ** in FORTRAN, e.g. 2^3 gives 8.
** power in FORTRAN, the same as ^ in BASIC.
! factorial, the same as fac(x), e.g. 3! or fac(3) gives 6.
< less than.
<= less than.
> greater than.
>= greater than.
<> unequal
a <> b gives 1 if a is not equal to b, 0 if a is equal to b, or left
unevaluated otherwise. It only test two real numbers.
e.g. 2 <> 3 gives 1, 2 <> 2 gives 0.
:= delayed assigment.
= immediate assignment.
== equal
a==b gives 1 if a is equal to b, 0 if a is not equal to b, or left
unevaluated otherwise. It can test two complex numbers or expressions.
It gives 1 if a and b are the same expression or left unevaluated otherwise.
e.g. 2==2 gives 1, a==a gives 1.
=== equation sign
e.g. x^6===0
, comma
The words from, to, step and comma are the same.
# comment statement
e.g. # this is demo.
-------------------------------------------------------------------------
14. References
[1] Huang, W., Proceedings of the workshop on symbolic and numeric
computation, Helsinki University, Finland, 1991, p 185-186.
[2] Huang, W., Int. J. Math. Educ. Sci. Tech., 1992, 23(1), 160-165.
[3] Microbit, IEEE Micro, 1992, 12(1), 76.
[4] Huang, W., IEEE Micro, 1992, 12(3), 80.
[5] Huang, W., Abs. Amer. Math. Soc., 1992, 13(3), 343-344.
[6] Huang, W., Abs. Amer. Math. Soc., 1992, 13(5), 518.
[7] Huang, W., Abs. Amer. Math. Soc., 1992, 13(6).
[8] Huang, W., SIGSMALL/PC Notes, 1992, 18(1&2), 63-64.
[9] Long, G., Australian PC World, 1992, June, 117-119.