I'm trying to determine whether or not I can find the integer solutions to (x+a)(x+b) = x(x−1) + x(a−b) (with a known x value you choose, i.e. 707). Plugging in my example value on Wolfram Alpha for x reveals the form of a hyperbola, but can I use http://mathworld.wolfram.com/EuclideanAlgorithm.html to help me generalize solutions for hyperbolic equations of this form?
Presumably plugging in the function into Wolfram Alpha and choosing my integer x value for every solution is not the only way to do this?
Answer
(x+a)(x+b)=x(x−1)+x(a−b),
(x+a)(x+b)−x(x−1)+x(a−b)=0, cancel stuff and
(2b+1)x+ab=0.
Introduce a variable
c=a+2x, so that
a=c−2x.
Then (2b+1)x+ab=0 becomes
x+bc=0,
bc=−x.
Therefore, find all divisors d of −x, both positive and negative, so that d∈{−|x|,…,−1,1…,|x|}.
For each such d, let
c=d,b=−x/d, with
a=d−2x,b=−x/d.
Finding all positive divisors of |x| is a matter of completely factoring |x|; for example, your 707=7⋅101. The positive divisors are 1,7,101,707, and all divisors are d∈{−707,−101,−7,−1,1,7,101,707}. For each such d, let a=d−1414 and b=−707/d.
set mp_Divisors( mpz_class i)
{
set sofar, more;
set::iterator iter;
sofar.insert(1);
more.clear();
string fac;
fac = " = ";
mpz_class p = 2;
mpz_class temp = i;
if (temp < 0 )
{
temp *= -1;
fac += " -1 * ";
}
if ( 1 == temp) fac += " 1 ";
if ( temp > 1)
{
int primefac = 0;
while( temp > 1 && p * p <= temp) // WWWWWWWWWWWWWWWWWWW
{
if (temp % p == 0)
{
++primefac;
if (primefac > 1) fac += " ";
// fac += stringify( p) ;
temp /= p;
int exponent = 1;
mpz_class power = p;
for(iter = sofar.begin() ; iter != sofar.end(); ++iter)
{
more.insert( power * *iter );
}
while (temp % p == 0)
{
temp /= p;
++exponent;
power *= p;
for(iter = sofar.begin() ; iter != sofar.end(); ++iter)
{
more.insert( power * *iter );
}
} // while p is fac
if ( exponent > 1)
{
fac += "^" ;
fac += stringify( exponent) ;
}
for(iter = more.begin() ; iter != more.end(); ++iter)
{
sofar.insert( *iter );
}
more.clear();
} // if p is factor
++p;
} // while p
if (temp > 1 && primefac >= 1) fac += " ";
// if (temp > 1 ) fac += stringify( temp.get_ui()) ;
if (temp > 1 ) fac += temp.get_str() ;
if ( temp > 1) {
for(iter = sofar.begin() ; iter != sofar.end(); ++iter)
{
more.insert( temp * *iter );
}
for(iter = more.begin() ; iter != more.end(); ++iter)
{
sofar.insert( *iter );
}
more.clear();
}
} // temp > 1
return sofar;
} // mp_Divisors
No comments:
Post a Comment