Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

Github repo cloud-examples: https://github.com/sagemath/cloud-examples

Views: 7947
License: MIT

Sympy Code Generating Test

%auto from sympy.utilities.codegen import codegen from sympy.utilities.autowrap import autowrap, binary_function from sympy import symbols, oo, pprint, IndexedBase, Idx, Eq
x, y, z = symbols('x y z') expr = ((1-x+y-z**2)**7).expand() #binary_callable = autowrap(expr) #binary_callable(2,3,1) f = binary_function('f', expr) f(x,y).evalf(2, subs = {x:1.1, y : -2.2})
Error in lines 5-5 Traceback (most recent call last): File "/mnt/home/2Qrdjpk5/.sagemathcloud/sage_server.py", line 494, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> File "/usr/local/sage/sage-5.10.rc1/local/lib/python2.7/site-packages/sympy/utilities/autowrap.py", line 406, in binary_function binary = autowrap(expr, **kwargs) File "/usr/local/sage/sage-5.10.rc1/local/lib/python2.7/site-packages/sympy/utilities/autowrap.py", line 386, in autowrap return code_wrapper.wrap_code(routine, helpers=helps) File "/usr/local/sage/sage-5.10.rc1/local/lib/python2.7/site-packages/sympy/utilities/autowrap.py", line 129, in wrap_code self._process_files(routine) File "/usr/local/sage/sage-5.10.rc1/local/lib/python2.7/site-packages/sympy/utilities/autowrap.py", line 153, in _process_files "Error while executing command: %s" % " ".join(command)) CodeWrapError: Error while executing command: f2py -m wrapper_module_4 -c wrapped_code_4.f90
A, x, y = map(IndexedBase, ['A', 'x', 'y']) m, n = symbols('m n', integer=True) i = Idx('i', m) j = Idx('j', n) expr = Eq(y[i], A[i, j]*x[j]) pprint(expr, use_unicode=True)
y[i] = A[i, j]⋅x[j]
matvec = autowrap(expr) matvec
Error in lines 1-1 Traceback (most recent call last): File "/mnt/home/2Qrdjpk5/.sagemathcloud/sage_server.py", line 494, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> File "/usr/local/sage/sage-5.10.rc1/local/lib/python2.7/site-packages/sympy/utilities/autowrap.py", line 386, in autowrap return code_wrapper.wrap_code(routine, helpers=helps) File "/usr/local/sage/sage-5.10.rc1/local/lib/python2.7/site-packages/sympy/utilities/autowrap.py", line 129, in wrap_code self._process_files(routine) File "/usr/local/sage/sage-5.10.rc1/local/lib/python2.7/site-packages/sympy/utilities/autowrap.py", line 153, in _process_files "Error while executing command: %s" % " ".join(command)) CodeWrapError: Error while executing command: f2py -m wrapper_module_1 -c wrapped_code_1.f90