HP Prime undef for Limes. Maybe a Bug?
10-10-2018, 08:58 PM
Post: #1
 blevita Junior Member Posts: 29 Joined: Jun 2018
HP Prime undef for Limes. Maybe a Bug?
Hello

I try to calculate the limit for a certain expression.
Unfortunately i dont get a result with the prime.

It should be -0.285

See here: https://www.symbolab.com/solver/limit-ca...D%5Cright)

Do i have to set some settings?
Or what can i do to solve the problem?

Thank you

Attached File(s) Thumbnail(s)

10-10-2018, 09:32 PM
Post: #2
 roadrunner Senior Member Posts: 429 Joined: Jun 2015
RE: HP Prime undef for Limes. Maybe a Bug?
Indeed, if you type:

limit((5-2*x)/(2*x^2-3*x-5),x,25/10)

you get the correct answer, but if you type:

limit((5-2*x)/(2*x^2-3*x-5),x,2.5)

you get undef.

10-11-2018, 06:47 AM
Post: #3
 blevita Junior Member Posts: 29 Joined: Jun 2018
RE: HP Prime undef for Limes. Maybe a Bug?
THank you so much!

I never thought that decimal numbers could be a problem.
Is there an obvious reason to not allow decimal numbers or to force the user to enter it as a fraction?

Just for others: you can also use exact(2.5) instead of 25/10.
It should not be very hard for the HP-Team to implement the usage of the exact function behind the lim operation.

Anyway thank you very much
Now i can do the excercises from our math lessons...
10-11-2018, 07:01 AM
Post: #4
 parisse Senior Member Posts: 1,253 Joined: Dec 2013
RE: HP Prime undef for Limes. Maybe a Bug?
Of course there is a reason:-)
The reason is that limit requires exact input to make simplifications (this is required here otherwise you get 0.0/0.0 or 0/0), with approx input, you could have rounding errors.
10-11-2018, 07:05 AM
Post: #5
 blevita Junior Member Posts: 29 Joined: Jun 2018
RE: HP Prime undef for Limes. Maybe a Bug?
Ok i see

I also understand the requirement for exact inputs.
But sometimes, 2.5 is already exact as possible ^^

Here i would be happy if the HP would automatically convert the input to an exact fraction by themself.
10-11-2018, 08:39 AM
Post: #6
 blevita Junior Member Posts: 29 Joined: Jun 2018
RE: HP Prime undef for Limes. Maybe a Bug?
I got an answer in the oficcial HP Forum.
There is also an even simpler way to do this.

You first enter the "unexact" form of the lim with 2.5
Then press enter.
Now click on the lim in the history once and then press the a b/c key.
Now you see a converted version of the expression.
Click the converted expression and press enter twice.
Now you see the correct result.
10-11-2018, 10:22 AM (This post was last modified: 10-11-2018 10:24 AM by Tim Wessman.)
Post: #7
 Tim Wessman Senior Member Posts: 2,290 Joined: Dec 2013
RE: HP Prime undef for Limes. Maybe a Bug?

Really is more just a way to quickly get to "exact" forms when you have decimals to ensure the cas behaves nicely when decimals are involved.

TW

Although I work for HP, the views and opinions I post here are my own.
10-12-2018, 06:17 AM
Post: #8
 parisse Senior Member Posts: 1,253 Joined: Dec 2013
RE: HP Prime undef for Limes. Maybe a Bug?
(10-11-2018 07:05 AM)blevita Wrote:  Ok i see

I also understand the requirement for exact inputs.
But sometimes, 2.5 is already exact as possible ^^

Here i would be happy if the HP would automatically convert the input to an exact fraction by themself.

This is dangerous. I added automatic conversion of floating points that look like integers (I mean for example 2.0, that looks like the integer 2 especially in Home), but 2.5 is *never* considered to be exact in the CAS, it might represent any real in a small interval around 2.5. If 2.5 is exact in your problem, you must enter it as 5/2.
10-12-2018, 03:11 PM
Post: #9
 roadrunner Senior Member Posts: 429 Joined: Jun 2015
RE: HP Prime undef for Limes. Maybe a Bug?
You can always make a CAS program to do that, such as:

Code:
#cas limit_exact(a,b,c,d):= BEGIN  c:=exact(c);  retrun subst(limit(a,b,c,d),b=c); END; #end

limit_exact(((5-2*x)/(2*x^2-3*x-5)),x,2.5,0)

will return -2/7.

10-12-2018, 08:08 PM
Post: #10
 CyberAngel Member Posts: 296 Joined: Jul 2018
RE: HP Prime undef for Limes. Maybe a Bug?
(10-12-2018 03:11 PM)roadrunner Wrote:  You can always make a CAS program to do that, such as:

Code:
#cas limit_exact(a,b,c,d):= BEGIN  c:=exact(c);  retrun subst(limit(a,b,c,d),b=c); END; #end

