Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Sage在呼叫Mathematica时挂断电话_Python_Wolfram Mathematica_Sage - Fatal编程技术网

Python Sage在呼叫Mathematica时挂断电话

Python Sage在呼叫Mathematica时挂断电话,python,wolfram-mathematica,sage,Python,Wolfram Mathematica,Sage,我最近在我的Fedora21机器上安装了Sage 6.3。我使用的是6.3版,它有点过时,因为它是yum存储库中最新的版本。我还在同一台计算机上安装了Mathematica,希望能够从Sage内部调用它 Mathematica的终端接口使用math命令工作,这应该是我所需要的。然而,当我从Sage命令行或笔记本告诉Sage使用mathematica时,Sage挂起了。以下是我与终端交互的示例(回溯非常可怕,在Sage中经常出现这种情况): 是我做错了什么,还是这是Sage中的一个错误?下载并构建

我最近在我的Fedora21机器上安装了Sage 6.3。我使用的是6.3版,它有点过时,因为它是
yum
存储库中最新的版本。我还在同一台计算机上安装了Mathematica,希望能够从Sage内部调用它

Mathematica的终端接口使用
math
命令工作,这应该是我所需要的。然而,当我从Sage命令行或笔记本告诉Sage使用mathematica时,Sage挂起了。以下是我与终端交互的示例(回溯非常可怕,在Sage中经常出现这种情况):

是我做错了什么,还是这是Sage中的一个错误?下载并构建最新版本(6.7)是否会手动修复该问题

编辑


我正在使用Mathematica 10.1.0。这可能是我的问题吗,即旧版本的Sage不知道如何处理新版本的Mathematica?

根据,这个问题应该在最新版本的Sage中解决。我个人没有Mathematica的副本来测试这个问题。

根据,这个问题应该在最新的Sage中解决。我个人没有Mathematica的副本来测试这个问题。

根据,这个问题应该在最新的Sage中解决。我个人没有Mathematica的副本来测试这个问题。

根据,这个问题应该在最新的Sage中解决。我个人没有Mathematica的副本来测试这一点。

我在这里问这个问题是因为我知道有一个由圣贤专家组成的小而活跃的社区。在某些方面,它更适合其他地方-如果社区认为它应该被移动,我将很乐意与迁移到其他地方或其他地方的人合作。没错,在超级用户上可能更好,虽然不太可能被看到,但ask.sagemath.org可能是最好的。我在这里问这个问题是因为我知道有一个由Sage专家组成的小而活跃的社区。在某些方面,它更适合其他地方-如果社区认为它应该被移动,我将很乐意与迁移到其他地方或其他地方的人合作。没错,在超级用户上可能更好,虽然不太可能被看到,但ask.sagemath.org可能是最好的。我在这里问这个问题是因为我知道有一个由Sage专家组成的小而活跃的社区。在某些方面,它更适合其他地方-如果社区认为它应该被移动,我将很乐意与迁移到其他地方或其他地方的人合作。没错,在超级用户上可能更好,虽然不太可能被看到,但ask.sagemath.org可能是最好的。我在这里问这个问题是因为我知道有一个由Sage专家组成的小而活跃的社区。在某些方面,它更适合其他地方-如果社区认为它应该被移动,我将很乐意与迁移到其他地方或其他地方的人合作。没错,超级用户可能会更好,尽管被看到的可能性更小-ask.sagemath.org可能是最好的。谢谢!如果有机会,我会建立最新版本。谢谢!如果有机会,我会建立最新版本。谢谢!如果有机会,我会建立最新版本。谢谢!当我有机会的时候,我会建立最新的版本。
sage: mathematica('hello world')
^CInterrupting Mathematica...
^C---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-1-9208bb19d841> in <module>()
----> 1 mathematica('hello world')

/usr/lib64/python2.7/site-packages/sage/interfaces/interface.pyc in __call__(self, x, name)
    197
    198         if isinstance(x, basestring):
--> 199             return cls(self, x, name=name)
    200         try:
    201             return self._coerce_from_special_method(x)

