I posted last week about the sample vector operations that come in the 33s manual. It turned out my trouble wasnot being in ALG mode. I didn't like the idea of switching modes every time I wanted to do vector products, so I am rewriting in RPN. This also gives me the opportunity to restructure to match my workflow a little closer.
I am beginning to get a handle on how the programming language works, and I would appreciate some feedback on two methods for performing a simple task in one of my subroutines.
TASK: Display or Input U,V,W coordinates. (May be called independently or from another routine) Calculate and display magnitude of vector.
METHOD A:
INPUT U
X^2
INPUT V
X^2
+
INPUT W
X^2
+
SQRT
STO M
VIEW M
METHOD B
INPUT U
INPUT V
--> THETA, r
INPUT W
--> THETA, r
STO M
VIEW M
Advantages I see:
B: Shorter code. Easier to retype (slightly less resource usage, though both are tiny)
A: Only uses two lines of stack (I think) vs. 3 for B
I used STO M / VIEW M because I wanted to not have the time restriction of PSE. Is there a better way? I doubt I will ever need the variable to actually be stored.
Is there anything else that folks would think about when forming a little snippet like this? One wants to begin a new language with good habits.
Thanks
Adam