Probable bug
01-18-2016, 01:56 PM
Post: #1
 jefierro Junior Member Posts: 16 Joined: Oct 2014
Probable bug
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.
01-19-2016, 06:03 AM
Post: #2
 cyrille de brébisson Senior Member Posts: 1,047 Joined: Dec 2013
RE: Probable bug
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

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
01-19-2016, 06:14 AM
Post: #3
 jefierro Junior Member Posts: 16 Joined: Oct 2014
RE: Probable bug
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))
01-19-2016, 12:52 PM
Post: #4
 primer Member Posts: 135 Joined: Sep 2015
RE: Probable bug
Hi,
The problem is your formula.
(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,

primer
01-19-2016, 02:02 PM
Post: #5
 jefierro Junior Member Posts: 16 Joined: Oct 2014
RE: Probable bug
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.
01-20-2016, 06:16 AM
Post: #6
 cyrille de brébisson Senior Member Posts: 1,047 Joined: Dec 2013
RE: Probable bug
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

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
01-20-2016, 08:19 AM
Post: #7
 Gerald H Senior Member Posts: 1,627 Joined: May 2014
RE: Probable bug
(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.
01-20-2016, 02:04 PM
Post: #8
 jefierro Junior Member Posts: 16 Joined: Oct 2014
RE: Probable bug
Cyrille

Thanks so much for the effort, I wish I could do more to help than to nag about this. Good luck with everything.
 « Next Oldest | Next Newest »

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