limit_exact(((5-2*x)/(2*x^2-3*x-5)),x,2.5,0)

will return -2/7.

It works only if I subst
retrun
with
return
;-)
VPN
10-13-2018, 07:04 PM
Post: #11
 Albert Chan Senior Member Posts: 2,142 Joined: Jul 2018
RE: HP Prime undef for Limes. Maybe a Bug?

On your limit_exact(), why is subst(...) needed ?
Also, I think limit_exact() had a bug:

f(x) := ((5-2x) + sin(5-2x)) / (2x^2 - 3x - 5)

limit(f(x), x, 5/2, 0) ==> -4/7

limit_exact(f(x), x, 2.5, 0) ==> undef
limit_exact(f(x), x, 5/2, 0) ==> undef

BTW, exact(...) may not always return exactly what you wanted.
Returned rationals were an approximation (based on config epsilon setting) of float.

Example, with epsilon = 1e-6, exact(500000.5) return 500001
10-14-2018, 12:18 AM
Post: #12
 roadrunner Senior Member Posts: 429 Joined: Jun 2015
RE: HP Prime undef for Limes. Maybe a Bug?
Hi Albert,

You are right. It's not working for your function, f(x). The call to limit in the function seems to be getting the second parameter incorrectly. I'm not sure why; it seems to be getting a "b" instead an "x"

I thought using the subst command fixed that, but apparently not in all cases.

10-14-2018, 01:42 AM (This post was last modified: 10-14-2018 02:46 AM by Albert Chan.)
Post: #13
 Albert Chan Senior Member Posts: 2,142 Joined: Jul 2018
RE: HP Prime undef for Limes. Maybe a Bug?
This work, but first argument had to be function of 1 argument ...

Code:
limit_exact(f, v, d) := begin     local x;      assume(x, symbol);     return limit(f(x), x, exact(v), d); end;
10-14-2018, 02:17 PM
Post: #14
 roadrunner Senior Member Posts: 429 Joined: Jun 2015
RE: HP Prime undef for Limes. Maybe a Bug?
Check out this version:

Code:
#cas limit_exact(a,b,c,d):= BEGIN  local x;  assume(x,symbol);  limit(subst(a,b=x),x,exact(c),d); END; #end

Now,

f(x) := ((5-2x) + sin(5-2x)) / (2x^2 - 3x - 5)
limit_exact(f(x), x, 2.5, 0) returns -4/7
limit_exact(f(t), t, 2.5, 0) also returns -4/7

It should work with any independent variable.

10-14-2018, 04:29 PM
Post: #15
 CyberAngel Member Posts: 296 Joined: Jul 2018
RE: HP Prime undef for Limes. Maybe a Bug?
(10-14-2018 02:17 PM)roadrunner Wrote:  Check out this version:

Code:
#cas limit_exact(a,b,c,d):= BEGIN  local x;  assume(x,symbol);  limit(subst(a,b=x),x,exact(c),d); END; #end

Now,

f(x) := ((5-2x) + sin(5-2x)) / (2x^2 - 3x - 5)
limit_exact(f(x), x, 2.5, 0) returns -4/7
limit_exact(f(t), t, 2.5, 0) also returns -4/7

It should work with any independent variable.

Great! - No coyote can catch you!
10-14-2018, 04:58 PM
Post: #16
 Albert Chan Senior Member Posts: 2,142 Joined: Jul 2018
RE: HP Prime undef for Limes. Maybe a Bug?

I suggest not using x for the symbolic local variable.
Preferably some name that will never be used ...

limit_exact(x + y, x, 1, 0) ==> y+1, OK
limit_exact(x + y, y, 1, 0) ==> 2, BAD
10-15-2018, 12:04 PM
Post: #17
 roadrunner Senior Member Posts: 429 Joined: Jun 2015
RE: HP Prime undef for Limes. Maybe a Bug?
(10-14-2018 04:58 PM)Albert Chan Wrote:  I suggest not using x for the symbolic local variable.
Preferably some name that will never be used ...

That's also true for the variables a, b, c, and d. I have run into that issue before with CAS programs.

10-16-2018, 09:35 PM
Post: #18
 CyberAngel Member Posts: 296 Joined: Jul 2018
RE: HP Prime undef for Limes. Maybe a Bug?
(10-14-2018 04:58 PM)Albert Chan Wrote:  Hi, roadrunner

I suggest not using x for the symbolic local variable.
Preferably some name that will never be used ...

limit_exact(x + y, x, 1, 0) ==> y+1, OK
limit_exact(x + y, y, 1, 0) ==> 2, BAD

Code:
 #cas exact_limit(Expr,Var,Val,Dir):= BEGIN   LOCAL ¬x;   assume(¬x,symbol);   limit(subst(Expr,Var=¬x),¬x,exact(Val),Dir); END; #end

Try that with any example.
CHAR(172) is that "hook" character.
 « Next Oldest | Next Newest »

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