home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mega CD-ROM 1
/
megacd_rom_1.zip
/
megacd_rom_1
/
MATH
/
CC4.ZIP
/
CC4.HLP
< prev
next >
Wrap
Text File
|
1991-03-27
|
84KB
|
2,182 lines
Remarks on structure of help file. This screen is never displayed by CC.
Each screen of information begins with a centered title, and the last line
is followed by CHR(200) ╚ . Following that is the list of screen numbers
referred to by <A>, <B>, ... on the screen. The screen number of this screen
is 0, the first visible screen (the next screen) is number 1. The last number
in the list of numbers before the terminator 9999 is the screen number of the
current screen.
╚
9999
CC - The Calculus Calculator
On-Line Help
<A> How to use On-Line Help
<B> Capabilities of CC
<C> Introduction to CC
<D> Help for individual commands
<E> Function keys and other special keys
<F> Saving and loading your formulas and data files
<G> Printing
<H> Disk and Memory management
╚
7
6
8
2
5
78
79
81
1
9999
Commands 1
<A> ! <K> ASC <H> COLS <C> DIV
<H> " <B> ASIN <H> COLVECTOR <L> DOTGRAPH
<K> ' <B> ASINH <H> COND <L> DTG
<A> * <B> ATAN <D> CONJ <H> EIG
<A> + <B> ATAN2 <B> COS <H> EIGENVAL
<A> - <B> ATANH <B> COSH <T> ELSE
<H> .* <H,I> AVERAGE <B> COT <T> END
<H> ./ <L> AXISCOLOR <L> CROSSX <L> ERASE
<A> / <L> AXISOFF <L> CROSSY <W> EVAL
<W> // <L> AXISON <B> CSC <T> EXIT
<F> < <T> BEEP <M> CURVE3D <B> EXP
<F> <= <C> BIN <L> CYAN <H> EYE
<F> <> <A> BINOM <L> DARKGRAY <F> FALSE
<F> == <L> BKCOLOR <B> DEGREE <L> FIELD
<F> > <L> BLACK <E> DENOMINATOR <L> FILL
<F> >= <L> BLUE <H> DET <R> FIN
<A> ABS <L> BROWN <H> DIAG <E> FIX
<B> ACOS <H> CHARPOLY <Q> DIF <E> FLOAT
<B> ACOSH <K> CHR <L> DIFFG <T> FOR
<F> AND <L> COLOR <H,I> DISPLAY <X> more commands
╚
21
22
23
24
25
26
27
28
34
36
37
38
57
2
64
67
68
69
2
71
78
79
8
3
2
9999
Commands 2
<W> FORGET <T> INPUT@ <I> LIST <H> ONES
<C> FRAC <T> INPUTS <L> LISTG <F> OR
<I> FREQUENCIES <T> INPUTS@ <B> LN <L> PA
<O> FSOLVE <C> INT <B> LNGAMMA <M> PA3
<T> FUNCTION <L> INTEG <U> LOADGRAPH <A> PAR
<L> GR <C> INTEGER <U> LOADVAR <L> PARAMG
<M> GR3 <Q> INTOL <B> LOG10 <M> PARAMG3D
<L> GRAPH <F> ISALIST <H> LU <T> PAUSE
<M> GRAPH3D <F> ISBIGNUM <L> MAGENTA <B> PI
<T> GRAPHICS <L> KEEPLINE <L> MARK <H> PINV
<L> GREEN <I> LENGTH <H> MATRIX <L> PLOT
<C> HEX <L> LEVELC <M> MATRIXG <L> PO
<L> HISTOGRAM <L> LIGHTBLUE <H> MATRIXTOL <L> POLARG
<T> IF <L> LIGHTCYAN <H,I> MAX <K> POS
<D> IM <L> LIGHTGRAY <L> MAXCOLOR <W> PRECISION
<O> IMP <L> LIGHTGREEN <H> MEDIT <V> PRINT
<O> IMPLICIT <L> LIGHTMAGENTA <H,I> MIN <V> PRINTGRAPH
<R> IN <L> LIGHTRED <C> MOD <T> PROCEDURE
<R> INDEPTH <L> LINE <F> NOT <G,H,I> PRODUCT
<T> INPUT <L> LINESTYLE <E> NUMERATOR <X> more commands
╚
21
22
23
24
25
26
27
28
34
36
37
38
57
3
64
67
68
69
3
71
78
79
8
4
3
9999
Commands 3
<H> QR <L> SETCOLOR <W> TEXTCOLOR <L> WINDOW
<L> QU <R> SETINDEPTH <L> THICKLINE <L> WINDOWBOTTOM
<L> QUICKG <R> SETINTOL <L> THICKTEXT <L> WINDOWLEFT
<B> RADIAN <H> SETMATRIXTOL <L> THINLINE <T> WRITE
<A> RANDOM <O> SETSOLVETOL <L> THINTEXT <L> WINDOWRIGHT
<H> RANK <B> SINH <H> TRACE <L> WINDOWTOP
<D> RE <B> SIN <L> TRAJ <L> WRITE@
<L> RECT <L> SK <H> TRANS <L> WRITE@C
<L> RED <L> SKETCH <F> TRUE <F> XOR
<H,I> REGR <O> SOLVE <W> UNDEFINED <L> YELLOW
<T> REPEAT <J> SOLVEPOLY <L> UNMARK <H> ZERO
<T> RETURN <O> SOLVETOL <T> UNTIL <X> More commands
<A> ROOT <A> SQRT <K> UPCASE
<H> ROWS <H,I> STANDEV <J> VALPOLY
<I> ROWVECTOR <G,H,I> SUM <L> VARYLINE
<H> RREF <H> SVD <L> VWRITE@
<U> SAVEGRAPH <P> TABLE <L> VWRITE@C
<U> SAVE <B> TAN <T> WAIT
<B> SEC <B> TANH <T> WHILE
<L> SETBKCOLOR <T> TEXT <L> WHITE
╚
21
22
23
24
25
26
27
28
34
36
37
38
57
4
64
67
68
69
4
71
78
79
8
5
4
9999
Commands 4
<H,S> | <B> Σ (alt-s) <E> ² (alt-r) <I> {}
<B> ê (alt-e) <D> ≥ (alt-m) <A,F> () <J> %
<C> î (alt-i) <D> ≤ (alt-l) <F> ^
<B> π (alt-p) <E> √ (alt-q) <A,G,H> []
Function Keys and other special keys
F1 Help (If graphics screen visible, abbreviated help) <K>
F2 Print menu (If graphics screen visible, print graphic) <L>
F3 Begin marking text Shift-F3 Mark entire entry <M>
F4 Insert text cut with F3 Shift-F3 Delete text buffers <M>
F5 Scroll output up Shift-F5 Scroll up full screen <N>
F6 Scroll output down Shift-F6 Scroll down full screen <N>
F7 Save current work (If graphics screen visible, save screen) <O>
F8 Load work from file <O>
Shift-F8 View directory Control-F8 Change directory <O>
F9 Display last graph Shift-F9 Toggle last graph to disk <P>
F10 Toggle between Input Window and Subroutine Window <Q>
Insert Toggle Insert/Overwrite mode <R>
Control-Enter Insert a blank line
╚
34
22
24
26
21
10
30
37
29
82
7
79
18
11
78
63
71
11
35
5
9999
Capabilities of CC
Evaluate formulas <A>
Using trigonometric, exponential and logarithmic functions <B>
Using real and complex numbers <C>
hexadecimal and binary numbers <D>
exact fractions and huge integers <E>
strings <F>
Graph curves <G>, polar <H> and parametric <I> curves
Graph surfaces <J>, paramtric surfaces <K>, space curves <L> and matrix data <M>
Solve equations and systems of equations <N>
Define implicit functions <O>
Differentiate <P> and integrate <Q> functions
Perform vector and matrix calculations <R> including eigenvalues and
eigenvectors <S> and statistical operations <T>
Collect data into lists <U> and perform statistical operations <V>
Save and load data from external files <W>
Print calculations, results and graphs <X>
Write your own Pascal-like functions and procedures <Y> using CC's powerful
mathematical and graphing operators.
╚
21
22
24
23
25
37
40
41
42
58
59
60
61
64
65
68
69
28
31
32
34
35
78
79
71
6
9999
How to use On-Line Help
Items on each help screen are accompanied by letters surrounded by
angle brackets, like <*>. Pushing the corresponding letter on the keyboard
will get you more help on this topic.
To leave Help and return to CC, push <ESC>. To back up to the previous
help screen, push <PgUp>.
Throughout these screens, CC commands are printed entirely in UPPERCASE
letters.
These help screens are stored in the file CC.HLP, which should be in the
same directory as CC unless you have set up a different location in your
configuration file <A>.
╚
19
7
9999
Introduction to CC
<A> Stopping CC and saving your work so you can continue later
<B> Entering mathematical formulas into CC
<C> Understanding your results and controlling decimal precision
PRECISION and UNDEFINED
<D> Using variables for storing results
FORGET
<E> Defining your own functions
EVAL
<F> Creating two-dimensional graphs
<G> Creating three-dimensional graphs
<H> Writing your own procedures and functions
<I> Adding comments to your work with //
<J> Using TEXTCOLOR to control the colors of your screen
<K> Using cut and paste to copy and edit your formulas
<L> Creating a configuration file for your own system
<M> List of reserved words (4 screens)
╚
9
10
12
13
14
38
57
15
16
17
18
19
2
8
9999
Stopping CC and saving your work
To stop CC, push Control-Q (for quit). You will be asked if you want to
save your work. If you respond Y for yes, you will be asked to enter a file
name for saving your work. Enter any memorable name, followed by a period,
followed by an extension. The name can be up to 8 characters long, and the
extension up to 3 characters. One common practice is to always use the
extension CC to identify CC files. For example, you could call your work
LEVERARM.CC .
To reload your work when you next use CC, start CC with the command:
CC LEVERARM.CC
That is, follow the program name CC with the name of the file containing your
work.
When you restart CC you must execute all the lines in your Input Window.
None of your functions or variables will be defined until you do this.
Advanced information: Path information can be part of the file name. CC
will run files from remote directories, or CC can be in a remote directory and
operate on a file in the current directory.
See also <A> Using external files.
╚
78
9
9999
Entering mathematical formulas into CC
Mathematical formulas are entered into CC much as you would ordinarily
write them. They are evaluated when you press <ENTER>. The usual order of
operations is followed, with exponentiation following multiplication and
division following addition and subtraction. Parentheses () can be used to
alter this order. The main difference from ordinary mathematical notation is
that everything must be written on one line. Here are some examples:
Mathematics CC
2
2(3.2-4.3) 2*(3.2-4.3)^2
4.2 - 2.3
--------- (4.2 - 2.3)/(2.1 + 3.2)
2.1 + 3.2
Sin(4.2) SIN(4.2)
See also editing entries <A>, entering numbers <B>, algebraic functions
<C>, transcendental functions <D>, hexadecimal and binary numbers <E>, matrices
<F>, complex numbers <G>, huge integers and exact fractions <H> and output <I>.
╚
11
20
21
22
23
28
24
25
12
10
9999
Editing entries
When typing an entry to CC, you can correct your entry by erasing with the
Backspace and Delete keys, moving the cursor with the arrow keys, and toggling
between insert and overwrite mode by pressing the Insert key. You can leave
your formula with the vertical arrow keys, but if you do the formula will not
be evaluated. To evaluate a formula, you must press <ENTER> while the cursor
is somewhere in the formula. Formulas that have been evaluated are displayed
as normal text; unevaluated formulas, including the one you are currently
typing, are displayed in boldface or a different color.
Formulas longer than one line can be entered into CC, but you must not
press <ENTER> while typing an entry. Just keep typing and let the entry flow
from one line to the next. If you press <ENTER>, you will cause your (partial)
entry to be terminated and evaluated.
After using a formula once, you can use it again. Move the cursor to
it, modify it if desired, and push <ENTER>. CC is controlled temporally like a
calculator rather than spatially like a spreadsheet. Your results depend on
the order in which you execute your formulas, not on the order in which they
are listed on your screen.
You can scroll more rapidly up and down your list of entries with the
<PgUp> and <PgDn> keys.
You can add blank lines between formulas by pressing Control-Enter.
See Cut and Paste <A> for information on advanced editing.
╚
18
11
9999
Understanding your results and controlling decimal precision
When you enter a formula into CC and press <ENTER> <A>, the result appears
after the variable ANS in the Output Window. If you assigned your formula to a
variable <B>, it will appear after the variable in the Output Window.
If the formula you entered had an undefined result, for example 1/0, then
the value UNDEFINED will be returned. If UNDEFINED is combined with any other
value, the result is UNDEFINED. You can even enter UNDEFINED from the
keyboard.
You can control the number of significant digits displayed by CC with the
command PRECISION(n), where n is a number between 1 and 9 (15 for CC87).
PRECISION(0) causes results to be displayed in scientific notation:
1,234,567,890 = 1.23456789E9, -0.0000001 = -1E-7.
Numbers displayed with î are complex values <C>. These may be created by
apparently real formulas like LN(-2) or ASIN(3) as well as by overtly complex
formulas.
╚
10
13
24
12
9999
Using variables for storing results
You can assign the result of any formula to a variable with a command
like: X = SIN(4.2) . Variable names can be up to 12 characters long. They
must begin with a letter and use only letters and digits. CC ignores upper and
lower case distinctions in variable names, so AB, ab, Ab and aB are the same
variable. All of your variables are listed in the Output Window. If there
are more variables than can be shown at one time, you can scroll the Output
Window with the function keys F5 and F6.
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.
Variables 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 ANS.
You can destroy the variable X with the command FORGET(X). If X stored a
large list, you could regain a considerable amount of memory by FORGETting X.
Also, since a variable and a function <A> cannot have the same name, you must
forget a variable before using its name for a function, and vice versa.
Greek letters can be used in variable names: α=alt-a, ß=alt-b, δ=alt-d,
φ=alt-f, Γ=alg-g, ε=alt-h, Ω = alt-o, and Θ=alt-t.
╚
14
13
9999
Defining your own functions
CC allows you to define your own functions for evaluating or graphing <A>.
Anytime you find yourself using the same expression over and over, you should
turn it into a function. Here are some sample function definitions:
f(x) = SIN(x + PI/3)
g(x,y) = x^2 - y^2
Once defined, functions can be used in expressions or in other function
definitions:
y = f(3.2)
z = g(4.1, -5.3)
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.
You can force all the components of a function to be evaluated when the
function is defined by preceeding the function with the command EVAL:
f(x) = EVAL(x^2+a)
╚
38
14
9999
Writing your own procedures and subroutine functions
CC allows you to extend its power with multi-line procedures and functions
written in a Pascal-like programming language. All standard control structures
are available. These functions can have value parameters and function-name
parameters. You can write a routine that operates on an arbitrary function,
like an equation-solving routine. Subroutines can call one another
irrespective of the order in which they are defined, and recursion is fully
supported.
Subroutines can be used to implement algorithms from numerical analysis,
to write interactive data analysis routines, or even to develop dynamic
presentations and interactive mathematics lessons. Programming commands are
available to pause a routine or make it wait a specified number of seconds; to
build complex graphics screens and permit the user to select one region with
the crosshairs; to write messages to the user and to acquire input from text or
graphics screens. Text and graphics color can be controlled completely, and
complex graphs can be recalled from disk for quick display.
For more information on subroutines, see <A>.
╚
71
15
9999
Adding comments to your work with //
You can add comments to your list of CC entries to remind yourself why
you did what you did or to inform another user how to use your routines.
Comments can be used in both the Input Window and the Subroutine Window.
To add a comment to the end of an entry, preface the comment with the
symbol //, for example:
s = 16*t^2 // Law of falling bodies
A line can be started with //, in which case the entire entry is a comment.
╚
16
9999
Using TEXTCOLOR to control the colors of your screen
If you are using a color screen, you can specify the color of executed
entries and all but the last output, the color of new entries and the last
output, and the background color with the command:
TEXTCOLOR(foreground,highlight,background)
Foreground, highlight and background must be integers between 0 and
MAXCOLOR, or color words which are just synonyms for these integers. The color
words corresponding to 0..15 are:
BLACK BLUE GREEN CYAN RED MAGENTA BROWN LIGHTGRAY
DARKGRAY LIGHTBLUE LIGHTGREEN LIGHTCYAN LIGHTRED LIGHTMAGENTA YELLOW WHITE
The author's favorite is TEXTCOLOR(BLUE, RED, LIGHTGRAY)
These colors can also be used for the graphics screens <A>.
╚
51
17
9999
Using cut and paste to copy and edit your formulas
You can copy part or all of one formula to another part of your Input
Window or Subroutine Window as follows: move the cursor to one end of the text
to be copied, press F3, move the cursor to the other end (the selected text
will be highlighted) and press <ENTER>. At any later time, you can press F4,
and the selected text will be copied at the cursor.
If you press <DEL> instead of <ENTER>, the selected text will disappear
from the screen. However, pressing F4 will still make it reappear at the
position of the cursor.
You can insert the selected text at several points; just move the cursor
to each place you want the text and press F4.
Pressing Shift-F3 will select the entire entry at the cursor, then
pressing <ENTER> or <DEL> will either select or cut and select this entry.
CC has 10 buffers for saving text. If you make a second selection, your
first selection is retained. You can cause it to be copied at the cursor by
pressing Alt-1. Each time you make a new selection, your previous selections
are promoted through the text buffers and can be accessed with the keys Alt-1
through Alt-9. If you need to recover the memory used by the text buffers, you
can empty all of them by pressing Shift-F4.
╚
18
9999
Creating a configuration file for your own system
CC starts with a number of default assumptions. It starts in radian mode
<A>, in insert mode <B>, with varying linestyles and colors <C>, and with
certain screen colors <D>. You can change these assumptions, you can change the
location of the help file <E> and the last graph file <F>, and you can specify
your printer type <G> with a configuration file. To create a configuration
file, press Control-F9 and answer the questions on the screen. CC will create
a file CC.CFG in the same directory as CC. It will read this file the next
time it starts and use the information found there to determine its default
assumptions.
If you already have a configuration file, you can change it by pressing
Control-F9 and answering the questions on the screen.
╚
22
11
49
17
7
63
79
19
9999
Entering Numerical values into CC
Numerical values are entered into CC just as you would ordinarily write
them. You can precede numbers with optional + or - signs. The following are
all valid numerical entries for CC:
3.47 0.347 .347 -347
Blanks are not permitted in numbers; the expression - 34 is not valid.
Numbers can be entered in scientific notation. The exponent is preceded
by E or e. The following numbers are all valid and all equal:
3.47 0.347E1 34.7e-1 347E-2 0.003470e3
See also complex numbers <A>, huge integers and exact fractions <B>,
hexadecimal and binary numbers <C>, and display precision <D>.
╚
24
25
23
12
20
9999
Arithmetic and algebraic functions
Numbers <A> can be combined with + (addition), - (subtraction), *
(multiplication), / (division) and ^ (exponentiation). For example:
3+4 = 7 3-4 = -1 3*4 = 12 3/4 = 0.75 3^4 = 81
Where it is not ambiguous, multiplication can be indicated by adjacency:
3(4-1) = 3*(4-1) = 9. Implicit multiplication is potentially dangerous, and
it is generally preferable to use * to indicate multiplication.
The following functions are available (z is complex, x real, n,m integers):
SQRT(z) = square root of z -- abbreviation: √=Alt-q
z² = square of z -- ² entered as Alt-r
ABS(z) = absolute value of z;
n! = n-factorial
RANDOM(n) = random integer in range 1..n
RANDOM = random real in (0,1)
INT(z) = integer part of x
FRAC(z) = fractional part of x
ROOT(x,n) = nth real root of x
LNGAMMA(z) = natural log of Γ(z); LNGAMMA(n+1) = LN(n!)
BINOM(n,m) = binomial coefficient = n!/(m!*(n-m)!)
╚
20
21
9999
Trigonometric and exponential functions
The value π = 3.14159... is entered into CC as PI or alt-p. Available
trignonmetric functions are: SIN(x), COS(x), TAN(x), COT(x), SEC(x) and
CSC(x). Inverse trigonometric functions are: ASIN(x), ACOS(x) and ATAN(x).
Trig functions are evaluated in radian mode unless you have changed to degree
mode by entering the command DEGREE. You can switch back to radian mode by
entering the command RADIAN. The current mode is indicated in the upper right
corner of the screen.
The function ATAN2(x,y) returns the polar angle of the point (x,y).
The base of the natural logarithms, ê = 2.718... is entered as alt-e.
Available exponential functions are EXP(x) = ê^x, LN(x) = natural logarithm of
x, and LOG10(x) = real log (base 10) of x.
Hyperbolic functions are also defined: SINH(x), COSH(x), TANH(x),
ASINH(x), ACOSH(x) and ATANH(x).
In all of these functions (except LOG10), x can be any real or complex
value <A>.
╚
24
22
9999
Integers: hexadecimal and binary numbers
CC can distinguish integers from non-integers, and it will operate on
integers with n DIV m (integer part of n/m) and n MOD m (remainder of n
divided by m).
Integers can be combined bitwise with the commands n AND m, n OR m
and n XOR m. You can invert the bits in an integer with the command NOT n .
Integers can be entered in hexadecimal or binary notation. Hexadecimal
numbers are preceded by $, binary by #. The following numbers are all equal:
27 = $1a = #11011
Integers, hexadecimal and binary numbers are all 32-bit quantities, but
integers are signed and the others are not. One kind of number can be changed
to another with the command INTEGER(n) (change to integer), HEX(n) (change to
hexadecimal) and BIN(n) (change to binary).
There is a function PAR(n) that returns 1 if n is even and -1 if n is odd.
This is useful for defining sums and products <A>.
See also huge integers and exact fractions <B>;
╚
25
23
9999
Complex numbers
CC can use complex numbers as easily as real numbers. Any of CC's
functions which are mathematically defined for complex values, for example
SIN(x) and EXP(x), will accept complex arguments. Complex numbers are entered
into CC like this: 3.2 - 4.7î, where î is entered with alt-i.
Special complex functions include:
RE(z) = real part of z
IM(z) = imaginary part of z
CONJ(z) = conjugate of z
If z is complex, then INT(z) returns INT(RE(z)) + INT(IM(z))î, and FRAC(z)
is defined by INT(z) + FRAC(z) = z. Also ABS(z) is the real modulus of z. The
polar argument of z can be computed as ATAN2(RE(z),IM(z)) <A>.
Functions which do not use complex values include ATAN2, LOG10 and ROOT.
Complex numbers can be defined with huge integer or exact fraction
coefficients <B>.
╚
22
25
24
9999
Using huge integers and exact fractions
CC has special routines to accomodate huge integers and exact fractions
with huge numerators and denominators. To enter a huge integer, precede it
with &: &12345678987654321 will be stored exactly. To create an exact
fraction, use two exact parts: &2/&3 is stored as 2/3, not 0.666666667.
Huge integers and exact fractions can be added, subtracted, multiplied,
divided, and operated on by integer exponents. The functions DIV, MOD, ! and
BINOM work on huge integers; ABS, INT and FRAC work on exact fractions.
If any other function is applied to an exact fraction, the fraction will
be changed to a decimal before the function is applied.
Matrices <A> can be defined with exact fraction entries, in which case
addition,multiplican and division of matrices will be exact.
If x is an exact fraction, then NUMERATOR(x) and DENOMINATOR(x) are the
numerator and denominator of x, and FLOAT(x) is the floating point approximation
to x. Conversely, if x is a floating point number, FIX(x) is the exact fraction
which is the floating point representation of x. This is useful for turning
integers into huge integers. Note: because of the inaccuracies in the floating
point representation of numbers, FIX(1/3) is different from &1/&3 = 1/fix(3).
To define the 5 x 5 exact Hilbert matrix, use:
H = MATRIX(1/fix(i+j-1), i=1 to 5, j=1 to 5)
If you then invert H with the command J = 1/H, you will get the exact inverse
of the Hilbert matrix. You can also try &3^100 and &100!.
╚
28
25
9999
Boolean expressions
Real numbers and strings <A> can be compared with the operators
a == b ( a equals b )
a <> b ( a does not equal b )
a < b ( a is less than b )
a > b ( a is greater than b )
a <= b ( a is less than or equal to b ) also denoted by ≤ = alt-l
a >= b ( a is greater than or equal to b) also denoted by ≥ = alt-m
The results of these comparisons is always one of the values TRUE, FALSE or
UNDEFINED. The result is UNDEFINED if one side is undefined or symbolic.
These comparisons are used mostly in conjunction with the decision-making
commands in subroutines <B>. Complex numbers can be compared with == and <>.
Note that the equals operator is 2 equal signs: == . This is so the
expression x == y won't be confused with the variable assignment x = y. The
boolean values TRUE and FALSE can be combined with the usual logical operators
AND, OR, XOR and NOT, for example:
a < b OR c <> d
Variables can be tested for being a list or a huge number or exact
fraction with the boolean functions ISALIST(x) or ISBIGNUM(x).
╚
37
71
26
9999
Sums and Products
You can defined finite sums (and analogous products) with CC. For
example, to sum the first 20 squares, enter:
SUM(i^2,i = 1 to 20)
To take the product of the first 10 even inverses (1/2)*(1/4)*..*(1/20), enter:
PRODUCT(1/n,n = 2 to 20 step 2).
Functions can be defined with sums and products. To define the nth Fourier
approximation to the square wave, enter:
f(x,n) = SUM(SIN(i*x)/i,i=1 to n step 2)
The operator SUM can be abbreviated with Σ = alt-s.
You can also take the sum (product) of a list x with SUM(x) <A> or sum the
columns of a matrix m with SUM(m) <B>.
╚
35
32
27
9999
Matrices
<A> Entering matrices into CC
{...} MATRIX MEDIT LOADVAR DISPLAY
<B> Defining special matrices
ONES ZERO EYE RANDOM DIAG
<C> Matrix operations
+ - * / \ ^ .* ./
<D> Matrix functions
CONJ TRANS " DET TRACE LU QR RREF RANK ROWS COLS CHARPOLY
EIGENVAL EIG SVD PINV COND
<E> Sorting and statistical operations
SORT MIN MAX SUM PRODUCT AVERAGE STANDEV REGR
<F> Controlling the accuracy of matrix operations
SETMATRIXTOL MATRIXTOL
╚
29
29
30
31
32
33
28
9999
Entering matrices and defining special matrices
There are four ways to enter a matrix into CC:
Enclose the elements in braces, seperating the elements with commas and the
rows with semicolons:
M = {1,2,3;4,5,6}
Define each matrix element by a formula:
M = MATRIX(3*i+j-3, i = 1 to 2, j = 1 to 3)
Cause CC to display a spreadsheet, and enter the elements of the matrix. The
size of the matrix is determined by the elements entered, and undefined
elements are changed to 0. Use the arrow and tab keys to move around the
spreadsheet: MEDIT(M)
Read the elements of the matrix from a specially prepared file (see <A>):
LOADVAR(M)
To display a previously constructed matrix, enter the command
DISPLAY(M).
Certain matrices are predefined:
EYE(n) is an n x n identity matrix
ZERO(n,m) is an n rows by m columns matrix of zeros
ONES(n,m) is an n x m matrix of 1's
RANDOM(n,m) is an n x m matrix of random elements in the range (0,1)
DIAG(x) is a diagonal matrix whose elements are taken from the list (or
row or column vector) x.
╚
78
29
9999
Matrix operations
Matrices can be combined in the usual way with + - * , provided the
sizes are correct. You can raise a matrix to a positive or negative integer
power: A^n. In addition, you can evaluate A/B = A*B^(-1) and
A\B = A^(-1)*B. Finally, element-by-element multiplication or division between
two matrices of the same size can be computed with the commands A.*B and
A./B .
Matrices and scalars can be multiplied and divided. If M is a matrix
and x a scalar, then x*M and M*x multiplies each element of M times x .
Also, M/x divides each element of M by x , and x/M = x*(M^(-1)). A quick
way to define the inverse of M is 1/M .
Submatrices are also defined. If M is a matrix, then M[i,j] is the
i,j'th element of M, and M[i1:i2, j1:j2] is the submatrix of M with rows
i1..i2 and columns j1..j2. M[i1:i2,j] is part of the j'th column of M , and
M[i,j1:j2] is part of the the i'th row of M .
If an ordinary scalar function like SIN is applied to a matrix, it is
applied to every element of the matrix.
╚
30
9999
Matrix functions
Suppose M is a matrix. The following functions are defined:
COLS(M) number of columns of M ROWS(M) number of rows of M
TRACE(M) trace of M DET(M) determinant of M
RANK(M) rank of M RREF(M) row-reduced form of M
TRANS(M) transpose of M CONJ(M) conjugate each element of M
PINV(M) pseudo-inverse of M COND(M) condition number of M
DIAG(v) if v is a single row or column matrix, returns diagonal matrix
M" conjugate-transpose (Hermitian) of M
CHARPOLY(M) characteristic polynomial of M, expressed as a list <A>
EIGENVAL(M) list of eigenvalues of M
EIG(M) list of two matrices A and D. A*D = M*A . D is diagonal and the
diagonal elements are the eigenvalues of M; the columns of A
are the eigenvectors of M.
LU(M) list of two matrices L and U; L*U = M (possibly with rows
permuted), L is lower triangular and U is upper triangular.
QR(M) list of two matrices Q and R; Q*R = M, the columns of Q are
orthonormal and R is upper triangular.
SVD(M) list of three matrices A,B,C; A and C have orthogonal columns,
and B is an invertible diagonal matrix. A*B*C" = M
The diagonal elements of B are the singular values of M
╚
34
31
9999
Sorting and statistical operations on matrices
If M is a matrix and i an integer, then SORT(M,i) returns a matrix of
the same size as M with the same rows as M but sorted on the i'th column.
The data in the i'th column can be real (not complex) numbers or strings <A>.
To sort on multiple columns, first sort on the least significant column, then
work your way up to sorting on the most significant column.
The commands MIN(M), MAX(M), PRODUCT(M), SUM(M), AVERAGE(M) and STANDEV(M)
all work the same way. They return a row vector the same size as one row of M,
containing in each position the minimum, maximum, etc of the the elements in
the corresponding column of M .
The operation of REGR is more complex. Suppose a is an m x n matrix.
Let a be the matrix obtained by deleting the last column of m and adding a
first column of 1's to m. Let c be the deleted column. Then x = REGR(m) is
a column vector which is the least squares solution to the equation a*x = c.
For example, let m be a n x 2 matrix. If each row represents a point, and
if y = b+mx is the regression line through the points, then:
┌ ┐
│b│
│m│ = REGR(M)
└ ┘
╚
37
32
9999
Controlling the accuracy of matrix operations
There is a small constant that controls the accuracy of matrix operations
like inverting matrices, the LU decomposition and row reduction. Basically,
whenever a matrix element smaller than this constant appears, it is set to 0.
This procedure is necessary to overcome the inherent inaccuracies in floating
point arithmetic. The current value of this constant is returned by MATRIXTOL.
To give this constant a new value, for example 0.001, execute the command
SETMATRIXTOL(0.001). Executing SETMATRIXTOL(0) restores the constant to its
default value. Too small a value for this constant makes even singular
matrices appear non-singular to CC; too large a value makes non-singular
matrices with large condition numbers <A> appear singular. Fiddling with this
constant can sometimes make a delicate matrix operation converge.
╚
31
33
9999
Lists
A list is a sequence of values of any sort: real or complex numbers,
strings <A>, even other lists. Many different kinds of values can be in a
single list. To define a list, either enclose its elements in parentheses:
(1,2,3,4,5)
or defined it with a formula:
LIST(i,i = 1 to 5).
The indexing variable in LIST need not increment by 1. You could define the
list (0, 0.01, 0.02, ... , 1.00) with the command LIST(x, x=0 to 1 step 0.01).
The expression () means the empty list. Defining a singleton list is
tricky, because (x) just means x. One way is to use the formula LIST(x,i=1,1).
If t is a list, then t[i] is the i'th element of t, and t[i:j] is the
sublist of t consisting of elements t[i]..t[j]. The expression t[i,j] means
the same thing as t[i][j]; it indicates the j'th element of the i'th element of
t, so it is not defined unless t[i] is itself a list.
Lists can be added, subtracted, multiplied and divided, term by term. The
length of the result is the length of the shortest component. If a scalar is
combined with a list by any of these arithmetic operations, it is combined with
each element of the list. Thus (1,2) + (3,4) = (4,6) and 1 + (2,3) = (3,4).
Scalar functions like SIN applied to a list are applied to every element of the
list.
For a description of list functions, see <B>.
╚
37
35
34
9999
List Functions
If x and y are lists, then we have the functions:
LENGTH(x) length of x x|y concatenation of x and y
SUM(x) sum of elements of x PRODUCT(x) product of elements of x
MIN(x) minimum of x MAX(x) maximum of x
AVERAGE(x) average of x STANDEV(x) standard deviation of x
ROWVECTOR(x) make x a row matrix COLVECTOR(x) make x a column matrix
DIAG(x) diagonal matrix <A> from elements of x.
FREQUENCIES(x,a,b,n) divides interval (a,b) into n subintervals and returns
list of number of elements of x in each subinterval.
See HISTOGRAM <B>.
REGR(x,y) returns list (m,b,r) of data for regression line through the points
(x[i],y[i]). The regression line is y = mx + b and the
correlation coefficient is r.
If an ordinary scalar function is applied to a list, for example SIN(x), then
the function is applied to every element in the list.
Once a list has been created, you can view it with the command
DISPLAY(x)
╚
28
52
35
9999
Polynomials
For CC, a polynomial is a list <A> of coefficients. The polynomial
n
a + bx + ... + cx is represented by the list (a,b,...,c). If p is a list,
the the value of the polynomial p at the point x can be computed with the
function
EVALPOLY(p,x).
For example, EVALPOLY((1,2,3), -1) = 2.
All the roots, real and complex with multiplicity, of the polynomial p
can be computed with the function
SOLVEPOLY(p)
which returns a list of roots. For example, SOLVEPOLY((2,-3,1)) = (1,2).
If some roots cannot be found, they are replaced by UNDEFINED in the list of
roots.
╚
34
36
9999
Strings
In CC, a string is a sequence of characters. Strings are defined by
placing the desired characters between apostrophes, like this:
'This is a string'
Strings are used in INPUT and WRITE statements, they can be stored in
variables, and they can be manipulated as follows.
If s is a string, then s[i] is the i'th character of s, and s[i,j]
or s[i:j] is the substring of s consisting of characters i through j .
Strings s and t can be concatenated with the operator s|t .
Strings can be compared with the operators ==, <>, < , <=, >, >= <A>, and
strings can be put into list and matrices. A list of strings can be operated
on by MAX and MIN <B>, and a matrices can be sorted on a column of strings <C>.
The following functions apply to strings:
LENGTH(s) number of characters in s.
ASC(s) list of ascii codes of characters of s. If s is a single character,
then ASC(s) is an integer, not a list of integers.
CHR(x) is x is an integer or list of integers, CHR(x) is the string of
characters whose codes are in x. Only codes 32..255 are recognized.
UPCASE(s) the same string as s , but with a..z replaced by A..Z.
POS(s,t) returns the position of the substring s in the string t, or 0.
╚
26
35
32
37
9999
Two-dimensional Graphing
<A> Defining Windows: WINDOW WI ERASE
WINDOWTOP WINDOWBOTTOM WINDOWLEFT WINDOWRIGHT
<B> Graphing y = f(x): GRAPH GR DOTGRAPH DTG QUICKG QU SKETCH SK
<C> Graphing r = f(Θ) in polar coordinates: POLARG PO
<D> Graphing parametric curves x = f(t), y = g(t): PARAMG PA
<E> Graphing level curves f(x,y) = c: LEVELC
<F> Vector fields and level curves: FIELD TRAJ
<G> Drawing lines and rectangles, filling regions: LINE RECT FILL
<H> Plotting and marking points: MARK UNMARK PLOT
<I> Adding labels to your graphs:
WRITE@ WRITE@C VWRITE@ VWRITE@C THICKTEXT THINTEXT
<J> Showing and hiding axes, and changing their color: AXISON AXISOFF AXISCOLOR
<K> Making successive graphs appear different: KEEPLINE VARYLINE
<L> Setting line styles: THICKLINE THINLINE LINESTYLE
<M> Setting screen colors: SETCOLOR SETBKCOLOR COLOR BKCOLOR MAXCOLOR
BLACK BLUE GREEN CYAN RED MAGENTA BROWN LIGHTGRAY
DARKGRAY LIGHTBLUE LIGHTGREEN LIGHTCYAN LIGHTRED LIGHTMAGENTA YELLOW WHITE
<N> Histograms of list data: HISTOGRAM
<O> Graphing lists of points: LISTG MARK UNMARK PLOT
<P> Using crosshairs: CROSSX CROSSY
<Q> Graphing integrals and derivatives: INTEG DIFFG
<R> Using Zoom and UnZoom to change the graphics window
╚
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
38
9999
Defining Windows
Two-dimensional graphs appear in a window which you define with the
command:
WINDOW(a,b,c,d)
where a,b,c,d are real numbers. The graphics window is then a ≤ x ≤ b,
c ≤ y ≤ d . For example, if you want to graph the function y = sin(x) in the
range 0 ≤ x ≤ 2π and show values -1 ≤ y ≤ 1, execute WINDOW(0,PI,-1,1)
before the graphics command <A>.
When you create a new window, it is empty except for optional axes <B>.
The abbreviation for WINDOW is WI.
CC actually expands the window you specify by 10% to assure that your
entire graph will be visible. The ends of the axes, which are not quite at
the edge of the window, correspond to your specified window limits.
You can erase all the figures in a window without rescaling the window
with the command:
ERASE
The startup window parameters are -1.4 ≤ x ≤ 1.4, -1 ≤ y ≤ 1. The aspect
ratio 1.4:1 makes circles appear round, not oval, on most monitors. The
command WINDOW(0,0,0,0) restores these parameters.
There are functions which return the boundaries of the current window:
WINDOWTOP WINDOWBOTTOM WINDOWLEFT WINDOWRIGHT
These are useful mostly for programming operations <C>.
╚
40
48
71
39
9999
Graphing y = f(x)
Once you have defined a graphing window <A>, you can view the portion of
the graph of y = f(x) which lies within the window by executing the command:
GRAPH(f(x),x)
f(x) can be either a function <B> with bound variable x or an expression
involving x. For example, you could graph the parabola with the command
GRAPH(x^2,x). The abbreviation for GRAPH is GR.
The operator GRAPH 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:
DOTGRAPH(f(x),x)
or its abbreviation DTG(f(x),x).
To plot only every third point (and connect the points), use
QUICKG(f(x),x)
or its abbreviation QU(f(x),x). To plot only every 20th point, which is
useful for rapidly graphing complicated functions, use
SKETCH(f(x),x)
or its abbreviation SK(f(x),x).
╚
39
14
40
9999
Graphing r = f(Θ) in polar coordinates
Once you have defined a graphing window <A>, you can graph the portion of
a polar curve r = f(Θ) for a ≤ Θ ≤ b that lies in the window with the
command:
POLARG(f(t),t=a to b)
f(t) can be a function with bound variable t or an expression involving t. For
example, to graph the cardoid r = 1+cos(Θ), 0 ≤ Θ ≤ 2π , execute the command
POLARG(1+cos(t),t=0 to 2*PI).
Polar curves are, by default, graphed with 200 line segments. To change
that default to any number of line segments up to 1000, add the desired number
of segments after the last parameter. Using a large number of segments can
make a smoother curve; using a smaller number can draw a faster curve or even a
polygon. Try
WINDOW(-1.4, 1.4, -1, 1)
POLARG(1, T = 0 TO 4*PI, 5)
The abbreviation for POLARG is PO.
╚
39
41
9999
Graphing parametric curves x = f(t), y = g(t)
Once you have defined a graphing window <A>, you can graph the portion of
a parametric curve x = f(t), y = g(t) for a ≤ t ≤ b that lies in the
window with the command:
PARAMG(f(t),g(t),t=a to b)
f(t) and g(t) can be a functions with bound variable t or expressions involving
t. For example, to graph the Lissajous curve x = sin(6t), y = sin(7t),
0 ≤ t ≤ 2π , execute the command
PARAMG(SIN(6*t), SIN(7*t),t=0 to 2*PI)
Parametric curves are, by default, graphed with 200 line segments. To
change that default to any number of line segments up to 1000, add the desired
number of segments after the last parameter. Using a large number of segments
can make a smoother curve; using a smaller number can draw a faster curve or
even a polygon. Try
PARAMG(SIN(6*t), SIN(7*t),t=0 to 2*PI,1000)
The abbreviation for PARAMG is PA.
╚
39
42
9999
Graphing level curves f(x,y) = g(x,y)
To graph the solution to the equation f(x,y) = 0, use the command:
LEVELC(f(x,y)=g(x,y), x = a, y = b)
LEVELC(x^2+y^2 = 1, x =.7, y = .7)
The graph will start at the solution point nearest (a,b) and extend in two
directions. The mnemonic GRAPHS means GraphSolution. Normally 50 steps are
used in each direction. To change the number of steps, add the number you wish
at the end of the command: LEVELC(f(x,y) = g(x,y), x = a, y = b, n). If you
specify the number of steps, you can optionally specify the step size as a
number between -5 and 5 (the default is 0--the scale is logarithmic).
Examples:
LEVELC(x^2+y^2 = 1, x =.7, y = .7, 100)
LEVELC(x^2+y^2 = 1, x =.7, y = .7, 100, 2)
LEVELC(x^2+y^2 = 1, x =.7, y = .7, 100, -2)
╚
43
9999
Vector fields and trajectories
To graph the vector field (f(x,y), g(x,y)), issue the command:
FIELD(f(x,y), g(x,y), x, y)
FIELD(-y/(x^2+y^2), x/(x^2+y^2), x, y)
Normally a field of 14 x 14 vectors will be displayed. Larger vectors show as
larger on the screen, but the proportions are not necessarily correct. To show
more or fewer vectors, add an integer parameter after the first and second
variable indicating how many vectors to show in each direction:
FIELD(-y/(x^2+y^2), x/(x^2+y^2), x, 10, y, 10)
To draw a trajectory following a vector field (f(x,y), g(x,y)), use:
TRAJ(f(x,y), g(x,y), x=a, y=b)
TRAJ(-y/(x^2+y^2), x/(x^2+y^2), x=0.5, y=0.5)
The trajectory will start at (a,b). Usually 50 steps are used; you can
optionally specify a different step number and step size as for LEVELC <A>.
╚
43
44
9999
Drawing lines and rectangles, filling regions
You can add lines and rectangles to your graphics screens or fill bounded
regions on the screen. To draw a line between (a,b) and (c,d) (assuming that
both these points lie in the current graphing window <A>), use the command:
LINE(a,b,c,d)
To draw a rectangle with opposite corners (a,b) and (c,d), execute:
RECT(a,b,c,d)
The color and style of the line or rectangle can be determined by SETCOLOR <B>
and LINESTYLE <C>.
To fill a region, first pick a point (a,b) inside the region. Then pick a
color c1 to fill with and a fill pattern p, 0 ≤ p ≤ 8. Use p = 1 for solid
fill. Suppose c2 is the color of the boundary of the region (the region must
be bounded by curves of one color). To fill the region, execute the command:
FILL(a,b,c1,c2,p)
╚
39
51
50
45
9999
Plotting and marking points
If (a,b) is a point in the current graphing window <A>, you can plot a
point of the current color <B> at (a,b) with the command:
PLOT(a,b)
To draw a cross like the crosshairs of the current color <B> at (a,b), use the
command:
MARK(a,b)
To delete this cross, use:
UNMARK(a,b)
Individual points created with PLOT are very hard to see, but numbers of them
can be used to shade regions or produce curves.
See <C> for information on using these commands with lists.
╚
39
51
53
46
9999
Adding labels to your graphs
You can put alphanumeric labels anywhere on your two-dimensional graphic
screens. They can be horizontal or vertical, and they can be printed in
various sizes. To print a string s <A> horizontally on the screen with the
lower-left corner at Window coordinates (a,b), use the command:
WRITE@(a,b,s)
To write vertically bottom to top, use
VWRITE@(a,b,s)
You can change the size of your labels by entering an optional size
parameter after the string. The parameter should be an integer in the range
1..7; the default is 2. For example, to label a curve you might enter:
WRITE@(0.5,0.5,'Parabola',3)
You can use the crosshairs <B> to locate labels. First, while viewing the
graphics screen, move the crosshairs to the desired point. Then return to the
Input Window and execute either WRITE@C(s) or VWRITE@C(s). An optional size
parameter can be added after the string.
To use thicker characters on the screen (only in size 3 or greater), enter
the command THICKTEXT. To return to the default characters, execute THINTEXT.
╚
37
54
47
9999
Showing and hiding axes, and changing their color
When you create a new graphics screen with WINDOW or ERASE <A>, CC
normally adds axes the screen. You can suppress the display of axes by
entering the command:
AXISOFF
before displaying the screen for the first time. Axes will not be displayed on
any subsequent screen until you restore them by executing:
AXISON
You can change the color of the axes for the next new screen with the
command:
AXISCOLOR(c)
where c is one of the color words or numbers <B>.
╚
39
51
48
9999
Making successive graphs appear different
CC allows you to draw as many graphs as you want on the same
two-dimensional graphics screen. Normally these graphs are distinguished by
being drawn with different line styles <A> (monochrome systems) or colors <B>
(color systems). To stop CC from changing line styles or colors between
graphs, issue the command
KEEPLINE
To start changing again, issue:
VARYLINE
If you set the color for a graph with the command SETCOLOR <B>, the next
graph will always be drawn in that color. Subsequent graphs will have
different colors or the same color depending on whether KEEPLINE or VARYLINE is
active.
Lines drawn with LINE <C> and LISTG <D> are always drawn with the current
line style and do not change the style, even if VARYLINE is active. Only
graphs drawn with GRAPH <E>, POLARG <F> and PARAMG <G> are affected.
╚
50
51
45
53
40
41
42
49
9999
Setting line styles
On both monochrome and color systems, CC will 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:
LINESTYLE(n)
See <A> for information on varying line styles with graphs.
Lines and graphs can be either thin (the default) or thick. You set this
default with the commands:
THICKLINE
THINLINE
Once set, the thickness stays the same until changed.
╚
49
50
9999
Setting screen colors
If you are using a color system, you can set the color of the next line or
graph with the command:
SETCOLOR(c)
where c is one of the color words:
BLACK BLUE GREEN CYAN RED MAGENTA BROWN LIGHTGRAY
DARKGRAY LIGHTBLUE LIGHTGREEN LIGHTCYAN LIGHTRED LIGHTMAGENTA YELLOW WHITE
or an integer in the range 0..15. The color of successive graphs may vary
unless you hold it constant <A>.
You can set the background color for your graphs with the command
SETBKCOLOR(c)
You can determine the current color or background color with the
functions:
COLOR
BKCOLOR
The highest color number available on your system is MAXCOLOR.
To erase a curve or line, redraw it in the background color, using
linestyle 0 <B>.
Color commands also apply to three-dimensional graphs. <C>
╚
49
50
62
51
9999
Histograms of list data
If x is a list <A> of data, you can plot a histogram of the data with
the command:
HISTOGRAM(x,a,b,n)
CC divides the interval (a,b) into n subintervals, computes the number of
elements in x contained in each subinterval, and plots a bar graph of these
numbers. Outliers are included in the lowest and highest categories
respectively. HISTOGRAM is also a function; it returns as its value a list of
the frequencies <B> or numbers of elements contained in each subinterval.
HISTOGRAM makes its own graphics window, ignoring the current window as
defined by WINDOW <C>.
╚
34
35
39
52
9999
Graphing lists of points
If x and y are lists of real numbers, then the command:
LISTG(x,y)
draws line segments from the point (x[i],y[i]) to the point (x[i+1],y[i+1])
for i = 1..length(x)-1. If x and y have different lengths, the shorter
length is used. If one end of a line is outside the current window, the line
will not be drawn.
You can plot these points instead of connecting them with the command:
PLOT(x,y)
and you can mark them with crosses like the crosshairs <A> with:
MARK(x,y)
and erase the marks with:
UNMARK(x,y).
See <B> for applying these commands to pairs of real numbers.
╚
54
45
53
9999
Using crosshairs
When you are viewing the two-dimensional graphics screen, you will see a
cross somewhere on the screen. On a new screen it appears in the upper-left-
hand corner. This is the crosshairs. The coordinates of the center of the
crosshairs are printed at the lower-right hand corner of the screen. You can
move the crosshairs with the cursor (arrow) keys. Try it, and see how the
coordinates change. You can effect finer movements with the shifted-cursor
keys, or the number keys 2,4,6,8. The crosshairs are useful for locating the
intersections of curves or points where graphs cross the axes.
The functions CROSSX and CROSSY return the last x- and y-coordinates of
the crosshairs. Suppose you have graphed a function y = f(x), and you want to
solve the equation f(x) = 0. Using the crosshairs, you can find the point
where the graph of f(x) crosses the x-axis. The x-coordinate of this point is
the solution to f(x) = 0. Return to the Input Window, and enter the command
<A>:
SOLVE(f(x) = 0, x = CROSSX)
That is, after you move the crosshairs to the x-intercept of the graph, you can
use CROSSX as an extremely accurate approximation to the desired root.
╚
64
54
9999
Graphing integrals and derivatives
You can illustrate the processes of integration and differentiation while
computing integrals and derivatives. Suppose you wanted to compute the
integral of sin(x) between x = 0 and x = π . You could use the command
IN(SIN(x), x = 0 to PI) <A>, but you can watch the integral being calculated by
using the command:
INTEG(SIN(x), x = 0 to PI)
CC will draw the graph of SIN(x) on the screen and fill in the area being
integrated (if it is inside your current graphing window <B>) as well as
computing the integral. Actually, you will see CC draw a sequence of vertical
lines. CC draws a line each time it evaluates the function being integrated.
Watching the lines will show you how CC computes its integrals.
Similarly, you could computed the derivative of a function f(x) at x = a
with the command DIF(f(x), x = a) <C>, but if you use the command:
DIFFG(f(x),x = a)
CC will draw the graph of f(x) and the tangent line at x = a as well as
computing the derivative.
╚
69
39
68
55
9999
Using Zoom and UnZoom to change the graphics window
Once you have displayed a two-dimensional graph on your screen, you can
outline and magnify part of it, or increase the size of the graphics window
to seem more of it.
Move the crosshairs <A> to one corner of the region to be magnified.
Press Control-Z. The crosshairs will change to Z.
Move the Z (with the cursor keys) to the opposite corner of the region to
be magnified. A box will outline the designated region.
Press <ENTER>.
The region you have outlined will be expanded to fill the screen.
To cancel Zoom any time after starting, just press <ESC>. If you have
already started Zooming, you can restart at the location of the Z by pressing
Control-Z again.
To undo the effect of zooming, press Control-U while the graph is visible
to return to the previous graph.
If you press Control-U without a graphic to UnZoom to, then the current
screen will be doubled in size and the graphs redrawn.
Only graphs drawn with GRAPH, DOTGRAPH, QUICKG, SKETCH, POLARG, PARAMG,
DIFFG, INTEG, FIELD, LEVELC and TRAJ can be Zoomed and UnZoomed. Written
labels <B>, lines drawn with LINE <C>, and area fills <D> will not be repeated.
╚
54
47
45
56
9999
Three-dimensional graphing
<A> Graphing z = f(x,y)
GRAPH3D GR3
<B> Graphing parametric surfaces x = f(s,t), y = g(s,t), z = h(s,t)
PARAMG3D PA3
<C> Graphing parametric curves x = f(t), y = g(t), z = h(t)
CURVE3D
<D> Graphing matrix data
MATRIXG
<E> Using color with three-dimensional graphs
SETCOLOR SETBKCOLOR AXISCOLOR COLOR BKCOLOR
After you have displayed a three-dimensional graph on the screen, you can
rotate it in space to view it from different directions by pressing the keys
x X y Y z Z. Multiple keypresses effect larger rotations. You can also change
the way the figure is shaded by pressing the keys 1 2 3 4.
╚
58
59
60
61
62
57
9999
Graphing z = f(x,y)
If f(x,y) is a function or expression in two variables, its graph is a
surface. You can sketch the portion of the graph over the rectangle a ≤ x ≤
b, c ≤ y ≤ d with the command:
GRAPH3D(f(x,y), x = a to b, y = c to d)
Each side of the rectangle is divided in to 15 segments to make the drawing,
and the range shown on the vertical axis is sufficient to show all points of
the graph.
You can control the number of subdivisions on each side of the domain
rectangle, and you can control the size of the vertical axis. To specify the
number of subdivisions for one of the horizontal axes, place the number after
the upper limit for that axis. To specify the vertical axis, place the lower
and upper limits after the specifications for the second horizontal axis. IF
YOU ADD SOME BUT NOT ALL OF THESE SPECIFICATIONS, YOU MUST SEPERATE THE PARTS
OF THE GRAPHING COMMAND WITH SEMICOLONS. Here are some sample graphing
commands:
GRAPH3D(x^2 - y^2, x = a to b step 10, y = c to d step 20, -2 to 2)
GRAPH3D(x^2 - y^2, x = a to b; y = c to d; -2 to 2)
GRAPH3D(x^2 - y^2, x = a to b step 10; y = c to d step 20)
The abbreviation of GRAPH3D is GR3.
╚
58
9999
Graphing parametric surfaces x = f(s,t), y = g(s,t), z = h(s,t)
Parametric surfaces are graphed much like ordinary surfaces <A>. You must
specify the range for each parameter. You can optionally specify the number of
steps to use within each parameter (the default is 15) and the visible range of
the x-, y- and z-axes. A sample minimal command for graphing a sphere is:
PARAMG3D(SIN(S)COS(T),SIN(S)SIN(T),COS(S), S = 0 to PI, T = 0 to 2*PI)
If you use some but not all of the options, you must seperate the parts of
the command with semicolons. If you specify the range of one axis, you must
specify all the axes.
PARAMG3D(SIN(S)COS(T),SIN(S)SIN(T),COS(S), S = 0 to PI step 30,
T = 0 to 2*PI step 30, -2,2,-2,2,-2,2)
PARAMG3D(SIN(S)COS(T),SIN(S)SIN(T),COS(S), S = 0 to PI; T = 0 to 2*PI;
-2,2,-2,2,-2,2)
PARAMG3D(SIN(S)COS(T),SIN(S)SIN(T),COS(S), S = 0 to PI step 30;
T = 0 to 2*PI step 30)
When you enter commands this long, just keep typing and let them spill
over onto a second or third screen line. Don't push <ENTER> when you come to
the end of your first line; that will execute your partially completed command.
The abbreviation for PARAMG3D is PA3.
╚
58
59
9999
Graphing parametric curves x = f(t), y = g(t), z = h(t)
Parametric curves are graphed just like parametric surfaces <A>, but only
one parameter need be specified. To graph the helix, for example, enter:
CURVE3D(COS(T),SIN(T),T, T = 0 to 4*PI)
You an optionally specify the number of segments to use for the parameter (the
default is 100) and the size of the x-,y- and z-axes. You must specify all
axes or none, and if you don't specify all options you must seperate the parts
of the command with semicolons. Here are some examples:
CURVE3D(COS(T),SIN(T),T, T = 0 to 4*PI step 20, -2,2, -2,2, 0,2)
CURVE3D(COS(T),SIN(T),T, T = 0 to 4*PI; -2,2, -2,2, 0,2)
CURVE3D(COS(T),SIN(T),T, T = 0 to 4*PI step 20)
╚
59
60
9999
Graphing matrix data
If M is a matrix, you can graph a surface whose heights are the entries
of the matrix with the command:
MATRIXG(M)
The size of the vertical axis is determined by the entries in the matrix You
can change this default and specify the size of the vertical axis yourself by
adding the lower and upper limits after the name of the matrix:
MATRIXG(M,-3,4)
╚
28
61
9999
Using color with three-dimensional graphs
You can select the color of a three-dimensional graph by executing
SETCOLOR(c)
before drawing the graph. The parameter c can be any of the color words <A>.
You can also select the color of the axes with
AXISCOLOR(c)
or the background color with
SETBKCOLOR(c)
Three dimensional surfaces are actually drawn with two colors representing the
two sides of the surface; the colors used are the one you selected and either
its brighter or dimmer version, for example YELLOW and BROWN.
The functions COLOR and BKCOLOR return the current color values.
╚
51
62
9999
Last Graph
When you leave a graphics screen by pressing <ENTER> or <ESC>, your graph
is saved in memory. (Actually, data that permits reconstruction of the graph
is saved.) You can see your last graph again by pressing F9, even if you have
already told CC to erase it by executing ERASE or WINDOW <A>. After
redisplaying the graph, you can manipulate it by moving the crosshairs
(two-dimensional) or rotating it (three-dimensional).
If you need more memory, you can save the last graph data on disk instead
of in memory by pressing shift-F9. Pressing shift-F9 again returns the last
graph data to memory. If CC senses that it is running short of memory, it will
automatically shift the last graph data to disk.
If you are saving your last graph on disk, the file of last graph data
will normally be located in the same directory as CC (even if you called CC
from a remote directory). You can use the configuration file <B> to change the
location of the last graph file.
╚
39
19
63
9999
Solving equations
To solve the equation f(x) = g(x) , you must choose an estimate a for
the solution and enter the command:
SOLVE(f(x) = g(x), x = a)
The solution is returned in the variable x . SOLVE is not a function; it is a
procedure that changes the variable x. For example, to solve Cos(x) = x ,
enter SOLVE(COS(x) = x, x = 1);
You can solve systems of equations too, provided there are the same number
of variable as equations. For example:
SOLVE(x^3 - y^2 = 3, x^2 + y^3 = 0, x = 2, y = -2)
The solutions show up in the variables x and y .
You can speed up equation solving, at the expense of accuracy, by
substituting FSOLVE for SOLVE.
See also:
<A> Implicit functions IMPLICIT IMP
<B> Controlling speed and accuracy of equation solving SETSOLVETOL SOLVETOL
╚
65
66
64
9999
Implicit functions
CC allows you to define functions implicitly. For example, the equation
Cos(x) = t*x defines a function of t; for each value of t you get a different
solution. You can define this function in CC with the command:
f(t) = IMPLICIT(COS(x) = t*x, x = 0.5)
The starting estimate x = 0.5 works well for t ≥ 0.
The abbreviation of IMPLICIT is IMP.
IMPLICIT also works with systems of equations <A>, returning a list of
values. You can make implicit functions evaluate faster by changing the
parameter SOLVETOL <B>.
╚
64
66
65
9999
Controlling speed and accuracy of equation solving
Equation solving is controlled by a constant called SolveTolerance. If
you are solving an equation f(x) = g(x) , CC stops when it finds x such that
│f(x) - g(x)│ < SolveTolerance . (If no such x can be found, but if CC can find
x such that │f(x) - g(x)│ < 100*SolveTolerance, CC will accept this
solution.)
You can change the value of SolveTolerance with the command:
SETSOLVETOL(t)
t must be a positive real number. The larger the value of t , the faster
your solutions will converge but the less accurate they may be. The default
value of SolveTolerance is 0.0000001. You can restore SolveTolerance to this
value with the command SETSOLVETOL(0).
The function:
SOLVETOL
returns the current value of this SolveTolerance.
╚
66
9999
Creating tables of function values
If f(x) is a function or expression using x, you can display a table of
functional values:
x f(x)
0.0 ...
0.1 ...
0.2 ...
...........
1.0 ...
with the command:
TABLE(f(x),x=0 to 1 step 0.1)
Of course you can use any values you like for the lower and upper limits and
step value of the parameter. The step must be specified. You can tabulate one
or two functions. You can also enter, for example,
TABLE(SIN(x), COS(x), x = 0 to PI/2 STEP PI/20)
╚
67
9999
Differentiation
If f(x) is a function or expression using x, then you can differentiate it
at the point x = a with the command:
DIF(f(x), x = a)
Differentiation is symbolic, not approximate. You can see the symbolic
derivative of f(x) (provided x is an undefined variable) with the command:
DIF(f(x), x)
Higher derivatives can be computed by putting the order of the derivative at
the end of the command:
DIF(f(x),x = a, 3)
To compute the third symbolic derivative, you must somehow tell CC that the 3
is not the value of x but the order of differentiation. You do this by placing
it after a comma:
DIF(f(x),x,3)
To avoid ambiguities, you must use '=' in the DIF statement when assigning a
value to the variable of differentiation and a comma before the order.
See <A> for graphing derivatives with DIFFG.
╚
55
68
9999
Integration
CC will compute the numerical approximation to the integral of f(x) for
a ≤ x ≤ b: b
⌠
│ f(x) dx
⌡
a
with the command:
IN(f(x),x = a to b)
For example:
IN(EXP(x), x = 1 to 2)
You can compute integrals faster, if less accurately, by substituting FIN for
IN.
See <A> for information on using INTOL INDEPTH SETINTOL SETINDEPTH to
control the speed and accuracy of integration.
For graphing integrals with INTEG, see <B>.
╚
70
75
69
9999
Controlling the speed and accuracy of integration
CC uses an adaptive Simpson's algorithm for computing integrals. The
algorithm is controlled by two constants, InTolerance and Depth. The current
values of these algorithms are returned by the functions:
INTOL
INDEPTH
You can reset these constants with the commands:
SETINTOL(t)
SETINDEPTH(n)
t must be a postive real number, and n a positive integer. Using 0 for either
value will reset the corresponding constant to its default value, which are
0.0001 and 5 respectively. The smaller the value of InTolerance and the larger
the value of depth, the slower and more accurate will be the computation of
integrals.
╚
70
9999
Subroutines
Subroutines are entered in the Subroutine Window. To see the Subroutine
Window, press function key F10. Press F10 again to return to the Input Window.
There are two kinds of subroutines, procedures and functions. Functions
can return a value, procedures cannot. Both consist of a header line which may
include parameters, followed by a series of ordinary CC entries and control
structures, followd by the word END on its own line. Subroutine names can be
up to 12 characters long and must begin with a letter. They cannot duplicate
the name of any of CC's built-in operators or any of your variables or
functions.
Subroutines CANNOT use variables and functions from the Input Window.
To return a value from a subroutine function, place the command RETURN(v)
on one line of your subroutine, where v is the value to be returned.
See also <A> Subroutine headers and parameters
PROCEDURE FUNCTION %
<B> Displaying messages and accepting user input
WRITE INPUT INPUTS PAUSE WAIT BEEP
<C> Decision and looping operators
IF..ELSE FOR WHILE REPEAT..UNTIL EXIT
<D> Programming and graphics
GRAPHICS TEXT INPUT@ INPUTS@
<E> Examples
╚
82
75
76
77
72
71
9999
Example 1 -- Taking a test
PROCEDURE Test(n)
// ask n addition questions, accept no wrong answers
FOR i = 1 to n
a = RANDOM(9)
b = RANDOM(9)
REPEAT
INPUT(STR(a)|' + '|STR(b)|' =',x)
UNTIL x = a+b
END
END
How to use: in the Input Window, enter:
Test(5)
To see another example, push <A>.
╚
73
72
9999
Example 2 -- Random Walk
PROCEDURE RandomWalk
// Depict a two-dimensional random walk
WINDOW(-4.2,4.2,-3,3)
GRAPHICS
x=0
y=0
WHILE x > WINDOWLEFT AND x < WINDOWRIGHT AND y > WINDOWBOTTOM
AND y < WINDOWTOP
t = RANDOM*2*PI
x1 = x+COS(t)
y1 = y+SIN(t)
LINE(x,y,x1,y1)
x = x1
y = y1
END
TEXT
END
To use this procedure, enter the command: RandomWalk.
To see another example, push <A>.
╚
74
73
9999
Example 3 -- Displaying Newton's Method
FUNCTION Newton(%f,x)
// Solving f(t) = 0 with Newton's method starting with t = x, illustrated
GRAPHICS
GRAPH(f(t), t)
REPEAT
x1 = x - f(x)/dif(f(t),t=x)
LINE(x,f(x),x1,0)
LINE(x1,0,x1,f(x1))
x = x1
INPUTS('x = '|STR(x)|'. Do another step (Y/N)?',c)
UNTIL UPCASE(c[1]) == 'N'
RETURN(x)
TEXT
END
To use this subroutine, enter the command:
Newton(x)
where x is a number between -1.5 and 1.5.
╚
74
9999
Displaying messages and accepting input
Subroutines can write messages on the screen with the command WRITE, for
example:
WRITE('The final answers are',x,'and',y)
Multiple values, including strings, separated by commas, can appear in a single
WRITE statement. When WRITE is executed, the subroutine pauses until the user
presses a key.
Subroutines can also pause to accept input if you use one of the commands
INPUT or INPUTS. INPUT asks for a numerical value; INPUTS for a string. Some
sample commands are:
INPUT('Enter initial value',x)
INPUTS('Do you want to continue (Y/N)',c)
Each INPUT command has two parts: a message to be displayed and a variable to
hold the users input.
You can make your subroutine issue an audible sound with the command BEEP
on its own line.
╚
75
9999
Decision and looping operators
CC supports all the standard looping and conditional statements found in
modern programming languages except CASE. Here are some examples:
IF x < 3 OR y > 2 WHILE ABS(x) < 1 REPEAT
z = z+3 x = f(x) oldx = x
w = x*y END x = x-f(x)/g(x)
ELSE IF x > 3 UNTIL ABS(x) < 0.01
z = 5
ELSE
w = 4
END
FOR i = 1 TO 20 FOR x = 0.05 TO 1 STEP 0.05
s = s + f(i/20) s = s + f(x)
END END
All conditional constructs, except REPEAT, must be terminated by END. The term
"then" is not needed after IF.
The command EXIT, on its own line, causes the immediate termination of the
current subroutine.
╚
76
9999
Programming and graphics
Sometimes you will want to execute a sequence of graphing commands in a
subroutine, but CC normally stops after each one and waits for the user to
press <ENTER> or <ESC>. You can prevent CC from stopping by prefacing your
list of graphics commands with the command GRAPHICS. All commands can be
executed while GRAPHICS is in force, but CC will not pause after each graphing
command. The effect of GRAPHICS can be turned off with the command TEXT.
If you want to stop in the middle of a sequence of graphics commands while
GRAPHICS is in force, use the command PAUSE. CC will pause until the user
presses <ENTER> or <ESC>. While paused, the user can move the crosshairs but
not zoom a graph. You can also stop your subroutines for n seconds with the
command WAIT(n).
While GRAPHICS is in effect, you may wish to require the user to input a
value. The usual INPUT command could be used, but its window would obscure
part of the graphics screen. Alternatively, you may use the command:
INPUT@(x,y,n,v)
CC will place a box sufficient to hold n characters at location (x,y) on the
screen, and wait for you to type a value into the box. The value entered will
be placed in the variable v. To input a string instead of a value, use
INPUTS@.
╚
77
9999
Using external files
CC permits you to save your work in disk files for later reloading or for
sharing with others. In this way you can start a problem at one time and
finish it later, develop work sheets to be completed by others, or write
interactive demonstrations and lessons. Not only can you save and reload files
of CC commands and subroutines, but you can also save and reload specific
lists, matrices and graphs.
To save your work, press function key F7 and enter the name of the file
you want to save. The file name can include path information. To reload a
saved file, press F8 and enter the name of the file. See also <A>.
To see a list of all the files in a directory, press Shift-F8 and enter
the name of the directory. This name can include a mask. After viewing the
directory, you will be asked if you wish to make it your current directory.
You can also change your current directory by pressing Control-F8 and entering
the name of the new current directory.
To save the data, use the command SAVE(data,filename). The filename
must be a a string value or surrounded by apostrophes. The data can be either
a variable or an expression. To reload the saved data into a variable, use
the command LOADVAR(var-name,filename). To save a graph, either press F7
while the graph is visible, or use the command SAVEGRAPH(filename) to save the
last graph. To load a graph, which will appear on the screen and become your
last graph <B>, use the command LOADGRAPH(filename).
╚
9
63
78
9999
Printing
CC can print text to any printer, and it can print special characters and
graphs on printers than can emulate the Epson, IBM or LaserJet printers. All
printer operations are entered via the function key F2. After pressing this
key, CC will ask you to select your printer type if you have not already done
so, and then present you with a menu of choices:
1. Start printing a record of all input and results
2. Stop printing
3. Print all formulas from input window, all subroutines and all variables
4. Print all formulas from input window
5. Print all subroutines
6. Print all variables
7. Skip to top of page
8. Save input window, subroutines and variables to disk
9. Change printer type
Option 1 prints all of your entries and results as you enter them. Option 2
cancels option 1. Options 3-6 print all current values. Option 8 prints to an
ASCII disk file instead of your printer.
For printing graphs or individual lists and matrices, see <A>.
╚
80
79
9999
Printing variables and graphs
You can print a graph either by pressing F2 while the graph is visible or
by entering the command PRINTGRAPH to print your last graph.
You can print a variable or any other expression, useful for lists or
matrices, with the command PRINT(data). For example:
m = MATRIX(1/(i+j-1),i=1,4,j=1,4)
PRINT(m)
╚
80
9999
Disk and Memory Management
CC is a large program. It will run in 512K of memory, but larger
problems require 640K. CC uses overlays to reduce the amount of code that must
be in memory at any time, so it runs best off a hard disk. If you must run CC
from a floppy disk, it is best to use a disk of at least 720K capacity. Then
all system files: CC.EXE, CC.OVR and CC.HLP can be on one disk. If you must
use a 360K disk, put CC.EXE and CC.OVR on it. The help facility will not be
available.
You should make as much memory as possible available before running CC.
Delete all but the most necessary TSR programs before starting CC.
You can free up memory while CC is running by using FORGET to delete
unnecessary variables <A> and Shift-F9 to transfer your Last Graph information
to disk <B>.
╚
13
63
81
9999
Subroutine Headers and Parameters
Each subroutine must begin with one of the lines:
PROCEDURE procedure-name(parameter-list)
FUNCTION function-name(parameter-list)
The procedure-name or function-name can be up to 12 characters long beginning
with a letter. It cannot duplicate the name of any of CC's built-in functions
or the name of any of your variables or functions from the Input Window.
The parameter list is a list of variable names <A>. When you call the
subroutine, you specify initial values for these variables, which can then be
used in the subroutine.
You an also pass a function definition to a subroutine by passing its
name as a parameter. You identify a function-name parameter in a subroutine
header by preceding it with %. See <B> for an example.
╚
13
74
82
9999