![]() | 1 | initial version |
Not a full answer, but it seems that Sympy can find your special solution :
sage: import sympy
sage: a, b = sympy.symbols("a, b", integer=True)
sage: A, B = sympy.symbols("A, B")
sage: f=A+B
sage: g=a*A+b*B
sage: sympy.solve(f-g, (a, b))
{a: 1, b: 1}
Now, your problem may have more solutions than that. Start with Maxima's solution (after a change of notations) :
sage: var("x, y, X, Y")
(x, y, X, Y)
sage: Sol=(X+Y-(x*X+y*Y)==0).solve((x, y)) ; Sol
[[x == -(Y*(r5 - 1) - X)/X, y == r5]]
A bit of algebraic mangling gives us :
sage: (Sol[0][0].subs(Sol[0][1].rhs()==Sol[0][1].lhs()).expand().collect_common_factors()-1).factor()
x - 1 == -Y*(y - 1)/X
which tells us that for any (integer) $y$, $(x,\, y)$ is a solution iif $\frac{Y(1-y)}{X}$ is integer. This is possible iif $\frac{X}{Y}$ is rational.
I believe that this describes the whole set of solutions, but I'd be glad to be demonstrated wrong.
Numerical example :
sage: (S:=(X+Y-(xX+yY)==0).subs({X:5sqrt(3), Y:3sqrt(3)}).solve((x, y)))[0][0].subs(S[0][1].rhs()==S[0][1].lhs()) x == -3/5*y + 8/5
which shows that the non-trivial solutions are of the form $\left(\frac{-3k}{5},\,k\right),\,k\in\mathbb{Z}$;
HTH,
![]() | 2 | No.2 Revision |
Not a full answer, but it seems that Sympy can find your special solution :
sage: import sympy
sage: a, b = sympy.symbols("a, b", integer=True)
sage: A, B = sympy.symbols("A, B")
sage: f=A+B
sage: g=a*A+b*B
sage: sympy.solve(f-g, (a, b))
{a: 1, b: 1}
Now, your problem may have more solutions than that. Start with Maxima's solution (after a change of notations) :
sage: var("x, y, X, Y")
(x, y, X, Y)
sage: Sol=(X+Y-(x*X+y*Y)==0).solve((x, y)) ; Sol
[[x == -(Y*(r5 - 1) - X)/X, y == r5]]
A bit of algebraic mangling gives us :
sage: (Sol[0][0].subs(Sol[0][1].rhs()==Sol[0][1].lhs()).expand().collect_common_factors()-1).factor()
x - 1 == -Y*(y - 1)/X
which tells us that for any (integer) $y$, $(x,\, y)$ is a solution iif $\frac{Y(1-y)}{X}$ is integer. This is possible iif $\frac{X}{Y}$ is rational.
I believe that this describes the whole set of solutions, but I'd be glad to be demonstrated wrong.
Numerical example :
sage: (S:=(X+Y-(xX+yY)==0).subs({X:5sqrt(3), Y:3sqrt(3)}).solve((x,
sage: (S:=(X+Y-(x*X+y*Y)==0).subs({X:5*sqrt(3), Y:3*sqrt(3)}).solve((x,
y)))[0][0].subs(S[0][1].rhs()==S[0][1].lhs())
x == -3/5*y + which shows that the non-trivial solutions are of the form $\left(\frac{-3k}{5},\,k\right),\,k\in\mathbb{Z}$;
HTH,