![]() |
Difference of Square Roots
Dear All,
I am looking for the solution of equation x^0.5 - y^0.5 = z; where x and y are integers while z is any floating number.. If z is known, can x and y be directly calculated rather then brute force? |
Because z is a floating point number this is a perfect solution, if you want a solution of absolute precision 2^(-b).
[CODE] (10:34) gp > ff(z,b)={y=2^(2*b);x=round((2^b+z)^2);return([x,y])} %1 = (z,b)->y=2^(2*b);x=round((2^b+z)^2);return([x,y]) (10:34) gp > ff(600.8,52) %2 = [20282409603657081949259500034970, 20282409603651670423947251286016] (10:34) gp > x=20282409603657081949259500034970; (10:34) gp > y=20282409603651670423947251286016; (10:34) gp > d=sqrt(x)-sqrt(y) %5 = 600.79999999999999997335463576229321828 (10:35) gp > (d-600.8)*2^52 %6 = -0.12000005245208740234 (10:35) gp > [/CODE] ps. using symmetry you can assume that z>=0 (just swap x and y). |
[QUOTE=R. Gerbicz;500552]Because z is a floating point number this is a perfect solution, if you want a solution of absolute precision 2^(-b).
[CODE] (10:34) gp > ff(z,b)={y=2^(2*b);x=round((2^b+z)^2);return([x,y])} %1 = (z,b)->y=2^(2*b);x=round((2^b+z)^2);return([x,y]) (10:34) gp > ff(600.8,52) %2 = [20282409603657081949259500034970, 20282409603651670423947251286016] (10:34) gp > x=20282409603657081949259500034970; (10:34) gp > y=20282409603651670423947251286016; (10:34) gp > d=sqrt(x)-sqrt(y) %5 = 600.79999999999999997335463576229321828 (10:35) gp > (d-600.8)*2^52 %6 = -0.12000005245208740234 (10:35) gp > [/CODE] ps. using symmetry you can assume that z>=0 (just swap x and y).[/QUOTE] Thanks for your quick response, but being a layman I am not able to understand your code.. Could you please explain in simple english the solution of this equation for example: x^0.5-y^0.5=1.234567 Thanks again |
[QUOTE=MARTHA;500533]I am looking for the solution of equation x^0.5 - y^0.5 = z; where x and y are integers while z is any floating number.. If z is known, can x and y be directly calculated rather then brute force?[/QUOTE]
Isn't this trying to map a countably infinite set to an uncountably infinite one? |
hmmm since X and Y are integer and different from 0, wouldn't that seriously reduce the number of solution?
|
[QUOTE=MARTHA;500557]
Could you please explain in simple english the solution of this equation for example: x^0.5-y^0.5=1.234567 Thanks again[/QUOTE] There is no solution in integers to that equation. If z is a non-zero rational number then \(\sqrt{x}\) and \(\sqrt{y}\) must be integers. |
[QUOTE=Nick;500563]There is no solution in integers to that equation.
If z is a non-zero rational number then \(\sqrt{x}\) and \(\sqrt{y}\) must be integers.[/QUOTE] Thanks to the formula given by Sir Gerbicz, we have \(\sqrt{281475018135852}\) - \(\sqrt{281474976710656}\)=1.234567001 But there must be lower values of x and y for this.. For example if z=1.026, we have \(\sqrt{1050678}\)- \(\sqrt{1048576}\)=1.02585333 with formula but \(\sqrt{24}\)- \(\sqrt{15}\)=1.02599 would be a better approximation... |
You asked for [U]solution[/U] not for approximation.
One way to see is if you amplify with the conjugate. \((\sqrt x -\sqrt y)(\sqrt x +\sqrt y)=z(\sqrt x +\sqrt y)\) then you have \(x-y=z(\sqrt x +\sqrt y)\). The left side is an integer, the right side is not, except very particular cases, like for example, z is irrational, and it has a common square free part with x and y, see \(\sqrt{75}-\sqrt{12}=3*\sqrt 3\). For z non-integer, rational, there is no solution with square free parts, as Nick said. |
[QUOTE=LaurV;500646]You asked for [U]solution[/U] not for approximation.
One way to see is if you amplify with the conjugate. \((\sqrt x -\sqrt y)(\sqrt x +\sqrt y)=z(\sqrt x +\sqrt y)\) then you have \(x-y=z(\sqrt x +\sqrt y)\). The left side is an integer, the right side is not, except very particular cases, like for example, z is irrational, and it has a common square free part with x and y, see \(\sqrt{75}-\sqrt{12}=3*\sqrt 3\). For z non-integer, rational, there is no solution with square free parts, as Nick said.[/QUOTE]To be fair, the OP [i]did[/i] specify z as a "floating number," which I interpret as a "floating point number," which is not an exact numeric type -- it has limited precision. [b]R. Gerbicz[/b]'s routine incorporates the precision into the answer. Trying to find [i]small[/i] solutions -- that's been a real head-scratcher for me. I note that, if z is a positive integer k, x = (n + k)^2 and y = n^2 give exact integer solutions. If z is not an integer, the integer part of z pretty much pegs the difference between the integer parts of sqrt(x) and sqrt(y). |
Thank you all for your precious time...
Its quite fascinating that even with Computers, there is still so much to be discovered in the field of MATH.. |
[QUOTE=MARTHA;500697]Thank you all for your precious time...
Its quite fascinating that even with Computers, there is still so much to be discovered in the field of MATH..[/QUOTE] [url]https://en.m.wikipedia.org/wiki/Lists_of_mathematics_topics[/url] here's a list of what is covered ... |
| All times are UTC. The time now is 01:10. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.