HP Forums

Full Version: HP Prime: Programming the sequence app
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
On the 38G I can use these two programmes to insert sequence symbolics in the sequence aplet:

SEQSET
SELECT Sequence:
UNCHECK 0:
0►NumFont:
0►Simult:
2►Angle:
1►InvCross:
1►NumStep:
1►Format:
1►NumCol:
1►NumStart:
6►NumRow:
RECURSE(U,0,0,0)►U1(N):
Ans►U2(N):
Ans►U3(N):
Ans►U4(N):
Ans►U5(N):
Ans►U6(N):
Ans►U7(N):
Ans►U8(N):
Ans►U9(N):
Ans►U0(N):

N1O2E3O
RUN SEQSET:
RECURSE(U,2*N-U5(N),1,2)►U1(N):
CHECK 1:
RECURSE(U,N-U6(N)+N^2,1,3)►U2(N):
CHECK 2:
RECURSE(U,2*N+U5(N),3,6)►U3(N):
CHECK 3:
RECURSE(U,N+U6(N)+N^2,3,9)►U4(N):
CHECK 4:
RECURSE(U,ROUND(√(2*N),0),1,2)►U5(N):
RECURSE(U,U5(N)*(6*N+1-U5(N)^2)/6,1,3)►U6(N):


I would be pleased to learn whether this is

1 Possible on the Prime

&

2 How to do it.

I have noticed the lack of RECURSE on the Prime & hope for some alternative to perform the task.

The programme should end up with the symbolic aspect of the sequence app looking the same as in the pictures here:

http://www.hpmuseum.org/forum/thread-3332.html

Edit: Improved legibility of 38G programme.
Is this what you're looking for?

Code:
EXPORT InitSeq()
BEGIN
LOCAL i;
  Sequence.U1:="2*N-U5(N)";
  Sequence.U2:="N-U6(N)+N^2";
  Sequence.U3:="2*N+U5(N)";
  Sequence.U4:="N+U6(N)+N^2";
  Sequence.U5:="ROUND(√(2*N),0)";
  Sequence.U6:="(U5(N)*(6*N+1-U5(N)^2))/6";
  FOR i FROM 1 TO 6 DO
    Sequence.CHECK(i);
  END;
END;
(03-12-2015 08:25 AM)Didier Lachieze Wrote: [ -> ]Is this what you're looking for?

Code:
EXPORT InitSeq()
BEGIN
LOCAL i;
  Sequence.U1:="2*N-U5(N)";
  Sequence.U2:="N-U6(N)+N^2";
  Sequence.U3:="2*N+U5(N)";
  Sequence.U4:="N+U6(N)+N^2";
  Sequence.U5:="ROUND(√(2*N),0)";
  Sequence.U6:="(U5(N)*(6*N+1-U5(N)^2))/6";
  FOR i FROM 1 TO 6 DO
    Sequence.CHECK(i);
  END;
END;

Yes, very much what I wanted, much more economical than keeping a whole app reserved for the one series.

Probably easy for you but for someone as ignorant as me in programming the Prime very helpful

Thanks.
(03-12-2015 09:53 AM)Gerald H Wrote: [ -> ]Probably easy for you but for someone as ignorant as me in programming the Prime very helpful

Well, there are several people on this forum that are much more knowledgeable than me in the Prime programming. In this case I just did a few tries to get the program working. All it takes is the manual and a bit of understanding of the underlying PPL principles.

Once you know about qualifying the name of application/program variables (see the English manual p. 507 + p. 435 for the Sequence variables) it’s doesn’t take a lot of time to come with : Sequence.U1:="2*N-U5(N)"

Then from the definition of CHECK in the manual (p. 373), I got Sequence.CHECK(1) working.
From then on the whole program was easily written.

(03-12-2015 09:53 AM)Gerald H Wrote: [ -> ]much more economical than keeping a whole app reserved for the one series.
You can also create multiple copies of the Sequence app (press Apps, select Sequence and press Save) if you want to work on several sequences at the same time.
Indeed. Reading the manual will certainly help. Plus, programming in PPL is much easier than programming in RPL. I for instance, started creating programs for the prime that I never thought possible on the 50g.
[quote= You can also create multiple copies of the Sequence app (press Apps, select Sequence and press Save) if you want to work on several sequences at the same time.
[/quote]

Yes, but you end up with an awful clutter of differently named sequence apps.
(03-12-2015 12:22 PM)Marcio Wrote: [ -> ]Indeed. Reading the manual will certainly help. Plus, programming in PPL is much easier than programming in RPL. I for instance, started creating programs for the prime that I never thought possible on the 50g.

Can you give an example of your programming - I can't find anything by you in the Prime Library section.
(03-12-2015 12:31 PM)Gerald H Wrote: [ -> ]Can you give an example of your programming - I can't find anything by you in the Prime Library section.

Most of them are very specific to my work/thesis, so they wouldn't help anyone. However, I am working on one that fits data to user-defined functions. It's working quite nicely already but not quite ready to be published.

There is an equivalent for the 50g which I use very often:

http://www.hpcalc.org/details.php?id=3905
(03-12-2015 12:28 PM)Gerald H Wrote: [ -> ]
Quote: You can also create multiple copies of the Sequence app (press Apps, select Sequence and press Save) if you want to work on several sequences at the same time.

Yes, but you end up with an awful clutter of differently named sequence apps.

Sure, it's only handy if you have a few instances to manage. If you want to manage for ex. a catalog of sequences then your programming approach is much better.

Btw, is this what you're working on: a catalog of sequences that you can share with your students?
Reference URL's