Created
March 9, 2012 11:02
-
-
Save RSully/2006091 to your computer and use it in GitHub Desktop.
Vector summation calculator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get the amount of vectors we need to sum | |
Input "SUM HOW MANY? ", A | |
# Clear the previous lists | |
ClrList lVSUA | |
ClrList lVSUB | |
ClrList lVSUX | |
ClrList lVSUY | |
# Zero-out each list with A items | |
A->dim(lVSUA) | |
A->dim(lVSUB) | |
A->dim(lVSUX) | |
A->dim(lVSUY) | |
# Loop through each position | |
For(I,1,A) | |
# Input mag and angle | |
DISP "VECT", I | |
Input "M?", K | |
Input "A?", L | |
# Update mag/ang in lists | |
K->lVSUA(I) | |
L->lVSUB(I) | |
End | |
# Loop through again: | |
For(I,1,A) | |
# Get ref to mag/angle | |
lVSUA(I)->K | |
lVSUB(I)->L | |
# Convert and insert into new list for X/Y | |
P:Rx(K,L)->P | |
P:Ry(K,L)->Q | |
P->lVSUX(I) | |
Q->lVSUY(I) | |
End | |
# Summation X/Y | |
sum(lVSUX) | |
sum(lVSUY) | |
# Output final result of new vector | |
R:Pr(sum(lVSUX), sum(lVSUY)) | |
R:Pº(sum(lVSUX), sum(lVSUY)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I feel bad for the poor sucker that had to type this up on the computer...