You'll
probably
want
to
try
"graphing" other
curves using the subroutines, so
we'll
go
into
a
little
detail
on
how
our
concentric
circles
program
works.
Line 10
gives
us
a nice
clear
screen to
start
with.
Line
20
sets
up
a
loop
which
increments the Radius
R
from
2 to
22
in
steps
of
4.
Line
30
sets
up
a
"nested" loop
which
increments
the X-coordinate of
our graph
from
—
R
toR.
Line
40 computes
the
Y-coordinate of
our graph
as
a function of the radius
R
and
the
X-
coordinate A.
The
square root subroutine
is
called.
Lines
50 and 60
center the
circle
on
the Display
and "draw
it".
Line
50 produces
the
lower
half
of the
ci&le,
and
line
60
produces
the
upper
half.
Lines 70,
80 and 90
.
.
.
you
can
figure
them
out
for yourself.
From One
Subroutine
to
Another
So
far
we've used
GOSUB
commands
in
the
main program
to
call
subroutines.
Now
let's
be
neighborly
—
and
let
one
subroutine
call
on
another.
Suppose
we.
want
to
compute
3
U
—
that's
3 times
itself
11
times.
We
can
compute
it
directly as
3*3*3*3*3*3*3*3*3*3*3,
right?
But what
about
3
1
'
3
-
that
is,
3 to the
11.3
power?
Simple
multiplication
isn't
going to
get us
anywhere on
this
one.
It
looks
like
a
job
for
Supersub!
That's
our Exponential Subroutine,
which
actually
calls
on two
other subroutines before
it's
through
—
one
for
logs,
one
for
anti-logs.
(These
are
not
the
opposing
sides
in
a conservation
dispute.
They're extremely
useful
math
functions.)
Supersub
derives
its
number-crunching
power from
a rather
complex-looking equation:
x Y
=
e
Y*logX
(You
don't have to
understand
it,
but
it's
nice to
know
it's
there.)
All
we
have
to
do
is
provide the subroutine
with
the values
for
X
and
Y,
in this
case 3
and
11.3,
and
the
rest
is
automatic.
The
subroutine goes
and
gets log
3, etc.,
and
returns to
our
main program
with the
final
answer.
W«'reustog
natural logs
and
auti;l«gs,
as
opposed;
to
common
log^
Bememoer,
this
is
a
classy
operation!
159