This is related to a subtle, undocumented difference between these two definitions of a symbolic expression:
var('v') r(v)=v print r /// v |--> v r=v print r /// v so both are printed different, but they return the same value when called with a question mark: r? /// *File:* /opt/sage-4.1.1/local/lib/python2.6/site-packages/sage/symbolic/expression.so *Type:* <type 'sage.symbolic.expression.Expression'> *Definition:* r(*args, **kwds) *Docstring:* x.__init__(...) initializes x; see x.__class__.__doc__ for signature Introducing F by hand pose no problem if the functions are introduced using the second syntax, but gives the same problem if the first one is used (only for F0(x)=x, not for F0(x)=2*x). var('x') F0(x)=x print F0 F_bis=Piecewise([[(0, 1), F0], [(1,2), -1/2*x^2 + 4*x - 5/2], [(2, 3), -1/10*e^2 +1/10*e^x + 7/2], [(3, 10), -1/10*e^2 + 1/10*e^3 - 1/2*cos(2*x)+ 1/2*cos(6) + 7/2]]) print F_bis /// x |--> x Piecewise defined function with 4 parts, [[(0, 1), x |--> x], [(1, 2), -1/2*x^2 + 4*x - 5/2], [(2, 3), -1/10*e^2 + 1/10*e^x + 7/2], [(3, 10), -1/10*e^2 + 1/10*e^3 - 1/2*cos(2*x) + 1/2*cos(6) + 7/2]] plot(F_bis) /// Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_86.py", line 4, in <module> exec compile(ur'plot(F_bis)' + '\n', '', 'single') File "", line 1, in <module> File "/opt/sage-4.1.1/local/lib/python2.6/site-packages/sage/plot/misc.py", line 243, in wrapper return func(*args, **kwds) File "/opt/sage-4.1.1/local/lib/python2.6/site-packages/sage/plot/misc.py", line 138, in wrapper return func(*args, **options) File "/opt/sage-4.1.1/local/lib/python2.6/site-packages/sage/plot/plot.py", line 2444, in plot G = funcs.plot(*args, **original_opts) File "/opt/sage-4.1.1/local/lib/python2.6/site-packages/sage/functions/piecewise.py", line 961, in plot return sum([plot(f, a, b, *args, **kwds) for (a,b),f in self.list()]) File "/opt/sage-4.1.1/local/lib/python2.6/site-packages/sage/plot/misc.py", line 243, in wrapper return func(*args, **kwds) File "/opt/sage-4.1.1/local/lib/python2.6/site-packages/sage/plot/misc.py", line 138, in wrapper return func(*args, **options) File "/opt/sage-4.1.1/local/lib/python2.6/site-packages/sage/plot/plot.py", line 2444, in plot G = funcs.plot(*args, **original_opts) File "expression.pyx", line 6059, in sage.symbolic.expression.Expression.plot (sage/symbolic/expression.cpp:24894) File "expression.pyx", line 5951, in sage.symbolic.expression.Expression._fast_float_ (sage/symbolic/expression.cpp:24305) File "/opt/sage-4.1.1/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 1181, in fast_float return FastFloatConverter(ex, *vars)() File "/opt/sage-4.1.1/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 208, in __call__ return self.symbol(ex) File "/opt/sage-4.1.1/local/lib/python2.6/site-packages/sage/symbolic/expression_conversions.py", line 1099, in symbol raise ValueError, "free variable: %s" % repr(ex) ValueError: free variable: x |--> x -- 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