incorrect value for slope of Gamma(x) at x=1
08-03-2018, 10:09 AM
Post: #1
 pr1268 Junior Member Posts: 3 Joined: Aug 2018
incorrect value for slope of Gamma(x) at x=1
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

08-03-2018, 02:44 PM
Post: #2
 parisse Senior Member Posts: 1,093 Joined: Dec 2013
RE: incorrect value for slope of Gamma(x) at x=1
Try slope(tangent(plotfunc(Gamma(x)),1))
08-03-2018, 04:19 PM
Post: #3
 Tim Wessman Senior Member Posts: 2,231 Joined: Dec 2013
RE: incorrect value for slope of Gamma(x) at 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.

TW

Although I work for the HP calculator group, the views and opinions I post here are my own.
08-03-2018, 04:25 PM
Post: #4
 Komanguy Junior Member Posts: 49 Joined: Jul 2018
RE: incorrect value for slope of Gamma(x) at x=1
(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.

Guy R. KOMAN, hp 50G, hp Prime Rev. C
08-03-2018, 05:45 PM
Post: #5
 pr1268 Junior Member Posts: 3 Joined: Aug 2018
RE: incorrect value for slope of Gamma(x) at x=1
(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, 05:47 PM
Post: #6
 pr1268 Junior Member Posts: 3 Joined: Aug 2018
RE: incorrect value for slope of Gamma(x) at x=1
(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, 05:52 PM (This post was last modified: 08-03-2018 05:54 PM by Dieter.)
Post: #7
 Dieter Senior Member Posts: 2,397 Joined: Dec 2013
RE: incorrect value for slope of Gamma(x) at x=1
(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-04-2018, 11:48 AM
Post: #8
 Komanguy Junior Member Posts: 49 Joined: Jul 2018
RE: incorrect value for slope of Gamma(x) at x=1
(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.

Attached File(s) Thumbnail(s)

Guy R. KOMAN, hp 50G, hp Prime Rev. C
08-04-2018, 01:36 PM (This post was last modified: 08-04-2018 01:38 PM by DrD.)
Post: #9
 DrD Senior Member Posts: 1,124 Joined: Feb 2014
RE: incorrect value for slope of Gamma(x) at x=1
(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]
08-04-2018, 02:05 PM
Post: #10
 roadrunner Member Posts: 292 Joined: Jun 2015
RE: incorrect value for slope of Gamma(x) at x=1
In cas, uncheck "change apparent integers into exact integers" and you get the expected result:

08-04-2018, 05:31 PM
Post: #11
 Komanguy Junior Member Posts: 49 Joined: Jul 2018
RE: incorrect value for slope of Gamma(x) at x=1
(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.

Guy R. KOMAN, hp 50G, hp Prime Rev. C
08-05-2018, 03:02 AM
Post: #12
 Tim Wessman Senior Member Posts: 2,231 Joined: Dec 2013
RE: incorrect value for slope of Gamma(x) at x=1
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.

TW

Although I work for the HP calculator group, the views and opinions I post here are my own.
08-05-2018, 11:32 AM
Post: #13
 roadrunner Member Posts: 292 Joined: Jun 2015
RE: incorrect value for slope of Gamma(x) at x=1
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.
 « Next Oldest | Next Newest »

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