ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 21 Sep 2016 16:42:36 +0200declare a variable as *not* an integer for solvehttps://ask.sagemath.org/question/34876/declare-a-variable-as-not-an-integer-for-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)
assumptions()
︡> [K > 0, K is real, R > 0, R < 1]
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?
ThanksWed, 21 Sep 2016 11:11:14 +0200https://ask.sagemath.org/question/34876/declare-a-variable-as-not-an-integer-for-solve/Comment by kcrisman for <p>I am trying to solve symbolically a simple equation for x:</p>
<pre><code>solve(x^K + d == R, x)
</code></pre>
<p>I am declaring these variables and assumptions:</p>
<pre><code>var('K, d, R')
assume(K>0)
assume(K, 'real')
assume(R>0)
assume(R<1)
assumptions()
︡> [K > 0, K is real, R > 0, R < 1]
</code></pre>
<p>Yet when I run the solve, I obtain the following error:</p>
<blockquote>
<p>Error in lines 1-1 </p>
<p>Traceback (most recent call last): </p>
<p>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 </p>
<p>...</p>
<p>File "/projects/sage/sage-7.3/local/lib/python2.7/site-packages/sage/interfaces/interface.py",
line 671, in __init__
raise TypeError(x)</p>
<p>TypeError: Computation failed since Maxima requested additional constraints; using the 'assume' command before evaluation <em>may</em> help (example of legal syntax is 'assume(K>0)', see <code>assume?</code> for more details) </p>
<p><strong>Is K an integer?</strong></p>
</blockquote>
<p>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?</p>
<p>Thanks</p>
https://ask.sagemath.org/question/34876/declare-a-variable-as-not-an-integer-for-solve/?comment=34878#post-id-34878See also http://stackoverflow.com/questions/39612476/declare-a-variable-as-not-an-integer-in-sage-maxima-solve/Wed, 21 Sep 2016 14:23:32 +0200https://ask.sagemath.org/question/34876/declare-a-variable-as-not-an-integer-for-solve/?comment=34878#post-id-34878Answer by kcrisman for <p>I am trying to solve symbolically a simple equation for x:</p>
<pre><code>solve(x^K + d == R, x)
</code></pre>
<p>I am declaring these variables and assumptions:</p>
<pre><code>var('K, d, R')
assume(K>0)
assume(K, 'real')
assume(R>0)
assume(R<1)
assumptions()
︡> [K > 0, K is real, R > 0, R < 1]
</code></pre>
<p>Yet when I run the solve, I obtain the following error:</p>
<blockquote>
<p>Error in lines 1-1 </p>
<p>Traceback (most recent call last): </p>
<p>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 </p>
<p>...</p>
<p>File "/projects/sage/sage-7.3/local/lib/python2.7/site-packages/sage/interfaces/interface.py",
line 671, in __init__
raise TypeError(x)</p>
<p>TypeError: Computation failed since Maxima requested additional constraints; using the 'assume' command before evaluation <em>may</em> help (example of legal syntax is 'assume(K>0)', see <code>assume?</code> for more details) </p>
<p><strong>Is K an integer?</strong></p>
</blockquote>
<p>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?</p>
<p>Thanks</p>
https://ask.sagemath.org/question/34876/declare-a-variable-as-not-an-integer-for-solve/?answer=34881#post-id-34881For completeness, it turns out that indeed assuming `K` is `'noninteger'` apparently works. See https://trac.sagemath.org/ticket/21554 for documenting this better.Wed, 21 Sep 2016 16:42:36 +0200https://ask.sagemath.org/question/34876/declare-a-variable-as-not-an-integer-for-solve/?answer=34881#post-id-34881