A few simple HP 35s programs « Next Oldest | Next Newest »

 ▼ Lode Unregistered Posts: 101 Threads: 11 Joined: Jun 2011 07-03-2011, 05:14 PM Hi, I made a few simple programs for the HP 35s which make it a little bit better imho :) I tried to let each one keep as much of the original stack as possible intact, this didn't succeed for every function however. There are: extract im/re, ->R, ->P, lambertw, complex loggamma, complex conjugate, complex asin/acos/atan and complex sqrt. They're almost all located on or near a key where either a function is similar, or the letter is a good mnemonic. The polar/rect and lambertw ones were inspired by posts from here but made simpler. What do you think of the programs? Got any tips to improve them? Are there any HP-35s related resources for other useful programs or programming tips and techniques? I found the Matrix Multitool which is very nice, but for the rest I only find surveying related programs... Any ideas for *games* that can be programmed on a device like this? Thanks! ```//Get re in x and im in y. Located on the imaginary number key. lbl g eqn: abs(regx-sq(abs(regx))/regx)/2 x<>y 1/x clx eqn: abs(lastx+sq(abs(lastx))/lastx)/2 rtn //Complex conjugate, on the +/- key lbl n 1/x clx sq(abs(lastx))/lastx rtn //LambertW, on the W key. Makes a mess of the stack. lbl w sto j fn= v solve i rollup x<>y rtn //LambertW helper function (too bad this costs a whole label, why can't you give line numbers to SOLVE??) lbl v rcl i e^x lastx * rcl j - rtn //Polar to rect, on the R key representing ->R lbl r eqn: regy*sin(regx) enter eqn: regx*cos(regy) rtn //Rect to polar, on the S key because it's next to the R. Unfortunately lets the oldest stack value get lost. lbl s i * + arg lastx abs rtn //Complex loggamma, on the z key which is above '!'. lbl z 1/x clx eqn: 0.918938533205+(lastx-0.5)*ln(lastx)-lastx+1/(12*lastx)-1/(360*lastx^3)+1/(1260*lastx^5) rtn //Square root of complex numbers, on the square root key lbl k 1/x clx eqn: lastx^0.5i0 rtn //Complex asin, on the sin key (why doesn't it support this by default anyway?) lbl h 1/x clx eqn: -i*ln(i*lastx+(1-lastx*lastx)^0.5i0) rtn //Complex acos, on the cos key lbl i 1/x clx eqn: -i*ln(lastx+((lastx*lastx-1)^035i0)) rtn //Complex atan, on the tan key lbl j 1/x clx eqn: 0.5*i*ln((1-i*lastx)/(1+i*lastx)) rtn ``` ▼ Paul Dale Unregistered Posts: 3,229 Threads: 42 Joined: Jul 2006 07-04-2011, 01:28 AM I wrote a game for the 35s which still hasn't made it into the software library but is available as an article and buried in the archives. Also, we did a group effort on R->P and P->R functions, again available as an article. These behave the same as internal commands with respects to stack operations, LastX etc. - Pauli ▼ Lode Unregistered Posts: 101 Threads: 11 Joined: Jun 2011 07-04-2011, 03:36 PM Why is there so much flag 10 logic in these R/P examples? If it's to clear it for the equation, isn't just a single "CF 10" enough? If it's to keep the original state of flag 10: is that really so important to be worth so much extra lines (not to me)? If a program wants to display a message it will set the flag anyway... The game looks cool! It's going to be a LOT of work to type it over though! I wish there existed a way to automate this inputting. When typing over the "Matrix Multitool", there was one big problem I had: since the calculator updates line numbers automatically when inserting lines, it sometimes messes with line numbers if you need to correct a mistake on an earlier line. It was hell. When I typed that matrix program, I had already added the "RTN" at the end while still typing all previous lines. It had changed almost all GTO's and XEQ's that pointed to the future, into line number 442. When going back to correct each of those, due to deleting and readding the GTO line, some others got messed up as well, etc... Any tips on efficiently entering a long program and not letting it mess up line numbers? ▼ Paul Dale Unregistered Posts: 3,229 Threads: 42 Joined: Jul 2006 07-04-2011, 05:38 PM Quote:Why is there so much flag 10 logic in these R/P examples? The logic is there so they act exactly like internal commands -- don't care about the state of the device on entry and don't change the state of the device on exit. Equations don't work if flag 10 is set so that has to be cleared and restored. Quote:If it's to clear it for the equation, isn't just a single "CF 10" enough? If it's to keep the original state of flag 10: is that really so important to be worth so much extra lines (not to me)? A nice simple solution is to remove the bits you don't want. The 35s isn't even remotely short of program memory so the extra lines are kind of moot. Quote:If a program wants to display a message it will set the flag anyway... And if the program neglects to clear this flag afterwards? What about a program that sets it to display messages and then does a rectangular polar conversion. These commands are designed to work regardless. Still, take out the bits you don't want or do your own. Quote:Any tips on efficiently entering a long program and not letting it mess up line numbers? Nope, it is just painful. When developing the game, I retyped it when substantial changes were made to avoid these issues. - Pauli

 Possibly Related Threads… Thread Author Replies Views Last Post HP Prime: Lists in programs Alberto Candel 7 3,520 12-04-2013, 02:16 AM Last Post: Alberto Candel HP Prime: matrices in programs, in need of help Alberto Candel 9 3,220 11-26-2013, 01:33 AM Last Post: cyrille de BrĂ©bisson Simple Tetris. free for you to improve on cyrille de BrĂ©bisson 3 1,912 11-20-2013, 05:43 PM Last Post: Erwin Ried Grouping programs on the HP Prime Michael de Estrada 11 3,705 11-04-2013, 01:38 PM Last Post: Damien [HP-Prime] Simple Game (Bugs) CompSystems 1 1,414 11-01-2013, 10:18 AM Last Post: Han Transfering HP-85A Programs Gerry Schultz 5 2,574 10-17-2013, 12:30 PM Last Post: Philip Reagan (Texas) Date/time programs for the HP 35s R. Pienne 0 1,073 10-03-2013, 02:37 PM Last Post: R. Pienne Simple Math Question Namir 2 1,391 08-09-2013, 06:13 PM Last Post: Eddie W. Shore New HP 35S Programs posted on my blog Eddie W. Shore 2 1,571 06-08-2013, 03:47 PM Last Post: Glenn Shields hp 35s programs in software library Andrew Nikitin 7 2,287 05-30-2013, 11:55 AM Last Post: Dave Hicks

Forum Jump: