CAS problem with solution
03-04-2015, 09:14 PM
Post: #1
 Teresa Junior Member Posts: 5 Joined: Mar 2015
CAS problem with solution
Hello all, I just bought a Prime and tried some things out. So I tried to get a solution in CAS mode for the equation lim X->infinity of (sqrt(X*X+2X+1)-sqrt(X*X)). I think the solution should be 1 but i get -infinity.
The plot of the function gives also 1. I tried it in the simulator (rev6975) and the calculator (rev.6975 CASvers. 1.1.2-11) same result.
What do i do wrong?
Thanks for your help Teresa
03-04-2015, 10:16 PM (This post was last modified: 03-04-2015 10:18 PM by Mark Hardman.)
Post: #2
 Mark Hardman Senior Member Posts: 525 Joined: Dec 2013
RE: CAS problem with solution
(03-04-2015 09:14 PM)Teresa Wrote:  Hello all, I just bought a Prime and tried some things out. So I tried to get a solution in CAS mode for the equation lim X->infinity of (sqrt(X*X+2X+1)-sqrt(X*X)). I think the solution should be 1 but i get -infinity.
The plot of the function gives also 1. I tried it in the simulator (rev6975) and the calculator (rev.6975 CASvers. 1.1.2-11) same result.
What do i do wrong?
Thanks for your help Teresa

limit(v(x^2+2*x+1)-vx^2,x,8)

If you give the CAS just a little bit of help, it will give you the correct answer:

It seems a bit odd that the CAS doesn't perform the trivial reduction of √x^2 = x. Perhaps it's reducing it to |x|. But even that shouldn't change the solution. Though, depending on the direction of the limit, the answer might be -1 or 1:

Attached File(s) Thumbnail(s)

Ceci n'est pas une signature.
03-04-2015, 10:20 PM
Post: #3
 Tim Wessman Senior Member Posts: 2,280 Joined: Dec 2013
RE: CAS problem with solution
Interestingly enough, the equation as you have it written does actually work. The ^2 seems to be doing something strange here.

limit(√(x*x+2*x+1)-(√(x*x)),x,∞) ----> 1
limit(√(x^2+2*x+1)-(√(x^2)),x,∞) ----> -∞

TW

Although I work for HP, the views and opinions I post here are my own.
03-04-2015, 10:38 PM
Post: #4
 Mark Hardman Senior Member Posts: 525 Joined: Dec 2013
RE: CAS problem with solution
(03-04-2015 10:20 PM)Tim Wessman Wrote:  Interestingly enough, the equation as you have it written does actually work. The ^2 seems to be doing something strange here.

limit(√(x*x+2*x+1)-(√(x*x)),x,∞) ----> 1
limit(√(x^2+2*x+1)-(√(x^2)),x,∞) ----> -∞

The CAS must be reducing the √(x^2) to just x (rather than |x|). In that case, the limit as x--> -∞ would be -∞:

But, regardless of which direction you force the limit it always gives the limit as x goes to -∞:

limit(√(x^2+2*x+1)-(√(x^2)),x,∞,-1) = -∞
limit(√(x^2+2*x+1)-(√(x^2)),x,∞,1) = -∞

Attached File(s) Thumbnail(s)

Ceci n'est pas une signature.
03-04-2015, 11:08 PM
Post: #5
 Helge Gabert Senior Member Posts: 467 Joined: Dec 2013
RE: CAS problem with solution
What are your cas settings? I get 1.

03-04-2015, 11:35 PM
Post: #6
 Teresa Junior Member Posts: 5 Joined: Mar 2015
RE: CAS problem with solution
My CAS settings are standard at least in the simulator (new install and reset). Is there an easy way to print those settings so i could post them?

Thanks for your replies. Learned new things about inputting formulas and that i did not too bad on my own. Even though i would not have spotted the problem when the answer would have been something positive.

Teresa
03-04-2015, 11:41 PM
Post: #7
 Helge Gabert Senior Member Posts: 467 Joined: Dec 2013
RE: CAS problem with solution
My CAS settings are:

Number standard 12
Integers Decimal check
Simplify Minimum
Exact check
Use sqrt check
principal check
complex no check
use i check
increasing no check
recursive eval 5
recursive replace 1
recursive function 9
epsilon .00000000001
probability 1E-15
Newton 40

If you want, try it again with these settings. Do you still get -infinity?
03-04-2015, 11:42 PM (This post was last modified: 03-04-2015 11:44 PM by Mark Hardman.)
Post: #8
 Mark Hardman Senior Member Posts: 525 Joined: Dec 2013
RE: CAS problem with solution
(03-04-2015 11:08 PM)Helge Gabert Wrote:  What are your cas settings? I get 1.

Excellent. If you check "Use i" in the CAS settings, you get the correct result.

But why would that make a difference?

Bernard?

Ceci n'est pas une signature.
03-05-2015, 12:12 AM
Post: #9
 Mark Hardman Senior Member Posts: 525 Joined: Dec 2013
RE: CAS problem with solution
(03-04-2015 11:42 PM)Mark Hardman Wrote:
(03-04-2015 11:08 PM)Helge Gabert Wrote:  What are your cas settings? I get 1.

But why would that make a difference?

To answer my own question.

With "Use i" unchecked:

simplify(√(x^2)) ----> |x|

With "Use i" checked:

simplify(√(x^2)) ----> x

Ceci n'est pas une signature.
03-05-2015, 08:31 AM
Post: #10
 parisse Senior Member Posts: 1,208 Joined: Dec 2013
RE: CAS problem with solution
OK, I have found why it does not work: it's sqrt(x^2+2x+1) that is wrongly rewritten as -x-1, there is a missing renormalization of square roots in the series/limit code. You can see it if you do
partfrac(sqrt(x^2+2x+1)-sqrt(x^2))
I'm going to fix that before the end of the week in Xcas.
It was never spotted before because nobody tried limit with the difference of two square roots of perfect squares.
03-05-2015, 08:37 AM
Post: #11
 salvomic Senior Member Posts: 1,394 Joined: Jan 2015
RE: CAS problem with solution
(03-05-2015 08:31 AM)parisse Wrote:  I'm going to fix that before the end of the week in Xcas.
always thank you!

Quote:It was never spotted before because nobody tried limit with the difference of two square roots of perfect squares.

so, thanks to Teresa for having found it...

It works with "i" checked in the CAS Settings: what's, precisely, the difference with "i" checked or not, please?

Salvo

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
03-05-2015, 03:20 PM
Post: #12
 Helge Gabert Senior Member Posts: 467 Joined: Dec 2013
RE: CAS problem with solution
What is the difference? Try factoring polynomials with complex solutions with "use i" checked and unchecked, e.g.

factor(x^4 +1), or

solve(x^4+1=0,x)
03-05-2015, 03:33 PM
Post: #13
 salvomic Senior Member Posts: 1,394 Joined: Jan 2015
RE: CAS problem with solution
(03-05-2015 03:20 PM)Helge Gabert Wrote:  What is the difference? Try factoring polynomials with complex solutions with "use i" checked and unchecked, e.g.

factor(x^4 +1), or
solve(x^4+1=0,x)

yes, I see (it introduces complex calculation and i in the factorization), but in some cases it can be simplified, like with factor() above (not the solve following)...
With sqrt(X*X+2X+1)-sqrt(X*X) with or without, we have different results.

So, I really don't know what's better

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
03-05-2015, 05:05 PM
Post: #14
 Helge Gabert Senior Member Posts: 467 Joined: Dec 2013
RE: CAS problem with solution
I'd say it is better to have "use i" checked in CAS settings (at least for now, see parisse's note above).
03-05-2015, 05:06 PM
Post: #15
 salvomic Senior Member Posts: 1,394 Joined: Jan 2015
RE: CAS problem with solution
(03-05-2015 05:05 PM)Helge Gabert Wrote:  I'd say it is better to have "use i" checked in CAS settings (at least for now, see parisse's note above).

in fact I keep it checked...

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
03-05-2015, 07:31 PM
Post: #16
 parisse Senior Member Posts: 1,208 Joined: Dec 2013
RE: CAS problem with solution
Actually, I would recommend keeping i not checked unless you know exactly what you do, and run cfactor or csolve if you need complex factorization/solutions. Some operations behave really differently if complex mode is enabled, for example sqrt(x^2) becomes x instead of abs(x).
03-05-2015, 07:57 PM
Post: #17
 salvomic Senior Member Posts: 1,394 Joined: Jan 2015
RE: CAS problem with solution
(03-05-2015 05:06 PM)salvomic Wrote:  in fact I keep it checked...

(03-05-2015 07:31 PM)parisse Wrote:  Actually, I would recommend keeping i not checked unless you know exactly what you do...

ok, I've unchecked it
thank you, Parisse, for your precious advise!

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
 « Next Oldest | Next Newest »

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