在 sage/maxima 中将变量声明为 *not* 整数 求解
declare a variable as *not* an integer in sage/maxima solve
我正在尝试用符号求解 x 的一个简单方程:
solve(x^K + d == R, x)
我声明这些变量和假设:
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]
然而当我运行求解时,我得到以下错误:
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?
看来maxima是在问K是不是整数?但是我明确声明了'real'!
我怎样才能最大程度地说明它不应该假设 K 是一个整数?
我只是期待 (R-d)^(1/K)
或 exp(log(R-d)/K)
作为答案。
Sage 和 Maxima 中的假设框架都相当薄弱,但在这种情况下并不重要,因为整数是实数,对吧?
但是,您可能想尝试 assume(K,'noninteger')
,因为显然 Maxima does support this 特定假设(我以前从未见过)。我现在不能尝试这个,很遗憾,祝你好运!
我正在尝试用符号求解 x 的一个简单方程:
solve(x^K + d == R, x)
我声明这些变量和假设:
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]
然而当我运行求解时,我得到以下错误:
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?
看来maxima是在问K是不是整数?但是我明确声明了'real'! 我怎样才能最大程度地说明它不应该假设 K 是一个整数?
我只是期待 (R-d)^(1/K)
或 exp(log(R-d)/K)
作为答案。
Sage 和 Maxima 中的假设框架都相当薄弱,但在这种情况下并不重要,因为整数是实数,对吧?
但是,您可能想尝试 assume(K,'noninteger')
,因为显然 Maxima does support this 特定假设(我以前从未见过)。我现在不能尝试这个,很遗憾,祝你好运!