Post Reply 
(50G) Question, has anyone programmed gauss's...
06-02-2014, 11:12 PM (This post was last modified: 06-15-2017 01:43 PM by Gene.)
Post: #1
(50G) Question, has anyone programmed gauss's...
has anyone wrote program to solve gauss's shoelace formula with a 50G?
http://en.wikipedia.org/wiki/Shoelace_formula

Thanks
~~~~8< Art >8~~~~

PS: Please post more 50G stuff :)
Find all posts by this user
Quote this message in a reply
06-03-2014, 02:33 AM (This post was last modified: 06-03-2014 02:37 AM by Thomas Klemm.)
Post: #2
RE: 50G Question, has anyone programmed gauss's...
(06-02-2014 11:12 PM)CosmicTruth Wrote:  has anyone wrote program to solve gauss's shoelace formula with a 50G?

Code:
\<<
  DUP HEAD +
  2 \<< CROSS \>> DOSUBS
  \GSLIST ABS 2 /
\>>
Example:
{
[ 2 1 ]
[ 4 5 ]
[ 7 8 ]
}


Area = 3
Find all posts by this user
Quote this message in a reply
06-03-2014, 11:02 AM (This post was last modified: 06-03-2014 11:09 AM by CosmicTruth.)
Post: #3
RE: 50G Question, has anyone programmed gauss's...
(06-03-2014 02:33 AM)Thomas Klemm Wrote:  
(06-02-2014 11:12 PM)CosmicTruth Wrote:  has anyone wrote program to solve gauss's shoelace formula with a 50G?

Code:
\<<
  DUP HEAD +
  2 \<< CROSS \>> DOSUBS
  \GSLIST ABS 2 /
\>>
Example:
{
[ 2 1 ]
[ 4 5 ]
[ 7 8 ]
}


Area = 3

Thanks for reply, whats GSLIST?
the \GSLIST is erroring this, but nice code. i get 'GSLIST/2.'

edit: GOTIT! the statistics EList function... this is good thanks

Thanks
~~~~8< Art >8~~~~

PS: Please post more 50G stuff :)
Find all posts by this user
Quote this message in a reply
06-03-2014, 11:13 AM
Post: #4
RE: 50G Question, has anyone programmed gauss's...
(06-03-2014 11:02 AM)CosmicTruth Wrote:  Thanks for reply, whats GSLIST?
the \GSLIST is erroring this, but nice code. i get 'GSLIST/2.'

\GSLIST == ∑LIST

Greetings,
    Massimo

-+×÷ ↔ left is right and right is wrong
Visit this user's website Find all posts by this user
Quote this message in a reply
06-03-2014, 11:40 AM
Post: #5
RE: 50G Question, has anyone programmed gauss's...
it works! thank you all so much for this code!
i'm happy Smile

Thanks
~~~~8< Art >8~~~~

PS: Please post more 50G stuff :)
Find all posts by this user
Quote this message in a reply
06-04-2014, 07:03 AM
Post: #6
RE: 50G Question, has anyone programmed gauss's...
This program is for the HP-42S:

Code:
00 { 39-Byte Prgm }
01 LBL "AREA"
02 ENTER
03 DIM?
04 ×
05 X<>Y
06 0
07 X<>Y
08 EDIT
09 LBL 00
10 ENTER
11 →
12 CROSS
13 +
14 ENTER
15 OLD
16 DSE ST Z
17 GTO 00
18 EXITALL
19 X<>Y
20 ABS
21 2
22 /
23 END

Example:
Consider the polygon defined by the points (3,4), (5,11), (12,8), (9,5), and (5,6).

1 ENTER NEWMAT
x: [ 1×1 Matrix ]

0 ENTER COMPLEX +
x: [ 1×1 Cpx Matrix ]

EDIT GROW
3 ENTER 4 COMPLEX →
5 ENTER 11 COMPLEX →
12 ENTER 8 COMPLEX →
9 ENTER 5 COMPLEX →
5 ENTER 6 COMPLEX
EXIT
x: [ 5×1 Cpx Matrix ]

XEQ "AREA"
y: [ 5×1 Cpx Matrix ]
x: 30
Find all posts by this user
Quote this message in a reply
06-07-2014, 12:41 PM (This post was last modified: 06-07-2014 12:43 PM by CosmicTruth.)
Post: #7
RE: 50G Question, has anyone programmed gauss's...
(06-04-2014 07:03 AM)Thomas Klemm Wrote:  This program is for the HP-42S:

Code:
00 { 39-Byte Prgm }
(clipped)

Example:
Consider the polygon defined by the points (3,4), (5,11), (12,8), (9,5), and (5,6).
(clipped)
XEQ "AREA"
y: [ 5×1 Cpx Matrix ]
x: 30

This is great and provided another great example, I have difficulty comparing the code or even seeing how it works because I don't have a 42S. I would have difficulty porting 42S code to my 50G, and I do wish 50G had "LBL" and "GOTO" like my old 41 did. I added a front end to the original 50G code above, so I can post it if anyone is interested? still a 50G work in progress but I have it asking for input and it stops and calculates if 0, 0 is entered.

Thanks
~~~~8< Art >8~~~~

PS: Please post more 50G stuff :)
Find all posts by this user
Quote this message in a reply
06-07-2014, 12:52 PM
Post: #8
RE: 50G Question, has anyone programmed gauss's...
OK so after 30 seconds no one was interested but I'm going to post this 50G code anyhow in hopes someone will look at it and give some pointers...

Code:

%%HP: T(3)A(D)F(.);
\<< CLEAR
   DO "X Y ?
0 0 TO END" { ":X:
:Y:" { 1. 0. } V } INPUT OBJ\-> \->V2
  UNTIL DUP [ 0. 0. ] ==
  END DROP DEPTH \->LIST DUP HEAD + 2.
  \<< CROSS
  \>> DOSUBS \GSLIST ABS 2. /
\>>

This just asks for input till 0,0 is input then calculates the area.

Next (someday) I plan to sum the end areas into a volume using average end area * length.

Thanks
~~~~8< Art >8~~~~

PS: Please post more 50G stuff :)
Find all posts by this user
Quote this message in a reply
09-21-2014, 04:36 PM (This post was last modified: 09-21-2014 04:38 PM by C.Ret.)
Post: #9
RE: 50G Question, has anyone programmed gauss's...
Here is a version for HP28S/C and any other old style RPL :

Code:

« DUP SIZE → LCoord s         @  LCoord list of vectors - s size of the list - keep both in stack
  « [0 0 0]                   @  Initialize summation of cross products
    1 s FOR i
       LCoord i GETI          @  Get i-th vetor and prepare to get next one vector
       ROT ROT GET            @  Rotate stack and get (i+1)-th vector
       CROSS +                @  Compute cross product and add into summation
    NEXT
    ABS 2 /                   @  Area is the halb the norm of sum
  »
»
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)