Post Reply 
how to solve equation with square root
12-24-2019, 07:30 AM
Post: #1
how to solve equation with square root
When using solve command to solve equation with square root, the calculator gives results including those negative value under square root. For example in the picture below.

[Image: pic1.png]

solving equation Sqrt[x^2 + x -2] + Sqrt[x^2 + x -30] = Sqrt[2*x^2 + 2*x -32]

The calculator give result : -6, -2, 1,5, which is correct.

However, for some of them e.g -2, 1, when putting in x, it will give negative value under square root.

if we want the calculator to return only non-negative number under square root, what can we do?
Find all posts by this user
Quote this message in a reply
12-24-2019, 04:22 PM
Post: #2
RE: how to solve equation with square root
Hey teerasak,
you could use the modulus:

[Image: absval.jpg]

Otherwise you could save the domain into a variable (e.g. dom) and get the intersection with the equation:

[Image: domaequ.jpg]

domain(sqrt((x^2)+x-2)+sqrt((x^2)+x-30)-sqrt((2x^2)+2x-32),x) --> dom
solve(sqrt((x^2)+x-2)+sqrt((x^2)+x-30=sqrt((2x^2)+2x-32) and dom,x)
Happy XMas holidays,

Aries Wink
Find all posts by this user
Quote this message in a reply
12-24-2019, 04:23 PM
Post: #3
RE: how to solve equation with square root
(12-24-2019 07:30 AM)teerasak Wrote:  When using solve command to solve equation with square root, the calculator gives results including those negative value under square root. For example in the picture below.

[Image: pic1.png]

solving equation Sqrt[x^2 + x -2] + Sqrt[x^2 + x -30] = Sqrt[2*x^2 + 2*x -32]

The calculator give result : -6, -2, 1,5, which is correct.

However, for some of them e.g -2, 1, when putting in x, it will give negative value under square root.

if we want the calculator to return only non-negative number under square root, what can we do?

It seems that when using CAS these solvers do not regard the CAS Settings flag
Complex: [ ]

You have to feed the answers back to the original equation yourself
to test if they give the Real domain answer.
:-(
Simply unbelievable, but real: fsolve may even give odd complex results.
Find all posts by this user
Quote this message in a reply
12-24-2019, 06:45 PM
Post: #4
RE: how to solve equation with square root
If complex is on (use i), solve returns real and complex solutions (like csolve), if complex mode is off, solve returns only real solutions. solve does not check if intermediate computations are done in the complex domain, you can run domain and assume to avoid this.
Find all posts by this user
Quote this message in a reply
01-03-2020, 06:58 AM
Post: #5
RE: how to solve equation with square root
thank you for all help.

@CyberAngel - Yeah, fsolve() returned weird result. I guess, it should be 1 as it is close to 1.
Find all posts by this user
Quote this message in a reply
01-03-2020, 07:08 AM
Post: #6
RE: how to solve equation with square root
When using solve(Sqrt(x^2+x-2) + Sqrt(x^2+x-30) = Abs(Sqrt(2*x^2+2*x-32)),x)

I expect it should fiter answer with intermediate complex number result, but it does not.

[Image: pic2.png]

Is it a bug?
Find all posts by this user
Quote this message in a reply
01-03-2020, 02:40 PM
Post: #7
RE: how to solve equation with square root
(01-03-2020 07:08 AM)teerasak Wrote:  When using solve(Sqrt(x^2+x-2) + Sqrt(x^2+x-30) = Abs(Sqrt(2*x^2+2*x-32)),x)

I expect it should fiter answer with intermediate complex number result, but it does not.

Think of it if you solve this manually ...

LHS and RHS both non-negative. Square both side:

\((x^2 + x - 2) + (x^2 + x - 30) + 2 \sqrt{(x^2 + x - 2) (x^2 + x - 30)} = 2x^2 + 2x -32\)

\(2 \sqrt{(x^2 + x - 2) (x^2 + x - 30)} = 0\)

Again, both side is non-negative, square again:

\(4(x^2 + x - 2) (x^2 + x - 30) = 4(x+2)(x-1)(x+6)(x-5) = 0 \)

Note that above does not involve complex numbers.

To remove "complex intermediates", we need RHS = \(2x^2 + 2x -32 ≥ 0\)
With this extra constraint, we are left with 2 roots, x = -6, +5
Find all posts by this user
Quote this message in a reply
01-03-2020, 02:45 PM
Post: #8
RE: how to solve equation with square root
(01-03-2020 07:08 AM)teerasak Wrote:  When using solve(Sqrt(x^2+x-2) + Sqrt(x^2+x-30) = Abs(Sqrt(2*x^2+2*x-32)),x)

I expect it should fiter answer with intermediate complex number result, but it does not.

[Image: pic2.png]

Is it a bug?

Use CAS.domain
to the original expression to see which answers are valid.
It is always good to include domain to any answer
Find all posts by this user
Quote this message in a reply
01-03-2020, 03:30 PM
Post: #9
RE: how to solve equation with square root
Just for the fun of it, I tried it on my CASIO fx-cg50...it came up with -6 and 5.
Find all posts by this user
Quote this message in a reply
01-03-2020, 03:38 PM
Post: #10
RE: how to solve equation with square root
“domain” is a nice way to preselect the valid real results domain before using solve (was not aware of that command). Turns this into a 2 step procedure (surprised that this is the case). Thanks for this.
Find all posts by this user
Quote this message in a reply
01-03-2020, 04:47 PM
Post: #11
RE: how to solve equation with square root
I'm reminded of mathematical history, where non-real intermediate values occurred when finding the real root of some cubic equations with real coefficients. (The imaginary parts of the intermediate values would cancel out in the final answer.) It's one of the main reasons for the initial acceptance of complex numbers as legitimate. Should such real roots be disallowed just because you need imaginary numbers to calculate them?

— Ian Abbott
Find all posts by this user
Quote this message in a reply
01-03-2020, 08:15 PM
Post: #12
RE: how to solve equation with square root
A question...if in such an example as this, can I safely assume that, after using “domain” that all results that fall outside of the domain are correct complex results, that in this case, would be -2i and i?

The CASIO fx-cg50 is a surprisingly good calculator, quite useful in graphical analysis. Surprised that it’s complex capability is not complete (ASIN 2.4 yields an error, for example). Surprised it will not find prime factors of a number. Also surprised that it has difficulty with integrals with undefined endpoints or within an interval (integral of 1/(5ROOT x-1) from 0 to 33, as an example...even a TI 36X Pro can deal with this sort of problem). One is forced to divide into 2 integrals, or if endpoints are problematic, add or subtract 1 E -12 to the undefined endpoint as appropriate.
Find all posts by this user
Quote this message in a reply
05-11-2020, 03:17 PM
Post: #13
RE: how to solve equation with square root
(01-03-2020 07:08 AM)teerasak Wrote:  When using solve(Sqrt(x^2+x-2) + Sqrt(x^2+x-30) = Abs(Sqrt(2*x^2+2*x-32)),x)

I expect it should filter answer with intermediate complex number result, but it does not.

[Image: pic2.png]

Is it a bug?

I don't get anyone of that just empty brackets!
Find all posts by this user
Quote this message in a reply
05-11-2020, 05:19 PM
Post: #14
RE: how to solve equation with square root
(05-11-2020 03:17 PM)tom234 Wrote:  
(01-03-2020 07:08 AM)teerasak Wrote:  When using solve(Sqrt(x^2+x-2) + Sqrt(x^2+x-30) = Abs(Sqrt(2*x^2+2*x-32)),x)

I expect it should filter answer with intermediate complex number result, but it does not.

[Image: pic2.png]

Is it a bug?

I don't get anyone of that just empty brackets!

So did I until I reset all the CAS Settings to their defaults. On both pages of CAS Settings, press Shift Esc. And of course make sure that 'x' doesn't have any value stored in it, which can be assured by doing del(x) or purge(x). Then try the solve() again. Depending on your firmware version, you'll either get all four results or just [-6, 5].

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
05-11-2020, 06:04 PM
Post: #15
RE: how to solve equation with square root
(05-11-2020 03:17 PM)tom234 Wrote:  
(01-03-2020 07:08 AM)teerasak Wrote:  When using solve(Sqrt(x^2+x-2) + Sqrt(x^2+x-30) = Abs(Sqrt(2*x^2+2*x-32)),x)

I expect it should filter answer with intermediate complex number result, but it does not.

[Image: pic2.png]

Is it a bug?

I don't get anyone of that just empty brackets!

Now after re-setting desktop connectivity calculator, we get what you got in your photo.
However, after trying a reset unsurely on the Hand Held Calculator Prime, it gives the same answer as it did a single number. 18.704
Find all posts by this user
Quote this message in a reply
Post Reply 




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