HP-12C trigonometrics « Next Oldest | Next Newest »

 ▼ Ex-PPC member Unregistered Posts: 142 Threads: 24 Joined: Jan 1970 10-11-2001, 02:47 PM Hi, I've recently got an HP-12C, 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/2-arc sine) with 8-10 decimal places accuracy, and uses no numbered registers at all, but I would love to see how other coped with this subject. ▼ W. Bruce Maguire II Unregistered Posts: 180 Threads: 23 Joined: Apr 2012 10-11-2001, 05:20 PM Ex-PPC member (are you under-cover?): 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 me---these 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 landscape-format advantage (for many people---I prefer the portrait format myself) and a number-display 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. ▼ Ex-PPC Unregistered Posts: 2 Threads: 0 Joined: Jan 1970 10-11-2001, 09:34 PM 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 HP-12C'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 coup-de-grace 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/2-arcsin) 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. ▼ Jim L Unregistered Posts: 155 Threads: 5 Joined: Jan 1970 10-11-2001, 09:57 PM You can do it like: ```[pre: program line 1 program line 2 etc. ]``` David Smith Unregistered Posts: 1,788 Threads: 36 Joined: Aug 2007 10-11-2001, 09:33 PM 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. ▼ Jan Unregistered Posts: 113 Threads: 19 Joined: Oct 2011 10-12-2001, 09:55 AM 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 ▼ Vieira, Luiz C. (Brazil) Unregistered Posts: 4,027 Threads: 172 Joined: Aug 2005 10-13-2001, 09:32 AM 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). ▼ Nenad (Croatia) Unregistered Posts: 172 Threads: 21 Joined: Sep 2005 10-13-2001, 11:02 AM 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-) ? ▼ Vieira, Luiz C. (Brazil) Unregistered Posts: 4,027 Threads: 172 Joined: Aug 2005 10-13-2001, 11:34 AM 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...) Michael Blankenship Unregistered Posts: 3 Threads: 1 Joined: Jan 1970 10-16-2001, 11:07 AM 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 series--they're actually the Maclaurin series. They work quite well in both directions. FYI and good luck, M. ▼ W. Bruce Maguire II Unregistered Posts: 180 Threads: 23 Joined: Apr 2012 10-16-2001, 12:50 PM Mike: You seem to have missed the point. I, too, posted information on programming trig. functions into the HP-17BII, 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 HP-17BII (Posted Sept. 26, 2001) I actually had posted my first post on trig. functions for the 17BII on 7/31/2001 (horrible code---see 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 HP-17BII listings. As soon as you go into the Forum, there is a hyper-link 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.

 Possibly Related Threads… Thread Author Replies Views Last Post HP 12C, 12C Platinum & 15C iOS App Walter Lam 2 1,407 06-02-2011, 01:25 PM Last Post: Andrés C. Rodríguez (Argentina) Trigonometrics on the 17bii+ Les Wright 8 2,194 03-04-2007, 09:44 PM Last Post: Les Wright Trigonometrics for Really Big Input Les Wright 18 4,057 02-24-2007, 10:38 PM Last Post: Massimo Gnerucci (Italy) 12C vs 12C Platinum Cash Flows Katie Wasserman 10 2,877 12-28-2005, 10:12 PM Last Post: tony(nz) 12c/12c Platinum programming differences Don Shepherd 6 2,039 08-11-2003, 10:11 AM Last Post: Gene Trigonometrics in financial applications Valentin Albillo 17 3,857 06-30-2003, 10:36 AM Last Post: Thibaut 12C or 12C Platinum...that is the question Joe 3 1,350 06-21-2003, 11:39 PM Last Post: Don Nguyen What's CPU of HP 12C and HP 12C Platinum Luc Chanh Truong 3 1,446 06-11-2003, 01:49 AM Last Post: Vieira, Luiz C. (Brazil) Hi !! Gene, HP 12C vs 12C Platinum Luc Chanh Truong 0 805 06-09-2003, 10:28 PM Last Post: Luc Chanh Truong Re: Inconsistent results #1: 12c vs. 12c Platinum hugh 1 952 05-14-2003, 03:22 PM Last Post: Gene

Forum Jump: