# HP Forums

Full Version: Probable bug
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I was trying to find the Fibonacci sequence on the sequence app although I think this formula is not correctly stated, it shouldn't hang the machine.

I have tried this in a hardware A and the iOS version with similar results.
Hello,

in the app sequence symbolic view, enter:
U1(1)=1
U1(2)=2
U1(N)=U1(N-1)+U1(N-2)
Press PLOT to see the graphic.
Press Num to see the table.

Cyrille
Thank you, that worked, but I just realize the attachment didn't upload from my phone in my original post.
I tried the following formula on the seccuance app In the latest firmware it hangs the calculator.

U1(1)=1
U1(2)=1
U1(n)=U1((n-2)+(n-1))
Hi,
(01-19-2016 06:14 AM)jefierro Wrote: [ -> ]U1(1)=1
U1(2)=1
U1(n)=U1((n-2)+(n-1))
how do you want the calc to know how to deals with that ?
Regards,
As a seasoned math geek I would rather have the thing beep at me when I input something silly like that, than to have to resuscitate it. That is all. That level of math is not that impressive to brake the machine.

thank you.
Hello,

Infinite recursion detection is not as easy as it sounds unfortunately.
In the calculator, Un is, more or less, a program. Like a user function.

How would the computer detect that Function(n) is infinitely recursive?
Testing that there are multiple calls in the stack for the same function with the same arguments sounds like a good idea, BUT it has some drawbacks.
1) It is quite slow and would/could slow down the calculator significantly.
2) Because functions can use global variables, the fact that a function calls itself with the same arguments recursively does not always mean that it is infinitely recursive. For example:

Count= 10;
export rec(a)
if Count:= Count-1 then
rec(a);
end;
return a+1;
end;

This function is NOT infinitely recursive, but it would be very hard for the program elevator to detect it.

It would be nice to have some type of detection nevertheless, I agree...

Cyrille
(01-20-2016 06:16 AM)cyrille de brébisson Wrote: [ -> ]Hello,

Infinite recursion detection is not as easy as it sounds unfortunately.
In the calculator, Un is, more or less, a program. Like a user function.

How would the computer detect that Function(n) is infinitely recursive?
Testing that there are multiple calls in the stack for the same function with the same arguments sounds like a good idea, BUT it has some drawbacks.
1) It is quite slow and would/could slow down the calculator significantly.
2) Because functions can use global variables, the fact that a function calls itself with the same arguments recursively does not always mean that it is infinitely recursive. For example:

Count= 10;
export rec(a)
if Count:= Count-1 then
rec(a);
end;
return a+1;
end;

This function is NOT infinitely recursive, but it would be very hard for the program elevator to detect it.

It would be nice to have some type of detection nevertheless, I agree...

Cyrille

Is the problem here one of INFINITE recursion?

The matter seems to have been dealt with in the HP 38G.
Cyrille

Thanks so much for the effort, I wish I could do more to help than to nag about this. Good luck with everything.
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :