![]() |
Yet another 12C mini-challenge (pi) - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: Yet another 12C mini-challenge (pi) (/thread-145498.html) |
Yet another 12C mini-challenge (pi) - Gerson W. Barbosa - 01-09-2009 Try to write an 11-step program to display 3.141592654 on the HP-12C.
[1] [0] [4] [3] [4] [8] [ENTER] [3] [3] [2] [1] [5] [/] [GTO 00] (14 steps)Too many steps!
[3] [.] [1] [4] [1] [5] [9] [2] [6] [5] [4] [GTO 00] (12 steps)Still too many steps...
Gerson.
Re: Yet another 12C mini-challenge (pi) - Dusan Zivkovic - 01-09-2009 2143 ENTER 22 / SQRT SQRT GTO 00
Re: Yet another 12C mini-challenge (pi) - Gerson W. Barbosa - 01-10-2009 Actually 3 is the correct ninth decimal digit but for the sake of rounding 4 is better. A very nice attemp anyway! I'll post my solution next week (in case anyone doesn't come up with it before). Regards,
Gerson.
Re: Yet another 12C mini-challenge (pi) - Egan Ford - 01-10-2009 Quote:
9 Steps: 01 3
You'll have to wait for it, but it will display the digits of Pi for a brief period of time.
Re: Yet another 12C mini-challenge (pi) - Namir - 01-10-2009 Here is my answer: [3] [5] [5] [ENTER] [1] [1] [3] [/] [GTO 00] 9 steps!! Why do we count the last since the machine seems to insert it automatically (yes? no?).
Namir Edited: 10 Jan 2009, 11:10 a.m.
Re: Yet another 12C mini-challenge (pi) - Dusan Zivkovic - 01-10-2009 Hi again Gerson, Re: Yet another 12C mini-challenge (pi) - Katie Wasserman - 01-10-2009 Dusan, I think that you (almost?) have a winner with just a little math you can write this as:
[3] The answer should be 3.14159265414... but on the original 12C it shows as 3.141592653 on the newer models it's 3.141592654.
Edited: 10 Jan 2009, 3:22 p.m.
Re: Yet another 12C mini-challenge (pi) - Gerson W. Barbosa - 01-10-2009 Hi Katie, Yes, Dusan is on the right track. You're advice to him is fine, however a slight modification has still to be made in order to both calculator display the same answers. I could post your modified program now but I think you prefer to find it by yourselves. You are very close now! In fact, the idea of this mini-challenge arose from your 12-step solution in an old thread you started, even though rather than using an approximation you've actually computed the constant, which is really nicer. http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv016.cgi?read=100992 Regards,
Gerson.
Re: Yet another 12C mini-challenge (pi) - Gerson W. Barbosa - 01-10-2009 Well, I was thinking of displaying all ten digits at once, so that the routine could be used as a pi key replacement and at least one step shorter than just entering the digits one by one. Anyway, your algorithm-oriented program is very interesting. Please see the link to Katie's program above. Regards,
Gerson.
Re: Yet another 12C mini-challenge (pi) - Gerson W. Barbosa - 01-10-2009 Hi Namir, This well known approximation is really excellent but not close enough to our purpose. Thanks for your interest! Regards, Gerson. P.S.: Answering your question, I decided to include the final GTO 00 as a standard but you can compare programs lenghts without considering it, if you wish.
Edited: 10 Jan 2009, 5:56 p.m.
Re: Yet another 12C mini-challenge (pi) - Gerson W. Barbosa - 01-10-2009 Hi Dusan, Most of these ln approximations are attributed to Ramanujan. For this problem I tried some of Roy William's e^(pi*sqrt(n)), for integer n. Scroll down the page until you get to Curiosités: http://www.pi314.net/approx.php I've found one 17-digit pandigital approximation involving ln, sqrt and factorial using one of these. Regards,
Gerson.
Re: Yet another 12C mini-challenge (pi) - Dusan Zivkovic - 01-10-2009 Thanks Katie. Re: Yet another 12C mini-challenge (pi) - Dusan Zivkovic - 01-10-2009 Hi Gerson, Re: Yet another 12C mini-challenge (pi) - MikeO - 01-10-2009 I estimate about 2.99 years to see the answer with Egan's approach. That's a long wait ;) -Mike
Re: Yet another 12C mini-challenge (pi) - Palmer O. Hanson, Jr. - 01-10-2009 Quote:You can change the last digit from a three to a four by addiing the steps ln ex I realize that makes it thirteen steps, but it makes a nice demonstration of the interesting things that happen with the log functions. Palmer
Re: Yet another 12C mini-challenge (pi) - Gerson W. Barbosa - 01-11-2009 You have found a new solution. Congratulations! Now I wonder if it can be done in 10 steps or less. My hint was making a slight modification in Katie's rewriting of your first approximation:
[3] Here is the pandigital approximation I have mentioned:
'LN(((8-1)!+2*5!)^sqrt(9)+(3!)!+4!)/sqrt(67)' = 3.14159265358979323957 = pi + 0.00000 00000 00000 00111 This can be rewritten to use only 8 digits instead of the 9 digits from 1 through 9:
'LN((7!+2*5!)^3+6!+4!)/sqrt(67)' On the HP-200LX, this gives out 3.141592653589793, also matching the machine's built-in approximation. Regards, Gerson.
Re: Yet another 12C mini-challenge (pi) - Dusan Zivkovic - 01-11-2009 The pandigital approximation doesn't seem promising as a way towards a "10 steps or fewer" solution. Too many inputs, too many operations. But maybe someone will prove me wrong. Let's wait and see.
Re: Yet another 12C mini-challenge (pi) - Paul Dale - 01-11-2009 I've got an almost that is so beautiful that I have to post it here:
5 LN . 5 1 2 3 / gives 3.141592645 9 steps (8 without the GTO 00 at the end)
Re: Yet another 12C mini-challenge (pi) - Gerson W. Barbosa - 01-12-2009 Quote: Actually, pandigital approximations are another kind of puzzle/problem. The goal is to obtain an approximation using all the digits from 0 to 9 (or from 1 to 9) only once. Pi Approximations in the MathWorld site presents a couple of them, but limited to 10 or 11 digits. Regards,
Gerson.
Re: Yet another 12C mini-challenge (pi) - Gerson W. Barbosa - 01-12-2009 Really beautiful despite the exchanged two last digits. And it does use one keyboard row (123). Thanks for posting it! Keyboard rows, columns and diagonals make for some interesting expressions, nothing to do with this problem though:
sqrt(9 + (sqrt(741/852) - 2^-14))^2) = 3.141592665 Just to mention a few... Gerson.
Re: Yet another 12C mini-challenge (pi) - Egan Ford - 01-12-2009 Yes. It was not to be taken seriously.
Re: Yet another 12C mini-challenge (pi) - Stuart Sprott - 01-13-2009 Quote: I have got to admit that I like this method the best of all. It is extremely easy to remember and as a Surveyor it is all that is needed in the practical world.
Given a circle of radius 100 Ks the error in calculating the circumference would be only 0.2 MM. That is good enough for me.
Re: Yet another 12C mini-challenge (pi) - George Bailey (Bedford Falls) - 01-13-2009 Quote: For the practical world it would be even easier to remember 3.14159 - and still be sufficient... ;-)
Edited: 13 Jan 2009, 6:06 a.m.
Re: Yet another 12C mini-challenge (pi) - George Bailey (Bedford Falls) - 01-13-2009 Quote: Why sooooo loooong????
4 Steps: 01 2 Just remember to imagine the . between 3 and 1 in a couple of months and to clear the X register before you start. ;-)
Hail to the 12C who might well be able to do it on one set of batteries. Edited: 13 Jan 2009, 6:14 a.m.
Re: Yet another 12C mini-challenge (pi) - Paul Dale - 01-13-2009 Getting closer....
4 1 LN 5 y^x 1 %T 3 +In ten steps (including the final GTO 00) gives 3.141592653 Now to see if I can get that final digit up by one.
Re: Yet another 12C mini-challenge (pi) - Paul Dale - 01-14-2009 More playing and a better result that more than achieves the challenge:
8 e^x 1 4 8 - 8 9 %T This gives the result asked for to all digits. It requires 10 steps (including the GTO 00 at the end) besting the target of 11.
The 148 can be replaced by: 5 e^x INTG without changing the result but it doesn't save any steps :-( The only down side is %T leaves a value in Y.
Re: Yet another 12C mini-challenge (pi) - Michael Meyer - 01-14-2009 Nice.
Re: Yet another 12C mini-challenge (pi) - Paul Dale - 01-14-2009 Quote: Yes it can. See my post below :-)
- Pauli
Re: Yet another 12C mini-challenge (pi) - Katie Wasserman - 01-14-2009 I'll second that "nice"!
This must have take an awfully long time to figure out, 1 step/hour?
Re: Yet another 12C mini-challenge (pi) - Paul Dale - 01-14-2009 Quote: I don't think I'll comment on this :-)
Re: Yet another 12C mini-challenge (pi) - Dusan Zivkovic - 01-15-2009 Very nice :)
Re: Yet another 12C mini-challenge (pi) - Gerson W. Barbosa - 01-15-2009 Quote:8 e^x 1 4 8 - 8 9 %T Very very nice!
Quote: I had a hunch YOU would beat the 11-step limit, considering your previous solutions to similar problems. Congratulations!
Quote: This prevents the routine from being used as an actual PI replacement in programs - Anyway, saving at least stack register X was NOT a requirement. Regards,
Gerson.
|