HP PRIME: interlinked sequences?



#2

In attempting to experiment with Jacobi iteration for solution of linear equations, I entered the sequences:

U1(1) = 1
U1(N) = (4 - U2(N-1) + U3(N-1))/4

U2(1) = 1
U2(N) = (2 - 2*U1(N-1) - U3(N-1))/5

U3(1) = 1
U3(N) = (11 - U1(N-1))/3

Now there's nothing mathematically wrong with these, except that the HP Prime doesn't like them. I can't use "Eval" for any of the definitions, as that gives rise to a never-ending mess of iterated definitions. I would have hoped that these sequences could simply be evaluated "as is", but I can't find a way to do so. In fact, I can't even check any of the sequences for inclusion in the numerical listing of their values or for plotting.

Is there any way to coerce the HP Prime to perform this sort of interlinked iteration?


#3

Interlinked sequences is something quite hard with the possibility of recursions and so forth. Some might work, while others will never resolve. This is something that is not supported at the moment but is definitely on the list of items to revisit once more important things get taken care of to see if we can figure out how to make it work well.

There is a sequence solving in the CAS, but I am not certain if it will handle interlinked sequences either.

TW

#4

Hello,

The "problem" in your example is that U1(N) can be expanded as:
(4 - (2 - 2*U1(N-2) - U3(N-2))/5 + U3(N-1))/4

which can itself be expanded as:
(4 - (2 - 2*U1(N-2) - (11 - U1(N-3))/3)/5 + (11 - U1(N-2))/3)/4

this show the dependency from U1(N) to U1(N-3)... but Prime can only handle 2 level recursion, not 3...

Cyrille


#5

Bonjour Cyrille,

Vu que toute série peut être étendue jusqu'à avoir des références à U(N-3) ou pire, je ne vois pas bien le pourquoi de ton explication.

Il suffirait que l'on calcule les éléments indice N de toutes les suites avant de calculer les éléments indice N+1 et le tour est joué.

Par exemple une suite de Fibonacl:

U(N)=U(N-1)+U(N-2)

peut être étendue à

U(N)=U(N-2)+2*U(N-3)+U(N-4)

mais c'est pas un problème pour l'évaluer.

#6

The thing is that you can't expand these definitions: you will end up with infinite recursion. On the other hand, they can be computed simply as they are, by starting with U1(1), U2(1) and U3(1), then using all of those values to compute U1(2), U2(2) and U3(2) and so on.

In a sense what we have is really an iteration of vectors:

[u1, u2, u3] -> [(4 - u2 + u3)/4, (2 - 2*u1 - u3)/5, (11 - u1)/3]

which would be trivial if the sequence app could manage sequences of vectors, as well as numbers.


Possibly Related Threads…
Thread Author Replies Views Last Post
  82162 printer escape sequences Hans Holzach 3 1,468 07-08-2012, 11:50 AM
Last Post: Hans Holzach
  HP nut CPU and illegal instruction sequences Håkan Thörngren 9 2,646 01-05-2010, 12:50 PM
Last Post: Eric Smith
  Escape sequences:Thinkjet... Jim Rudnick 1 960 02-24-2004, 03:19 PM
Last Post: Mads Daugbjerg

Forum Jump: