how to solve equation with square root - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: how to solve equation with square root (/thread-14223.html) how to solve equation with square root - teerasak - 12-24-2019 07:30 AM 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. 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? RE: how to solve equation with square root - Aries - 12-24-2019 04:22 PM Hey teerasak, you could use the modulus: Otherwise you could save the domain into a variable (e.g. dom) and get the intersection with the equation: 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 RE: how to solve equation with square root - CyberAngel - 12-24-2019 04:23 PM (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. 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. RE: how to solve equation with square root - parisse - 12-24-2019 06:45 PM 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. RE: how to solve equation with square root - teerasak - 01-03-2020 06:58 AM thank you for all help. @CyberAngel - Yeah, fsolve() returned weird result. I guess, it should be 1 as it is close to 1. RE: how to solve equation with square root - teerasak - 01-03-2020 07:08 AM 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. Is it a bug? RE: how to solve equation with square root - Albert Chan - 01-03-2020 02:40 PM (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 RE: how to solve equation with square root - CyberAngel - 01-03-2020 02:45 PM (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. 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 RE: how to solve equation with square root - lrdheat - 01-03-2020 03:30 PM Just for the fun of it, I tried it on my CASIO fx-cg50...it came up with -6 and 5. RE: how to solve equation with square root - lrdheat - 01-03-2020 03:38 PM “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. RE: how to solve equation with square root - ijabbott - 01-03-2020 04:47 PM 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? RE: how to solve equation with square root - lrdheat - 01-03-2020 08:15 PM 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. RE: how to solve equation with square root - tom234 - 05-11-2020 03:17 PM (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. Is it a bug? I don't get anyone of that just empty brackets! RE: how to solve equation with square root - Joe Horn - 05-11-2020 05:19 PM (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. 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]. RE: how to solve equation with square root - tom234 - 05-11-2020 06:04 PM (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. 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