Revision history [back]

Looks like you found a typo in the Sage code that is raising that exception. I'll start a ticket for that. Thanks.

It is probably the case that without changing some settings/assumptions in Maxima directly, it's not going to be able to solve your particular equation. The assumptions you need relating x and k are tricky.. you have fractional exponents depending on k, so you've got to assume x is real and positive. But doing that doesn't seem to help Maxima.

Here is a work around, though. If you know the form of the equation is going to be like the one you have, the human mathematician would probably take the log of both sides and solve for log(x), then exponentiate. This kind of process is easy to automate:

sage: var('x,y,k')
sage: eq = (1/(x^((k - 2)/k))) == 1/2*(k + 1)*x^(1/k)
sage: eq = log(eq)
sage: eq.full_simplify()
-(k - 2)*log(x)/k == -(k*log(2/(k + 1)) - log(x))/k

sage: eq = eq.full_simplify()
sage: eq = eq.subs(log(x) == y)
sage: solve(eq, y)
[y == k*log(2/(k + 1))/(k - 1)]
sage: S = solve(eq, y)
sage: soln = exp(S[0].rhs())
sage: soln
e^(k*log(2/(k + 1))/(k - 1))


Looks like you found a typo in the Sage code that is raising that exception. I'll start a ticket for that. Thanks.

It is probably the case that without changing some settings/assumptions in Maxima directly, it's not going to be able to solve your particular equation. The assumptions you need relating x and k are tricky.. you have fractional exponents depending on k, so you've got to assume x is real and positive. But doing that doesn't seem to help Maxima.

Here is a work around, though. If you know the form of the equation is going to be like the one you have, the human mathematician would probably take the log of both sides and solve for log(x), then exponentiate. This kind of process is easy to automate:

sage: var('x,y,k')
sage: eq = (1/(x^((k - 2)/k))) == 1/2*(k + 1)*x^(1/k)
sage: eq = log(eq)
sage: eq.full_simplify()
-(k - 2)*log(x)/k == -(k*log(2/(k + 1)) - log(x))/k

sage: eq = eq.full_simplify()
sage: eq = eq.subs(log(x) == y)
sage: solve(eq, y)
[y == k*log(2/(k + 1))/(k - 1)]
sage: S = solve(eq, y)
sage: soln = exp(S[0].rhs())
sage: soln
e^(k*log(2/(k + 1))/(k - 1))


Hopefully there is a better answer which involves telling Maxima to load a package for doing "logarithmic solving" or whatever the process I just described is called.