home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hacker Chronicles 2
/
HACKER2.BIN
/
450.ALGETRIG.DOC
< prev
next >
Wrap
Text File
|
1993-06-13
|
5KB
|
125 lines
AlgeTrig 1.2 by Duane Bailey
Requires an 80286 or higher processor, 55 KB of free RAM memory, probably
needs DOS 2.1 or higher. I recommend a hard drive for speed in keeping a log
file when you choose to keep one.
______________________________________________________________________________
This program can find the sine, cosine, tangent, cotangent, secant, and
cosecant of the angles you enter. You can give it the values in degrees,
radians, or grads. It also converts between the three modes. Finally, it finds
both natural logarithms (based on "e") and common logarithms (based on 10).
AlgeTrig can also keep a text log file if you wish. You choose the path and
name. The program is intended to be easy to use, but if you need help mail me
your questions. If the program is worth $8.00 bucks to you, you get my number
and "almost free" updates if any come along. This means I would individually
compute the exact price of disk and postage, and charge only that, in order to
break even. You will also get info on other computer creations of mine; I have
written 3 other programs, written a short book on science, and painted some
superb pictures with a mouse and some superb shareware paint programs that
blow Windows paintbrush totally away. (I do like Windows, but let's face it,
the paint module is on a budget...)
I'm writing this manual mainly with some programmers' support in mind. I'll go
into a couple algorithms.
The language I'm using only provides Sine and Cosine functions; however, the
other four trig functions are derived from these two anyway.
opp adj opp Sin Cos 1
Sin = ───── , Cos = ───── , Tan = ───── = ───── , and Cot = ───── = ─────
hyp hyp adj Cos Sin Tan
1 1
Sec = ───── , while Csc = ─────
Cos Sin
Identities:
1) Sin²Θ + Cos²Θ = 1
2) 1 + Tan²Θ = Sec²Θ
3) 1 + Cot²Θ = Csc²Θ
4) Sin(-Θ) = -Sin Θ (odd function)
5) Cos(-Θ) = Cos Θ (even function)
┌ ┐
│ π │
6) Sin │ ───── - Θ │ = Cos Θ
│ 2 │
└ ┘
┌ ┐
│ π │
7) Cos │ ───── - Θ │ = Sin Θ
│ 2 │
└ ┘
Always when programming I'm very careful about zero denominators. Now for
tangent, cotangent, secant, and cosecant, I -first- evaluate the denominator
in your choice of either degrees, radians, or grads. If it's zero then I abort
the division and leave the appropriate message on the screen. Then I start
over by asking you for the next one. If the division were to be attempted, the
program would suddenly stop running, and you would be looking at a DOS prompt.
Try Tan, (C), and choose degrees. Enter 90 to see what I mean. At 90 degrees
the cosine is 0.
If you goof and enter a letter when it's supposed to be a number, your entry
is not counted. Also, in the two logarithm routines, if you enter a number
that is either negative or zero, your entry is not counted. But in the trig
functions if you get "undefined" for an answer, the entry is counted. (As
things rotate through multiples of 2π, there are an infinite number of angles
that have some undefined trig function, how could you be expected to know?).
This information is valuable sometimes anyway. The entry is counted as valid.
The logarithm routines: Well my language only provides for natural logs, that
is, Ln(x). To get a common log, that is, Log(x), I had to rack my brain, but I
figured it out. Here it is:
Ln(x)
Log(x) = ─────────
Ln(10)
______________________________________________________________________________
The log file: It's a "plain-Jane" ASCII text file containing your session. You
don't have to keep one, but it sure could help if you had 101 problems to do
quickly and needed the results in concrete form right away if not sooner. You
can edit it as you wish, import parts of it to other programs, print it, etc.
.... a harried and hurried engineer's dream!
If you have any problems or bugs to report, -please- mail them to me and tell
me as much as you can about what went wrong. For example if your computer has
a math co-processor chip, tell me what brand, model number, whether SX or DX,
etc.... I am testing the program exhaustively but you never know, it may
misbehave on some particular configuration of machine. It does not require a
math co-processor, and one is unlikely to help, but you never know, it may try
to fight with some of the newer off-brand math chips.
"I'm a hack, she's a hack. Wouldn't ya like to be a hack too?"
Revision history:
1.0: Original release, project took 4 days from conception to completion.
1.1: Made the functions A through F easier to exit (less effort).
1.2: Made the calculations sections scroll, for ease of use.
Duane Bailey
409 W. First St, Apt. C
Winston-Salem, NC 27101