mersenneforum.org  

Go Back   mersenneforum.org > Math Stuff > Computer Science & Computational Number Theory

Reply
 
Thread Tools
Old 2018-11-20, 03:34   #1
MARTHA
 
Jan 2018

43 Posts
Default 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?
MARTHA is offline   Reply With Quote
Old 2018-11-20, 09:45   #2
R. Gerbicz
 
R. Gerbicz's Avatar
 
"Robert Gerbicz"
Oct 2005
Hungary

22·7·53 Posts
Default

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 >
ps. using symmetry you can assume that z>=0 (just swap x and y).

Last fiddled with by R. Gerbicz on 2018-11-20 at 09:47
R. Gerbicz is offline   Reply With Quote
Old 2018-11-20, 10:41   #3
MARTHA
 
Jan 2018

43 Posts
Smile

Quote:
Originally Posted by R. Gerbicz View Post
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 >
ps. using symmetry you can assume that z>=0 (just swap x and y).
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
MARTHA is offline   Reply With Quote
Old 2018-11-20, 11:38   #4
axn
 
axn's Avatar
 
Jun 2003

5,051 Posts
Default

Quote:
Originally Posted by MARTHA View Post
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?
Isn't this trying to map a countably infinite set to an uncountably infinite one?
axn is offline   Reply With Quote
Old 2018-11-20, 11:45   #5
firejuggler
 
firejuggler's Avatar
 
Apr 2010
Over the rainbow

23×52×13 Posts
Default

hmmm since X and Y are integer and different from 0, wouldn't that seriously reduce the number of solution?
firejuggler is offline   Reply With Quote
Old 2018-11-20, 11:50   #6
Nick
 
Nick's Avatar
 
Dec 2012
The Netherlands

2×23×37 Posts
Default

Quote:
Originally Posted by MARTHA View Post
Could you please explain in simple english the solution of this equation for example:
x^0.5-y^0.5=1.234567

Thanks again
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.
Nick is offline   Reply With Quote
Old 2018-11-20, 13:44   #7
MARTHA
 
Jan 2018

43 Posts
Default

Quote:
Originally Posted by Nick View Post
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.
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...

Last fiddled with by MARTHA on 2018-11-20 at 13:51
MARTHA is offline   Reply With Quote
Old 2018-11-21, 07:51   #8
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
Jun 2011
Thailand

7·1,373 Posts
Default

You asked for solution 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.

Last fiddled with by LaurV on 2018-11-21 at 07:57
LaurV is offline   Reply With Quote
Old 2018-11-21, 14:33   #9
Dr Sardonicus
 
Dr Sardonicus's Avatar
 
Feb 2017
Nowhere

4,643 Posts
Default

Quote:
Originally Posted by LaurV View Post
You asked for solution 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.
To be fair, the OP did 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. R. Gerbicz's routine incorporates the precision into the answer.

Trying to find small 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).
Dr Sardonicus is offline   Reply With Quote
Old 2018-11-22, 00:49   #10
MARTHA
 
Jan 2018

538 Posts
Smile

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..
MARTHA is offline   Reply With Quote
Old 2018-11-22, 00:51   #11
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

Quote:
Originally Posted by MARTHA View Post
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..
https://en.m.wikipedia.org/wiki/List...ematics_topics here's a list of what is covered ...
science_man_88 is offline   Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Spot the Difference a1call Miscellaneous Math 34 2017-12-11 00:17
Ring Square Roots in NFS paul0 Computer Science & Computational Number Theory 4 2015-01-09 14:57
V4 and V5 TF Reporting Difference RMAC9.5 PrimeNet 2 2010-05-23 02:20
difference between WZ1 and Wc1 in results.txt? ixfd64 Lounge 2 2005-11-19 18:13
Identifing perfect squares and calculating square roots.. dsouza123 Math 2 2003-07-19 17:17

All times are UTC. The time now is 01:10.


Sat Jul 17 01:10:27 UTC 2021 up 49 days, 22:57, 1 user, load averages: 0.65, 1.36, 1.44

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.