code
stringlengths
17
6.64M
def request_wolfram_alpha(input, verbose=False): "\n Request Wolfram Alpha website.\n\n INPUT:\n\n - ``input`` -- string\n - ``verbose`` -- bool (default: ``False``)\n\n OUTPUT:\n\n json\n\n EXAMPLES::\n\n sage: from sage.interfaces.mathematica import request_wolfram_alpha\n sag...
def parse_moutput_from_json(page_data, verbose=False): "\n Return the list of outputs found in the json (with key ``'moutput'``)\n\n INPUT:\n\n - ``page_data`` -- json obtained from Wolfram Alpha\n - ``verbose`` -- bool (default: ``False``)\n\n OUTPUT:\n\n list of unicode strings\n\n EXAMPLES...
def symbolic_expression_from_mathematica_string(mexpr): "\n Translate a mathematica string into a symbolic expression\n\n INPUT:\n\n - ``mexpr`` -- string\n\n OUTPUT:\n\n symbolic expression\n\n EXAMPLES::\n\n sage: from sage.interfaces.mathematica import symbolic_expression_from_mathemat...
def _mathics_sympysage_symbol(self): "\n Convert a Sympy symbol ``self`` to a correspondig element\n in Sage's symbolic ring.\n\n This function replaces ``_sympysage_symbol`` to\n take care of the special names used in Mathics.\n It is set to the method `_sage_` of the Sympy class\n :class:`symp...
class Mathics(Interface): "\n Interface to the Mathics interpreter.\n\n Implemented according to the Mathematica interface but avoiding Pexpect\n functionality.\n\n EXAMPLES::\n\n sage: # optional - mathics\n sage: t = mathics('Tan[I + 0.5]')\n sage: t.parent()\n Mathics\n ...
@instancedoc class MathicsElement(ExtraTabCompletion, InterfaceElement): "\n Element class of the Mathics interface.\n\n Its instances are usually constructed via the instance call of its parent.\n It wrapes the Mathics library for this object. In a session Mathics methods\n can be obtained using tab ...
def reduce_load(X): "\n Used in unpickling a Mathics element.\n\n This function is just the ``__call__`` method of the interface instance.\n\n EXAMPLES::\n\n sage: sage.interfaces.mathics.reduce_load('Denominator[a / b]') # optional -- mathics\n b\n " return mathics(X)
def mathics_console(): '\n Spawn a new Mathics command-line session.\n\n EXAMPLES::\n\n sage: mathics_console() # not tested\n\n Mathics 2.1.1.dev0\n on CPython 3.9.2 (default, Mar 19 2021, 22:23:28)\n using SymPy 1.7, mpmath 1.2.1, numpy 1.19.5, cython 0.29.21\n\n Copyri...
class Matlab(Expect): "\n Interface to the Matlab interpreter.\n\n EXAMPLES::\n\n sage: # optional - matlab\n sage: a = matlab('[ 1, 1, 2; 3, 5, 8; 13, 21, 33 ]')\n sage: b = matlab('[ 1; 3; 13]')\n sage: c = a * b\n sage: print(c)\n 30\n 122\n ...
@instancedoc class MatlabElement(ExpectElement): def __getitem__(self, n): raise RuntimeError('Use parenthesis for MATLAB matrices instead.') def _matrix_(self, R): "\n Return Sage matrix from this matlab element.\n\n EXAMPLES::\n\n sage: # optional - matlab\n ...
def reduce_load_Matlab(): return matlab
def matlab_console(): '\n This requires that the optional matlab program be installed and in\n your PATH, but no optional Sage packages need be installed.\n\n EXAMPLES::\n\n sage: matlab_console() # optional - matlab; not tested\n < M A T L A B ...
def matlab_version(): "\n Return the version of Matlab installed.\n\n EXAMPLES::\n\n sage: matlab_version() # random; optional - matlab\n '7.2.0.283 (R2006a)'\n " return str(matlab('version')).strip()
class Maxima(MaximaAbstract, Expect): '\n Interface to the Maxima interpreter.\n\n EXAMPLES::\n\n sage: m = Maxima()\n sage: m == maxima\n False\n ' def __init__(self, script_subdirectory=None, logfile=None, server=None, init_code=None): "\n Create an instance of ...
def is_MaximaElement(x): '\n Returns True if ``x`` is of type :class:`MaximaElement`.\n\n EXAMPLES::\n\n sage: from sage.interfaces.maxima import is_MaximaElement\n sage: is_MaximaElement(1)\n doctest:...: DeprecationWarning: the function is_MaximaElement is deprecated; use isinstance(x...
@instancedoc class MaximaElement(MaximaAbstractElement, ExpectElement): '\n Element of Maxima through Pexpect interface.\n\n EXAMPLES:\n\n Elements of this class should not be created directly.\n The targeted parent should be used instead::\n\n sage: maxima(3)\n 3\n sage: maxima(c...
@instancedoc class MaximaElementFunction(MaximaElement, MaximaAbstractElementFunction): "\n Maxima user-defined functions.\n\n EXAMPLES:\n\n Elements of this class should not be created directly.\n The method ``function`` of the targeted parent should be used instead::\n\n sage: maxima.function...
def reduce_load_Maxima(): '\n Unpickle a Maxima Pexpect interface.\n\n EXAMPLES::\n\n sage: from sage.interfaces.maxima import reduce_load_Maxima\n sage: reduce_load_Maxima()\n Maxima\n ' return maxima
def reduce_load_Maxima_function(parent, defn, args, latex): "\n Unpickle a Maxima function.\n\n EXAMPLES::\n\n sage: from sage.interfaces.maxima import reduce_load_Maxima_function\n sage: f = maxima.function('x,y','sin(x+y)')\n sage: _,args = f.__reduce__()\n sage: g = reduce_loa...
def __doctest_cleanup(): '\n Kill all Pexpect interfaces.\n\n EXAMPLES::\n\n sage: from sage.interfaces.maxima import __doctest_cleanup\n sage: maxima(1)\n 1\n sage: maxima.is_running()\n True\n sage: __doctest_cleanup()\n sage: maxima.is_running()\n F...
class MaximaAbstract(ExtraTabCompletion, Interface): '\n Abstract interface to Maxima.\n\n INPUT:\n\n - ``name`` - string\n\n OUTPUT: the interface\n\n EXAMPLES:\n\n This class should not be instantiated directly,\n but through its subclasses Maxima (Pexpect interface)\n or MaximaLib (libr...
@instancedoc class MaximaAbstractElement(ExtraTabCompletion, InterfaceElement): "\n Element of Maxima through an abstract interface.\n\n EXAMPLES:\n\n Elements of this class should not be created directly.\n The targeted parent of a concrete inherited class should be used instead::\n\n sage: fr...
class MaximaAbstractElementFunction(MaximaAbstractElement): "\n Create a Maxima function with the parent ``parent``,\n name ``name``, definition ``defn``, arguments ``args``\n and latex representation ``latex``.\n\n INPUT:\n\n - ``parent`` - an instance of a concrete Maxima interface\n\n - ``nam...
def reduce_load_MaximaAbstract_function(parent, defn, args, latex): "\n Unpickle a Maxima function.\n\n EXAMPLES::\n\n sage: from sage.interfaces.maxima_abstract import reduce_load_MaximaAbstract_function\n sage: f = maxima.function('x,y','sin(x+y)')\n sage: _,args = f.__reduce__()\n ...
def maxima_version(): "\n Return Maxima version.\n\n Currently this calls a new copy of Maxima.\n\n EXAMPLES::\n\n sage: from sage.interfaces.maxima_abstract import maxima_version\n sage: maxima_version() # random\n '5.41.0'\n " with os.popen('{} --version'.format(MAXIMA)) as...
def maxima_console(): '\n Spawn a new Maxima command-line session.\n\n EXAMPLES::\n\n sage: from sage.interfaces.maxima_abstract import maxima_console\n sage: maxima_console() # not tested\n Maxima 5.34.1 http://maxima.sourceforge.net\n ...\n ' from sage...
def stdout_to_string(s): "\n Evaluate command ``s`` and catch Maxima stdout\n (not the result of the command!) into a string.\n\n INPUT:\n\n - ``s`` - string; command to evaluate\n\n OUTPUT: string\n\n This is currently used to implement :meth:`~MaximaLibElement.display2d`.\n\n EXAMPLES::\n\n...
def max_to_string(s): "\n Return the Maxima string corresponding to this ECL object.\n\n INPUT:\n\n - ``s`` - ECL object\n\n OUTPUT: string\n\n EXAMPLES::\n\n sage: from sage.interfaces.maxima_lib import maxima_lib, max_to_string\n sage: ecl = maxima_lib(cos(x)).ecl()\n sage: m...
def parse_max_string(s): "\n Evaluate string in Maxima without *any* further simplification.\n\n INPUT:\n\n - ``s`` - string\n\n OUTPUT: ECL object\n\n EXAMPLES::\n\n sage: from sage.interfaces.maxima_lib import parse_max_string\n sage: parse_max_string('1+1')\n <ECL: ((MPLUS) ...
class MaximaLib(MaximaAbstract): '\n Interface to Maxima as a Library.\n\n INPUT: none\n\n OUTPUT: Maxima interface as a Library\n\n EXAMPLES::\n\n sage: from sage.interfaces.maxima_lib import MaximaLib, maxima_lib\n sage: isinstance(maxima_lib,MaximaLib)\n True\n\n Only one su...
def is_MaximaLibElement(x): '\n Return True if ``x`` is of type :class:`MaximaLibElement`.\n\n EXAMPLES::\n\n sage: from sage.interfaces.maxima_lib import maxima_lib, is_MaximaLibElement\n sage: is_MaximaLibElement(1)\n doctest:...: DeprecationWarning: the function is_MaximaLibElement i...
@instancedoc class MaximaLibElement(MaximaAbstractElement): '\n Element of Maxima through library interface.\n\n EXAMPLES:\n\n Elements of this class should not be created directly.\n The targeted parent should be used instead::\n\n sage: from sage.interfaces.maxima_lib import maxima_lib\n ...
@instancedoc class MaximaLibElementFunction(MaximaLibElement, MaximaAbstractElementFunction): pass
def reduce_load_MaximaLib(): '\n Unpickle the (unique) Maxima library interface.\n\n EXAMPLES::\n\n sage: from sage.interfaces.maxima_lib import reduce_load_MaximaLib\n sage: reduce_load_MaximaLib()\n Maxima_lib\n ' return maxima_lib
def sage_rat(x, y): '\n Return quotient x/y.\n\n INPUT:\n\n - ``x`` - integer\n\n - ``y`` - integer\n\n OUTPUT: rational\n\n EXAMPLES::\n\n sage: from sage.interfaces.maxima_lib import sage_rat\n sage: sage_rat(1,7)\n 1/7\n ' return (x / y)
def mrat_to_sage(expr): "\n Convert a Maxima MRAT expression to Sage SR.\n\n INPUT:\n\n - ``expr`` - ECL object; a Maxima MRAT expression\n\n OUTPUT: symbolic expression\n\n Maxima has an optimised representation for multivariate\n rational expressions. The easiest way to translate those\n to...
def mqapply_to_sage(expr): "\n Special conversion rule for MQAPPLY expressions.\n\n INPUT:\n\n - ``expr`` - ECL object; a Maxima MQAPPLY expression\n\n OUTPUT: symbolic expression\n\n MQAPPLY is used for function as li[x](y) and psi[x](y).\n\n EXAMPLES::\n\n sage: from sage.interfaces.max...
def mdiff_to_sage(expr): "\n Special conversion rule for %DERIVATIVE expressions.\n\n INPUT:\n\n - ``expr`` - ECL object; a Maxima %DERIVATIVE expression\n\n OUTPUT: symbolic expression\n\n EXAMPLES::\n\n sage: from sage.interfaces.maxima_lib import maxima_lib, mdiff_to_sage\n sage: f...
def mlist_to_sage(expr): '\n Special conversion rule for MLIST expressions.\n\n INPUT:\n\n - ``expr`` - ECL object; a Maxima MLIST expression (i.e., a list)\n\n OUTPUT: a Python list of converted expressions.\n\n EXAMPLES::\n\n sage: from sage.interfaces.maxima_lib import maxima_lib, mlist_t...
def max_at_to_sage(expr): '\n Special conversion rule for AT expressions.\n\n INPUT:\n\n - ``expr`` - ECL object; a Maxima AT expression\n\n OUTPUT: symbolic expression\n\n EXAMPLES::\n\n sage: from sage.interfaces.maxima_lib import maxima_lib, max_at_to_sage\n sage: a=maxima_lib("\'a...
def dummy_integrate(expr): "\n We would like to simply tie Maxima's integrate to\n sage.calculus.calculus.dummy_integrate, but we're being\n imported there so to avoid circularity we define it here.\n\n INPUT:\n\n - ``expr`` - ECL object; a Maxima %INTEGRATE expression\n\n OUTPUT: symbolic expre...
def max_harmonic_to_sage(expr): '\n EXAMPLES::\n\n sage: from sage.interfaces.maxima_lib import maxima_lib, max_to_sr\n sage: c=maxima_lib(harmonic_number(x,2))\n sage: c.ecl()\n <ECL: (($GEN_HARMONIC_NUMBER SIMP) 2 |$_SAGE_VAR_x|)>\n sage: max_to_sr(c.ecl())\n harmoni...
def max_pochhammer_to_sage(expr): "\n EXAMPLES::\n\n sage: from sage.interfaces.maxima_lib import maxima_lib, max_to_sr\n sage: c = maxima_lib('pochhammer(x,n)')\n sage: c.ecl()\n <ECL: (($POCHHAMMER SIMP) $X $N)>\n sage: max_to_sr(c.ecl())\n gamma(n + x)/gamma(x)\n ...
def pyobject_to_max(obj): "\n Convert a (simple) Python object into a Maxima object.\n\n INPUT:\n\n - ``expr`` - Python object\n\n OUTPUT: ECL object\n\n .. note::\n\n This uses functions defined in sage.libs.ecl.\n\n EXAMPLES::\n\n sage: from sage.interfaces.maxima_lib import pyobj...
def sr_to_max(expr): "\n Convert a symbolic expression into a Maxima object.\n\n INPUT:\n\n - ``expr`` - symbolic expression\n\n OUTPUT: ECL object\n\n EXAMPLES::\n\n sage: from sage.interfaces.maxima_lib import sr_to_max\n sage: var('x')\n x\n sage: sr_to_max(x)\n ...
def max_to_sr(expr): "\n Convert a Maxima object into a symbolic expression.\n\n INPUT:\n\n - ``expr`` - ECL object\n\n OUTPUT: symbolic expression\n\n EXAMPLES::\n\n sage: from sage.interfaces.maxima_lib import maxima_lib, max_to_sr\n sage: f = maxima_lib('f(x)')\n sage: f.ecl...
class Mupad(ExtraTabCompletion, Expect): '\n Interface to the MuPAD interpreter.\n ' def __init__(self, maxread=None, script_subdirectory=None, server=None, server_tmpdir=None, logfile=None): '\n Create an instance of the MuPAD interpreter.\n\n EXAMPLES::\n\n sage: mupa...
@instancedoc class MupadFunction(ExtraTabCompletion, ExpectFunction): def _instancedoc_(self): '\n EXAMPLES::\n\n sage: mupad.diff.__doc__\n No help on diff available\n ' M = self._parent return M.help(self._name) def __getattr__(self, attrname): ...
@instancedoc class MupadFunctionElement(ExtraTabCompletion, FunctionElement): def _instancedoc_(self): "\n EXAMPLES::\n\n sage: x = mupad('x') # optional - mupad\n sage: x.diff.__doc__ # optional - mupad\n No help on diff available\n\n " return sel...
@instancedoc class MupadElement(ExtraTabCompletion, ExpectElement): def __getattr__(self, attrname): '\n EXAMPLES::\n\n sage: # optional - mupad\n sage: mupad.package(\'"MuPAD-Combinat"\')\n sage: S = mupad.examples.SymmetricFunctions()\n sage: type(S)\n...
def reduce_load_mupad(): '\n EXAMPLES::\n\n sage: from sage.interfaces.mupad import reduce_load_mupad\n sage: reduce_load_mupad()\n Mupad\n ' return mupad
def mupad_console(): '\n Spawn a new MuPAD command-line session.\n\n EXAMPLES::\n\n sage: from sage.interfaces.mupad import mupad_console\n sage: mupad_console() #not tested\n\n *----* MuPAD Pro 4.0.2 -- The Open Computer Algebra System\n /| /|\n *----* | Cop...
def __doctest_cleanup(): '\n EXAMPLES::\n\n sage: from sage.interfaces.mupad import __doctest_cleanup\n sage: m = mupad(2) # optional - mupad\n sage: mupad.is_running() # optional - mupad\n True\n sage: __doctest_cleanup()\n sage: mupad.is_running() # optio...
def Mwrank(options='', server=None, server_tmpdir=None): '\n Create and return an mwrank interpreter, with given options.\n\n INPUT:\n\n - ``options`` - string; passed when starting mwrank.\n The format is::\n\n -h help prints this info and quits\n -q quiet ...
def validate_mwrank_input(s): '\n Returns a string suitable for mwrank input, or raises an error.\n\n INPUT:\n\n - `s` -- one of the following:\n\n - a list or tuple of 5 integers [a1,a2,a3,a4,a6] or (a1,a2,a3,a4,a6)\n - a string of the form \'[a1,a2,a3,a4,a6]\' or \'a1 a2 a3 a4 a6\' where ...
class Mwrank_class(Expect): '\n Interface to the Mwrank interpreter.\n ' def __init__(self, options='', server=None, server_tmpdir=None): '\n INPUT:\n\n\n - ``options`` - string; passed when starting mwrank.\n The format is::\n\n -h help print...
def _reduce_load_mwrank(): '\n Return the standard mwrank instance\n\n EXAMPLES::\n\n sage: from sage.interfaces.mwrank import _reduce_load_mwrank\n sage: _reduce_load_mwrank()\n Mwrank\n ' return mwrank
def mwrank_console(): '\n Start the mwrank console.\n\n EXAMPLES::\n\n sage: mwrank_console() # not tested: expects console input\n Program mwrank: ...\n ' from sage.repl.rich_output.display_manager import get_display_manager if (not get_display_manager().is_in_terminal()): ...
class Octave(Expect): '\n Interface to the Octave interpreter.\n\n EXAMPLES::\n\n sage: octave.eval("a = [ 1, 1, 2; 3, 5, 8; 13, 21, 33 ]").strip() # optional - octave\n \'a =\\n\\n 1 1 2\\n 3 5 8\\n 13 21 33\'\n sage: octave.eval("b = [ 1; 3; 13]").strip() # ...
def to_complex(octave_string, R): "\n Helper function to convert octave complex number\n\n TESTS::\n\n sage: from sage.interfaces.octave import to_complex\n sage: to_complex('(0,1)', CDF)\n 1.0*I\n sage: to_complex('(1.3231,-0.2)', CDF)\n 1.3231 - 0.2*I\n " (real, i...
@instancedoc class OctaveElement(ExpectElement): def _get_sage_ring(self): "\n TESTS::\n\n sage: octave('1')._get_sage_ring() # optional - octave\n Real Double Field\n sage: octave('I')._get_sage_ring() # optional - octave\n Complex Double Field\n ...
def reduce_load_Octave(): '\n EXAMPLES::\n\n sage: from sage.interfaces.octave import reduce_load_Octave\n sage: reduce_load_Octave()\n Octave\n ' return octave
def octave_console(): '\n Spawn a new Octave command-line session.\n\n This requires that the optional octave program be installed and in\n your PATH, but no optional Sage packages need be installed.\n\n EXAMPLES::\n\n sage: octave_console() # not tested\n GNU Octave, version 2.1...
def get_solution_dicts(output_file_contents, input_ring, get_failures=True): "\n Return a list of dictionaries of variable:value (key:value)\n pairs. Only used internally; see the solution_dict function in\n the PHC_Object class definition for details.\n\n INPUT:\n\n - output_file_contents -- phc ...
def get_classified_solution_dicts(output_file_contents, input_ring, get_failures=True): "\n Return a dictionary of lists of dictionaries of variable:value (key:value)\n pairs. Only used internally; see the classified_solution_dict function in\n the PHC_Object class definition for details.\n\n INPUT:\...
def get_variable_list(output_file_contents): "\n Return the variables, as strings, in the order in which PHCpack has processed them.\n\n EXAMPLES::\n\n sage: from sage.interfaces.phc import *\n sage: R2.<x1,x2> = PolynomialRing(QQ,2)\n sage: test_sys = [(x1-2)^5-x2, (x2-1)^5-1]\n ...
class PHC_Object(): def __init__(self, output_file_contents, input_ring): "\n A container for data from the PHCpack program - lists of float\n solutions, etc. Currently the file contents are kept as a string;\n for really large outputs this would be bad.\n\n INPUT:\n\n ...
class PHC(): '\n A class to interface with PHCpack, for computing numerical\n homotopies and root counts.\n\n EXAMPLES::\n\n sage: from sage.interfaces.phc import phc\n sage: R.<x,y> = PolynomialRing(CDF,2)\n sage: testsys = [x^2 + 1, x*y - 1]\n sage: phc.mixed_volume(testsys)...
class PolymakeError(RuntimeError): '\n Raised if polymake yields an error message.\n\n TESTS::\n\n sage: polymake.eval(\'print foo;\') # optional - jupymake\n Traceback (most recent call last):\n ...\n PolymakeError: Unquoted string "foo" may clash with future reserved word......
def polymake_console(command=''): "\n Spawn a new polymake command-line session.\n\n EXAMPLES::\n\n sage: from sage.interfaces.polymake import polymake_console\n sage: polymake_console() # not tested\n Welcome to polymake version ...\n ...\n Ewgenij Gawrilow, Michae...
class PolymakeAbstract(ExtraTabCompletion, Interface): '\n Abstract interface to the polymake interpreter.\n\n This class should not be instantiated directly,\n but through its subclasses Polymake (Pexpect interface)\n or PolymakeJuPyMake (JuPyMake interface).\n\n EXAMPLES::\n\n sage: from s...
class PolymakeElement(ExtraTabCompletion, InterfaceElement): '\n Elements in the polymake interface.\n\n EXAMPLES:\n\n We support all "big" polymake types, Perl arrays of length\n different from one, and Perl scalars::\n\n sage: p = polymake.rand_sphere(4, 20, seed=5) # optional - ju...
class PolymakeFunctionElement(InterfaceFunctionElement): "\n A callable (function or member function) bound to a polymake element.\n\n EXAMPLES::\n\n sage: # optional - jupymake\n sage: c = polymake.cube(2)\n sage: V = polymake.new_object('Vector', [1,0,0])\n sage: V\n 1 0...
class PolymakeJuPyMake(PolymakeAbstract): '\n Interface to the polymake interpreter using JuPyMake.\n\n In order to use this interface, you need to either install the\n optional polymake package for Sage, or install polymake system-wide\n on your computer; it is available from https://polymake.org.\n ...
def reduce_load_Polymake(): '\n Return the polymake interface object defined in :mod:`sage.interfaces.polymake`.\n\n EXAMPLES::\n\n sage: from sage.interfaces.polymake import reduce_load_Polymake\n sage: reduce_load_Polymake()\n Polymake\n ' return polymake
class POVRay(): '\n POV-Ray The Persistence of Vision Ray Tracer\n\n INPUT:\n\n - ``pov_file`` -- complete path to the .pov file you want to be rendered\n - ``outfile`` -- the filename you want to save your result to\n - ``**kwargs`` -- additionally keyword arguments you want to pass to POVRay\n\n ...
class PSage(Sage): def __init__(self, **kwds): if ('server' in kwds): raise NotImplementedError("PSage doesn't work on remote server yet.") Sage.__init__(self, **kwds) import sage.misc.misc T = sage.misc.temporary_file.tmp_dir('sage_smp') self.__tmp_dir = T ...
class PSageElement(SageElement): def is_locked(self): return self.parent().is_locked()
def _qepcad_atoms(formula): "\n Return the atoms of a qepcad quantifier-free formula, as a set of strings.\n\n INPUT:\n\n - `formula` (string) - a quantifier-free formula.\n\n .. NOTE::\n\n This function is pis-aller used for doctesting, not a complete\n parser, which should be written i...
def _qepcad_cmd(memcells=None): "\n Construct a QEPCAD command line.\n\n Optionally set the number of memory cells to use.\n\n EXAMPLES::\n\n sage: from sage.interfaces.qepcad import _qepcad_cmd\n sage: s = _qepcad_cmd()\n sage: s == 'env qe=%s qepcad '%SAGE_LOCAL\n True\n ...
def _update_command_info(): "\n Read the file ``qepcad.help`` to find the list of commands\n supported by QEPCAD.\n\n Used for tab-completion and documentation.\n\n EXAMPLES::\n\n sage: from sage.interfaces.qepcad import _update_command_info, _command_info_cache\n sage: _update_command_i...
class Qepcad_expect(ExtraTabCompletion, Expect): '\n The low-level wrapper for QEPCAD.\n ' def __init__(self, memcells=None, maxread=None, logfile=None, server=None): '\n Initialize a low-level wrapper for QEPCAD.\n\n You can specify\n the number of memory cells that QEPCAD...
class Qepcad(): '\n The wrapper for QEPCAD.\n ' def __init__(self, formula, vars=None, logfile=None, verbose=False, memcells=None, server=None): "\n Construct a QEPCAD wrapper object.\n\n Requires a formula, which\n may be a :class:`qformula` as returned by the methods of\n...
def _format_cell_index(a): "\n Given a tuple (or list, etc.) containing a QEPCAD cell index, return a\n string with a properly-formatted index.\n\n The input is flattened, so\n extra levels of brackets are ignored. Also, if the first item\n in the flattened list is a :class:`QepcadCell` object, th...
@instancedoc class QepcadFunction(ExpectFunction): '\n A wrapper for a QEPCAD command.\n ' def _instancedoc_(self): "\n Return the documentation for a QEPCAD command, from\n ``qepcad.help``.\n\n EXAMPLES::\n\n sage: qe = qepcad(x == 17, interact=True) # optional ...
def qepcad(formula, assume=None, interact=False, solution=None, vars=None, **kwargs): "\n Quantifier elimination and formula simplification using QEPCAD B.\n\n If ``assume`` is specified, then the given formula is ``'assumed'``,\n which is taken into account during final solution formula construction.\n\...
def qepcad_console(memcells=None): "\n Run QEPCAD directly. To exit early, press :kbd:`Control` + :kbd:`C`.\n\n EXAMPLES::\n\n sage: qepcad_console() # not tested\n ...\n Enter an informal description between '[' and ']':\n " from sage.repl.rich_output.display_manager import ge...
def qepcad_banner(): '\n Return the QEPCAD startup banner.\n\n EXAMPLES::\n\n sage: from sage.interfaces.qepcad import qepcad_banner\n sage: qepcad_banner() # optional - qepcad\n =======================================================\n Quantifier Elimination\n ...
def qepcad_version(): "\n Return a string containing the current QEPCAD version number.\n\n EXAMPLES::\n\n sage: qepcad_version() # random, optional - qepcad\n 'Version B 1.69, 16 Mar 2012'\n\n TESTS::\n\n sage: qepcad_version() # optional - qepcad\n 'Version B ..., ...'\n ...
class qformula(): "\n A qformula holds a string describing a formula in QEPCAD's syntax,\n and a set of variables used.\n " def __init__(self, formula, vars, qvars=[]): "\n Construct a qformula from a string, a frozenset of variable names,\n and (optionally) a list of ordered q...
class qepcad_formula_factory(): '\n Contains routines to help construct formulas in QEPCAD syntax.\n ' def _normalize_op(self, op): "\n Given a relational operator (either a string, or a function from\n the \\module{operator} module) return the corresponding QEPCAD\n operat...
def _eval_qepcad_algebraic(text): "\n Given a string of the form:\n 'the unique root of 8 x^2 - 8 x - 29 between -47/32 and -1503/1024'\n (as produced by QEPCAD) this returns the corresponding \\sage\n algebraic real number.\n\n Requires that the given rational bounds are exactly representable as\n...
class QepcadCell(): '\n A wrapper for a QEPCAD cell.\n ' def __init__(self, parent, lines): "\n Construct a :class:`QepcadCell` wrapper for a QEPCAD cell, given\n a :class:`Qepcad` object and a list of lines holding QEPCAD's\n cell output.\n\n This is typically calle...
@cached_function def sage_spawned_process_file(): '\n EXAMPLES::\n\n sage: from sage.interfaces.quit import sage_spawned_process_file\n sage: len(sage_spawned_process_file()) > 1\n True\n\n ' from sage.env import DOT_SAGE, HOSTNAME d = os.path.join(DOT_SAGE, 'temp', HOSTNAME, st...
def register_spawned_process(pid, cmd=''): '\n Write a line to the ``spawned_processes`` file with the given\n ``pid`` and ``cmd``.\n ' if (cmd != ''): cmd = cmd.strip().split()[0] try: with open(sage_spawned_process_file(), 'a') as o: o.write(('%s %s\n' % (pid, cmd)))...
def expect_quitall(verbose=False): "\n EXAMPLES::\n\n sage: sage.interfaces.quit.expect_quitall()\n sage: gp.eval('a=10') # needs sage.libs.pari\n '10'\n sage: gp('a') ...
def kill_spawned_jobs(verbose=False): "\n INPUT:\n\n - ``verbose`` -- bool (default: ``False``); if ``True``, display a\n message each time a process is sent a kill signal\n\n EXAMPLES::\n\n sage: gp.eval('a=10') # needs sage.libs.pari...
def is_running(pid): '\n Return True if and only if there is a process with id pid running.\n ' try: os.kill(int(pid), 0) return True except (OSError, ValueError): return False
def invalidate_all(): '\n Invalidate all of the expect interfaces.\n\n This is used, e.g., by the fork-based @parallel decorator.\n\n EXAMPLES::\n\n sage: # needs sage.libs.pari sage.symbolic\n sage: a = maxima(2); b = gp(3)\n sage: a, b\n (2, 3)\n sage: sage.interfaces...
def _setup_r_to_sage_converter(): '\n Set up a the converter used to convert from rpy2\'s\n representation of R objects to the one sage expects.\n\n EXAMPLES:\n\n Simple numeric values are represented as vectors in R. So `1`\n would actually be an array of length 1. We convert all vectors of\n l...