I have a very strange situation with matplotlib plotting in sage-4.0.rc0. The worksheet below illustrates the problem.
If the worksheet is restarted, and "Evaluate All" is selected, the last cell produces an error (see traceback at the end). But, if that input cell is evaluated again, the error clears, and the plot is produced. Everything will be fine until the worksheet is restarted, when a new evaluation will once again produce the error. Baffled. ==================== Plot Strangeness 3 system:sage {{{id=0| import matplotlib.pyplot as pyplot import numpy as NP /// }}} {{{id=89| Vs=NP.array([165.8, 166.3, 161.2, 162.6, 158.9], dtype=float) Ps=NP.array([141.4, 144.3, 134.7, 136.4, 127.6], dtype=float) X=Vs^4 Y=Vs * Ps /// }}} {{{id=33| var('a, b') data=zip(X, Y) model(x) = a + b * x linear_fit = find_fit(data, model, solution_dict = True) /// }}} {{{id=19| A=linear_fit[a] B=linear_fit[b] fit(x)= A + B * x Xfit=[0,800000000] Yfit=[float(fit(0)), float(fit(800000000))] P2=pyplot.plot(Xfit, Yfit, 'b') pyplot.savefig('test.png') /// Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/kwh/.sage/sage_notebook/worksheets/KevinHorton/27/code/ 47.py", line 13, in <module> Yfit=[float(fit(_sage_const_0 )), float(fit(_sage_const_800000000 ))] File "expression.pyx", line 2785, in sage.symbolic.expression.Expression.__call__ (sage/symbolic/ expression.cpp:14209) File "/opt/sage-4.0.rc0/local/lib/python2.5/site-packages/sage/ symbolic/callable.py", line 448, in _call_element_ return SR(_the_element.substitute(**d)) File "parent.pyx", line 284, in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:4084) File "parent.pyx", line 1087, in sage.structure.parent.Parent.convert_map_from (sage/structure/parent.c: 9912) File "parent.pyx", line 1094, in sage.structure.parent.Parent.discover_convert_map_from (sage/structure/ parent.c:10062) File "parent.pyx", line 958, in sage.structure.parent.Parent.coerce_map_from (sage/structure/parent.c: 8791) File "parent.pyx", line 1007, in sage.structure.parent.Parent.discover_coerce_map_from (sage/structure/ parent.c:9139) File "ring.pyx", line 138, in sage.symbolic.ring.SymbolicRing._coerce_map_from_ (sage/symbolic/ ring.cpp:3254) File "parent.pyx", line 883, in sage.structure.parent.Parent.has_coerce_map_from (sage/structure/ parent.c:8344) File "parent.pyx", line 905, in sage.structure.parent.Parent.has_coerce_map_from (sage/structure/ parent.c:8307) File "parent.pyx", line 958, in sage.structure.parent.Parent.coerce_map_from (sage/structure/parent.c: 8791) File "parent.pyx", line 1007, in sage.structure.parent.Parent.discover_coerce_map_from (sage/structure/ parent.c:9139) File "parent_old.pyx", line 579, in sage.structure.parent_old.Parent._coerce_map_from_ (sage/structure/ parent_old.c:7269) File "/opt/sage-4.0.rc0/local/lib/python2.5/site-packages/sage/ rings/complex_field.py", line 310, in _coerce_map_from_ if RR.has_coerce_map_from(S): File "parent.pyx", line 883, in sage.structure.parent.Parent.has_coerce_map_from (sage/structure/ parent.c:8344) File "parent.pyx", line 905, in sage.structure.parent.Parent.has_coerce_map_from (sage/structure/ parent.c:8307) File "parent.pyx", line 958, in sage.structure.parent.Parent.coerce_map_from (sage/structure/parent.c: 8791) File "parent.pyx", line 1007, in sage.structure.parent.Parent.discover_coerce_map_from (sage/structure/ parent.c:9139) File "real_mpfr.pyx", line 458, in sage.rings.real_mpfr.RealField._coerce_map_from_ (sage/rings/ real_mpfr.c:5688) File "parent.pyx", line 879, in sage.structure.parent.Parent._coerce_map_via (sage/structure/parent.c: 8117) File "parent.pyx", line 958, in sage.structure.parent.Parent.coerce_map_from (sage/structure/parent.c: 8791) File "parent.pyx", line 1007, in sage.structure.parent.Parent.discover_coerce_map_from (sage/structure/ parent.c:9139) File "real_lazy.pyx", line 111, in sage.rings.real_lazy.LazyField._coerce_map_from_ (sage/rings/ real_lazy.c:2992) File "parent.pyx", line 883, in sage.structure.parent.Parent.has_coerce_map_from (sage/structure/ parent.c:8344) File "parent.pyx", line 905, in sage.structure.parent.Parent.has_coerce_map_from (sage/structure/ parent.c:8307) File "parent.pyx", line 958, in sage.structure.parent.Parent.coerce_map_from (sage/structure/parent.c: 8791) File "parent.pyx", line 1007, in sage.structure.parent.Parent.discover_coerce_map_from (sage/structure/ parent.c:9139) File "parent_old.pyx", line 581, in sage.structure.parent_old.Parent._coerce_map_from_ (sage/structure/ parent_old.c:7298) File "parent_old.pyx", line 130, in sage.structure.parent_old.Parent.coerce_map_from_c (sage/structure/ parent_old.c:1732) File "parent_old.pyx", line 179, in sage.structure.parent_old.Parent.coerce_map_from_c_impl (sage/ structure/parent_old.c:2443) File "parent_old.pyx", line 431, in sage.structure.parent_old.Parent.has_coerce_map_from_c (sage/structure/ parent_old.c:5825) File "parent_old.pyx", line 444, in sage.structure.parent_old.Parent.has_coerce_map_from_c_impl (sage/ structure/parent_old.c:6038) File "parent.pyx", line 1346, in sage.structure.parent.Parent.an_element (sage/structure/parent.c:12879) File "parent_old.pyx", line 591, in sage.structure.parent_old.Parent._an_element_ (sage/structure/ parent_old.c:7583) File "ring.pyx", line 370, in sage.symbolic.ring.SymbolicRing._an_element_ (sage/symbolic/ring.cpp: 4820) File "parent.pyx", line 284, in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:4084) File "parent.pyx", line 1087, in sage.structure.parent.Parent.convert_map_from (sage/structure/parent.c: 9912) File "parent.pyx", line 1094, in sage.structure.parent.Parent.discover_convert_map_from (sage/structure/ parent.c:10062) File "parent.pyx", line 958, in sage.structure.parent.Parent.coerce_map_from (sage/structure/parent.c: 8791) File "parent.pyx", line 1007, in sage.structure.parent.Parent.discover_coerce_map_from (sage/structure/ parent.c:9139) File "ring.pyx", line 88, in sage.symbolic.ring.SymbolicRing._coerce_map_from_ (sage/symbolic/ ring.cpp:2727) File "/opt/sage-4.0.rc0/local/lib/python2.5/site-packages/sage/ symbolic/callable.py", line 307, in _coerce_map_from_ return SymbolicRing._coerce_map_from_(self, R) File "ring.pyx", line 88, in sage.symbolic.ring.SymbolicRing._coerce_map_from_ (sage/symbolic/ ring.cpp:3582) File "ring.pyx", line 118, in sage.symbolic.ring.SymbolicRing._coerce_map_from_ (sage/symbolic/ ring.cpp:2863) AttributeError: 'module' object has no attribute 'float128' }}} -- Kevin Horton Ottawa, Canada --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---