Post Reply 
Probable bug
01-18-2016, 01:56 PM
Post: #1
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.
Find all posts by this user
Quote this message in a reply
01-19-2016, 06:03 AM
Post: #2
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.
Find all posts by this user
Quote this message in a reply
01-19-2016, 06:14 AM
Post: #3
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))
Find all posts by this user
Quote this message in a reply
01-19-2016, 12:52 PM
Post: #4
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))
so your U1(3)=U1((3-2)+(3-1))=U1(1+2)=U1(3)
how do you want the calc to know how to deals with that ?
Regards,

primer
Find all posts by this user
Quote this message in a reply
01-19-2016, 02:02 PM
Post: #5
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.
Find all posts by this user
Quote this message in a reply
01-20-2016, 06:16 AM
Post: #6
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.
Find all posts by this user
Quote this message in a reply
01-20-2016, 08:19 AM
Post: #7
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.
Find all posts by this user
Quote this message in a reply
01-20-2016, 02:04 PM
Post: #8
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.
Find all posts by this user
Quote this message in a reply
Post Reply 




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