List processing problem HP 50g
#1

Hello RPL geeks,

I need your help!

I want to program a something which is feed by a list of two dim. vectors (the control points) and has bezier points (as vectors, too) as an output.

The problem for is the input or more precise to get the right three points.

The points are po, p1, p2, p3, p4, ...and so on.

Input: {po p1 p2 p3 p4 p5 p6}

I want a to get these lists:

{{po p1 p2} {p2 p3 p4} {p4 p5 p6}} or
{po p1 p2 p2 p3 p4 p4 p5 p6}

This can be of course be programmed with direct accessing to the list, but maybe somebody know a method which uses the "parallel" list processing features of the HP 50g.

The three functions "DOLIST", "STREAM" and "SUBSET" don't solve my problem as far I know.

Sincerely
peacecalc

Edited: 28 Jan 2013, 3:52 p.m.

#2

The second list is easy

\<<
1
\<< NSUB 3 MOD NOT DUPN \>>
DOSUBS
\>>
Will duplicate every third element
and from that list
\<<
3
\<< 3 \->LIST \>>
DOSUBS
\>>
Will produce the first list

Cheers, Werner

#3

Hi peacecalc !

Quote:
Input: {po p1 p2 p3 p4 p5 p6}

I want a to get these lists:

{{po p1 p2} {p2 p3 p4} {p4 p5 p6}}


«
3 « 3 ->LIST NSUB 2 MOD NOT { DROP} IFT » DOSUBS
»

#4

\<<
1
\<< NSUB 3 MOD NOT DUPN \>>
DOSUBS
\>>

Excellent ;)

EDIT : oups.... in fact this don't work
Gives : { po p1 p2 p2 p3 p4 p5 p5 p6 }

Edited: 28 Jan 2013, 4:41 p.m.

#5

This produces { { p0 p1 p2 } { p2 p3 p4 } { p5 p5 p6 } } which isn't quite what was requested.

Edited: Note that p5 is duplicated instead of p4.


Edited: 28 Jan 2013, 4:36 p.m.

#6

Hello Gilles Carpentier,

thank you for your fast solution.
I've checked it and it works fine.
For me it was a good lesson in RPL: your little piece of programming gem works in an unusual way. It produce every triple and deletes which are not wanted on the fly. Chapeau!

Normally someone who makes programs (that the way I'm think, too) is avoiding every needless calculation, but here it is the way, which overcomes the obstacle.

Again thank you very much!

Sincerely
peacecalc

P.S.: Also to you Werner, thank you very much for your suggestions, even they aren't working, but they showed the possible way
for a solution!

Edited: 28 Jan 2013, 6:28 p.m.

#7

A similar trick can be used here:

\<<
3
\<< 3 \->LIST NSUB 2 MOD NOT DROPN \>>
DOSUBS
\>>

Cheers, Werner



Possibly Related Threads…
Thread Author Replies Views Last Post
  Milestones:List of IEEE Milestones -> HP-35 AlbertTocarLoseggs 4 2,064 11-27-2013, 08:52 AM
Last Post: Massimo Gnerucci (Italy)
  HP-Prime : Extracting elements from a list in RPN Miguel Toro 0 1,569 11-15-2013, 06:44 PM
Last Post: Miguel Toro
  [HP-Prime] Picking elements from a List in a program Jean-Michel 3 1,936 11-15-2013, 04:16 AM
Last Post: dg1969
  Hp PRIME - how to send a list to the connectivity Kit giancarlo 1 1,285 11-10-2013, 11:50 AM
Last Post: Tim Wessman
  How do I decompose a list with the HP Prime. Hal Bitton in Boise 4 1,983 11-08-2013, 02:07 PM
Last Post: Patrice
  HP-Prime/Xcas: vector/list indexing fhub 6 2,774 10-27-2013, 04:52 PM
Last Post: fhub
  Hp prime list function - indexing into a list Andy B (Australia) 3 1,900 10-07-2013, 01:41 AM
Last Post: cyrille de Brébisson
  [HP-Prime CAS] list[x,y,z], vector[x, y, z ] ... data type operation? CompSystems 1 1,175 08-22-2013, 03:30 PM
Last Post: Joe Horn
  [HP-prime] Parallel Processing, vectors, matrices as a only data type =( CompSystems 1 1,168 08-08-2013, 04:48 PM
Last Post: peacecalc
  HP 50G List of Library numbers already in use? Michael Lopez 2 1,210 08-04-2013, 10:10 PM
Last Post: Michael Lopez

Forum Jump: