HP Forums

Full Version: incorrect value for slope of Gamma(x) at x=1
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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=slo...D1&x=0&y=0

[attachment=6180]
[attachment=6179]
[attachment=6181]
Try slope(tangent(plotfunc(Gamma(x)),1))
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.
(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 the Gamma function IS defined for at x=1. Refer to http://www.wolframalpha.com/input/?i=slo...D1&x=0&y=0

Works well on real Prime. Gives 0.
(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 the Gamma function IS defined for at x=1. Refer to http://www.wolframalpha.com/input/?i=slo...D1&x=0&y=0

Works well on real Prime. Gives 0.

The slope of Gamma(x) at x=1 is NOT 0. It's -0.57721...
(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....
(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
(08-03-2018 05:45 PM)pr1268 Wrote: [ -> ]
(08-03-2018 04:25 PM)Komanguy Wrote: [ -> ]Works well on real Prime. Gives 0.

The slope of Gamma(x) at x=1 is NOT 0. It's -0.57721...

You’re right but on mine it gives 0, not NaN.
It’s weird, results are different here.
(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...

You’re right but on mine it gives 0, not NaN.
It’s weird, results are different here.

Gamma(X) @ X=1; Hardware C, latest firmware:
[attachment=6186]
In cas, uncheck "change apparent integers into exact integers" and you get the expected result:

[attachment=6187]

-road
(08-04-2018 02:05 PM)roadrunner Wrote: [ -> ]In cas, uncheck "change apparent integers into exact integers" and you get the expected result:



-road

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.
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.
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.
Reference URL's