On 11/08/11 10:05, kcrisman wrote: > > > Ah, that is luckily easy to fix! Just name your file > > piecewise_test.sage > > and all will be forgiven.
I've tried this before, and gave up out of frustration. Most of my code is stored in different modules and imported into little executable scripts that either prove or graph something. This isn't a very good problem report, but "everything gets screwed up" when you begin importing from other modules that may or may not be preparsed. Anyway, in this case, I'd like to define 'f' in one module (piecewise_data) and import it into the main script (piecewise_test). $ cat piecewise_data.sage from sage.all import * x = SR.symbol('x', domain='real') interval0 = (0, 0.5) function0(x) = 4.0*(x - 0.5)**2 f = piecewise([[interval0, function0]]) $ cat piecewise_test.sage #!/home/mjo/bin/sage from sage.all import * from piecewise_data import * print "f(1/2):" print f(1/2) print "" $ sage piecewise_test.sage Traceback (most recent call last): File "piecewise_test.py", line 6, in <module> from piecewise_data import * ImportError: No module named piecewise_data $ mv piecewise_data.sage piecewise_data.py $ sage piecewise_test.sage Traceback (most recent call last): File "piecewise_test.py", line 6, in <module> from piecewise_data import * File "/home/mjo/piecewise_data.py", line 6 function0(x) = 4.0*(x - 0.5)**2 SyntaxError: can't assign to function call -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org