#19851: Interpreter cell magics in Jupyter
-------------------------------------+-------------------------------------
Reporter: vbraun | Owner:
Type: defect | Status: needs_work
Priority: major | Milestone: sage-7.0
Component: interfaces | Resolution:
Keywords: | Merged in:
Authors: Volker Braun | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/vbraun/interpreter_cell_magics_in_jupyter|
6f7176f3f9981af65af8fbb4724def5f9bae6d6e
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by charpent):
I retract part of the previous comment : %e CAN be accepted... provided I
correctly prefix the celll with %%maxima, NOT %maxima as I did
inadvertently.
I still get errors from the Sage side :
{{{
%%maxima
declare(x,real,mu,real,sigma,real);
assume(sigma>0)
define(phi(x,mu,sigma),%e^-((x-mu)^2/(sigma*sqrt(2*%pi))));
assume(mu>0)
Int:integrate(phi(x,mu,sigma),x,minf,inf);
M:integrate(x*phi(x,mu,sigma),x,minf,inf);
V:integrate((x-M)^2*phi(x,mu,sigma),x,minf,inf);
}}}
results in :
{{{
IndexError Traceback (most recent call
last)
<ipython-input-20-7e78cfec051e> in <module>()
----> 1 get_ipython().run_cell_magic(u'maxima', u'',
u'declare(x,real,mu,real,sigma,real);\nassume(sigma>0)\ndefine(phi(x,mu,sigma),%e^-((x-mu)^2/(sigma*sqrt(2*%pi))));\nassume(mu>0)\nInt:integrate(phi(x,mu,sigma),x,minf,inf);\nM:integrate(x*phi(x,mu,sigma),x,minf,inf);\nV:integrate((x-M)^2*phi(x,mu,sigma),x,minf,inf);')
/usr/local/sage-7.0/local/lib/python2.7/site-
packages/IPython/core/interactiveshell.pyc in run_cell_magic(self,
magic_name, line, cell)
2291 magic_arg_s = self.var_expand(line, stack_depth)
2292 with self.builtin_trap:
-> 2293 result = fn(magic_arg_s, cell)
2294 return result
2295
/usr/local/sage-7.0/local/lib/python2.7/site-
packages/sage/repl/interface_magic.pyc in cell_magic(line, cell)
294 if line:
295 raise SyntaxError('Interface magics have no
options, got "{0}"'.format(line))
--> 296 output = self._interface.eval(cell)
297 print(output)
298 cell_magic.__doc__ =
CELL_DOCSTRING.format(name=self._name)
/usr/local/sage-7.0/local/lib/python2.7/site-
packages/sage/interfaces/expect.pyc in eval(self, code, strip,
synchronize, locals, allow_use_file, split_lines, **kwds)
1234 if (split_lines == "nofile" and allow_use_file and
1235 self._eval_using_file_cutoff and len(code)
> self._eval_using_file_cutoff):
-> 1236 return self._eval_line_using_file(code)
1237 elif split_lines:
1238 return '\n'.join([self._eval_line(L,
allow_use_file=allow_use_file, **kwds)
/usr/local/sage-7.0/local/lib/python2.7/site-
packages/sage/interfaces/expect.pyc in _eval_line_using_file(self, line,
restart_if_needed)
750 except RuntimeError as msg:
751 raise RuntimeError('%s terminated unexpectedly
while reading in a large line'%self)
--> 752 if "Input/output error" in msg[0]: # This occurs on
non-linux machines
753 raise RuntimeError('%s terminated unexpectedly
while reading in a large line'%self)
754 raise RuntimeError('%s terminated unexpectedly while
reading in a large line:\n%s'%(self,msg[0]))
IndexError: tuple index out of range
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/19851#comment:6>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.