Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exponential equation with negative base with rational solution #19866

Open
sylee957 opened this issue Jul 31, 2020 · 0 comments
Open

Exponential equation with negative base with rational solution #19866

sylee957 opened this issue Jul 31, 2020 · 0 comments

Comments

@sylee957
Copy link
Member

sylee957 commented Jul 31, 2020

I see exponential equation solving is not implemented for rationals for negative or complex bases

from sympy import *

x = Symbol('x')

a = (-2*I)**2
b = (-2*I)**3

solveset(a**x - b, x, S.Rationals)

But it should be improved to give the solutions satisfying the diophantine problem like below
image

from sympy import *

n1, n2 = symbols('n1 n2', integer=True)

a = (-2*I)**2
b = (-2*I)**3
ratio = simplify(log(abs(a)) / log(abs(b)))
assert ratio.is_Rational
p, q = ratio.p, ratio.q

angle_a = cancel(arg(a) / pi)
angle_b = cancel(arg(b) / pi)
assert angle_a.is_Rational
assert angle_b.is_Rational

eqn = q*(2*n1 + angle_a) - p*(2*n2 + angle_b)
eqn = Poly(eqn, n1, n2)
coeff_n1 = eqn.coeff_monomial(n1)
coeff_n2 = eqn.coeff_monomial(n2)
coeff_const = eqn.coeff_monomial([0, 0])

_, _, gcd = gcdex(coeff_n1, coeff_n2)
assert (coeff_const % gcd) == 0
print(1/ratio)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant