▼
Posts: 142
Threads: 24
Joined: Jan 1970
Hi, I've recently got an HP12C, and I'm trying to write
a program for it implementing all six trigonometric
functions that it lacks, namely sin, cos, tan, and their
inverses. Now, I'm pretty sure this must be old hat for
everyone, but I've never seen before such a program.
I would be grateful if someone could point me where to
find that program, so that I could compare with mine and
see how its author solved the many troubles I've suffered
while implementing it, namely extreme shortage of program
memory to implement all 6 functions at once at the
greatest possible accuracy (8 decimal places or better)
for all the range of input values.
My actual beta version implements everything except the
arc cosine function (no big deal, it can be easily
computed as pi/2arc sine) with 810 decimal places
accuracy, and uses no numbered registers at all, but I
would love to see how other coped with this subject.
▼
Posts: 180
Threads: 23
Joined: Apr 2012
ExPPC member (are you undercover?):
Can you post the program? I would love to see it, as would others, I'm sure.
For the good of us all, maybe we'll start a sort of informal contest, where programs are presented for the 12C and 17BII to acomplish the trig. and inverse trig. functions. Seems reasonable to methese two calculators are current, and both have advantages over the 32SII (the only current RPN scientific) excepting some key scientific functions. I would say that the 12C has a landscapeformat advantage (for many peopleI prefer the portrait format myself) and a numberdisplay advantage, and the 17BII has numerous advantages over the 32SII (the 17BII is simply a much more powerful machine).
I recently submitted my solution for the 17BII, but I limited my solution to the region [0, PI/2]. I'm sure my program could be improved, but there doesn't seem to be an overwhelming interest...
Bruce.
▼
Posts: 2
Threads: 0
Joined: Jan 1970
Thanks for your kind words. I don't know how to post the
program here, I guess a raw listing in a posted response
would get weirdly formatted, if at all.
The main difficulties I've found stem from the HP12C's
extremely limited programming capabilities. You just have
to try and fit all 6 trig functions in 99 bytes ! That
wouldn't be so bad as it seems were it not for the fact
that you don't have labels, nor flags, only x<=y and
x=0 tests (which forces you to *substract* two values
and compare the result to zero, when you actually wanted
to compare one against the other), no indirect adressing, no increment/decrement instructions, and, most decisively,
you don't have subroutine capability (!!). That alone is
really the ultimate coupdegrace to fit everything
accurately in so little memory. Matter of fact, I haven't
succeeded, I just can't find room enough to include
the arc cosine. Only the fact that it's easily computed
from the arc sine (pi/2arcsin) saves the day. That's
why I'm so interested in looking at other people's
solutions to this particular programming issue. I'm sure
some must exist already.
▼
Posts: 155
Threads: 5
Joined: Jan 1970
You can do it like:
[pre:
program line 1
program line 2
etc.
]
Posts: 1,788
Threads: 36
Joined: Aug 2007
If you can find a copy of the Collected Algorithms of the ACM (Association for Computing Machinery) from around 1976 +/ 3 years or so there is a "continued fraction" algorithm. As I rememeber it produces a couple of numbers that depending upon how you combine them gives you all the trig funcions, e^x, and hyperbolics. It has been a long time since I played with it but it was rather short, fast, and most interesting.
▼
Posts: 113
Threads: 19
Joined: Oct 2011
Try:
M. Abramowitz and I. Stegun. Handbook of Mathematical Functions. Dover, 1972.
There you will find a lot of very useful approximations, easy to program for different levels of accuracy.
Jan
▼
Posts: 4,027
Threads: 172
Joined: Aug 2005
I have once written a very short program for the HP38C that computed SIN, COS and TAN (no inverses), less than 15 steps. At that time I was studying for Electrical Eng. (long, long time ago...) and I have lost it. I remember computing Taylor series for sine and cosine (n! saved the day) and dividing both to compute tangent. It would fit perfectly in an HP12C.
I also remembered using TVM procedure to estimate energy consumption x production in a power plant. How many good stuff we had to do at that time...
Will anybody share the programs with us? I would if I had, I remember not even noting the steps, as the program was of no specific need of mine (only for that charming 19 Y.O. girl I cannot really forget the thankful face when my program ran smoothly on her HP38C).
▼
Posts: 172
Threads: 21
Joined: Sep 2005
Luiz Claudio, if we put trigonometrics aside, it would be more interesting to know what happened later, with respect to that 19 Y.O. 8) ?
▼
Posts: 4,027
Threads: 172
Joined: Aug 2005
She got her Engineering graduation and... left many gratefull memories. I would like knowing where is she, right now. Just memories... Anyway, who does not have them?
(
(Hey, do you still need that material about the 41CX? Let me know...)
Posts: 3
Threads: 1
Joined: Jan 1970
All,
I have already posted the trig functions earlier here. See Forum Archive 6 entitled "Add trig functions on HP17BII, etc.? (You can)" for the source. I incorrectly stated that they were the Maclaughlin seriesthey're actually the Maclaurin series. They work quite well in both directions.
FYI and good luck,
M.
▼
Posts: 180
Threads: 23
Joined: Apr 2012
Mike:
You seem to have missed the point. I, too, posted information on programming trig. functions into the HP17BII, except my algorithms also include the INVERSE trig. functions, which is something that we are talking about here. I also included a full program listing. Look in the current forum page for:
Improved TRIG. and INVERSE TRIG. functions for the HP17BII (Posted Sept. 26, 2001)
I actually had posted my first post on trig. functions for the 17BII on 7/31/2001 (horrible codesee the later post for details). I then followed it up on 9/26/2001 with a vastly superior implementation than the dumb one I first posted. Your article was posted on 9/3/2001. Please look at my 9/26/2001 post for an example of formatting that I think is acceptable for HP17BII listings. As soon as you go into the Forum, there is a hyperlink to advanced formatting techniques.
The point here, is come up with code to fit these functions into a 12c. The 12c is a completely different programming beast than the 17BII, and is much more limited. That is what this thread is about.
If you are able to implement your algorithms on a 12c for all the trig. AND INVERSE TRIG. functions, please post a 12c listing!
Bruce.
