HP Prime emulator: Gamma function - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: HP Prime emulator: Gamma function (/thread-248552.html) |
HP Prime emulator: Gamma function - Stephan Matthys - 08-21-2013 I played around with the HP Prime emulator today & also tried the Gamma function. For positive numbers everything seems to be OK, but for negative numbers the Prime emulation gives different results compared to my 15C, 15C LE, 34C, 35s & HP49g+ (which all give the same result, e.g. -5.5! => -0.0600; unfortunately I forgot the result of the Prime emulator & my virtual W7 machine is not up at the moment...)
Might there be a problem with the Gamma function of the HP Prime? Or is it only an emulator problem?
Re: HP Prime emulator: Gamma function - Tim Wessman - 08-21-2013 Did you look at the help for the function? Graph both Gamma(X) and X! and I think you'll see what is happening. Also compare the graph at http://en.wikipedia.org/wiki/Gamma_function to what you see on the calc.
TW Edited: 21 Aug 2013, 2:54 p.m.
Re: HP Prime emulator: Gamma function - Joe Horn - 08-21-2013 If it's a bug, it must involve a setting of some kind, because after Calculator Clear on the emulator, all four of the following return the same correct result (-.0600196013005) both in Home and in CAS:
(-5.5)! (using the [-] key) If you see the bug again, please let us know what your non-default settings are. Thanks!
-Joe-
Re: HP Prime emulator: Gamma function - Stephan Matthys - 08-21-2013 Thanks, Joe. Re: HP Prime emulator: Gamma function - Gerson W. Barbosa - 08-21-2013 On the HP-49G+ and on the Prime, Gamma and ! are two different functions. From the manual: ---------------------------------------
Factorial: Factorial of a positive integer. For non-integers, ! = |-- (x + 1). value!Gamma: Returns the value of the gamma function (|--) for a number a. Gamma(a)--------------------------------------- Thus Gamma(-4.5) = (-5.5)! = -0.0600196013005 Gerson.
This was meant to Stephan. Somehow it has ended up here. Edited: 21 Aug 2013, 3:05 p.m.
Re: HP Prime emulator: Gamma function - Stephan Matthys - 08-21-2013 Thanks, Gerson. Re: HP Prime emulator: Gamma function - Namir - 08-21-2013 I compared a few negative values (-5.5, -4.5, -3.5, -2.25, -2.45, and -22.45) for the Gamma function using the emulator AND using Wolfram Alpha. I did not see any difference in the results.
Namir Edited: 21 Aug 2013, 4:53 p.m.
Re: HP Prime emulator: Gamma function - Gerson W. Barbosa - 08-21-2013 You might also want to check your emulator version:
Re: HP Prime emulator: Gamma function - Thomas Klemm - 08-22-2013 WolframAlpha disagrees with the precedence of - and !: -5.5! = -287.885....
Cheers Re: HP Prime emulator: Gamma function - Gilles Carpentier - 08-22-2013 Gerson are you sure about -5.5! ?
I get this for (-5.5)! with my emulator -5.5! -> -287.885...
Re: HP Prime emulator: Gamma function - Stephan Matthys - 08-22-2013 I checked the thing again this morning & got the incorrect results again:
The version of my emulator is: Edited: 22 Aug 2013, 2:16 a.m.
Re: HP Prime emulator: Gamma function - Thomas Klemm - 08-22-2013 [img:http://img96.imageshack.us/img96/1623/yaui.png] [img:http://img580.imageshack.us/img580/8314/dkpr.png] [img:http://img839.imageshack.us/img839/6941/nv0h.png] Not a problem with a proxy but with markup. And I used the direct URL.
Cheers
Re: HP Prime emulator: Gamma function - Gilles Carpentier - 08-22-2013 I got it !
CAS mode (-5.5)! = -.245736133286 Rev 4980
Re: HP Prime emulator: Gamma function - Gilles Carpentier - 08-22-2013 Hi Joe The bug is in CAS mode and ° setting :
Set angle in Radian (-5.5)! -> -.6... now set angle in ° (always CAS mode) (-5.5)! -> -.2457...
(Rev 4980) Edited: 22 Aug 2013, 3:14 a.m.
Re: HP Prime emulator: Gamma function - Marcus von Cube, Germany - 08-22-2013 The setting (Degree or radian) affects both environments (goto settings in CAS or Home and see they are the same). The error only occurs from the CAS screen, not from the Home screen.
Re: HP Prime emulator: Gamma function - peacecalc - 08-22-2013 Hello prime researchers, the gamma function is normally defined for complex numbers except the negative integers. Maybe there is connection between the DEG and RAD mode and the inconsistent results in CAS mode?
Greeting Re: HP Prime emulator: Gamma function - Thomas Klemm - 08-22-2013 Quote: Couldn't agree more.
Cheers Re: HP Prime emulator: Gamma function - Gerson W. Barbosa - 08-22-2013 Gilles and Thomas, I did enter (-5.5)!, but the history showed -5.5! (I hadn't noticed that). Looks like we have another bug here:
Cheers,
Gerson.
Re: HP Prime emulator: Gamma function - Gerson W. Barbosa - 08-22-2013 Good find! This means the formula involving sine is being used for negative arguments. The bug persists on Rev. 5106.
Re: HP Prime emulator: Gamma function - Gerson W. Barbosa - 08-22-2013 Quote: Not your fault, but HP's. They've forgotten to check the user's angle mode setting when evaluating Gamma . See Gilles's post below. You've indeed found a new bug. Thanks for reporting! Regards,
Gerson.
Re: HP Prime emulator: Gamma function - Thomas Klemm - 08-22-2013 Quote:
= -0.24573613328569488790394658885834332520579131620384...
Quote: Gerson, I think you're correct! But then why is -4.5 used instead of 5.5 in sin?
Cheers Edited: 22 Aug 2013, 10:23 a.m.
Re: HP Prime emulator: Gamma function - Gilles Carpentier - 08-22-2013 I tested with XCAS and same problem...
Re: HP Prime emulator: Gamma function - Stephan Matthys - 08-22-2013 You're welcome. Actually it was by mistake... ;-)
Does anyone know if the bug also occurs on the real Prime or just in the emulator? Edited: 22 Aug 2013, 11:24 a.m.
Re: HP Prime emulator: Gamma function - Gerson W. Barbosa - 08-22-2013 Perhaps they're doing (-z)!(z - 1)! = pi/(sin(pi*z))and letting z = -4.5Thus, Gamma(-4.5) = (-5.5)! = pi/(sin(-pi*4.5)*4.5!) = -0.0600196013005Considering the argument has been unduly converted into degrees, we convert it back to radians, that is, z = -4.5*pi/180and we get the same result the Prime is giving, -0.245736133286, which of course is completely wrong, as you know. Cheers, Gerson. Edited to fix a typo.
Edited: 22 Aug 2013, 2:53 p.m.
Re: HP Prime emulator: Gamma function - Miguel Toro - 08-22-2013 Hi, So, CAS mode does not show the expression the way you entered (CAS mode, Radians):
What is the difference between these two ?
And there you have it. Of course, pressing [Enter] key gives:
Re: HP Prime emulator: Gamma function - Thomas Klemm - 08-22-2013 Oh, now I see:
Thanks for pointing that out!
Best regards Re: HP Prime emulator: Gamma function - Gerson W. Barbosa - 08-22-2013 So they look alike, but are actually different :-) Regards,
Gerson.
Re: HP Prime emulator: Gamma function - Gerson W. Barbosa - 08-22-2013 Actually I only intended to write it in an easier-to-remember and less prone to confusion form:
Best regards,
Gerson.
Re: HP Prime emulator: Gamma function - Thomas Klemm - 08-23-2013 This formula reminds me of Valentin's HP-15C Mini-challenge.
|