1 | initial version |
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)]
Transform your equation yourself :
sage: (x^a==c).log().log_expand().solve(x)
[x == c^(1/a)]
(but beware of transformations introducing spurious roots...).
HTH,
2 | No.2 Revision |
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...).
Transform your equation yourself :
sage: (x^a==c).log().log_expand().solve(x)
[x == c^(1/a)]
(but beware of transformations introducing spurious roots...).
HTH,