我正在尝试用符号求解 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 是否为整数?但我明确宣布它是“真实的”! 我怎样才能最大限度地说明它不应该假设 K 是一个整数?
我只是期待 (R-d)^(1/K)
或 exp(log(R-d)/K)
作为答案。
最佳答案
Sage 和 Maxima 中的假设框架都相当薄弱,但在这种情况下无关紧要,因为整数是实数,对吧?
但是,您可能想尝试 assume(K,'noninteger')
因为显然 Maxima does support this特定假设(我以前没见过)。很遗憾,我现在无法尝试此操作,祝你好运!
关于python - 在 sage/maxima solve 中将变量声明为 *not* 整数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39612476/