incorrect value for slope of Gamma(x) at x=1 - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: incorrect value for slope of Gamma(x) at x=1 (/thread-11159.html) |
incorrect value for slope of Gamma(x) at x=1 - pr1268 - 08-03-2018 10:09 AM Prime app for Android gives (incorrect) NaN for the slope of Gamma(x) at x=1, but valid slope for x=0.99 and x=1.01, etc. Refer to attached screenshots. The slope of the Gamma function IS defined for at x=1. Refer to http://www.wolframalpha.com/input/?i=slope+of+gamma(x)+at+x%3D1&x=0&y=0 [attachment=6180] [attachment=6179] [attachment=6181] RE: incorrect value for slope of Gamma(x) at x=1 - parisse - 08-03-2018 02:44 PM Try slope(tangent(plotfunc(Gamma(x)),1)) RE: incorrect value for slope of Gamma(x) at x=1 - Tim Wessman - 08-03-2018 04:19 PM So what is probably going on here is that it is returning the symbolic constant internally in the plotter and it is not a numeric value, hence it reports Not a Number. We probably need to handle attempting to convert to a numeric value in these few cases. RE: incorrect value for slope of Gamma(x) at x=1 - Komanguy - 08-03-2018 04:25 PM (08-03-2018 10:09 AM)pr1268 Wrote: Prime app for Android gives (incorrect) NaN for the slope of Gamma(x) at x=1, but valid slope for x=0.99 and x=1.01, etc. Refer to attached screenshots. Works well on real Prime. Gives 0. RE: incorrect value for slope of Gamma(x) at x=1 - pr1268 - 08-03-2018 05:45 PM (08-03-2018 04:25 PM)Komanguy Wrote:(08-03-2018 10:09 AM)pr1268 Wrote: Prime app for Android gives (incorrect) NaN for the slope of Gamma(x) at x=1, but valid slope for x=0.99 and x=1.01, etc. Refer to attached screenshots. The slope of Gamma(x) at x=1 is NOT 0. It's -0.57721... RE: incorrect value for slope of Gamma(x) at x=1 - pr1268 - 08-03-2018 05:47 PM (08-03-2018 02:44 PM)parisse Wrote: Try slope(tangent(plotfunc(Gamma(x)),1)) Thank you; that does work. But I would have hoped it would work inside the function plot screen. Oh well.... RE: incorrect value for slope of Gamma(x) at x=1 - Dieter - 08-03-2018 05:52 PM (08-03-2018 04:19 PM)Tim Wessman Wrote: So what is probably going on here is that it is returning the symbolic constant Just to make this clear: The slope \(\Gamma~' (1) \) is –γ, i.e. the negative Euler-Mascheroni constant = –0,5772... Now... (08-03-2018 04:19 PM)Tim Wessman Wrote: ...internally in the plotter and it is not a numeric value, hence it reports Not a Number. ...does this mean that the symbolic result "–γ" is returned to the plotter app which in turn does not convert this into a numeric value and thus returns "NaN"? (08-03-2018 04:19 PM)Tim Wessman Wrote: We probably need to handle attempting to convert to a numeric value in these few cases. Sounds like a good idea. ;-) Dieter RE: incorrect value for slope of Gamma(x) at x=1 - Komanguy - 08-04-2018 11:48 AM (08-03-2018 05:45 PM)pr1268 Wrote:(08-03-2018 04:25 PM)Komanguy Wrote: Works well on real Prime. Gives 0. You’re right but on mine it gives 0, not NaN. It’s weird, results are different here. RE: incorrect value for slope of Gamma(x) at x=1 - DrD - 08-04-2018 01:36 PM (08-04-2018 11:48 AM)Komanguy Wrote:(08-03-2018 05:45 PM)pr1268 Wrote: The slope of Gamma(x) at x=1 is NOT 0. It's -0.57721... Gamma(X) @ X=1; Hardware C, latest firmware: [attachment=6186] RE: incorrect value for slope of Gamma(x) at x=1 - roadrunner - 08-04-2018 02:05 PM In cas, uncheck "change apparent integers into exact integers" and you get the expected result: [attachment=6187] -road RE: incorrect value for slope of Gamma(x) at x=1 - Komanguy - 08-04-2018 05:31 PM (08-04-2018 02:05 PM)roadrunner Wrote: In cas, uncheck "change apparent integers into exact integers" and you get the expected result: Oups! I used CAS.Gamma(X) instead of Gamma(X), Slope is always 0. With the Gamma(X), slope is NaN at x=1 when "change apparent integers into exact integers" is checked, and slope is -0.577215..... when this option is unchecked. Thanks a lot. RE: incorrect value for slope of Gamma(x) at x=1 - Tim Wessman - 08-05-2018 03:02 AM So this pretty much confirms my suspicion regarding the symbolic object being returned. Similar things used to happen with some area calculations till we introduced a way to force numerical evaluation in all cases. The slope command however goes through a different path to handle evaluation. That needs the same type of fix. RE: incorrect value for slope of Gamma(x) at x=1 - roadrunner - 08-05-2018 11:32 AM Not sure if it's related or not, but when (X-1)! is plotted the slope is 0 and tangent line is horizontal at all values of X. That is irrespective of the CAS check box setting. |