# Dealing with undefined exponents in SAGE

I've been playing with sage a bit and have been running into a number of walls in terms of getting analytical solutions so I decided to check if my beliefs are true about SAGE's difficulty with trying to solve the following algebraic problem in sage. $$x^a-c=0, c\geq0$$ on paper if we were to solve for this problem on paper we get $$x^*=c^{\frac{1}{a}}$$

What is simply done on paper seems to be an issue to run in sage:

x,a,c = var('x a c')
solve(x^a - c== 0)


This code does not work and wont give me the simple pen and paper solution to this problem. why is this the case?

edit retag close merge delete

Sort by » oldest newest most voted

Your code doesn't work because you didn't specify what to solve for. If you try solve(x^a==c,x), Sage becomes nosy (verging on indiscrete...;-). You have a couple of solutions :

• add assumptions about a and c (see assume?).

• add temporary assumptions (useful for testing different branches) :

For example:

sage: with assuming(a,"noninteger", c>0): solve(x^a==c,x)
[x == c^(1/a)]
sage: with assuming(a,"noninteger", c<0): solve(x^a==c,x)
[x^a == c]
sage: with assuming(a,"noninteger", c==0): solve(x^a==c,x)
[x == c^(1/a)]


(one notes that the latter is nonsens, while formally correct...).

sage: (x^a==c).log().log_expand().solve(x)
[x == c^(1/a)]


(but beware of transformations introducing spurious roots...).

HTH,

more

My man you are saving me alot of time today! Thank you!

The quick and dirty code for this is:

x,a,c = var('x a c')
assume(x>0,a>0,c>0)
solve(x^a - c== 0,x)

more