Search code examples
pythonsagemaxima

declare a variable as *not* an integer in sage/maxima solve


I am trying to solve symbolically a simple equation for x:

solve(x^K + d == R, x)

I am declaring these variables and assumptions:

var('K, d, R')
assume(K>0)
assume(K, 'real')
assume(R>0)
assume(R<1)
assume(d<R)

assumptions()
︡> [K > 0, K is real, R > 0, R < 1, d < R]

Yet when I run the solve, I obtain the following error:

Error in lines 1-1

Traceback (most recent call last):

File "/projects/sage/sage-7.3/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 957, in execute exec compile(block+'\n', '', 'single') in namespace, locals

...

File "/projects/sage/sage-7.3/local/lib/python2.7/site-packages/sage/interfaces/interface.py", line 671, in init raise TypeError(x)

TypeError: Computation failed since Maxima requested additional constraints; using the 'assume' command before evaluation may help (example of legal syntax is 'assume(K>0)', see assume? for more details)

Is K an integer?

Apparently, maxima is asking whether K is an integer? But I explicitly declared it 'real'! How can I spell out to maxima that it should not assume that K is an integer?

I am simply expecting (R-d)^(1/K) or exp(log(R-d)/K) as answer.


Solution

  • The assumption framework in both Sage and Maxima is fairly weak, though in this case it doesn't matter, since integers are real numbers, right?

    However, you might want to try assume(K,'noninteger') because apparently Maxima does support this particular assumption (I had not seen it before). I can't try this right now, unfortunately, good luck!