/usr/lib64/python2.7/site-packages/sage/interfaces/expect.pyc in __init__(self, parent, value, is_name, name)
   1310         else:
   1311             try:
-> 1312                 self._name = parent._create(value, name=name)
   1313             # Convert ValueError and RuntimeError to TypeError for
   1314             # coercion to work properly.

/usr/lib64/python2.7/site-packages/sage/interfaces/interface.pyc in _create(self, value, name)
    387     def _create(self, value, name=None):
    388         name = self._next_var_name() if name is None else name
--> 389         self.set(name, value)
    390         return name
    391

/usr/lib64/python2.7/site-packages/sage/interfaces/mathematica.pyc in set(self, var, value)
    508         cmd = '%s=%s;'%(var,value)
    509         #out = self.eval(cmd)
--> 510         out = self._eval_line(cmd, allow_use_file=True)
    511         if len(out) > 8:
    512             raise TypeError("Error executing code in Mathematica\nCODE:\n\t%s\nMathematica ERROR:\n\t%s"%(cmd, out))

/usr/lib64/python2.7/site-packages/sage/interfaces/mathematica.pyc in _eval_line(self, line, allow_use_file, wait_for_prompt, restart_if_needed)
    535     def _eval_line(self, line,  allow_use_file=True, wait_for_prompt=True, restart_if_needed=False):
    536         s = Expect._eval_line(self, line,
--> 537              allow_use_file=allow_use_file, wait_for_prompt=wait_for_prompt)
    538         return str(s).strip('\n')
    539

/usr/lib64/python2.7/site-packages/sage/interfaces/expect.pyc in _eval_line(self, line, allow_use_file, wait_for_prompt, restart_if_needed)
    890                     out = ''
    891         except KeyboardInterrupt:
--> 892             self._keyboard_interrupt()
    893             raise KeyboardInterrupt("Ctrl-c pressed while running %s"%self)
    894         if self._terminal_echo:

/usr/lib64/python2.7/site-packages/sage/interfaces/mathematica.pyc in _keyboard_interrupt(self)
    420         e = self._expect
    421         e.sendline(chr(3))  # send ctrl-c
--> 422         e.expect('Interrupt> ')
    423         e.sendline("a")  # a -- abort
    424         e.expect(self._prompt)

/usr/lib64/sagemath/site-packages/pexpect.pyc in expect(self, pattern, timeout, searchwindowsize)
    914         """
    915         compiled_pattern_list = self.compile_pattern_list(pattern)
--> 916         return self.expect_list(compiled_pattern_list, timeout, searchwindowsize)
    917
    918     def expect_list(self, pattern_list, timeout = -1, searchwindowsize = -1):

/usr/lib64/sagemath/site-packages/pexpect.pyc in expect_list(self, pattern_list, timeout, searchwindowsize)
    965                     raise TIMEOUT ('Timeout exceeded in expect_list().')
    966                 # Still have time left, so read more data
--> 967                 c = self.read_nonblocking (self.maxread, timeout)
    968                 incoming = incoming + c
    969                 if timeout is not None:

/usr/lib64/sagemath/site-packages/pexpect.pyc in read_nonblocking(self, size, timeout)
    546                 raise EOF ('End Of File (EOF) in read_nonblocking(). Pokey platform.')
    547
--> 548         r, w, e = select.select([self.child_fd], [], [], timeout)
    549         if not r:
    550             if not self.isalive():

/usr/lib64/python2.7/site-packages/sage/ext/c_lib.so in sage.ext.c_lib.sage_python_check_interrupt (build/cythonized/sage/ext/c_lib.c:1683)()

/usr/lib64/python2.7/site-packages/sage/ext/c_lib.so in sage.ext.c_lib.sig_raise_exception (build/cythonized/sage/ext/c_lib.c:769)()

KeyboardInterrupt:
sage:
Mathematica 10.1.0 for Linux x86 (64-bit)
Copyright 1988-2015 Wolfram Research, Inc.

In[1]:= hello world

Out[1]= hello world

In[2]:=