WP 34S: missing vector cross product  Printable Version + HP Forums (https://archived.hpcalc.org/museumforum) + Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum1.html) + Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum2.html) + Thread: WP 34S: missing vector cross product (/thread188466.html) 
WP 34S: missing vector cross product  fhub  07232011 I saw that the cross product is still missing in the vector library, so that's a good chance to write my first WP34s program. ;) Here's the pure code which fulfills all conditions required in vectors.txt (at least I hope so)  you just have to give it a label of your choice:
STO C Just 20 steps, not so bad for my first program ... :)
Franz
Re: WP 34S: missing vector cross product  Paul Dale  07232011 Give me a break, I only added vectors.txt yesterday. I'll add your code instead of writing my own :)
Re: WP 34S: missing vector cross product  Paul Dale  07232011 The vectors.txt file is updated. vectors.wp34s will be in due course I expect. I think that 112 steps is pretty lean for this lot :) Thank to Franz for the final piece.
Re: WP 34S: missing vector cross product  fhub  07232011 I must say that writing this cross product was really a nightmare:
And with all these troubles I had an idea which would greatly simplify such calculations (with so many parameters on the stack):
Maybe this 2nd stack registers could be named with a dot preceding the names (.X, .Y, .... .C, .D) and adressed with the sequence RCL XEQ (because XEQ is almost the only key which is still free to use after a STO/RCL), which would then display "RCL .__" and wait for any stackregister name (X to D). Well, just a dream of me  but it would indeed make programming much easier ... Franz
PS: I know this could be done with the usual registers Rxx (and STOS), but I also know that you don't like changing any registers during 'usual' calculations within a program. Edited: 23 July 2011, 7:22 a.m.
Re: WP 34S: missing vector cross product  Paul Dale  07232011 Not possible: no RAM left.
We do have save and restore stack operations: STOS & RCLS.
Re: WP 34S: missing vector cross product  fhub  07232011 Quote:Ok, and what about a few more stack manipulation commands?
It would be nice to have something like Rv and R^ not for the whole stack but just for a part of it (e.g. only do a rolldown/up on the first 3 registers X,Y,Z). Edited: 23 July 2011, 8:43 a.m.
Re: WP 34S: missing vector cross product  Gene Wright  07232011 While we are thinking of stack commands :) how about something like these? Y <> Z Y <> T
Z <> T
Re: WP 34S: missing vector cross product  fhub  07232011 Quote:Yes, not a bad idea  my HP48GX has much more (useful!) stack manipulation commands than are available on the WP34S. But the major problem is certainly the limited space on the WP34S, wheras the 48GX doesn't suffer from such space restrictions. ;) Re: WP 34S: missing vector cross product  Paul Dale  07232011 And the other four stack levels??
Re: WP 34S: missing vector cross product  Gene Wright  07232011 True true... but I do think at least these for the standard 4 levels would be useful. How about a general <> function? Is that possible?
X<> already prompts for the other location. Is it possible to code for both? :)
Re: WP 34S: missing vector cross product  htom trites jr  07232011 Cleanest is to implement "stackdup and stackpop". Upon entry, your code does a stackdup; this gives you a copy of the current stack and status. Do what you will (including calling other program segments.) When you're done, you explicitly write results into the lower stack and status registers, and then execute a stackpop, which throws away all of your unsaved values, leaving the calling code with your results. Stackpop gets really messy if you modify the structure of the "top stack".
Re: WP 34S: missing vector cross product  Paul Dale  07232011 It isn't possible. The opcodes used for commands don't have enough space to hold two register addresses. So it would have to be a separate command for each at about eighty bytes per  even supporting just swaps of Y, Z and T with anything will eat into our feeble memory reserve. It is possible I could streamline things and reduce the space use a little by reusing code profusely. I don't think supporting the specific individual functions will be any smaller. I did have a general rearrange the (4 level) stack plus last X in a completely general manner instruction but it was lost. It replaced a lot of the traditional stack operations rather nicely but would have been really confusing for users. There is hope however, define them yourself and stash them in a flash segment. For example:
LBL'Z<>T' or
LBL'Z<>T'
Re: WP 34S: missing vector cross product  Marcus von Cube, Germany  07242011 You will need a register area from the numerical registers for this. DUP is already there: STOS. Recalling only part of the stack can be done with RCPY. RCPY needs X for its argument so you need to take care of this in an extra step.
Pauli, a command ROLLv with an argument for the number of rolls might be helpful.
Re: WP 34S: missing vector cross product  Paul Dale  07242011 Quote: Number of rolls as in the number of times Rv is executed or the number of registers being rolled? I suspect this suggestion will upset the RPL haters :)
 Pauli
Re: WP 34S: missing vector cross product  Marcus von Cube, Germany  07242011 Pauli, I meant the number of rolls to perform.
Re: WP 34S: missing vector cross product  fhub  07242011 Quote:Well, I would say Rv and R^ only the first n stackregisters is more important. Performing n rolls (as you suggest) needs just pressing the same key (Rv or R^) ntimes, but imagine the following situation:
You need the value from stackregister A during your calculation, and after that it's not needed anymore. In this case a "R^ A" would be very comfortable, wheras you would have to key in the following sequence to achieve the same: x<>yAnd you know how many keystrokes this would need (especially the "x<> _") ... :( Franz
Edited: 24 July 2011, 3:56 p.m.
