Opened 10 years ago
Closed 8 years ago
#7377 closed enhancement (fixed)
Symbolic Ring to Maxima via EclObject
Reported by: | nbruin | Owned by: | nbruin |
---|---|---|---|
Priority: | major | Milestone: | sage-4.7.1 |
Component: | symbolics | Keywords: | |
Cc: | burcin, saliola, jpflori | Merged in: | sage-4.7.1.alpha0 |
Authors: | Robert Bradshaw, Nils Bruin, Jean-Pierre Flori, Karl-Dieter Crisman | Reviewers: | Jean-Pierre Flori, François Bissey, Karl-Dieter Crisman, Nils Bruin |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
With maxima-as-an-ecl-library and ecl accessible as a library, we can start interfacing with maxima via a binary library interface. This should be more efficient and more robust, because expressions can be transmitted in a much richer format than text and parsing does not have to recognise error messages and questions (since communication does not go via STDIN/STDOUT anymore).
Applies cleanly to 4.7.alpha3.
Depends on: #10766, #10773, #10743. #10818 desirable but not essential.
Apply:
- trac_7377-abstract-maxima_p2.patch
- trac_7377-maximalib_p2.patch
- trac_7377-fastcalculus_p2.patch
- trac_7377-better-ask-error_p2.patch
- trac_7377-split_and_refactor-p3.patch
- trac_7377-lazy-maxlib.p2.patch
- trac_7377-floatcast.patch
- trac_7377-unicode_to_ecl-p1.patch
- trac_7377-assumptions-p3.patch
- trac_7377-doctests-p3.patch
Attachments (32)
Change History (201)
Changed 10 years ago by
comment:1 Changed 10 years ago by
- Owner changed from burcin to nbruin
comment:2 in reply to: ↑ description Changed 10 years ago by
I think the following email might be of interest to other people wanting to hack maxima:
Since there is already a decent string parser for taking Sage stuff to Maxima and (especially) getting back Sage stuff from Maxima, would there be a way to modify the above - or ecl_eval - to give back the Maxima expression directly? Perhaps this is already in the lib/ecl.pyx file, though I didn't see it on the first reading.
lib/ecl.pyx has nothing to do with maxima-specific stuff. That is all in sagemax.py. It is actually a little bit important to keep that distinction. Maxima is not the only lisp program we might want to interface with.
There is max_read(S) = cadadr(EclObject("#$%s"%S))
, which *reads* the string
S as a maxima expression and returns its parsed result.
So meval(max_read(S))
would do the trick. I do not know what routines maxima
has to convert expressions to a string. If I wanted to know, I would find it
out by looking at something like
max_read("maxima-command-to-print-to-string(x)")
and see what token the maxima reader puts in. I imagine you get something like
<ECL: ((MAX-PRINT-STRING) x)>
back, So do:
maxprint:=EclObject("MAX-PRINT-STRING") #do this once globally meval(EclObject([[maxprint], maxexpression])).python()
Indeed:
sage: max_read("string(x)") <ECL: (($STRING) $X)> sage: meval(max_read("string(x)")) <ECL: "x"> sage: meval(max_read("string(x)")).python() '"x"' sage: meval(max_read("string(x)")).python()[1:-1] 'x'
So
sage: maxprint=EclObject("$STRING") sage: def max_to_string(s): ....: return meval(EclObject([[maxprint],s])).python()[1:-1]
would give you a string representation. Be aware that #$...$ suffers from performance loss, so if you repeatedly use it, your timings will go south quickly. See Dodier's comments on this a while ago. Apparently you could patch Maxima to lose the performance-losing routine (at the expense of losing the wonderful linear-search history the maxima parser offers now).
Sage command -> calls Maxima command -> Maxima command evaluated, but in the ECL library version, not the pexpect version -> Maxima output (a string) converted back using the stuff in Sage
Yes, that would be an approach virtually orthogonal to the one taken in sagemax.py.
> sage: str(ecl_eval("#$load(to_poly_solver)$")) > append: argument must be a non-atomic expression; found false > -- an error. To debug this try debugmode(true);
To illustrate the inner workings:
sage: from sagemax import * sage: e=max_read('load("to_poly_solver")') sage: e <ECL: (($LOAD) "to_poly_solver")> sage: meval(e) append: argument must be a non-atomic expression; found false -- an error. To debug this try debugmode(true); sage: meval(max_read("append(a,b)")) append: argument must be a non-atomic expression; found a -- an error. To debug this try debugmode(true);
So my guess is that "load" is trying to append to an improperly initialized maxima list. I guess that means that in the current setting, our maxima environment hasn't properly been set up yet. That is no surprise. It is actually surprising that so much of maxima works without any initialization at all.
Changed 10 years ago by
comment:3 Changed 10 years ago by
- Report Upstream set to N/A
Finally success! Recipe for getting calculus use maxima in ecl library mode do the following
- apply the patch from #6781
- apply Robert's 7377-abstract-maxima.patch
- apply maxlib.patch
The calculus doctests currently fail because maxima asking questions does not get handled yet.
comment:4 Changed 10 years ago by
Updated maxlib.patch. Changes made:
- Code catches (throw 'macsyma-quit) and tries to recognise errors (often successful)
- suppress questions and throw errors instead
- suppress ";;; load ..." lines and load warnings
- set environment appropriately for calculus instance
There is a nasty problem that "forget(facts())" gets executed by sage, but throws errors. These get caught by the classic interface, but mess up the printing.
Doctesting calculus/calculus.py leads to 10 failures. All have to do with either forget() acting up or the fact that "maxima asks a question" gets reported differently by the two interfaces.
(the uploaded code has some diagnostic output in maxima_eval
to try to debug the "forget" issues. The "ask" errors should just consist of updating the doctest.
Go at it!
comment:5 Changed 10 years ago by
Another update:
- change to symbolic/assumptions.py to not try: ... error: pass (gentler removal of assumptions makes the interface behave a bit better)
- monkey patch maxima to throw error on divergent integral instead of *printing* "Principal Value" and giving an answer.
(maxima does behave as documented, so it is a matter of taste to change maxima's behaviour)
- slightly more pretty/informative error messages
Doctests failures on calculus.py are only 5 and are restricted to whitespace and differently formatted error messages (in other words, for real use, the two interfaces shouldn't be distinguishable anymore).
comment:6 Changed 10 years ago by
- Cc burcin added
comment:7 Changed 10 years ago by
Very sadly I do not have time right now to look at this properly, but if it behaves as advertised, the layout is very understandable and I think might even improve the previous interface in terms of future customization.
Do you think you can post some sample timings, just for information? After all, one (not the only) reason for this would be to significantly speed up repeated use of Maxima for certain applications.
Thanks to nbruin and robertwb for working so hard on this!
comment:8 Changed 10 years ago by
The latest patch must be applied after abstract-maxima
and maxlib
. It adds routines sr_to_max
and max_to_sr
that try to translate between maxima's internal datastructure and SR while avoiding string transformations as much as possible. It falls back to the old interface to establish many of its symbol and operator translations, but takes note of them and uses a dictionary directly the next time around. It also avoids the overhead of binding expressions to maxima variables.
to go back and forth, maxima_lib.MaximaElement()
as a new function {ecl()} which passes back the underlying EclObject?. Conversely, maxima_lib.maxima
accepts EclObjects? and returns a corresponding expect interface object.
This patch also rewrite calculus integral, limit and sum to directly pass back and forth to maxima. There is a lot of overhead in SR itself, so speed gains are not that big. New times are:
sage: timeit("integral(cos(x),x)") 625 loops, best of 3: 1.1 ms per loop sage: timeit("integral(cos(x^2),x)") 5 loops, best of 3: 31.2 ms per loop
where old were
sage: timeit("integral(cos(x),x)") 25 loops, best of 3: 8.08 ms per loop sage: timeit("integral(cos(x^2),x)") 5 loops, best of 3: 37 ms per loop
It is easy to swap the old and new interfaces: simply comment/uncomment the appropriate lines in calculus.py
to define the appropriate calculus.maxima
There are 7 doctest failures in calculus.py
. All of them are whitespace, errors and changed precision in floats:
the binary interface passes double
s directly, so there are no digits rounded. This affects some doctests. In other words, as far is calculus.py
is concerned the two interfaces are functionally equivalent.
comment:9 Changed 9 years ago by
- Cc saliola added
comment:10 Changed 9 years ago by
- Cc jpflori added
comment:11 follow-up: ↓ 12 Changed 9 years ago by
Does this need any rebasing? I am willing to give it a spin in sage-on-gentoo to see if there are any obvious problems on linux.
comment:12 in reply to: ↑ 11 Changed 9 years ago by
- Status changed from new to needs_work
Replying to fbissey:
Does this need any rebasing?
Unfortunately, it does. Since Robert split off the Maxima pexpect interface, there were a few minor changes to sage/interfaces/maxima.py
. His patch needs to be rebased.
AFAIR, the only reason that held this ticket back was a mix-up in the updates to the ecl/maxima packages. The version that properly built maxima as a library got lost since there were several new packages at the same time. I don't know if that problem is fixed in the latest release.
comment:13 Changed 9 years ago by
Note that there's a ticket to update both Maxima and ECL open just now. See #10187
At this point in time, it does not have positive review, but I think it is pretty close to getting it. The packages work together, but there's a doctest failure which needs to be resolved. As far as I can see, its just that Maxima is outputing results in a different form (yet again).
I would suggest you use the packages at #10187 and make this dependent on that, which I think will be merged in the next alpha.
comment:14 Changed 9 years ago by
I tried to update the patches so that they apply on Sage 4.6.1 with Maxima 5.22.1, some things moved since the last patches were produced, but there was nothing too terrible. I'll up them right now.
However, there is now a problem when loading Maxima as a library. Maybe some changes in the spkg (in init-cl.lisp where set-pathnames is defined ?) are responsible for this. Without that line, there is a problem later.
/home/jp/boulot/sage/sage-current/local/lib/python2.6/site-packages/sage/interfaces/maxima_lib.py in <module>() 487 ecl_eval("(defvar *MAXIMA-LANG-SUBDIR* NIL)") 488 ecl_eval("(set-locale-subdir)") --> 489 ecl_eval("(set-pathnames)") 490 ecl_eval("(defun add-lineinfo (x) x)") 491 ecl_eval("""(defun retrieve (msg flag &aux (print? nil))(error (concatenate 'string "Maxima asks:" (meval (list '($string) msg)))))""") /home/jp/boulot/sage/sage-current/local/lib/python2.6/site-packages/sage/libs/ecl.so in sage.libs.ecl.ecl_eval (sage/libs/ecl.c:5616)() /home/jp/boulot/sage/sage-current/local/lib/python2.6/site-packages/sage/libs/ecl.so in sage.libs.ecl.ecl_eval (sage/libs/ecl.c:5570)() /home/jp/boulot/sage/sage-current/local/lib/python2.6/site-packages/sage/libs/ecl.so in sage.libs.ecl.ecl_safe_eval (sage/libs/ecl.c:2403)() RuntimeError: ECL says: In function PATHNAME, the value of the only argument is NIL which is not of the expected type (OR FILE-STREAM STRING PATHNAME) Error importing ipy_profile_sage - perhaps you should run %upgrade? WARNING: Loading of ipy_profile_sage failed.
I don't know anything about Lisp, ECL and Maxima, so I was not able to fix that in the little time I tried.
As far as the patches as concerned, I feel that more work is needed. Deleting duplicate examples and methods, moving the library interface to libs directory, not sure where maxima abstract should go (if it is kept, should something be done like MaximaLib/Maxima? as for Pari/GP ? no idea if those two "interfaces" share something...), getting rid of the inheritance on Expect in Maxima_lib and Maxima_abstract.
I'm ready to have a look at all of this, if someone helps me launching Maxima as library with latest versions of everything.
comment:15 Changed 9 years ago by
What happens if you just remove that line? I just noticed a typo - marking makes you terrible at that kind of things :) "We begin here by initializing maxima in library more"
^{ }
comment:16 Changed 9 years ago by
It fails later, here is the piece of code involved:
/home/jp/boulot/sage/sage-current/local/lib/python2.6/site-packages/sage/interfaces/maxima_lib.py in __init__(self, script_subdirectory, logfile, server, init_code) 586 ecl_eval("(setf *standard-output* *dev-null*)") 587 for l in init_code: --> 588 ecl_eval("#$%s$"%l) 589 ecl_eval("(setf *standard-output* original-standard-output)") 590 /home/jp/boulot/sage/sage-current/local/lib/python2.6/site-packages/sage/libs/ecl.so in sage.libs.ecl.ecl_eval (sage/libs/ecl.c:5616)() /home/jp/boulot/sage/sage-current/local/lib/python2.6/site-packages/sage/libs/ecl.so in sage.libs.ecl.ecl_eval (sage/libs/ecl.c:5570)() /home/jp/boulot/sage/sage-current/local/lib/python2.6/site-packages/sage/libs/ecl.so in sage.libs.ecl.ecl_safe_eval (sage/libs/ecl.c:2403)() RuntimeError: ECL says: THROW: The catch MACSYMA-QUIT is undefined. Error importing ipy_profile_sage - perhaps you should run %upgrade? WARNING: Loading of ipy_profile_sage failed.
Tried to google that, but couldn't find anything meaningful to me.
comment:17 Changed 9 years ago by
me neither :(
comment:18 Changed 9 years ago by
I don't know what happened but I rebuilt ecl and maxima while trying to add debug information and everything is fine now. I surely did something wrong at some point...
There are some problems left with what I uploaded earlier in sage.symbolic.integration.external I'll upload fixed version of the patches soon.
comment:19 Changed 9 years ago by
Ok I will give it a spin in sage-on-gentoo.
comment:20 follow-up: ↓ 21 Changed 9 years ago by
I tried the patch against 4.6.2.alpha2 and it builds but it doesn't run properly here:
/usr/lib64/python2.6/site-packages/sage/calculus/calculus.py in <module>() 375 definite_integral 376 import sage.symbolic.pynac --> 377 import sage.interfaces.maxima_lib 378 379 """ /usr/lib64/python2.6/site-packages/sage/interfaces/maxima_lib.py in <module>() 482 from sage.libs.ecl import * 483 ecl_eval("(setf *load-verbose* NIL)") --> 484 ecl_eval("(require 'maxima)") 485 ecl_eval("(in-package :maxima)") 486 ecl_eval("(setq $nolabels t))") /usr/lib64/python2.6/site-packages/sage/libs/ecl.so in sage.libs.ecl.ecl_eval (sage/libs/ecl.c:5617)() 992 993 --> 994 995 996 /usr/lib64/python2.6/site-packages/sage/libs/ecl.so in sage.libs.ecl.ecl_eval (sage/libs/ecl.c:5571)() 1007 1008 -> 1009 1010 1011 /usr/lib64/python2.6/site-packages/sage/libs/ecl.so in sage.libs.ecl.ecl_safe_eval (sage/libs/ecl.c:2404)() 184 185 --> 186 187 188 RuntimeError: ECL says: Module error: Don't know how to REQUIRE MAXIMA. Error importing ipy_profile_sage - perhaps you should run %upgrade? WARNING: Loading of ipy_profile_sage failed.
I am currently also running ecl-11.1.1 which is a source of trouble but I don't think it is responsible here.
comment:21 in reply to: ↑ 20 Changed 9 years ago by
RuntimeError?: ECL says: Module error: Don't know how to REQUIRE MAXIMA. Error importing ipy_profile_sage - perhaps you should run %upgrade? WARNING: Loading of ipy_profile_sage failed.
My first guess is that maxima.fas is not available to your newly built ecl-11.1.1.
Note that in 4.6.1, building maxima produces this library:
$SAGE_ROOT/local/lib/ecl-10.4.1/maxima.fas
so once you upgrade ecl, you need to rebuild maxima as well. Did you do that?
comment:22 Changed 9 years ago by
I downgraded to ecl-10.4.1 and rebuilt maxima and sage but I don't seem to have maxima.fas, I have a number of other fas but not maxima.fas. It was done on sage-on-gentoo, so it is possible that this particular file wasn't installed for a reason or another. I will check what the maxima spkg do.
comment:23 Changed 9 years ago by
OK pity it is not build in maxima by default, works for me now. Not sure how i will sell that one to the maintainer of maxima in Gentoo. Even if I have a good relationship with him.
comment:24 follow-up: ↓ 25 Changed 9 years ago by
I just upgraded to 4.6.2.aplha2 (hoping I won't have to rebuild from scratch for next upgrade...) and everything went fine, it gives me better timings than with the Pexpect interface. Before patches:
Loading Sage library. Current Mercurial branch is: jp sage: timeit("integral(cos(x^2),x)") 5 loops, best of 3: 96.6 ms per loop sage: Exiting Sage (CPU time 0m1.02s, Wall time 0m8.17s). Exiting spawned Maxima process.
After:
Loading Sage library. Current Mercurial branch is: jp sage: timeit("integral(cos(x^2),x)") 5 loops, best of 3: 62.8 ms per loop sage: Exiting Sage (CPU time 0m1.56s, Wall time 3m5.27s).
However those are much more than what was posted above.
Glad to hear it also ran on Sage on Gentoo.
I think some refactoring still has to be done for the new classes. The abstract class is a good idea to transparently switch interface but I think it would be cleaner if it did not inherit from Expect class (and so "Maxima as a lib" does not too). I'll try to work on this this weekend.
It should be also be decided, which interface is used for what, especially since we can only have one "Maxima as a lib" running. Should that Maxima as lib be used for calculus and be given a direct access (maybe as "maximalib" variable as "maxima" gives access to a copy of Maxima in Sage, even if currently the "maxima" variable points to a different instance of Maxima than the one used by calculus).
comment:25 in reply to: ↑ 24 Changed 9 years ago by
Replying to jpflori:
Hi Jean-Pierre,
It's great you're taking on this project! It has the potential of being a lot of fun. I won't be working on it, so I'm very happy to see someone else interested in taking it on. I'll give you some background on the points you raise, so that you can take more informed design decisions.
I think some refactoring still has to be done for the new classes. The abstract class is a good idea to transparently switch interface but I think it would be cleaner if it did not inherit from Expect class (and so "Maxima as a lib" does not too). I'll try to work on this this weekend.
The *only* reason to organize the maxima interfaces as they are now is because Robert remarked that whatever was needed to communicate with maxlib at a string-level was going to have a lot of overlap with the present maxima interface. Hence, he abstracted out the common stuff and I modified the concrete maxlib interface to talk to ecllib instead of a separate process. This was experimental and at the time I had no idea how much was necessary, so I changed as little as possible: The original interface inherited from expect, so the new one did too, just overriding whatever methods needed overriding. So yes, there will be a lot of lint and extraneous stuff in there. What you're looking at is a first hack.
It should be also be decided, which interface is used for what, especially since we can only have one "Maxima as a lib" running. Should that Maxima as lib be used for calculus and be given a direct access (maybe as "maximalib" variable as "maxima" gives access to a copy of Maxima in Sage, even if currently the "maxima" variable points to a different instance of Maxima than the one used by calculus).
The largest benefit is to be gained when the communication can avoid string parsing altogether. (ecllib at the moment converts Integers to ecl bignums via strings, which is silly: They are both implemented as gmp/mpir integers! The only reason is that I never succeeded in importing the gmp/mpir headers in a usable way in ecl.pyx, to copy over the integer. ECL largely avoids gmp's registered memory manager, so some care must be taken to transfer the integer to properly allocated memory.) The routines sr_to_max and max_to_sr (in the fastcalculus patch) implement this strategy. If you want to have this benefit, the maxlib instance *has* to be the "calculus" instance. Note that the default "maxima" instance is already distinct from the "calculus" instance:
sage: integrate(cos(x),x); sage: maxima(x); sage: Exiting Sage (CPU time 0m0.12s, Wall time 0m16.73s). Exiting spawned Maxima process. Exiting spawned Maxima process.
(note the two maxima spawns)
Once the design has stabilized, it would be possible to make max_to_sr and sr_to_max more intelligent. For instance, SR variables would not need to be translated to maxima identifiers with the same name. This currently leads to problems, because this conversion collapses namespaces:
sage: cosvar=SR.var("cos") sage: cos(cosvar) cos(cos) sage: integrate(cos(cosvar),cosvar) integrate(cos(cos), cos) sage: cosvar=SR.var("sage_cos") sage: integrate(cos(cosvar),cosvar) sin(sage_cos)
as you see, the print name of the SR.var matters!
Let me know if you have further questions. I might be able to help with information.
comment:26 Changed 9 years ago by
Thanks so much, Nils and JP, for resurrecting this. JP, I stand ready to test anything you feel is ready to look at. If you know little about ECL, I know even less, so I can't do more than that, but this would be a great start to improving some of Sage's interface. It's true that the timing on average doesn't improve so greatly (yet), but the point is that not having to start Maxima up when you want to do an integral means more immediate gratification for the user. (Assuming immediate gratification is a good thing.)
comment:27 follow-up: ↓ 28 Changed 9 years ago by
Ok so it runs but in its present state it breaks quite a lot of doctests for me. Unless you can point out something else I would need to do. example 1
sage -t -force_lib "devel/sage/sage/symbolic/function_factory.py" ********************************************************************** File "/usr/share/sage/devel/sage/sage/symbolic/function_factory.py", line 174: sage: g Expected: b*D[0](cr)(a) Got: b*del(a) ********************************************************************** File "/usr/share/sage/devel/sage/sage/symbolic/function_factory.py", line 184: sage: g.substitute_function(cr, cos) Expected: -b*sin(a) Got: b*del(a) ********************************************************************** File "/usr/share/sage/devel/sage/sage/symbolic/function_factory.py", line 187: sage: g.substitute_function(cr, (sin(x) + cos(x)).function(x)) Expected: -(sin(a) - cos(a))*b Got: b*del(a) ********************************************************************** 1 items had failures: 3 of 58 in __main__.example_6
example 2
sage -t -force_lib "devel/sage/sage/interfaces/maxima.py" ********************************************************************** File "/usr/share/sage/devel/sage/sage/interfaces/maxima.py", line 426: sage: t.limit(Ax=0, dir='+') Exception raised: Traceback (most recent call last): File "/usr/bin/ncadoctest.py", line 1231, in run_one_test self.run_one_example(test, example, filename, compileflags) File "/usr/bin/sagedoctest.py", line 38, in run_one_example OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags) File "/usr/bin/ncadoctest.py", line 1172, in run_one_example compileflags, 1) in test.globs File "<doctest __main__.example_0[93]>", line 1, in <module> t.limit(Ax=Integer(0), dir='+')###line 426: sage: t.limit(Ax=0, dir='+') File "expression.pyx", line 8202, in sage.symbolic.expression.Expression.limit (sage/symbolic/expression.cpp:31252) File "/usr/lib/python2.6/site-packages/sage/calculus/calculus.py", line 1122, in limit return l.sage() File "element.pyx", line 327, in sage.structure.element.Element.__getattr__ (sage/structure/element.c:2715) File "parent.pyx", line 277, in sage.structure.parent.getattr_from_other_class (sage/structure/parent.c:2841) File "parent.pyx", line 175, in sage.structure.parent.raise_attribute_error (sage/structure/parent.c:2636) AttributeError: 'sage.rings.integer.Integer' object has no attribute 'sage' ********************************************************************** File "/usr/share/sage/devel/sage/sage/interfaces/maxima.py", line 894: sage: f(3.2) Expected: -.05837414342758009 Got: -.058374143427580086 ********************************************************************** File "/usr/share/sage/devel/sage/sage/interfaces/maxima.py", line 1006: sage: maxima.version() Expected: '5.22.1' Got: '5.23.2' ********************************************************************** File "/usr/share/sage/devel/sage/sage/interfaces/maxima.py", line 1087: sage: maxima_version() Expected: '5.22.1' Got: '5.23.2' ********************************************************************** File "/usr/share/sage/devel/sage/sage/interfaces/maxima.py", line 608: sage: integrate(1/(x^3 *(a+b*x)^(1/3)),x) Expected: Traceback (most recent call last): ... TypeError: Computation failed since Maxima requested additional constraints (try the command 'assume(a>0)' before integral or limit evaluation, for example): Is a positive or negative? Got: Traceback (most recent call last): File "/usr/bin/ncadoctest.py", line 1231, in run_one_test self.run_one_example(test, example, filename, compileflags) File "/usr/bin/sagedoctest.py", line 38, in run_one_example OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags) File "/usr/bin/ncadoctest.py", line 1172, in run_one_example compileflags, 1) in test.globs File "<doctest __main__.example_6[3]>", line 1, in <module> integrate(Integer(1)/(x**Integer(3) *(a+b*x)**(Integer(1)/Integer(3))),x)###line 608: sage: integrate(1/(x^3 *(a+b*x)^(1/3)),x) File "/usr/lib/python2.6/site-packages/sage/misc/functional.py", line 718, in integral return x.integral(*args, **kwds) File "expression.pyx", line 8153, in sage.symbolic.expression.Expression.integral (sage/symbolic/expression.cpp:30871) File "/usr/lib/python2.6/site-packages/sage/symbolic/integration/integral.py", line 601, in integrate return indefinite_integral(expression, v) File "function.pyx", line 419, in sage.symbolic.function.Function.__call__ (sage/symbolic/function.cpp:4486) File "/usr/lib/python2.6/site-packages/sage/symbolic/integration/integral.py", line 85, in _eval_ res = integrator(f, x) File "/usr/lib/python2.6/site-packages/sage/symbolic/integration/external.py", line 19, in maxima_integrator result = maxima.sr_integral(expression,v) File "/usr/lib/python2.6/site-packages/sage/interfaces/maxima_lib.py", line 983, in sr_integral raise error RuntimeError: ECL says: Maxima asks:?mtext("Is ",a," positive or negative?") ********************************************************************** File "/usr/share/sage/devel/sage/sage/interfaces/maxima.py", line 618: sage: integral(x^n,x) Expected: Traceback (most recent call last): ... TypeError: Computation failed since Maxima requested additional constraints (try the command 'assume(n+1>0)' before integral or limit evaluation, for example): Is n+1 zero or nonzero? Got: Traceback (most recent call last): File "/usr/bin/ncadoctest.py", line 1231, in run_one_test self.run_one_example(test, example, filename, compileflags) File "/usr/bin/sagedoctest.py", line 38, in run_one_example OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags) File "/usr/bin/ncadoctest.py", line 1172, in run_one_example compileflags, 1) in test.globs File "<doctest __main__.example_6[7]>", line 1, in <module> integral(x**n,x)###line 618: sage: integral(x^n,x) File "/usr/lib/python2.6/site-packages/sage/misc/functional.py", line 718, in integral return x.integral(*args, **kwds) File "expression.pyx", line 8153, in sage.symbolic.expression.Expression.integral (sage/symbolic/expression.cpp:30871) File "/usr/lib/python2.6/site-packages/sage/symbolic/integration/integral.py", line 601, in integrate return indefinite_integral(expression, v) File "function.pyx", line 419, in sage.symbolic.function.Function.__call__ (sage/symbolic/function.cpp:4486) File "/usr/lib/python2.6/site-packages/sage/symbolic/integration/integral.py", line 85, in _eval_ res = integrator(f, x) File "/usr/lib/python2.6/site-packages/sage/symbolic/integration/external.py", line 19, in maxima_integrator result = maxima.sr_integral(expression,v) File "/usr/lib/python2.6/site-packages/sage/interfaces/maxima_lib.py", line 983, in sr_integral raise error RuntimeError: ECL says: Maxima asks:?mtext("Is ",n+1," zero or nonzero?") ********************************************************************** 5 items had failures: 1 of 95 in __main__.example_0 1 of 16 in __main__.example_13 1 of 3 in __main__.example_17 1 of 4 in __main__.example_21 2 of 11 in __main__.example_6 ***Test Failed*** 6 failures. For whitespace errors, see the file /home/francois/.sage/tmp/.doctest_maxima.py
and there are more. Tests are still running on this slow machine.
comment:28 in reply to: ↑ 27 Changed 9 years ago by
- Reviewers set to Jean-Pierre Flori, Francois Bissey, Karl-Dieter Crisan
sage -t -force_lib "devel/sage/sage/symbolic/function_factory.py" ********************************************************************** File "/usr/share/sage/devel/sage/sage/symbolic/function_factory.py", line 174: sage: g Expected: b*D[0](cr)(a) Got: b*del(a) ********************************************************************** File "/usr/share/sage/devel/sage/sage/symbolic/function_factory.py", line 184: sage: g.substitute_function(cr, cos) Expected: -b*sin(a) Got: b*del(a) ********************************************************************** File "/usr/share/sage/devel/sage/sage/symbolic/function_factory.py", line 187: sage: g.substitute_function(cr, (sin(x) + cos(x)).function(x)) Expected: -(sin(a) - cos(a))*b Got: b*del(a) **********************************************************************
Hmm, that is very interesting. I am not quite sure what this del
thing is, but I remember seeing something about it on the Maxima list...
File "/usr/share/sage/devel/sage/sage/interfaces/maxima.py", line 426:
sage: t.limit(Ax=0, dir='+')
return l.sage()
File "element.pyx", line 327, in sage.structure.element.Element.getattr (sage/structure/element.c:2715) File "parent.pyx", line 277, in sage.structure.parent.getattr_from_other_class (sage/structure/parent.c:2841) File "parent.pyx", line 175, in sage.structure.parent.raise_attribute_error (sage/structure/parent.c:2636)
AttributeError?: 'sage.rings.integer.Integer' object has no attribute 'sage'
This must be us using Sage Integers somehow at the library level where before they were coming back from Maxima?
File "/usr/share/sage/devel/sage/sage/interfaces/maxima.py", line 608:
sage: integrate(1/(x^{3 *(a+b*x)}(1/3)),x)
Expected:
Traceback (most recent call last): ... TypeError?: Computation failed since Maxima requested additional constraints (try the command 'assume(a>0)' before integral or limit evaluation, for example): Is a positive or negative?
Notice we expect a TypeError?.
RuntimeError?: ECL says: Maxima asks:?mtext("Is ",a," positive or negative?")
Now we just get a different error. I assume that the new code interface has something about ECL asking. We would want to make sure that this still is turned into the helpful type of message we have here, but that should be easy (if tedious) to make work.
Thank you for beginning this testing!
comment:29 Changed 9 years ago by
- Reviewers changed from Jean-Pierre Flori, Francois Bissey, Karl-Dieter Crisan to Jean-Pierre Flori, Francois Bissey, Karl-Dieter Crisman
I don't have the cedille, pardon me :(
comment:30 Changed 9 years ago by
- Reviewers changed from Jean-Pierre Flori, Francois Bissey, Karl-Dieter Crisman to Jean-Pierre Flori, François Bissey, Karl-Dieter Crisman
I have a cedilla thanks to the international setting on my desktop.
More seriously, it should be pointed out that this is done with ecl-11.1.1 and it may have an influence. I have a faster machine at work and I'll test ecl-10.4.1 on Monday.
comment:31 Changed 9 years ago by
Ok so I have a lot of failures that I attribute to maxima-lib, I am making a list for quick reference. I have another sage-on-gentoo report on there being a lot failure with it and this time with ecl-10.4.1.
sage -t -force_lib "devel/sage/sage/functions/special.py" # Time out
sage -t -force_lib "devel/sage/sage/functions/piecewise.py"
sage -t -force_lib "devel/sage/sage/functions/min_max.py"
sage -t -force_lib "devel/sage/sage/functions/orthogonal_polys.py"
sage -t -force_lib "devel/sage/sage/interfaces/maxima_lib.py"
sage -t -force_lib "devel/sage/sage/interfaces/maxima_abstract.py"
sage -t -force_lib "devel/sage/sage/interfaces/maxima.py"
sage -t -force_lib "devel/sage/sage/symbolic/function_factory.py"
sage -t -force_lib "devel/sage/sage/symbolic/integration/integral.py" # Time out
sage -t -force_lib "devel/sage/sage/symbolic/integration/external.py"
sage -t -force_lib "devel/sage/sage/symbolic/relation.py" # Time out
sage -t -force_lib "devel/sage/sage/symbolic/assumptions.py" # Time out
sage -t -force_lib "devel/sage/sage/symbolic/power_helper.pyx"
sage -t -force_lib "devel/sage/sage/symbolic/expression_conversions.py"
sage -t -force_lib "devel/sage/sage/symbolic/ring.pyx"
sage -t -force_lib "devel/sage/sage/symbolic/expression.pyx" # Time out
sage -t -force_lib "devel/sage/sage/rings/number_field/number_field_element_quadratic.pyx"
sage -t -force_lib "devel/sage/sage/rings/number_field/number_field_element.pyx"
sage -t -force_lib "devel/sage/sage/structure/sage_object.pyx"
sage -t -force_lib "devel/sage/sage/misc/functional.py"
sage -t -force_lib "devel/sage/sage/modules/free_module_element.pyx"
sage -t -force_lib "devel/sage/sage/modular/modform/ambient_R.py"
sage -t -force_lib "devel/sage/sage/calculus/desolvers.py"
sage -t -force_lib "devel/sage/sage/calculus/calculus.py"
sage -t -force_lib "devel/sage/sage/calculus/tests.py"
sage -t -force_lib "devel/sage/sage/calculus/functional.py"
sage -t -force_lib "devel/sage/sage/calculus/interpolators.pyx"
sage -t -force_lib "devel/sage/sage/calculus/wester.py"
Some are probably due to ecl-11.1.1 so it should shrink, but it will take a bit of time since ecl, maxima and sage have to be rebuild.
comment:32 follow-ups: ↓ 34 ↓ 36 Changed 9 years ago by
ecl-10.4.1, maxima-5.23.2:
sage -t --verbose -force_lib "devel/sage/sage/functions/special.py" times out because it stops:
Trying: elliptic_e(arccoth(Integer(1)), x**Integer(2)*e)###line 535:_sage_ >>> elliptic_e(arccoth(1), x^2*e) Expecting: elliptic_e(arccoth(1), x^2*e) The number 1 isn't in the domain of acoth -- an error. To debug this try: debugmode(true); Error in format: Unknown format directive. The number ~:M isn't in the domain of ~A ^ while processing indirect format string: ~? ^ No restarts available. Broken at LAMBDA. MAXIMA>>
comment:33 Changed 9 years ago by
Interesting one, notice that it still wants maxima-5.19.1
sage -t -force_lib "devel/sage/sage/interfaces/maxima_lib.py" ********************************************************************** File "/usr/share/sage/devel/sage/sage/interfaces/maxima_lib.py", line 426: sage: t.limit(Ax=0,dir='above') Exception raised: Traceback (most recent call last): File "/usr/bin/ncadoctest.py", line 1231, in run_one_test self.run_one_example(test, example, filename, compileflags) File "/usr/bin/sagedoctest.py", line 38, in run_one_example OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags) File "/usr/bin/ncadoctest.py", line 1172, in run_one_example compileflags, 1) in test.globs File "<doctest __main__.example_0[93]>", line 1, in <module> t.limit(Ax=Integer(0),dir='above')###line 426: sage: t.limit(Ax=0,dir='above') File "expression.pyx", line 8202, in sage.symbolic.expression.Expression.limit (sage/symbolic/expression.cpp:31252) File "/usr/lib/python2.6/site-packages/sage/calculus/calculus.py", line 1122, in limit return l.sage() File "element.pyx", line 327, in sage.structure.element.Element.__getattr__ (sage/structure/element.c:2715) File "parent.pyx", line 277, in sage.structure.parent.getattr_from_other_class (sage/structure/parent.c:2841) File "parent.pyx", line 175, in sage.structure.parent.raise_attribute_error (sage/structure/parent.c:2636) AttributeError: 'sage.rings.integer.Integer' object has no attribute 'sage' ********************************************************************** File "/usr/share/sage/devel/sage/sage/interfaces/maxima_lib.py", line 966: sage: maxima.version() Expected: '5.19.1' Got: '5.23.2' ********************************************************************** File "/usr/share/sage/devel/sage/sage/interfaces/maxima_lib.py", line 1076: sage: maxima_version() Expected: '5.19.1' Got: '5.23.2' ********************************************************************** File "/usr/share/sage/devel/sage/sage/interfaces/maxima_lib.py", line 639: sage: integrate(1/(x^3 *(a+b*x)^(1/3)),x) Expected: Traceback (most recent call last): ... TypeError: Computation failed since Maxima requested additional constraints (try the command 'assume(a>0)' before integral or limit evaluation, for example): Is a positive or negative? Got: Traceback (most recent call last): File "/usr/bin/ncadoctest.py", line 1231, in run_one_test self.run_one_example(test, example, filename, compileflags) File "/usr/bin/sagedoctest.py", line 38, in run_one_example OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags) File "/usr/bin/ncadoctest.py", line 1172, in run_one_example compileflags, 1) in test.globs File "<doctest __main__.example_8[3]>", line 1, in <module> integrate(Integer(1)/(x**Integer(3) *(a+b*x)**(Integer(1)/Integer(3))),x)###line 639: sage: integrate(1/(x^3 *(a+b*x)^(1/3)),x) File "/usr/lib/python2.6/site-packages/sage/misc/functional.py", line 718, in integral return x.integral(*args, **kwds) File "expression.pyx", line 8153, in sage.symbolic.expression.Expression.integral (sage/symbolic/expression.cpp:30871) File "/usr/lib/python2.6/site-packages/sage/symbolic/integration/integral.py", line 601, in integrate return indefinite_integral(expression, v) File "function.pyx", line 419, in sage.symbolic.function.Function.__call__ (sage/symbolic/function.cpp:4486) File "/usr/lib/python2.6/site-packages/sage/symbolic/integration/integral.py", line 85, in _eval_ res = integrator(f, x) File "/usr/lib/python2.6/site-packages/sage/symbolic/integration/external.py", line 19, in maxima_integrator result = maxima.sr_integral(expression,v) File "/usr/lib/python2.6/site-packages/sage/interfaces/maxima_lib.py", line 983, in sr_integral raise error RuntimeError: ECL says: Maxima asks:?mtext("Is ",a," positive or negative?") ********************************************************************** File "/usr/share/sage/devel/sage/sage/interfaces/maxima_lib.py", line 649: sage: integral(x^n,x) Expected: Traceback (most recent call last): ... TypeError: Computation failed since Maxima requested additional constraints (try the command 'assume(n+1>0)' before integral or limit evaluation, for example): Is n+1 zero or nonzero? Got: Traceback (most recent call last): File "/usr/bin/ncadoctest.py", line 1231, in run_one_test self.run_one_example(test, example, filename, compileflags) File "/usr/bin/sagedoctest.py", line 38, in run_one_example OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags) File "/usr/bin/ncadoctest.py", line 1172, in run_one_example compileflags, 1) in test.globs File "<doctest __main__.example_8[7]>", line 1, in <module> integral(x**n,x)###line 649: sage: integral(x^n,x) File "/usr/lib/python2.6/site-packages/sage/misc/functional.py", line 718, in integral return x.integral(*args, **kwds) File "expression.pyx", line 8153, in sage.symbolic.expression.Expression.integral (sage/symbolic/expression.cpp:30871) File "/usr/lib/python2.6/site-packages/sage/symbolic/integration/integral.py", line 601, in integrate return indefinite_integral(expression, v) File "function.pyx", line 419, in sage.symbolic.function.Function.__call__ (sage/symbolic/function.cpp:4486) File "/usr/lib/python2.6/site-packages/sage/symbolic/integration/integral.py", line 85, in _eval_ res = integrator(f, x) File "/usr/lib/python2.6/site-packages/sage/symbolic/integration/external.py", line 19, in maxima_integrator result = maxima.sr_integral(expression,v) File "/usr/lib/python2.6/site-packages/sage/interfaces/maxima_lib.py", line 983, in sr_integral raise error RuntimeError: ECL says: Maxima asks:?mtext("Is ",n+1," zero or nonzero?") ********************************************************************** 4 items had failures: 1 of 95 in __main__.example_0 1 of 3 in __main__.example_18 1 of 4 in __main__.example_23 2 of 11 in __main__.example_8 ***Test Failed*** 5 failures. For whitespace errors, see the file /home/francois/.sage/tmp/.doctest_maxima_lib.py [17.3 s] ---------------------------------------------------------------------- The following tests failed: sage -t -force_lib "devel/sage/sage/interfaces/maxima_lib.py" Total time for all tests: 17.3 seconds
sage -t -force_lib "devel/sage/sage/symbolic/integration/integral.py times out because:
Trying: integrate(sin(x)*cos(Integer(10)*x)*log(x), x)###line 462:_sage_ >>> integrate(sin(x)*cos(10*x)*log(x), x) Expecting: 1/198*(11*cos(9*x) - 9*cos(11*x))*log(x) + 1/44*Ei(-11*I*x) - 1/36*Ei(-9*I*x) - 1/36*Ei(9*I*x) + 1/44*Ei(11*I*x) Wrong number of arguments to gamma_incomplete -- an error. To debug this try: debugmode(true); Error in format: Unknown format directive. Wrong number of arguments to ~:@M ^ while processing indirect format string: ~? ^ No restarts available. Broken at LAMBDA.
sage -t -force_lib "devel/sage/sage/symbolic/relation.py" times out because of this:
Trying: solve([sqrt(x) + sqrt(y) == Integer(5), x + y == Integer(10)], x, y)###line 492:_sage_ >>> solve([sqrt(x) + sqrt(y) == 5, x + y == 10], x, y) Expecting: [[x == -5/2*I*sqrt(5) + 5, y == 5/2*I*sqrt(5) + 5], [x == 5/2*I*sqrt(5) + 5, y == -5/2*I*sqrt(5) + 5]] assoc: every list element must be an expression with two arguments; found: [sage147] #0: simp_%solve(e=sage135,v=sage146,extraargs=[sage147]) -- an error. To debug this try: debugmode(true); Error in format: Unknown format directive. assoc: every list element must be an expression with two arguments; found: ~:M ^ while processing indirect format string: ~? ^ No restarts available.
sage -t -force_lib "devel/sage/sage/symbolic/assumptions.py":
Trying: decl2.assume()###line 89:_sage_ >>> decl2.assume() Expecting: Traceback (most recent call last): ... ValueError: Assumption is inconsistent declare: inconsistent declaration declare(x,odd) -- an error. To debug this try: debugmode(true); Error in format: Unknown format directive. declare: inconsistent declaration ~:M ^ while processing indirect format string: ~? ^ No restarts available.
sage -t -force_lib "devel/sage/sage/symbolic/expression.pyx":
Trying: solve(acot(x),x)###line 7453:_sage_ >>> solve(acot(x),x) Expecting: [] The number 0 isn't in the domain of cot -- an error. To debug this try: debugmode(true); Error in format: Unknown format directive. The number ~:M isn't in the domain of ~A ^ while processing indirect format string: ~? ^ No restarts available.
sage -t -force_lib "devel/sage/sage/structure/sage_object.pyx" is interesting:
File "/usr/share/sage/devel/sage/sage/structure/sage_object.pyx", line 1053: sage: print "x"; sage.structure.sage_object.unpickle_all() Expected: x... Successfully unpickled ... objects. Failed to unpickle 0 objects. Got: x doctest:1: DeprecationWarning: Your word object is saved in an old file format since FiniteWord_over_OrderedAlphabet is deprecated and will be deleted in a future version of Sage (you can use FiniteWord_list instead). You can re-save your word by typing "word.save(filename)" to ensure that it will load in future versions of Sage. doctest:1: DeprecationWarning: Your word object is saved in an old file format since AbstractWord is deprecated and will be deleted in a future version of Sage (you can use FiniteWord_list instead). You can re-save your word by typing "word.save(filename)" to ensure that it will load in future versions of Sage. doctest:1: DeprecationWarning: Your word object is saved in an old file format since Word_over_Alphabet is deprecated and will be deleted in a future version of Sage (you can use FiniteWord_list instead). You can re-save your word by typing "word.save(filename)" to ensure that it will load in future versions of Sage. doctest:1: DeprecationWarning: Your word object is saved in an old file format since Word_over_OrderedAlphabet is deprecated and will be deleted in a future version of Sage (you can use FiniteWord_list instead). You can re-save your word by typing "word.save(filename)" to ensure that it will load in future versions of Sage. doctest:1: DeprecationWarning: ChristoffelWord_Lower is deprecated, use LowerChristoffelWord instead * unpickle failure: load('/home/francois/.sage/temp/vrooom/13483/dir_2/pickle_jar/_class__sage_interfaces_maxima_MaximaFunction__.sobj') Failed: _class__sage_interfaces_maxima_MaximaFunction__.sobj Successfully unpickled 585 objects. Failed to unpickle 1 objects.
sage -t -force_lib "devel/sage/sage/modules/free_module_element.pyx" now pass, so probably ecl-11.1.1 related.
sage -t -force_lib "devel/sage/sage/calculus/tests.py" (extracts):
File "/usr/share/sage/devel/sage/sage/calculus/tests.py", line 107: sage: integrate(log(1-x^2)/x, x) Exception raised: Traceback (most recent call last): File "/usr/bin/ncadoctest.py", line 1231, in run_one_test self.run_one_example(test, example, filename, compileflags) File "/usr/bin/sagedoctest.py", line 38, in run_one_example OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags) File "/usr/bin/ncadoctest.py", line 1172, in run_one_example compileflags, 1) in test.globs File "<doctest __main__.example_0[41]>", line 1, in <module> integrate(log(Integer(1)-x**Integer(2))/x, x)###line 107: sage: integrate(log(1-x^2)/x, x) File "/usr/lib/python2.6/site-packages/sage/misc/functional.py", line 718, in integral return x.integral(*args, **kwds) File "expression.pyx", line 8153, in sage.symbolic.expression.Expression.integral (sage/symbolic/expression.cpp:30871) File "/usr/lib/python2.6/site-packages/sage/symbolic/integration/integral.py", line 601, in integrate return indefinite_integral(expression, v) File "function.pyx", line 419, in sage.symbolic.function.Function.__call__ (sage/symbolic/function.cpp:4486) File "/usr/lib/python2.6/site-packages/sage/symbolic/integration/integral.py", line 85, in _eval_ res = integrator(f, x) File "/usr/lib/python2.6/site-packages/sage/symbolic/integration/external.py", line 19, in maxima_integrator result = maxima.sr_integral(expression,v) File "/usr/lib/python2.6/site-packages/sage/interfaces/maxima_lib.py", line 977, in sr_integral return max_to_sr(maxima_eval(([max_integrate],[sr_to_max(SR(a)) for a in args]))) File "/usr/lib/python2.6/site-packages/sage/interfaces/maxima_lib.py", line 1228, in max_to_sr args.append(max_to_sr(car(max_args))) File "/usr/lib/python2.6/site-packages/sage/interfaces/maxima_lib.py", line 1228, in max_to_sr args.append(max_to_sr(car(max_args))) File "/usr/lib/python2.6/site-packages/sage/interfaces/maxima_lib.py", line 1228, in max_to_sr args.append(max_to_sr(car(max_args))) File "/usr/lib/python2.6/site-packages/sage/interfaces/maxima_lib.py", line 1221, in max_to_sr sage_expr=SR(maxima(expr)) File "parent.pyx", line 915, in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:6668) File "coerce_maps.pyx", line 156, in sage.structure.coerce_maps.NamedConvertMap._call_ (sage/structure/coerce_maps.c:4045) File "/usr/lib/python2.6/site-packages/sage/interfaces/maxima_abstract.py", line 1373, in _symbolic_ return R(self._sage_()) File "/usr/lib/python2.6/site-packages/sage/interfaces/maxima_abstract.py", line 1354, in _sage_ maxima=self.parent()) File "/usr/lib/python2.6/site-packages/sage/calculus/calculus.py", line 1646, in symbolic_expression_from_maxima_string raise TypeError, "unable to make sense of Maxima expression '%s' in Sage"%s TypeError: unable to make sense of Maxima expression 'li[2]' in Sage
File "/usr/share/sage/devel/sage/sage/calculus/tests.py", line 151: sage: integrate(ceil(x^2 + floor(x)), x, 0, 5) # todo: Mathematica can do this Expected: integrate(ceil(x^2) + floor(x), x, 0, 5) Got: 155/3 ********************************************************************** File "/usr/share/sage/devel/sage/sage/calculus/tests.py", line 189: sage: integrate(sin(x), x, a, b) Expected: cos(a) - cos(b) Got: ceil(cos(a))
sage -t -force_lib "devel/sage/sage/calculus/interpolators.pyx" is actually unrelated to maxima I think.
comment:34 in reply to: ↑ 32 Changed 9 years ago by
Replying to fbissey:
ecl-10.4.1, maxima-5.23.2:
sage -t --verbose -force_lib "devel/sage/sage/functions/special.py" times out because it stops:Trying: elliptic_e(arccoth(Integer(1)), x**Integer(2)*e)###line 535:_sage_ >>> elliptic_e(arccoth(1), x^2*e) Expecting: elliptic_e(arccoth(1), x^2*e) The number 1 isn't in the domain of acoth
Hmm, this must have to do with 5.23.2, because "Here arccoth doesn't have 1 in its domain, so we just hold the expression:" in the past. So Maxima must have improved something here.
sage: integrate(ceil(x^2 + floor(x)), x, 0, 5) # todo: Mathematica can do this Expected: integrate(ceil(x^2) + floor(x), x, 0, 5) Got: 155/3
If this is right, that's good. No idea what's going on with the next one.
In general, I'm seeing a lot of stuff that's related to having the newer Maxima. I think that we should either upgrade Maxima first, and take care of things related to better error handling/functionality in Maxima, and then address this ticket separately, OR do this first with our current Maxima and then upgrade Maxima. My preference would be to upgrade Maxima first, assuming one can do that relatively easily (would ECL also have to be upgraded? It's annoying that one has to do them simultaneously at times, at least with some of my slower test machines.).
comment:35 Changed 9 years ago by
I will do another run of tests with maxima-5.22.1 later. It is not too hard to go from one version of maxima to another. At least you don't have to rebuild anything else.
But it definitely looks like upgrading maxima would be a good thing, we'll have to make a ticket about it.
comment:36 in reply to: ↑ 32 Changed 9 years ago by
Something blows up rather badly here. The MAXIMA>>
prompt indicates that you're dropped into to ECL debugger [the default behaviour of LISPs is to drop you into a debugger when an uncaught condition arises]. Ecllib tries to avoid this by executing any LISP code inside the LISP equivalent of try/except (being HANDLER-CASE). You can get tracebacks and code to see what is happening from the debugger (try ":h" to get help about the ECL debugger)
---------------------------------------------------------------------- | Sage Version 4.6.1, Release Date: 2011-01-11 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- Loading Sage library. Current Mercurial branch is: dev sage: elliptic_e(arccoth(1), x^2*e) The number 1 isn't in the domain of acoth -- an error. To debug this try: debugmode(true);
This is Maxima printing something on the STDOUT. We should be catching this before it gets printed! In other words, find which routine in maxima prints this and monkey-patch it to raise an error *before* printing this. Apparently, maxima does raise an error after printing this, which normally gets caught on maxima's top level. But since we decapitated maxima, we're getting that now, and that is where the next thing goes wrong:
Error in format: Unknown format directive. The number ~:M isn't in the domain of ~A ^ while processing indirect format string: ~? ^ No restarts available. Broken at LAMBDA. MAXIMA>> :b Backtrace: > LAMBDA > print-object > common-lisp-user::sage-safe-apply MAXIMA>> :le (LAMBDA (CONDITION STREAM) (FORMAT STREAM "~?" (SIMPLE-CONDITION-FORMAT-CONTROL CONDITION) (SIMPLE-CONDITION-FORMAT-ARGUMENTS CONDITION)))
so a FORMAT statement is failing here. Apparently "Condition" objects (roughly "exception" objects in python) can have a format string and items hanging off them. FORMAT is LISPs "printf", but with a much more baroque set of options. FORMAT format specifiers have been rumoured to be Turing complete. Let's look at the parameters:
MAXIMA>> (SIMPLE-CONDITION-FORMAT-CONTROL CONDITION) "The number ~:M isn't in the domain of ~A" MAXIMA>> (SIMPLE-CONDITION-FORMAT-ARGUMENTS CONDITION) NIL
So the "~:M" is probably a Maxima extension to format which is not accessible at the point where we are trying it. The fact that there are no arguments also indicates that Maxima might be forming a condition object that is not fit for general consumption.
Let's see where this error really arose by stepping further up in the backtrace:
MAXIMA>> :p Broken at PRINT-OBJECT. MAXIMA>> :le (SI:LAMBDA-BLOCK PRINT-OBJECT (SI::X STREAM) (DECLARE (TYPE SIMPLE-CONDITION SI::X) (SI::NO-CHECK-TYPE SI::X)) (IF *PRINT-ESCAPE* (CALL-NEXT-METHOD) ((LAMBDA (CONDITION STREAM) (FORMAT STREAM "~?" (SIMPLE-CONDITION-FORMAT-CONTROL CONDITION) (SIMPLE-CONDITION-FORMAT-ARGUMENTS CONDITION))) SI::X STREAM))) {{{ So this is LISP trying to print a CONDITION object. Apparently, Maxima has created a CONDITION object that doesn't allow this method to work. This could be a bug in ECL or it could be Maxima being non-compliant. }}} MAXIMA>> :p Broken at COMMON-LISP-USER::SAGE-SAFE-APPLY. MAXIMA>> :le (SI:LAMBDA-BLOCK COMMON-LISP-USER::SAGE-SAFE-APPLY (COMMON-LISP-USER::FUNC COMMON-LISP-USER::ARGS) (DECLARE (SI::C-GLOBAL)) (HANDLER-CASE (VALUES (APPLY COMMON-LISP-USER::FUNC COMMON-LISP-USER::ARGS)) (SERIOUS-CONDITION (COMMON-LISP-USER::CND) (VALUES NIL (PRINC-TO-STRING COMMON-LISP-USER::CND))))) MAXIMA>> COMMON-LISP-USER::FUNC MAXIMA-EVAL MAXIMA>> COMMON-LISP-USER::ARGS ((MEVAL* '((MSETQ) $SAGE1 (($ELLIPTIC_E) ((%ACOTH) 1) ((MTIMES) ((MEXPT) $X 2) ((%EXP) 1))))))
Finally we're at the ecllib level. SAGE-SAFE-APPLY is the way ecllib tries to execute LISP code As you can see, the arguments here indicate that this is the original call we started with, translated to maxima (well, the underlying LISP representation of maxima). We know this raised an error, which gets processed by the HANDLER-CASE/SERIOUS-CONDITION. The PRINC-TO-STRING tries to make a string rendition of the CONDITION object, which fails for the reasons we have seen above.
So, the most direct way to solve the problem is to monkey-patch Maxima to raise an acceptable error *instead* of printing a message and sending a CONDITION object that crashes PRINC (which should be a near-universal printing routine). This should be relatively straightforward, because that Maxima routine already produces an acceptable string. Simply produce that string but instead of printing it, do an (ERROR string) or whatever is acceptable (the way "retrieve" gets monkey-patched in maximalib is already an example of that).
It does make me a bit pessimistic, though: Maxima improves some of its error reporting and in the process immediately blows up our error catching! This looks like something that is going to happen every time Maxima changes something. It's bad enough when dealing with the pexpect interface, but in this case we're basically using an unsupported and undocumented API! I know Robert Dodier is definitely sympathetic to making Maxima usable as a library, so perhaps if we can get reasonable functionality, he might be willing to take into account the required hooks when changing Maxima.
comment:37 in reply to: ↑ description Changed 9 years ago by
I have looked a little into the error reporting and it looks like maxima was not creating the error that crashed ecllib's error string creation routine -- instead it was maxima-eval, the maxima "top level" replacement we run to catch and interpret maxima's error reporting. Maxima's error reporting hasn't changed since 1985. It just happened that this was the first time we stumbled into an error message that was not properly handled. The new patch "errorcatching.patch" (to be applied after all the "rebased" patches) fixes this.
We now get:
sage: arccoth(1).simplify() -- an error. To debug this try: debugmode(true); (result= MAXIMA-ERROR) ($error= ((MLIST) The number ~:M isn't in the domain of ~A 1 ACOTH)) TypeError: ECL says: The number 1 isn't in the domain of acoth sage: elliptic_e(arccoth(1), x^2*e) (result= (MAXIMA_EVAL . /usr/local/sage/4.6/local/share/maxima/5.22.1/share/orthopoly/orthopoly.lisp)) ($error= ((MLIST) The number ~:M isn't in the domain of ~A 1 ACOTH)) (result= (MAXIMA_EVAL)) ($error= ((MLIST) The number ~:M isn't in the domain of ~A 1 ACOTH)) -- an error. To debug this try: debugmode(true); (result= MAXIMA-ERROR) ($error= ((MLIST) The number ~:M isn't in the domain of ~A 1 ACOTH)) elliptic_e(arccoth(1), x^2*e)
So we see a bunch of things:
- printing the error has now been turned off, but a quick glance at the code shows that the message
-- an error. To debug this try: debugmode(true);
cannot be turned off. I regard that a bug in Maxima and we can consider reporting that. We could also just monkeypatch MERROR. - the error now gets properly reported
- there is a lot of junk diagnostic output generated by my fixed routine. Feel free to comment that back out.
- the actual simplification of elliptic_e (whatever is tried there) apparently is wrapped in a try/except and the error reported by ecl is nicely hidden and the result is left unchanged.
This should be closer to how sage handled this first.
comment:38 in reply to: ↑ description Changed 9 years ago by
The following doctest from calculus.py now goes wrong:
limit(-e^(x^2)*erf(x) + e^(x^2), x=oo)
Which stumbles at calculus.calculus.limit at these lines:
1122 return l.sage() 1123 return ex.parent()(l)
Two return statements??? A little hg -blame
points to #7661. Indeed, commenting out line 1122 fixes a lot of the limit problems. However, Burcin put in that line for a reason, I assume, so I'm hesitant to just commit a reversal.
Note that the issue of #7661 is exactly due to a namespace collapse from SR -> Maxima; something this interface could eventually solve much more elegantly, by just mapping (at no cost) SR.var('x') to the maxima identifier "sage_SR_var_x".
comment:39 follow-up: ↓ 40 Changed 9 years ago by
two return statements is indeed strange. Is the second return ever reached? Could it be a left over forgotten there? Looking at the code I am not sure what ex.parent()(l) is supposed to be. I haven't had time to test the errorcatching patch but will try ASAP. One of my testing friend noted that maxima as a lib and ecl compiled with thread support are not compatible (ever seen a SIGPWR?). I am mentioning that, in case it becomes the default in ecl in the future.
comment:40 in reply to: ↑ 39 ; follow-up: ↓ 43 Changed 9 years ago by
two return statements is indeed strange. Is the second return ever reached?
No, it isn't. However, Burcin apparently thought that l.sage()
would give better results. I'm actually thankful that he left in the original return statement because that served as a nice flag that something had changed there.
Could it be a left over forgotten there? Looking at the code I am not sure what ex.parent()(l) is supposed to be.
It is "Coerce l into the parent of ex", the original input parameter, i.e., coerce l into the Symbolic Ring. In the new code, "sr_limit" produces something that is hopefully *coercible* into the SymbolicRing? -- it probably isn't a maxima object at all anymore. I think in all cases it's better to coerce into SR instead of calling l.sage(): On maxima objects it should be about the same and if limit produces something that cannot be represented in the SymbolicRing? we should get an error. I'll ping him about it.
One of my testing friend noted that maxima as a lib and ecl compiled with thread support are not compatible (ever seen a SIGPWR?). I am mentioning that, in case it becomes the default in ecl in the future.
Good to know! A little googling found http://www.hpl.hp.com/personal/Hans_Boehm/gc/debugging.html It's the garbage collector that uses SIGXCPU and SIGPWR to synchronise cross-thread garbage collection. So if we want ecllib+threads we need to adjust the sage signal handler to properly handle those. BoehmGC is made for integration into C programs, so this may be doable.
comment:41 Changed 9 years ago by
Re-running sage -testall with maxima-lib enabled, ecl-10.4.1 maxima-5.22.1, sage-4.6.2_alpha3. Most of the time out have disappeared expect for three which at first sight are unrelated, but don't fail without maxima-lib
sage -t -force_lib devel/sage/sage/misc/randstate.pyx sage -t -force_lib devel/sage/sage/interfaces/psage.py sage -t -force_lib devel/sage/sage/interfaces/sage0.py
From the first one:
Trying: subsage = Sage()###line 134:_sage_ >>> subsage = Sage() Expecting nothing ok Trying: s = ZZ(subsage('initial_seed()'))###line 135:_sage_ >>> s = ZZ(subsage('initial_seed()')) Expecting nothing
And it hangs there.
I also have SIGFPE in the following
sage -t -force_lib "devel/sage/sage/functions/other.py" * sage -t -force_lib devel/sage/sage/functions/log.py * sage -t -force_lib devel/sage/sage/symbolic/constants.py sage -t -force_lib devel/sage/sage/symbolic/pynac.pyx sage -t -force_lib devel/sage/sage/rings/complex_number.pyx sage -t -force_lib devel/sage/sage/rings/real_double.pyx sage -t -force_lib devel/sage/sage/rings/real_mpfr.pyx sage -t -force_lib devel/sage/sage/libs/mpmath/utils.pyx sage -t -force_lib devel/sage/sage/libs/mpmath/ext_libmp.pyx sage -t -force_lib devel/sage/sage/libs/mpmath/ext_impl.pyx sage -t -force_lib devel/sage/sage/libs/mpmath/ext_main.pyx sage -t -force_lib devel/sage/sage/calculus/calculus.py * sage -t -force_lib devel/sage/sage/structure/element.pyx sage -t -force_lib devel/sage/sage/schemes/elliptic_curves/ell_point.py sage -t -force_lib devel/sage/sage/schemes/elliptic_curves/ell_generic.py *
The stars indicate where I also had some verbose out from maxima, usually ending with
($error= ((MLIST SIMP) No error.))
And there is quite few more. I am doing another run with the little correction in calculus.py to see if that solve some of them.
comment:42 Changed 9 years ago by
scrap the three time out. They still happen without maxima-lib I was mistaken.
comment:43 in reply to: ↑ 40 ; follow-up: ↓ 44 Changed 9 years ago by
Thank you all for working on this again. I hope this will also solve some of the long standing issues we had with the maxima interface, like setting domains for variables #6862, or recognizing special symbols #6882.
Replying to nbruin:
two return statements is indeed strange. Is the second return ever reached?
No, it isn't. However, Burcin apparently thought that
l.sage()
would give better results. I'm actually thankful that he left in the original return statement because that served as a nice flag that something had changed there.
It was clearly a mistake on my part to leave the second return statement. I'm glad it ended up being useful though.
I don't have much time these days to investigate this. So it would be great if someone can update me on the progress. Especially, when rebasing Robert's patch to split off the maxima interface, did you merge in the changes that were made to sage/interfaces/maxima.py in the meantime?
Could it be a left over forgotten there? Looking at the code I am not sure what ex.parent()(l) is supposed to be.
It is "Coerce l into the parent of ex", the original input parameter, i.e., coerce l into the Symbolic Ring. In the new code, "sr_limit" produces something that is hopefully *coercible* into the SymbolicRing? -- it probably isn't a maxima object at all anymore. I think in all cases it's better to coerce into SR instead of calling l.sage(): On maxima objects it should be about the same and if limit produces something that cannot be represented in the SymbolicRing? we should get an error. I'll ping him about it.
The operation we are using is conversion, not coercion. IMHO, the code for converting maxima objects (of any kind, pexpect or library) to Sage symbolics objects should be within the maxima objects. Most of this functionality is in sage/calculus/calculus.py at the moment, I would like to see that moved to sage/interfaces/maxima.py or it's variants.
Adding a .sage() method to maxima interface objects was a step in this direction. This method knows which lookup tables to use to convert functions, etc. from maxima back to Sage. The code for this function is simply
def _sage_(self): import sage.calculus.calculus as calculus return calculus.symbolic_expression_from_maxima_string(self.name(), maxima=self.parent())
around line 1775 of sage/interfaces/maxima.py. I would expect this to work for the library interface to maxima as well, since AFAIK, this is also string based ATM.
I am not quite sure what a conversion to the symbolic ring does for maxima interface objects. I don't expect it to have special behavior if the input is a maxima interface object. It would make sense, if it called the .sage() or ._sage_() methods of the argument though.
Sorry I can't be more helpful.
comment:44 in reply to: ↑ 43 Changed 9 years ago by
Thank you, Burcin. That is very useful information indeed.
I don't have much time these days to investigate this. So it would be great if someone can update me on the progress. Especially, when rebasing Robert's patch to split off the maxima interface, did you merge in the changes that were made to sage/interfaces/maxima.py in the meantime?
I'll leave that to JP
The operation we are using is conversion, not coercion. IMHO, the code for converting maxima objects (of any kind, pexpect or library) to Sage symbolics objects should be within the maxima objects. Most of this functionality is in sage/calculus/calculus.py at the moment, I would like to see that moved to sage/interfaces/maxima.py or it's variants.
OK, conversion indeed. Good to know there is a philosophy behind the change
Adding a .sage() method to maxima interface objects was a step in this direction. This method knows which lookup tables to use to convert functions, etc. from maxima back to Sage.
Ultimately, this model might fit better with maximalib, but currently it means some refactoring of what we already had (or just go back to the SR coercion)
around line 1775 of sage/interfaces/maxima.py. I would expect this to work for the library interface to maxima as well, since AFAIK, this is also string based ATM.
With the fastcalculus patch it is not, though. In principle one could try to polish the abstract_maxima and maxima_lib patches so that they give a drop-in string-based library interface to maxima, but I never really went that far. That would be (probably boring but) very well-defined project and might speed up adoption.
What happens with the current set of patches:
- a maxima_lib interface is made available that in principle should be a drop-in replacement for maxima (except that only one instance can exist)
- this interface adds some extra methods to get "under the hood" of objects:
(1) There is an .ecl() method that returns the underlying EclObject? (i.e., direct access to the LISP object implementing the maxima object)
(2) the maxima() method also accepts EclObjects? and returns the appropriate wrapper, so maxima(M.ecl()) and maxima(eclobject).ecl() are supposed to be the identity (In a strong sense: The python wrapped might change Id but the ecl object not) where defined.
(3) sr_to_max(), a method to translate an SR object into an EclObject? ready for wrapping in maxima.
(4) max_to_sr(), a method to translate an EclObject? representing a maxima expression to something in or coercible to SR. Note that maxima expressions can be lists, which should be translated into a python list of SR elements, so the mapping cannot be perfectly into SR.
(5) methods sr_limit, sr_sum, sr_integrate which expect arguments living in SR and return something convertible to SR
The idea is that (3) and (4) offer a way to go back and forth between SR and maxima without using strings. maxima(E) and maxima(sr_to_max(E)) should have the same result. Similarly, SR(M) and SR(max_to_sr(M.ecl())) should have the similar result. Under the hood, sr_to_max and max_to_sr keep mappings between SR symbols and their EclObject? counterparts. They build up these mappings via the string-based interface, but avoid strings once they know the mappings.
The methods in (5) were an attempt to make "compute limit/sum/integral via maxima" dependent on which maxima interface was in use. The old maxima-interface got stubs that just returned the result of calling the appropriate maxima expression, which returns a maxima expression, which is coercible into SR again.
The maxima-lib implementation uses sr_to_max and max_to_sr as much as possible and returns the result of a max_to_sr, so that should be coercible into SR as well.
Doing it this way (at the time) was the smallest change and left as much as possible in the calculus.limit routine. The general setup fits will in Burcin's philosophy, but is presently broken because the result of a max_to_sr likely doesn't have a .sage() method. An alternative would be to push the actual conversion of the answer to SR into the sr_limit routine as well. But then one would have to tell sr_limit into which SR the answer has to be pushed. (I guess expr.parent())
I think the _proper_ way to do all these computations is to construct a dummy_limit or a dummy_integral in SR first ("inert" limit and "inert" integral being the less opinionated synonyms), convert that to maxima (via sr_to_max or string-based), call the appropriate simplification on it there (note that sr_to_max will absolutely not do any simplification. It's just mapping over expression trees) and then pull the answer back via max_to_sr or string based.
To come up with a truly robust design for this (the present was just a first hack and proof-of-concept), people who know a lot about SR and the general calculus architecture need to be involved. I've tried to show with various examples on this ticket that you don't need to understand much of lisp to make sense of what happens in maxima. The sage side of this is really much more complicated than the maxima side. The ECL objects representing maxima expressions look messy and have a lot of parentheses, but have a very straightforward structure.
Finally for (4): I know maxima functions like li[n] and psi[n] are not translated yet, because recognising them means looking a bit deeper in the maxima constructs. This is straightforward to do. There may be more of these constructs. Whoever wrote the string-based converter probably knows them already, because there they need special treatment too.
comment:45 follow-up: ↓ 46 Changed 9 years ago by
- Description modified (diff)
comment:46 in reply to: ↑ 45 Changed 9 years ago by
doctesting on 4.6.1 yields failures in only 12 files, and most of these are just changed formatting of output, numerical noise because floats are now binarily copied rather than transcribed via decimal string representations, and because some errors get reported differently. (For ECL everything is a RuntimeError?, for instance).
List here:
devel/sage/sage/symbolic/assumptions.py
: "Assumption
is inconsistent" errors get reported differently
devel/sage/sage/symbolic/function_factory.py
: Serious issues with
translating FDerivative constructs (it doesn't work at the moment)
devel/sage/sage/symbolic/expression.pyx
: A strange
issue with (x*log(9)).simplify_log('all')
. Oddly,
(x*log(3/7)).simplify_log('all')
does behave correctly.
devel/sage/sage/symbolic/integration/integral.py
:
"Maxima asks a question" errors get reported differently, float issues
devel/sage/sage/interfaces/maxima.py
: "Maxima asks
a question" errors get reported differently. These doctests are wrong, because they test the maxima_lib interface via calculus, not a real maxima interface.
devel/sage/sage/interfaces/maxima_abstract.py
:
These doctests were never adapted
devel/sage/sage/calculus/calculus.py
: Whitespace
and nintegral reports failure differently.
devel/sage/sage/calculus/wester.py
: Looks like
correct answer, but differently collected.
devel/sage/sage/calculus/tests.py
: Odd errors. They seem to depend on
context. Perhaps assumptions that aren't properly forgotten or max_to_sr cache that gets spoilt?
devel/sage/sage/calculus/desolvers.py
: lots of
problems. The desolve interface probably needs treatment like the to_poly_solve routine.
devel/sage/sage/calculus/functional.py
: "Maxima
asks a question" gets reported differently
devel/sage/sage/symbolic/assumptions.py
:
Inconsistent assumptions get reported differently.
Most of these are a matter of changing the doctests to the generated answer, but a few serious issues remain.
comment:47 Changed 9 years ago by
David Kirkby and I have started to look at up updating ecl to 11.1.1 in #10766. From my own experiments some of this patch set will need rebasing if it goes in.
I will certainly test your new patch.
comment:48 Changed 9 years ago by
the lisp function retrieve
in maxima is responsible for asking questions, so we just monkey-patch it to throw an error with an informative message instead. The patch trac_7377-better-ask-error.patch improves the readability of this message by executing exactly the original code in retrieve, but wrapped in a (with-output-to-string (*standard-output*) ...)
. The method is generally applicable and may be useful in adapting other printing bits.
Oddly enough, this patch does not invalidate any additional doctests, but:
sage -t "devel/sage-devel/sage/interfaces/maxima_lib.py" ********************************************************************** Error: TAB character found.
so perhaps maxima inserts a TAB in the error message. Are TABs not allowed in doctest output?
(it looks like one gets produced and matched by a "..." in the doctest template). A sage -t --verbose
shows that no individual test fails.
comment:49 Changed 9 years ago by
I accidentally introduced a TAB by mistake in a doctest the other and it was flagged so I'd say it is not allowed. Good news, bad news time. David Kirkby and I are updating ecl to 11.1.1 and maxima to 5.23.2 in #10766 (ecl) and #10773 (maxima).
The bad news is that the current patches in this ticket will need rebasing again because of the patches I had to apply for ecl-11.1.1. Actually I wouldn't mind some input on #10766 as it seem to resurrect #6189.
comment:50 Changed 9 years ago by
I forgot I already posted about ecl. Anyway, Nils could you put in the description the list of patches to apply and in which order if it is relevant?
I mean, is the error_catching.patch still necessary with the 2 new patches?
comment:51 Changed 9 years ago by
Never mind. I'll just go to bed.
comment:52 Changed 9 years ago by
- Description modified (diff)
comment:53 follow-up: ↓ 54 Changed 9 years ago by
#10766 and #10773 now both have positive review. #10766 vis-a-vis #6189 does happen, but maybe it just doesn't matter - that's what we concluded, but we'll see how the release manager(s) feels (feel).
I would like to work on fixing some of these issues soon enough for this to be in 4.7, but I have a feeling the desolver and abstract derivative piece might be a little time-consuming. At worst with the deriv, we could just figure out what Sage was passing/getting from Maxima before and jerry-rig that, though it's not a long-term solution.
comment:54 in reply to: ↑ 53 Changed 9 years ago by
desolver
This might be not so bad.
The main thing there is that the call forms for "desolve" are rather complicated, because there are all kinds of auxiliary arguments. to_poly_solve had a similar problem. I solved that by declaring an explicit to_poly_solve method on maxima_lib.MaximaElement?.
Probably just parsing the optional arguments and putting them together in the right kind of structure (see to_poly_solve for an example) solves most problems.
I don't know how bad the structures are that come back from desolve, but for most cases I have had surprisingly little problems in that direction.
abstract derivative
The whole D[0](f)
syntax needs separate treatment. I realized later that currently, only
D[i,j,k](f)(x1,x2,...,xn)
is allowed if x1,...,xn
are distinct symbolic variables. This surprised me a bit. Sage support for functional derivatives is only rudimentary.
I think that if we have an expression: D[i0,...,ir](f)(e0,...,en)
, we should just do
diff( f(t0,...,tn), [[t0,...,tn][i] for i in [i0,...,ir]]).subs({t0:e0,...,tn:en})
i.e., introduce temporary variables t0,...,tn to take the appropriate derivate relative to named variables and then specialize to the evaluation point requested. Is there a reason this approach has not been taken? Just lack of need/implementation time?
In Maxima one can take exactly the same approach:
at(diff( f(t0,t1,t2,t3) , t0,1,t1,1,t0,1 ), [t0=e0,t1=e1,t2=e2])
the documentation of at is scary: substitutions are done in series, not in parallel. That's basically a bug given the intended use of the routine, even though it is documented behaviour. However, if we make sure that our temporary variables are truly unique, there should be no problem. Perhaps call gensym
.
comment:55 follow-up: ↓ 56 Changed 9 years ago by
OK so I tested the new patch set on sage-on-gentoo and it is strange. I see all the doctests failures that Nils is seeing. Plus a few more strangely enough in scheme/elliptic_curves/ that you wouldn't think are related. But I also get a lot of SIGFPE all over the place from seemingly unrelated components (mpmath, pynac...). They go away when I rebuild without the patches.
I fail to see the cause to effect relation between maxima-lib and these, but there they are.
I almost forgot I have an unpickling failure as well
sage -t -force_lib "devel/sage-main/sage/structure/sage_object.pyx" ********************************************************************** File "/usr/share/sage/devel/sage-main/sage/structure/sage_object.pyx", line 1053: sage: print "x"; sage.structure.sage_object.unpickle_all() Expected: x... Successfully unpickled ... objects. Failed to unpickle 0 objects. Got: x doctest:1: DeprecationWarning: Your word object is saved in an old file format since FiniteWord_over_OrderedAlphabet is deprecated and will be deleted in a future version of Sage (you can use FiniteWord_list instead). You can re-save your word by typing "word.save(filename)" to ensure that it will load in future versions of Sage. doctest:1: DeprecationWarning: Your word object is saved in an old file format since AbstractWord is deprecated and will be deleted in a future version of Sage (you can use FiniteWord_list instead). You can re-save your word by typing "word.save(filename)" to ensure that it will load in future versions of Sage. doctest:1: DeprecationWarning: Your word object is saved in an old file format since Word_over_Alphabet is deprecated and will be deleted in a future version of Sage (you can use FiniteWord_list instead). You can re-save your word by typing "word.save(filename)" to ensure that it will load in future versions of Sage. doctest:1: DeprecationWarning: Your word object is saved in an old file format since Word_over_OrderedAlphabet is deprecated and will be deleted in a future version of Sage (you can use FiniteWord_list instead). You can re-save your word by typing "word.save(filename)" to ensure that it will load in future versions of Sage. doctest:1: DeprecationWarning: ChristoffelWord_Lower is deprecated, use LowerChristoffelWord instead * unpickle failure: load('/home/fbissey/.sage/temp/QCD_nzi3/26167/dir_2/pickle_jar/_class__sage_interfaces_maxima_MaximaFunction__.sobj') Failed: _class__sage_interfaces_maxima_MaximaFunction__.sobj Successfully unpickled 585 objects. Failed to unpickle 1 objects.
comment:56 in reply to: ↑ 55 Changed 9 years ago by
Replying to fbissey:
But I also get a lot of SIGFPE all over the place from seemingly unrelated components
ECL does normally install SIG handlers, but we try to put them back (at the time Juanjo said this should be basically safe). The responsible code is in sage.libs.ecl.init_ecl()
,
sage/libs/ecl.pyx:131
.
#get all the signal handlers (does any system have signal numbers above 32?) for i in range(1,33): sigaction(i,NULL,&(act[i])) #initialize ECL cl_boot(0, argv) #and put the signal handlers back for i in range(1,33): sigaction(i,&(act[i]),NULL)
To see if this is the culprit, take a pristine sage and ensure that sage.libs.ecl_init() gets called upon initialization (i.e., insert a call into some module to ensure this gets called. Normally it doesn't) Now run the SIGFPE producing doctests. Do they offend again? Perhaps you can improve ecllib's initialization?
Other things to watch out for:
- Your Boehm-Weiser GC might be built with different options
- Make sure that ecl.so links against the same MPIR/GMP library. Having two GMPs hang around will definitely wreak havoc.
(I think I saw the pickling error too. Some gherkin expert can probably easily pinpoint what's wrong and how to fix it)
comment:57 follow-up: ↓ 58 Changed 9 years ago by
I produced new versions of the patches based on Sage 4.6.2.alpha4, ECL 11.1.1 of #10766 and Maxima 5.23.1 of #10773.
I think I forgot to include some changes in Sage in the previous rebased patches, things should be better with those versions.
The patches will follow shortly.
I'm currently running "make ptest" to check I get the same failures as what was posted above.
I'm also currently trying to get rid of the Pexpect class inheritage of MaximaAbstract? and MaximaLib? classes.
The best idea I got so far is to split all the non-pexpect and non-communication things of Sage pexpect class into a parent class and make MaximaAbstract? inherit from that class so that we still have access to all the nice features defined in Pexpect class.
MaximaLib? would just inherit MaximaAbstract? and Maxima woulb inherit both MaximaAbstract? and Pexpect.
I'll post this set of patches asap.
comment:58 in reply to: ↑ 57 Changed 9 years ago by
The best idea I got so far is to split all the non-pexpect and non-communication things of Sage pexpect class into a parent class and make MaximaAbstract? inherit from that class so that we still have access to all the nice features defined in Pexpect class.
Yes, we want to make sure that we can still use Maxima via the console as before, with all the usual stuff. I don't know exactly the best way to do that, but we definitely want that.
comment:59 follow-up: ↓ 61 Changed 9 years ago by
Here is the list of the failure left in "make ptest" with all "_p2" patches applied:
The following tests failed: sage -t -force_lib devel/sage/sage/symbolic/assumptions.py # 2 doctests failed sage -t -force_lib devel/sage/sage/symbolic/function_factory.py # 3 doctests failed sage -t -force_lib devel/sage/sage/symbolic/expression.pyx # 1 doctests failed sage -t -force_lib devel/sage/sage/symbolic/integration/integral.py # 5 doctests failed sage -t -force_lib devel/sage/sage/interfaces/maxima_lib.py # 0 doctests failed sage -t -force_lib devel/sage/sage/interfaces/maxima.py # 2 doctests failed sage -t -force_lib devel/sage/sage/calculus/tests.py # 4 doctests failed sage -t -force_lib devel/sage/sage/calculus/wester.py # 1 doctests failed sage -t -force_lib devel/sage/sage/calculus/calculus.py # 2 doctests failed sage -t -force_lib devel/sage/sage/calculus/desolvers.py # 7 doctests failed sage -t -force_lib devel/sage/sage/calculus/functional.py # 1 doctests failed sage -t -force_lib devel/sage/sage/structure/sage_object.pyx # 1 doctests failed
- symbolic/assumptions.py : Error reporting changed (RuntimeError ...)
- symbolic/function_factory.py : "del" thing as posted earlier
- symbolic/expression.pyx : got "x*log(9)" instead of "log(9^x)" so Maxima got better in simplify_all, but also a lot of blabbering : "solve: using arc-trig functions to get a solution.
Some solutions will be lost." and "rat: replaced -0.032 by -4/125 = -0.032"
- symbolic/integration/integral.py : error reporting, numerical noise and same kind of verbosity as mentionned above ("rat: replaced ...")
- interfaces/maxima_lib.py : TAB character (anyway changes are still missing)
- interfaces/maxima.py : Error reporting
- calculus/tests.py :
- integrate(ceil(x^2 + floor(x)), x, 0, 5) gives 155/3 instead of integrate(ceil(x^2) + floor(x), x, 0, 5), Maple gives me 145
- integrate(sin(x), x, a, b) gives cos(a) - cos(b) instead of ceil(cos(a)) ...
- next 2 errors are __call__() takes at most 3 arguments (4 given)
- calculus/wester.py : some verbosity ("solve:..."), the results are printed differently but are equal (I'll test with #9880)
- calculus/calculus.py :
- a = sage.calculus.calculus.maxima("x#0"); a gives x # 0 and a lot of strange verbosity ("*JOB ABORT DUE TO UNRECOVERED ERROR.") instead of x#0
- nintegral reports error differently
- calculus/desolvers.py : seems broken, lots of ascii art displayed things
- calculus/functional.py : error reporting
- structure/sage_object.pyx : unpickle failure: load('/home/jp/.sage/temp/napoleon/8057/dir_2/pickle_jar/_class__sage_interfaces_maxima_MaximaFunction__.sobj')
So I get the same errors as reported above. I don't know why Maxima gets so verbose ("rat:...", "solve:...", ascii art things in desolve, "-- an error. To debug this try debugmode(true);"...), was it intended in the patches ?
Cheers,
comment:60 follow-up: ↓ 62 Changed 9 years ago by
My experience is totally different. I patched my sage-on-gentoo to the max (ecl/maxima/cython/mpmath/ppl+this set), reinstall ecl-11.1.1, maxima-5.23.2 and sage-4.6.2.alpha4 and ran the tests.
The only abnormal failure for sage-on-gentoo was interfaces/r.py and it didn't show up again when I tried it individually. No SIGFPE, everything fine. This is a 64 bit intel machine and the install of the sage spkg itself was from scratch.
It's the first time this patch set doesn't give me a huge amount of broken doctests back.
comment:61 in reply to: ↑ 59 Changed 9 years ago by
Replying to jpflori:
So I get the same errors as reported above. I don't know why Maxima gets so verbose ("rat:...", "solve:...", ascii art things in desolve, "-- an error. To debug this try debugmode(true);"...), was it intended in the patches ?
That's wonderful! A cleaner refactoring as proposed above would be great. Concerning the verbosity: Maxima is always like that. With the current interface, pexpect receives this and filters it out. With the library setup, we're not listening to stdout anymore, so this ends up with the user. Possible solutions:
- get maxima patched to have options to remove these warnings & verbosity. There are already a few out there (no error message is printed anymore thanks to turning one off), but others survive (the " -- an error occurred ..." is hard-wired. I've reported that one to Maxima)
- live with it (that shouldn't be necessary)
- redirect lisp standard output. Thankfully, lisp wraps all its I/O in its own stream system which allows for redirection so if we feed (setf *standard-output* *dev-null*) to ECL during maxima initialization, we'll never see anything (obviously not a good idea for debugging). Perhaps we also need that on *standard-error*. In fact, since a lot of this output does not seem to affect doctesting, perhaps it's already ending up on stderr.
This actually suggests another approach to getting a strings-based interface to maxima/ECLlib:
- locate the Maxima Read/Evaluate/Print? loop and break it open to just be a Read/Evaluate/Print? routine maxima-rep (i.e., it returns instead of looping)
- wrap this routine:
(defun mrep-with-stringio (maxima-input-string) (let ((*standard-input* (make-string-input-stream maxima-input-string)) (*standard-output* (make-string-output-stream))) (maxima-rep) (get-output-stream-string *standard-output*) ))
This approach would be a little closer to the current pexpect interface, so you could possibly reuse more of the current maxima pexpect interface. You'd still only be communicating with maxima via string I/O, though, whereas we can do much better with the library. It would be an option if all you're interested in is creating an I/O based interface to maxima without fork.
comment:62 in reply to: ↑ 60 Changed 9 years ago by
Replying to fbissey:
My experience is totally different. I patched my sage-on-gentoo to the max (ecl/maxima/cython/mpmath/ppl+this set), reinstall ecl-11.1.1, maxima-5.23.2 and sage-4.6.2.alpha4 and ran the tests.
The only abnormal failure for sage-on-gentoo was interfaces/r.py and it didn't show up again when I tried it individually. No SIGFPE, everything fine. This is a 64 bit intel machine and the install of the sage spkg itself was from scratch.
It's the first time this patch set doesn't give me a huge amount of broken doctests back.
Dear me. I should have a curfew. I hadn't applied the maximalib patch after all. :(
comment:63 Changed 9 years ago by
I get the same thing that Jean-Pierre in the end. But the SIGFPE I had before are gone. For some tests it is indeed just a matter of change in error reporting and we could just fix the doctests. I notice that sage/interfaces/maxima.py and sage/symbolic/integration/integral.py have a test in common:"integral(x^n,x)" I also got an ecl error already mentioned
File "/usr/share/sage/devel/sage-main/sage/libs/ecl.pyx", line 415: sage: a Expected: <ECL: 9.999999999999999E39> Got: <ECL: 9.999999999999999e39>
comment:64 follow-up: ↓ 67 Changed 9 years ago by
I've put a first (very) rough version of a patch to refactor the different interfaces:
- It split the previous Expect classes in Interface classes (without pexpect stuff, did not find a better name) and Expect classes (inheriting from the previous ones + pexpect stuff)
- MaximaAbstract? classes depends on Interface classes
- MaximaLib? on MaximaAbstract?
- Maxima (classic) on MaximaAbstract? and Expect
It kind of works easily thanks to the current Method Resolution Order used by the version of Python in Sage but it obviously introduces a lot of new failures in addition to the one above.
The patch must be applied after the "_p2" patches (and ecl_iter).
It is quite big, touches a lot of files, and should be splitted in at least two parts (split Expect; refactor).
It is absolutely not considered as finished (very far from it) and I did not test it (apart from trivial things like integrate(x)), it is mainly to get some feedback on the choices I made, so any comments are mare than welcome.
comment:65 follow-up: ↓ 66 Changed 9 years ago by
comment:66 in reply to: ↑ 65 Changed 9 years ago by
Replying to drkirkby:
You should probably be aware of #10766 (an update of ECL), which has positive review and #10773 (an update of Maxima) which also has positive review.
If you look at the descriptions of the p2
patches, they all mention they depend on those new versions, though not by ticket number. I think they are based on Maxima 5.23.1 it says, but probably that is not 100% necessary.
comment:67 in reply to: ↑ 64 Changed 9 years ago by
Replying to jpflori:
It kind of works easily thanks to the current Method Resolution Order used by the version of Python in Sage but it obviously introduces a lot of new failures in addition to the one above.
Perhaps you can do a quick test if depending on multiple inheritance causes a huge slowdown in method resolution? (I guess that is the only major architectural change you're making). Since it's the *proper* thing to do even a small slowdown should be acceptable, but we wouldn't want to degrade too badly.
The patch must be applied after the "_p2" patches (and ecl_iter).
I recommend that you first do the refactoring *without* fast-calculus. That basically takes maxima_lib out of the equation and means you'll be refactoring code that is known to be good (actually, a quick test seems to indicate that the pexpect maxima interface based on abstract_maxima already breaks doctests. I think that back in 4.1.* or whatever Robert's work was based on, they were fine, so there may be some changes that didn't properly get adapted for the _p2 patches).
Perhaps open a separate ticket "refactor maxima to multiply inherit from a new class maxima_abstract and pexpect". It would reduce the number of complicating factors you'd be considering.
Work here would basically remain exploratory until that ticket is finished. We can then rebase the work here to your new organization of maxima interfaces. I noticed that your changes to maxima_lib.py were minimal so at least for now, that should be easy.
comment:68 follow-ups: ↓ 69 ↓ 70 ↓ 71 Changed 9 years ago by
Ok I found the reason of the strange "ceil" function appearing.
That's because sr_to_max calls op_max=caar(maxima(expr).ecl()) and maxima(expr) can simplify the object change its structure, so the dictionary is wrongly built (we get "ceil" for "+").
Putting op_max=maxima(op).ecl() seems functional.
The issue with (log(9)*x).simplify_log('all') is similar.
Maxima transforms log(9^x) back to log(9)*x before it is passed to string function in max_to_string:
(%i8) logexpand:false$ (%i9) string(log(9^x)); (%o9) "log(9)*x" (%i10) log(9^x); (%o10) log(9)*x (%i11) simp:false$ (%i12) log(9^x); (%o12) log(9^x) (%i13) string(log(9^x)); (%o13) "log(9^x)"
As far as the classic pexpect interface is concerned, a lot of problems are solved if one changes "back" return result to return result._sage_() in sage.symbolic.integration.external
It used to be return result.sage() but some routines in the fastcalculus patch for maxlib return symbolic object which do not have such a method but one with underscores.
I'll post updated patches when they are in a better shape.
comment:69 in reply to: ↑ 68 Changed 9 years ago by
First of all, great sleuthing! Excellent progress.
Ok I found the reason of the strange "ceil" function appearing.
That's because sr_to_max calls op_max=caar(maxima(expr).ecl()) and maxima(expr) can simplify the object change its structure, so the dictionary is wrongly built (we get "ceil" for "+").
Putting op_max=maxima(op).ecl() seems functional.
I think I tried your alternative before, but that could also lead to parse errors (feeding just the operator to maxima may not lead to a syntactical expression on the other side). Note that the "learning" via the strings-based interface is only a hack to profit from work done there (and to stay compatible with it). Most of this knowledge on how to map SR.operator() objects to maxima and back, is hand-coded somewhere in sage anyway. If we could get that info once and for all and transcribe it to the sr_to_max dicts, we wouldn't need this hack anymore.
The issue with (log(9)*x).simplify_log('all') is similar.
Maxima transforms log(9^x) back to log(9)*x before it is passed to string function in max_to_string:
Interesting! So this problem would disappear again if simplify_log were wrapped similarly to sr_integral etc., where sr_to_max and max_to_sr are used as much as possible.
comment:70 in reply to: ↑ 68 Changed 9 years ago by
Replying to jpflori:
Maxima transforms log(9^x) back to log(9)*x before it is passed to string function in max_to_string:
Thanks for locating the error! It's simply that maxima's string
(in lisp $STRING
) does too much work, meaning that max_to_string involves a new call to MEVAL. The definition is in suprv1.lisp
and points to what to do differently. Two definitions in maxima_lib.py need adjusting:
maxprint=EclObject("(defun mstring-for-sage (form) (coerce (mstring form) 'string))").eval() def max_to_string(s): return maxprint(s).python()[1:-1]
WARNING: the routine maxprint is lisp, not maxima and is presently not run under maxima-eval's control, so maxima errors will be poorly reported. If converting maxima expressions to strings can trigger errors we need an adjusted version of maxima-eval that calls EVAL rather than MEVAL on the parameter (to execute lisp code under our replacement of maxima's toplevel)
comment:71 in reply to: ↑ 68 Changed 9 years ago by
Replying to jpflori:
That's because sr_to_max calls op_max=caar(maxima(expr).ecl()) and maxima(expr) can simplify the object change its structure, so the dictionary is wrongly built (we get "ceil" for "+").
Putting op_max=maxima(op).ecl() seems functional.
A little digging gives us a way to access *just* the maxima reader, without the extra evaluation:
mymread=ecl_eval(""" (defun my-mread (cmd) (caddr (mread (make-string-input-stream cmd)))) """) def parsemaxstring(l): return mymread('"%s;"'%l)
Examples:
sage: parsemaxstring("integral(x^2,x)") <ECL: (($INTEGRAL) ((MEXPT) $X 2) $X)> sage: parsemaxstring("ceiling(x^2+floor(x))") <ECL: (($CEILING) ((MPLUS) ((MEXPT) $X 2) (($FLOOR) $X)))> sage: parsemaxstring("log(9^x)") <ECL: ((%LOG) ((MEXPT) 9 $X))>
The effect is about the same as
sage: EclObject("#$ceiling(x^2+floor(x))$").cdr().car().cdr().car() <ECL: (($CEILING) ((MPLUS) ((MEXPT) $X 2) (($FLOOR) $X)))>
comment:72 follow-up: ↓ 73 Changed 9 years ago by
With the new version of the patch only the following errors persist with maxima as a lib:
- unpickling problems,
- some timeouts (sage.interfaces.gap3).
And trivial to fix:
- error reporting,
- floating point precision.
With the classical maxima, I only get the first set of errors.
The translation of the derivatives seems better than before and the errors in desolver disappeared.
comment:73 in reply to: ↑ 72 Changed 9 years ago by
Great work! The patches don't apply on 4.6.1 so I can't test them at the moment. Reading through the patch:
- Line 74
(string-trim '(#\Newline) (with-output-to-string (*standard-output*) (terpri)
If you're going to trim the newlines, don't bother with terpri. It just inserts a newline. Perhaps if you delete the terpri the trimming isn't necessary (I put it there because previously, the "ask" error messages had a newline before the question)
- derivatives: If you want FDerivativeOperator handled by special_sage_to_max you'll need to change a bit more than just the API of the functions in that dictionary (for that, you can just put "op" as the first parameter and not use it in most cases)
One possibility is to index special_sage_to_max by type(op) rather than op. Then it makes a lot more sense to pass op as a parameter too (because currently, the op would be a constant for any entry in special_sage_to_max).
- the line:
[deriv_max.extend([sr_to_max(args[i]), EclObject(params.count(i))]) for i in set(params)]
leads to an algorithm that is quadratic in the number of variables, but it should be (soft) linear. It should be interesting to design an example where this matters ...)
comment:74 follow-up: ↓ 75 Changed 9 years ago by
There is currently a problem with ecl and signals.
With the current initialization, interrupting a computation does not work well.
You can try the example of sage.interfaces.maxima with maxima as a lib:
sage: from sage.interfaces.maxima_lib import maxima_lib as maxlib sage: maxlib('sum(1/x^2, x, 1, 10000)') # or bigger to be convinced
and hit Ctrl+C immediately.
comment:75 in reply to: ↑ 74 ; follow-up: ↓ 76 Changed 9 years ago by
Replying to jpflori:
There is currently a problem with ecl and signals.
Yes, sage.lib.ecl simply does not enable them.
It looks like ECL development has carefully looked at how to best handle signals. See http://ecls.sourceforge.net/new-manual/ch22.html . But it also looks like a non-trivial task to adapt Sage's signal handling to play nice with the way ECL expects it. The ECL_OPT_SIGNAL_HANDLING_THREAD way sounds patently incompatible with sage.
You could of course try to just insert the appropriate sig_on() and sig_off() around the calls to ecl's "eval" and hope for the best. This must be a problem that has arisen for other libraries, such as pari, singular, ginac, gap etc.
comment:76 in reply to: ↑ 75 ; follow-up: ↓ 77 Changed 9 years ago by
comment:77 in reply to: ↑ 76 Changed 9 years ago by
comment:78 follow-up: ↓ 79 Changed 9 years ago by
I have tested the new packages with 4.6.2.alpha4 and I am finding largely agreement with JP. As a baseline, I have used ECL and Maxima from #10766 and #10773 respectively, with applied patches:
trac_10766-fix_doctest.patch trac_10766-fix_symbolic_integration_integral.patch trac_10773-fix_maxima_version.patch trac_10743-ecl-iter_p1.patch handlerswap.p2.patch #this is from ticket #10818
All doctests are OK there. When I further apply
trac_7377-abstract-maxima_p2.patch trac_7377-maximalib_p2.patch trac_7377-fastcalculus_p2.patch trac_7377-better-ask-error_p2.patch trac_7377-split_and_refactor.patch
I am finding doctest failures that are just due to different errors reporting and floating point, so these can be fixed by changing the doctests:
sage -t devel/sage-main/sage/calculus/functional.py # 1 doctests failed sage -t devel/sage-main/sage/interfaces/maxima.py # 2 doctests failed sage -t devel/sage-main/sage/symbolic/assumptions.py # 2 doctests failed sage -t devel/sage-main/sage/symbolic/integration/integral.py # 5 doctests failed
Furthermore,
sage -t devel/sage-main/sage/tests/startup.py # 1 doctests failed
usually fails. Note that we are now initializing ECL upon startup, so we're really doing more work. Should we be lazy with this? This just means that the calculus maxima instance would have to be made lazy (i.e., set to a function that initializes maxima and then rebinds sage.calculus.maxima)
sage -t devel/sage-main/sage/structure/sage_object.pyx # 1 doctests failed
needs a pickling expert
sage -t devel/sage-main/sage/interfaces/gap3.py # Time out
this is a real error that was probably introduced by split_and_refactor
. The timeout is caused by an infinite recursion upon exit (run with -verbose) and probably has to do with the fact that
sage: gap3("1+2")
now fails differently. It seems that a "name()" attribute is missing. If you now try to "quit()", an infinite loop on some Exception resolution is triggered, but I expect the damage happened in the line above. gap3 is optional, by the way, but the error apparently already happens with tests that check the absence of gap3.
Impressive progress indeed!
comment:79 in reply to: ↑ 78 ; follow-up: ↓ 80 Changed 9 years ago by
Replying to nbruin:
sage -t devel/sage-main/sage/interfaces/gap3.py # Time out
this is a real error that was probably introduced bysplit_and_refactor
. The timeout is caused by an infinite recursion upon exit (run with -verbose) and probably has to do with the fact thatsage: gap3("1+2")
now fails differently. It seems that a "name()" attribute is missing. If you now try to "quit()", an infinite loop on some Exception resolution is triggered, but I expect the damage happened in the line above. gap3 is optional, by the way, but the error apparently already happens with tests that check the absence of gap3. Impressive progress indeed!
Thanks for that one, I do not have gap3 installed and get the time out, but did not bother. I'll have a look at it.
comment:80 in reply to: ↑ 79 Changed 9 years ago by
The benefits of unexpected snow ... It looks like the gap3 problem was due to some unqualified references to name()
in sage.interfaces.interface, where it should be self.name()
. Patch attached, but since this was a rather low-brained search-and-replace, JP should check I didn't miss any/didn't change any erroneously.
The one pickling problem is the only issue left!
comment:81 Changed 9 years ago by
Some forensics on:
sage -t devel/sage-main/sage/structure/sage_object.pyx
The error occurs on
_class__sage_interfaces_maxima_MaximaFunction__.sobj
in the pickle jar, coming from the doctest (slightly adapted):
sage: f=maxima.function('x,y','sin(x+y)') sage: save(f,"newpickle.sobj") sage: load("newpickle.sobj")==f True
The incompatibility seems to come from a rearranging of the abstract_maxima interface etc. To pin down version information:
$ ls -l _class__sage_interfaces_maxima_MaximaFunction__.* -rw-r--r-- 1 nbruin nbruin 96 2009-03-10 13:04 _class__sage_interfaces_maxima_MaximaFunction__.sobj -rw-r--r-- 1 nbruin nbruin 130 2009-03-10 13:04 _class__sage_interfaces_maxima_MaximaFunction__.txt $ cat _class__sage_interfaces_maxima_MaximaFunction__.txt type(obj) = <class 'sage.interfaces.maxima.MaximaFunction'> version = 3.4.rc1 obj = ' sage270'
Loading this pickle into a new version yields:
sage: load("/home/nbruin/_class__sage_interfaces_maxima_MaximaFunction__.sobj"); AttributeError: 'module' object has no attribute 'reduce_load_Maxima_function'
On the other hand, loading the new pickle into an old version (4.3.4):
sage: load("newpickle.sobj"); ImportError: No module named maxima_abstract
So this seems to be not so much an error but more a non-compatible change. I am sure these have happened before elsewhere. I'd be happy to just accept the fact that these pickles aren't portable across these versions, but if someone has an example we might be able to put the hooks in to preserve backwards compatibility (really, no-one should have a reason to pickle maxima functions from sage).
comment:82 Changed 9 years ago by
Replying to nbruin:
The benefits of unexpected snow ... It looks like the gap3 problem was due to some unqualified references to
name()
in sage.interfaces.interface, where it should beself.name()
. Patch attached, but since this was a rather low-brained search-and-replace, JP should check I didn't miss any/didn't change any erroneously. The one pickling problem is the only issue left!
Thanks for the fix, that was my mistake: I changed some references to self.__name to calls to a name() function which was much more clear with the new class hierarchy.
I confirm that your patch fixes the gap3 timeout (without gap3 installed).
I'll post an updated patch "split_and_refactor" including your fixes and some changes so that the name of "MaximaLib?" is now "_maxima_lib_" (even if most of the time, if not always, the related objects are treated like maxima ones for now).
As far as the pickling problem is concerned, I was aware that it was "just" caused by the changes in class hierarchy (and names).
I search a little bit through Google (http://ask.sagemath.org/question/123/what-is-the-standard-pickle-jar-for-and-how-do-i), and I think the Sage general policy is to be able to pick up old pickles (quite lgical), so I guess that we should try to include a workaround.
...Ok you've just posted a fix for that one too, so I'll include it as well.
comment:83 Changed 9 years ago by
- Description modified (diff)
comment:84 Changed 9 years ago by
That sounds great. Just to be picky could the split_and_refactor patch be consolidated? By that I mean that the patchset patch some files like sage/interfaces/expect.py and then patch over that patch. It makes things fairly difficult to follow from my point of view.
comment:85 Changed 9 years ago by
I'm currently running "make ptestlong" to check for errors we could have missed.
As soon as it is finished (say in a couple of hours), I'll post a new version of "split_and_refactor" including the following patches:
trac_7377-split_and_refactor.patch trac_7377-interface-namefix.patch trac_7377-pickle-fix.patch
And a minor change I made inbetween which is in none of these patches (setting the "name" of maxima lib to "_maxima_lib_" rather than "_maxima_").
Is that what you wanted (there will still be successive patches applied to maxima* files... however) ?
comment:86 Changed 9 years ago by
That's not what I meant Jean-Pierre. The current split_and_refactor patch starts with:
diff -r a928dca2950b -r b766df9c3439 sage/interfaces/expect.py --- a/sage/interfaces/expect.py Fri Feb 04 14:19:57 2011 -0800 +++ b/sage/interfaces/expect.py Mon Feb 14 14:06:15 2011 +0100 @@ -42,6 +42,8 @@ import time
and some patching is done to that file. Then later in the same patch file file we have
from mupad import mupad, mupad_console, Mupad # NOT functional yet diff -r b766df9c3439 -r fba59ed64da6 sage/interfaces/expect.py --- a/sage/interfaces/expect.py Mon Feb 14 14:06:15 2011 +0100 +++ b/sage/interfaces/expect.py Wed Feb 16 16:38:39 2011 +0100 @@ -489,12 +489,6 @@ except Exception, msg:
Which is applied on top of the previous one. sage/interfaces/maxima_lib.py is also in that case and I am fairly sure there is a third one like that.
I am guessing the first set is the "split" part and the second "refactor". In short I would prefer if there was only one instance of patching these files rather than two in succession in the same patch. But as I said that's because I am being picky. Mercurial seems to cope fine with those, gnu patch doesn't really like them.
comment:87 follow-up: ↓ 88 Changed 9 years ago by
With the new patch that follows (and without lazy patch!), I only get the following failures due to error reporting and float precision:
---------------------------------------------------------------------- The following tests failed: sage -t -long -force_lib devel/sage/sage/interfaces/maxima.py # 2 doctests failed sage -t -long -force_lib devel/sage/sage/calculus/functional.py # 1 doctests failed sage -t -long -force_lib devel/sage/sage/symbolic/assumptions.py # 2 doctests failed sage -t -long -force_lib devel/sage/sage/symbolic/integration/integral.py # 5 doctests failed ---------------------------------------------------------------------- Total time for all tests: 2633.7 seconds
The update patch should be "consolidated" as asked (that was because of the command I used to generate it).
So the patches should be applied as follows:
trac_7377-abstract-maxima_p2.patch trac_7377-maximalib_p2.patch trac_7377-fastcalculus_p2.patch trac_7377-better-ask-error_p2.patch trac_7377-split_and_refactor_p2.patch
Applying "lazy" patch breaks more test for me:
- lazy objects are not callable so maxima(x) fails in sage.plot.plot3d.plot3d
- exception raised in sage.plot.line
comment:88 in reply to: ↑ 87 Changed 9 years ago by
Replying to jpflori:
Applying "lazy" patch breaks more test for me:
- lazy objects are not callable so maxima(x) fails in sage.plot.plot3d.plot3d
- exception raised in sage.plot.line
Sorry and thanks for catching. Both are solved by adding a "call" method to lazy:
def __call__(self,*args,**kwargs): import sage.interfaces.maxima_lib sage.calculus.calculus.maxima = sage.interfaces.maxima_lib.maxima return sage.calculus.calculus.maxima(*args,**kwargs)
but in fact sage.misc.lazy_import
does exactly what we need here. (See attached patch). I've ran doctests and I don't think the lazy causes additional fails.
Incidentally, I'm getting a silly doctest failure
sage -t "devel/sage-main/sage/interfaces/maxima_abstract.py"
for the result of
sage: sorted(maxima._commands(verbose=False))
but it looks like nothing has changed. Perhaps my build is corrupted.
comment:89 follow-up: ↓ 91 Changed 9 years ago by
Turns out the rounding errors weren't really that. Rather, max_to_sr preferred to return floats rather than RealDoubleElement?, which are apparently the sage default type for float, and these print differently:
sage: var('x,y') (x, y) sage: assume(y>1) sage: M=sage.calculus.calculus.maxima sage: I1=SR(M("integrate(log(x^2+y^2),x,0.0001414,1.0)")) sage: I2=integrate(log(x^2+y^2),x,0.0001414,1.0) sage: c1=I1.operands()[2].operands()[1].pyobject() sage: c2=I2.operands()[2].operands()[1].pyobject() sage: [c1,c2] [-0.0001414, -0.00014139999999999999] sage: [type(c1),type(c2)] [<type 'sage.rings.real_double.RealDoubleElement'>, <type 'float'>]
Patch attached. That means that the only doctest failures now are due to the fact that "maxima asks a question" gets reported via a different error. Ready for review?
comment:90 Changed 9 years ago by
- Description modified (diff)
comment:91 in reply to: ↑ 89 ; follow-up: ↓ 92 Changed 9 years ago by
Patch attached. That means that the only doctest failures now are due to the fact that "maxima asks a question" gets reported via a different error. Ready for review?
I'm sorry I haven't been able to test this lately. Can you give an example? As long as the end user still knows what to do (as in, assume(x>0)
etc.) that should be fine.
comment:92 in reply to: ↑ 91 ; follow-up: ↓ 95 Changed 9 years ago by
Replying to kcrisman:
Patch attached. That means that the only doctest failures now are due to the fact that "maxima asks a question" gets reported via a different error. Ready for review?
I'm sorry I haven't been able to test this lately. Can you give an example? As long as the end user still knows what to do (as in,
assume(x>0)
etc.) that should be fine.
For example:
sage: integral(x^n,x) Expected: Traceback (most recent call last): ... TypeError: Computation failed since Maxima requested additional constraints (try the command 'assume(n+1>0)' before integral or limit evaluation, for example): Is n+1 zero or nonzero? Got: Traceback (most recent call last): ... RuntimeError: ECL says: Maxima asks: Is n+1 zero or nonzero?
So we do not parse the error message and are less explicit than before.
There are still some things I'd like to change before a potential review:
- Currently the interact function is broken for maxima_lib, it would be nicer to have it working than deleting it (and we should not leave something broken)
- I'll update "split_and_refactor" to get rid of superfluous terpri or string-trim as stated in comment 73
- Someone should check error stated in comment 88, I also got it sometimes, not sure why because that code was not so much touched
- I could merge "floatcast" with "fast_calulculus" or "split_and_refactor" so that we have less patches to apply and it is easier to test
- Parse error messages or just change the doctests and do bettor error reporting later.
Afterwards (in other tickets ?):
- Add doctests to maxima_abstract and maxima_lib
- Avoid as much as possible string conversion in maxima_lib and take into account comment 73.
comment:93 Changed 9 years ago by
Here is a patch to fix the interact function. It was only broken because python_to_ecl did not convert unicode objects.
My workaround is to convert the unicode object to an str object and convert that object as before.
There is surely a better way to do it, feel free to post a better patch and I'll integrate it to split_and_refactor instead of this one.
comment:94 Changed 9 years ago by
Does this patch means that sage won't be allergic to ecl being compiled with unicode support anymore? https://github.com/cschwan/sage-on-gentoo/issues/closed#issue/2
comment:95 in reply to: ↑ 92 Changed 9 years ago by
Thanks for indulging me, that helps a lot.
sage: integral(x^n,x) Expected: Traceback (most recent call last): ... TypeError: Computation failed since Maxima requested additional constraints (try the command 'assume(n+1>0)' before integral or limit evaluation, for example): Is n+1 zero or nonzero? Got: Traceback (most recent call last): ... RuntimeError: ECL says: Maxima asks: Is n+1 zero or nonzero?So we do not parse the error message and are less explicit than before.
Hmm, we should really catch this particular RuntimeError? (enough to search for 'Maxima asks', I think) and then copy the code which gave the user a potential way to fix it. This behavior will be too confusing for the most likely people to be using Maxima, which is why we changed it the first time. Should be pretty easy to copy from the previous behavior, though, if you are still getting this error.
comment:96 follow-ups: ↓ 97 ↓ 98 Changed 9 years ago by
- Better organization of patches: Yes! Keep in mind that separate patches have served us well previously, though, when initial fixes were amended (e.g., lazy loading).
- unicode_to_ecl: seems like a reasonable approach to me. ECL can support unicode, but that is probably not of much use to us. Should that one go on a separate ticket, though? (think bitrot)
- doctest in http://trac.sagemath.org/sage_trac/ticket/7377#comment:88 Perhaps the following helps. I tried that test on a pristine patched 4.6.2 and it passed. Then I ran
make ptestlong
and now it fails -- also when run individually. So that would point to ptestlong changing something. Does it rewrite/invalidate some maxima cache somewhere?
- errors: I realized I was not quite correct. Errors about inconsistent assumptions now get reported differently too.
- effort on error messages: Exceptions get used as a program flow control tool (e.g., in the coercion system) so any extra effort on constructing an error message has the potential of slowing down the system. So if you want extra info in the error message, put it where the string is created. We're controlling both sides of the plumbing anyway. See the better-ask-error patch. You could change it to something like
(cond ((not print?) ;;I'm not sure we want to honour this flag (setq print? t) (princ *prompt-prefix*) ;;and I'm not sure we care about pre/suffices either (princ *prompt-suffix*)) ((null msg) (princ "nothing") ((atom msg) (format t "~a~a~a" *prompt-prefix* msg *prompt-suffix*) ;;(format t "~a" msg ) ;;if we don't care about pre/suff (mterpri)) ((eq flag t) (princ *prompt-prefix*) (mapc #'princ (cdr msg)) (princ *prompt-suffix*) (mterpri)) (t (princ *prompt-prefix*) (displa msg) (princ *prompt-suffix*) (mterpri)))))) (princ " You maybe able to answer this by using assume(...)")) ;;put helpful advice here
- the same applies to the python_to_ecl error message: By using a "...%s..."%... in constructing the error message, you are slowing down the exception propagation. People can easily figure out which type it failed on by letting python drop into a debugger (%pdb 1) that allows them to analyze the local environment upon exception raising. (OK, you have to go "u" one time because pdb isn't terribly helpful with cython functions)
- ecl+unicode: I doubt this patch solves it, since this implements something that was previously properly signalled by an exception, whereas the bugreport deals with a timeout. I suspect that bug might come from something in the other direction: ECL producing unicode that EclObject? doesn't know how to deal with. I am sure this failure originates from me being non-unicode compliant, since both ecl and python individually can handle this properly.
comment:97 in reply to: ↑ 96 Changed 9 years ago by
Replying to nbruin:
- doctest in http://trac.sagemath.org/sage_trac/ticket/7377#comment:88 Perhaps the following helps. I tried that test on a pristine patched 4.6.2 and it passed. Then I ran
make ptestlong
and now it fails -- also when run individually. So that would point to ptestlong changing something. Does it rewrite/invalidate some maxima cache somewhere?
It messes something in ~/.sage/maxima_commandlist_cache.sobj on my computer.
Did not took the time to investigate it further.
If you delete that file it runs again.
- errors: I realized I was not quite correct. Errors about inconsistent assumptions now get reported differently too.
I was aware of the inconsistent assumptions, I guess that's not a big problem.
- the same applies to the python_to_ecl error message: By using a "...%s..."%... in constructing the error message, you are slowing down the exception propagation. People can easily figure out which type it failed on by letting python drop into a debugger (%pdb 1) that allows them to analyze the local environment upon exception raising. (OK, you have to go "u" one time because pdb isn't terribly helpful with cython functions)
I'll remove it.
comment:98 in reply to: ↑ 96 ; follow-up: ↓ 99 Changed 9 years ago by
- effort on error messages: Exceptions get used as a program flow control tool (e.g., in the coercion system) so any extra effort on constructing an error message has the potential of slowing down the system. So if you want extra info in the error message, put it where the string is created. We're controlling both sides of the plumbing anyway. See the better-ask-error patch. You could change it to something like
(princ " You maybe able to answer this by using assume(...)")) ;;put helpful advice here
Yes, this would be ideal of course, it's just not something I know enough Lisp to do properly. Is there a way to format the returned message in a similar way to how it currently happens (so that your ellipses above are filled in)? It's currently something like
j = v.find('Is ') v = v[j:] k = v.find(' ',4) msg = "Computation failed since Maxima requested additional constraints (try the command 'assume(" + v[4:k] +">0)' before integral or limit evaluation, for example):\n" + v + self._ask[i-1] self._sendline(";")
So if one could do the same extracting of the Of course, this is at the end of a long line of other things it does with respect to the self._ask
business, which might be annoying. Still, anything which does not explicitly give a Sage command which has a chance to work would be a downgrade.
Otherwise amazing work, by the way! So cool to see this nearly done.
comment:99 in reply to: ↑ 98 ; follow-up: ↓ 100 Changed 9 years ago by
Replying to kcrisman:
Is there a way to format the returned message in a similar way to how it currently happens (so that your ellipses above are filled in)?
Yes, you could do the string processing in lisp, but in that case you may want to intercept that various ask... routines to preformat the question that gets sent to retrieve to begin with. Those should have more structured information on what question is asked, so formatting the question differently there should be quite cheap. However, there are two points why I think it's a bad idea anyway:
- The advice currently is wrong! Why would "...>0" be the right thing? That just propagates a kind of halfbrained trial-and-error mathematics that I cannot bring myself to endorse. The proper advice is for the user to read up on the assume(...) facility.
- There are big problems with relying on the print names of symbols agreeing between maxima and sage. Now that we're moving away from string-based communication it would be quite easy to let SR("x") correspond to EclObject?("$SAGE-SYMBOLIC-VARIABLE-4711"). The actual question that maxima asks is not so enlightening anymore in that situation.
In fact, currently, the advice already leads to errors
sage: my_symbolic_n=SR.var('n') sage: limit(x^my_symbolic_n,x=oo) TypeError: Computation failed since Maxima requested additional constraints (try the command 'assume(n>0)' before integral or limit evaluation, for example): Is n positive, negative, or zero? sage: assume(n>0) AttributeError: 'bool' object has no attribute 'assume' sage: n <function numerical_approx at 0x18e0410>
so the user actually has a good reason to not shadow the python binding of n, but of course the print name n for a symbolic variable is very desirable. You CANNOT assume that the print name corresponds with the python variable bound to your object and sage SHOULD NOT propagate such assumptions in its error messages. It's nice to make a program accessible to starters but not at the expense of allowing them to progress to experienced users.
comment:100 in reply to: ↑ 99 ; follow-up: ↓ 101 Changed 9 years ago by
- The advice currently is wrong! Why would "...>0" be the right thing? That just propagates a kind of halfbrained trial-and-error mathematics that I cannot bring myself to endorse. The proper advice is for the user to read up on the assume(...) facility.
Then you did not read the words, "for example". And the 'trial-and-error mathematics' comment may then be aimed at Maxima as well, especially when it asks all kinds of questions and the result is always the same. (rjf would no doubt comment that this is undecidable.) Perhaps the user really didn't consider whether x>0
until just then, and might as well try all possibilities. That certainly happens in real life.
This is the best we have to deal with it right now, and until Maxima stops asking such questions, what else can one do? The error message gives the syntax, not the mathematics. Can you think of a different way to phrase it that makes it clear we aren't actually suggesting x>0
in reality?
Saying to read up on assume() is sort of like telling people to read the man page; totally useless if you do not already have an idea that such a thing exists. Read assume?
if you don't believe me. Obviously that could be improved, but it would be strange to put things about integrals and limits at the top of that file (where they'd need to be to catch attention), and there is no reason not to give a maximally helpful error message right off the bat.
In fact, currently, the advice already leads to errors sage: my_symbolic_n=SR.var('n') sage: limit(x^{my_symbolic_n,x=oo) TypeError?: Computation failed since Maxima requested additional constraints (try the command 'assume(n>0)' before integral or limit evaluation, for example): Is n positive, negative, or zero? sage: assume(n>0) AttributeError?: 'bool' object has no attribute 'assume' sage: n <function numerical_approx at 0x18e0410> }
You CANNOT assume that the print name corresponds with the python variable bound to your object and sage SHOULD NOT propagate such assumptions in its error messages. It's nice to make a program accessible to starters but not at the expense of allowing them to progress to experienced users.
Nothing here is stopping someone from advancing to being experienced. This problem occurs other places than here - see many discussions on sage-devel about print names not coinciding, or about var() being annoying in general. If someone knows anything about what you are saying, they will be plenty experienced to realize that this message isn't talking about 'their' n.
Sorry if I sound irked. But there is a place for such lawyering - lawyering over a minor thing which would make Sage more friendly to beginners and which doesn't actually harm the advanced users - and that place is not in a program that is trying to become a 'viable replacement for Mathematica and Maple'. I've seen this over and over, and can't figure out who this is hurting in many such cases.
Anyway, I hope we can come to some reasonable compromise on this. The current suggestion would make a very common error message less useful.
comment:101 in reply to: ↑ 100 Changed 9 years ago by
Solve it how you like. I don't particularly mind what sage does. I've given you the reasons why I won't be doing it. I think you can settle on some fixed example expression inside the error message, a la "A declaration along the lines of assume(x>0) may help solve your problem.", because the surgery that is currently done doesn't always lead to useful suggestions anyway, i.e.,
sage: var('x,y') sage: integrate(log(x^2+y^2),x,0,1)
suggests assume( (y+1)*(y-1) > 0 )
which doesn't make the question go away, and the fact that sage clearly goes out of its way to make a suggestion that doesn't turn out to help really does look silly.
Let's keep this issue outside the ticket comments, because they are getting too long to scroll already.
comment:102 Changed 9 years ago by
There are tickets with three times as many comments, and I have never heard that complaint before. If a ticket causes a regression - and this is one, if slight - then that should be dealt with appropriately on that ticket.
If one insists that it is not relevant, or that it should not hold up a valuable improvement, then it would seem courteous for the person who believes it no longer belongs on that ticket to open a followup ticket along with relevant links to the discussion on the previous ticket. Given the work that has gone into this, that might be appropriate, but it seems to me it could also be dealt with on this one.
As to the error report, it doesn't always make it go away, sure. This is because some integration problems are just hard, and because Maxima can't do all the ones that might not be hard, and because Maxima's assumption framework is in fact weak, as they always say. It doesn't really seem any sillier than Maxima asking a million questions all to come up with the same answer.
comment:103 follow-up: ↓ 106 Changed 9 years ago by
Tried all the patches on top of the current 4.7.alpha2. Apart from the already much discussed doctests errors mentioned so far I had one in interfaces/maxima_abstract.py
sage -t -long -force_lib "devel/sage/sage/interfaces/maxima_abstract.py" ********************************************************************** File "/usr/share/sage/devel/sage/sage/interfaces/maxima_abstract.py", line 197: sage: sorted(maxima._commands(verbose=False)) Expected: ['Alpha', 'Beta', ... 'zunderflow'] Got: ['Alpha', 'Beta', <cut a very long list> 'zunderflow', 'zz']
comment:104 Changed 9 years ago by
I just updated the split_and_refactor patch to rmove supefluous calls to "terpri" and "mterpri".
I left the "strim-string" because it seems that "displa" adds one.
Anyway, there should be work done on error reporting (I'd say later, let's try to get the lib interface reviewed and merged now).
Nils and I got the same problem as François in maxima_abstract.
It's related to the data saved in ~/.sage/maxima_commandlist_cache.sobj which seems to get updated with unrelated data.
If you delete the file and rerun the test, it gives you what it should.
I'll have a look at it.
comment:105 Changed 9 years ago by
- Description modified (diff)
comment:106 in reply to: ↑ 103 Changed 9 years ago by
Replying to fbissey:
Tried all the patches on top of the current 4.7.alpha2. Apart from the already much discussed doctests errors mentioned so far I had one in interfaces/maxima_abstract.py
sage -t -long -force_lib "devel/sage/sage/interfaces/maxima_abstract.py" ********************************************************************** File "/usr/share/sage/devel/sage/sage/interfaces/maxima_abstract.py", line 197: sage: sorted(maxima._commands(verbose=False)) Expected: ['Alpha', 'Beta', ... 'zunderflow'] Got: ['Alpha', 'Beta', <cut a very long list> 'zunderflow', 'zz']
The problem here is that some doctest in maxima_abstract.py creates something called 'zz' and if the test line 197 gets executed afterwards, self.__commands gets built then and includes 'zz', it fails... not really sure why this happens now and did not before.
If I put a call to self._commands() at the beginning of the doctest for trait_names(), self.__commands is built without 'zz'.
So we could consider that this is not a bug.
What's more problematic is that the result of _commands() gets cached and includes a fraction of random variable names (as 'sage???' and the problematic 'zz'). that was already the case before but fortunately no var between 'Alpha' and 'Beta' or after 'zunderflow' was created.
comment:107 Changed 9 years ago by
Okay, I think I learned enough just barely enough Lisp now that I might be able to help on the assumptions/declarations issue.
However, there are other Maxima errors that might get reported. So one would, at the minimum, want to have a conditional error situation. One princ option wouldn't be enough. That seems to be a nightmare to do (at least for someone not an expert in Lisp). I even briefly wondered whether we might want Sage people at the command line to be able to interact and type 'y' like in Maxima, which perhaps is possible now... anyway, that was lies madness, at least for me.
So would it be terribly horrible to catch in the same way the function already does?
def sr_integral(self,*args): try: return max_to_sr(maxima_eval(([max_integrate],[sr_to_max(SR(a)) for a in args]))) except RuntimeError, error: s = str(error) if "Divergent" in s or "divergent" in s: raise ValueError, "Integral is divergent." else: raise error
This is only going to slow things down if there is, in fact, an error. I don't see why one couldn't put something here, if we are already going to catch divergent integrals. And this is basically how it was handled before.
One could similarly do this with sr_limit
(what is sr_tlimit
?), with examples like
sage: var('a') a sage: limit(x^a,x=0) <snip> RuntimeError: ECL says: Maxima asks: Is a positive, negative, or zero?
which, remarkably, is not in the doctests (there is no limit question-asking error, that is, despite the fact that Maxima certainly will ask about this).
Similarly, with the inconsistent assumptions, one could change the try/except
File "/Users/student/Desktop/sage-4.6.2/local/lib/python/site-packages/sage/symbolic/assumptions.py", line 104, in assume maxima.eval("declare(%s, %s)" % (repr(self._var), self._assumption)) File "/Users/student/Desktop/sage-4.6.2/local/lib/python/site-packages/sage/interfaces/maxima_lib.py", line 266, in eval if statement: result = ((result + '\n') if result else '') + max_to_string(maxima_eval("#$%s$"%statement)) File "ecl.pyx", line 619, in sage.libs.ecl.EclObject.__call__ (sage/libs/ecl.c:4425) File "ecl.pyx", line 202, in sage.libs.ecl.ecl_safe_apply (sage/libs/ecl.c:2609) RuntimeError: ECL says: Error executing code in Maxima: declare: inconsistent declaration declare(x,odd)
in assumptions.py to look for a RuntimeError?.
The latter is pretty easy to fix, I think. But hopefully all of these could lead to finishing this off.
What about doctests? I noticed that definitely not all functions are doctested - no surprise, this is a huge project. Will that hold up merging of this, though?
devel/sage/sage/interfaces//maxima_lib.py SCORE devel/sage/sage/interfaces//maxima_lib.py: 37% (13 of 35) devel/sage/sage/interfaces//maxima_abstract.py SCORE devel/sage/sage/interfaces//maxima_abstract.py: 96% (78 of 81) devel/sage/sage/interfaces//maxima.py SCORE devel/sage/sage/interfaces//maxima.py: 61% (19 of 31)
The current Maxima interface has 94 of 100 functions doctested. Just throwing it out there, I know jpflori also has mentioned it above, but this is a little data on it.
comment:108 follow-up: ↓ 109 Changed 9 years ago by
So there are 3 identified problems left:
- We could catch errors as suggested in the previous comment to report them as before. It could be changed back to something else in a later ticket (hopefully this ticket could be merged quickly, and anyway there is still a lot of work left to communicate directly with Maxima as a lib avoiding strings transformations).
- I'll try to add doctests this weekend.
- As far as the problem mentionned in comment 106 is concerned, we could mark its output as random or something like ![... ,gcd,...another function,...] (and modify commands() later if really needed).
Afterwards the ticket would finally be ready for review.
comment:109 in reply to: ↑ 108 Changed 9 years ago by
- Description modified (diff)
- Work issues set to Maxima question doctests, 100% coverage, Maxima command list doctest
- We could catch errors as suggested in the previous comment to report them as before. It could be changed back to something else in a later ticket (hopefully this ticket could be merged quickly, and anyway there is still a lot of work left to communicate directly with Maxima as a lib avoiding strings transformations).
Okay, that seems best to me as well so it can actually get merged. Presumably lots of potential followup tickets.
So I will try to do this today on top of the current list of patches, though I expect whatever I create will be merged by one of you into a p3 patch if that makes it easier to follow.
- I'll try to add doctests this weekend.
Impressive! Hopefully at least some can be nearly copied from the previous doctests (?)
- As far as the problem mentionned in comment 106 is concerned, we could mark its output as random or something like ![... ,gcd,...another function,...] (and modify commands() later if really needed).
Probably better to have an actual doctest like that, as random might allow weird things to slip through.
Afterwards the ticket would finally be ready for review.
Yes!
comment:110 follow-up: ↓ 111 Changed 9 years ago by
Another minor issue with the doctests. Am I correct that maxima
still gives the pexpect interface, while all 'calculus' stuff is done with the library interface? In that case the stuff about calculus at the top of maxima.py
needs to be deleted, probably - perhaps put at the top of maxima_lib.py
, since we would want to keep the doctests and information?
Also, probably JP, Nils, and/or Robert's names should be added at the top of these files!
comment:111 in reply to: ↑ 110 ; follow-up: ↓ 112 Changed 9 years ago by
Replying to kcrisman:
Another minor issue with the doctests. Am I correct that
maxima
still gives the pexpect interface, while all 'calculus' stuff is done with the library interface? In that case the stuff about calculus at the top ofmaxima.py
needs to be deleted, probably - perhaps put at the top ofmaxima_lib.py
, since we would want to keep the doctests and information?
You're right about maxima and calculus, I'll have a look at that while working on doctests.
Also, probably JP, Nils, and/or Robert's names should be added at the top of these files!
I'll do it also.
comment:112 in reply to: ↑ 111 Changed 9 years ago by
Replying to jpflori:
Replying to kcrisman:
Another minor issue with the doctests. Am I correct that
maxima
still gives the pexpect interface, while all 'calculus' stuff is done with the library interface? In that case the stuff about calculus at the top ofmaxima.py
needs to be deleted, probably - perhaps put at the top ofmaxima_lib.py
, since we would want to keep the doctests and information?You're right about maxima and calculus, I'll have a look at that while working on doctests.
Never mind, this is all correct as it stands. I have been singularly unhelpful, though not by design. Maybe one could copy the material at the top of maxima.py
and put it in maxima_lib.py
with a from sage.interface.maxima_lib import maxima
at the very beginning, with some clarifying words. That would provide a double check, too.
There are also a few places in a few docs that still mention expect wrongly, I think - I'll keep looking for them.
Issues I think I can deal with while taking care of the error handling:
maxima._expect_expr
, while usefully staying the same as before, certainly isn't doctested by those tests any more.- Can the old
sr_integral
etc. inmaxima.py
be removed, or should they be kept in case someone wanted to use the pexpect for doing calculus? I would think remove. - With respect to
sr_sum
andsr_integral
, since they are implementing the divergent integral/sum check, should we remove those fromcalculus.py
andsymbolic.integration.external.py
? Those pieces of code will probably never be reached, since the ValueError is already raised inmaxima_lib.py
.
I'll keep looking for things like this, hopefully catch as many as possible.
comment:113 Changed 9 years ago by
Okay, while this patch is not 100% ready, it is certainly good enough to look at and give feedback on. It takes care of the three things I mention above, and adds a little doctesting. It also documents assume
more comprehensively early in its docstring.
I get a weird error with this, though:
sage: sage: var('x, n') (x, n) sage: sage: integral(x^n,x) ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (534, 0)) <snip - then the expected ValueError>
which I cannot explain.
Changed 9 years ago by
Trial patch to improve assumption messages and documentation of helper functions
comment:114 Changed 9 years ago by
- Description modified (diff)
- Work issues Maxima question doctests, 100% coverage, Maxima command list doctest deleted
We now have 100% ((really) basic (and stupid)) doctests coverage.
I also fixed some minor issues here and there.
What could be postponed to later tickets:
- better doctests
- better error handling
- better conversions between maxima and sr
- reorganize the code in maxima_lib to make it clearer
comment:115 Changed 9 years ago by
Thanks for catching the calculus/functional one. I also noticed something that will cause a Sphinx error - which was my bad - so I'm uploading a trivially changed p2.
comment:116 follow-up: ↓ 117 Changed 9 years ago by
- Description modified (diff)
- Status changed from needs_work to needs_review
Sorry I do not have time to check this properly today. Do you get the
ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid
problem with these patches? I hope not :)
A couple very small points about the doctests patch, which by the way is nontrivial and nice all by itself.
- You should have a
loads(dumps(foo))==foo
test if possible for class definitions. I think there are eight of these? - You probably don't need to put
INPUT
and/orOUTPUT
blocks if there isn't one or it's essentially stated in the first line of the documentation - I'm thinking of_false_symbol
orversion
. Up to you, of course, since you already did it. - In a few places where you have more than 'really basic and stupid' documentation (you sell yourself short! it's not bad at all) you have some lines that aren't going to work. Ones like
- ``use_disk_cache`` - boolean (default: True); if set to True, try to read cached result from disk
are too long, and should be made into two lines like you did for
- ``eqns`` - a list of m strings; each representing a linear question in m = n variables
However, these will cause a problem in Sphinx, I think, unless you reformat them like so
- ``eqns`` - a list of m strings; each representing a linear question in m = n variables
This won't show up well on Trac, but notice that the 'q' in 'question' is lined up with the first '' in '
eqns
`'. This was correctly done for 'pts_list', for example.
It looks like the zunderflow zz
was fixed as well, and assuming that fix passes tests as well, I think it can be 'needs review'.
In fact, as long as everyone involved is not reviewing their own patch, this can even be 'positive review'. For instance, I will assume that JP slightly changing my reviewer patch indicates no problems with it.
Can anyone say what would still need to be done for positive review, other than passing all long doctests, which I can't check right now, and taking care of the things above which will lead to Sphinx errors?
comment:117 in reply to: ↑ 116 Changed 9 years ago by
Can anyone say what would still need to be done for positive review, other than passing all long doctests, which I can't check right now, and taking care of the things above which will lead to Sphinx errors?
Sorry, and adding the loads/dumps tests, if they are possible. Some should be, based on the discussion about pickling above and previous behavior working:
---------------------------------------------------------------------- | Sage Version 4.6.2, Release Date: 2011-02-25 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- sage: loads(dumps(Maxima))==Maxima True sage: a = maxima(5) sage: type(a) <class 'sage.interfaces.maxima.MaximaElement'> sage: loads(dumps(a))==a True
comment:118 follow-up: ↓ 119 Changed 9 years ago by
Replying to kcrisman:
Sorry I do not have time to check this properly today. Do you get the
ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid
problem with these patches? I hope not :)
I do not get that one.
A couple very small points about the doctests patch, which by the way is nontrivial and nice all by itself. * You should have a
loads(dumps(foo))==foo
test if possible for class definitions. I think there are eight of these? * You probably don't need to putINPUT
and/orOUTPUT
blocks if there isn't one or it's essentially stated in the first line of the documentation - I'm thinking of_false_symbol
orversion
. Up to you, of course, since you already did it. * In a few places where you have more than 'really basic and stupid' documentation (you sell yourself short! it's not bad at all) you have some lines that aren't going to work. Ones like- use_disk_cache - boolean (default: True); if set to True, try to read cached result from disk
are too long, and should be made into two lines like you did for- eqns - a list of m strings; each representing a linear question in m = n variables
However, these will cause a problem in Sphinx, I think, unless you reformat them like so- eqns - a list of m strings; each representing a linear question in m = n variables
This won't show up well on Trac, but notice that the 'q' in 'question' is lined up with the first '' in '
eqns
`'. This was correctly done for 'pts_list', for example.
I was not aware of line length limitation, I'll have a look at that tonight. For the eqns one, you are right, I just forgot to indent it correctly.
For the INPUT and OUTPUT blocks, I just tried to follow http://www.sagemath.org/doc/developer/conventions.html as much as possible to get something consistent even if it is often redundant or empty.
It looks like the
zunderflow zz
was fixed as well, and assuming that fix passes tests as well, I think it can be 'needs review'. In fact, as long as everyone involved is not reviewing their own patch, this can even be 'positive review'. For instance, I will assume that JP slightly changing my reviewer patch indicates no problems with it. Can anyone say what would still need to be done for positive review, other than passing all long doctests, which I can't check right now, and taking care of the things above which will lead to Sphinx errors?
It is fixed because I changed the check to something else.
The real problem is that this test gives a somewhat random output according to when it is run.
So I guess the problem, if there is one, does not lie in the test used now, but in the implementation of the function itself.
See http://trac.sagemath.org/sage_trac/ticket/7377#comment:106 I guess we could open another ticket if we want to change the current behavior.
comment:119 in reply to: ↑ 118 ; follow-up: ↓ 120 Changed 9 years ago by
- Reviewers changed from Jean-Pierre Flori, François Bissey, Karl-Dieter Crisman to Jean-Pierre Flori, François Bissey, Karl-Dieter Crisman, Nils Bruin
- Status changed from needs_review to needs_work
- Work issues set to loads(dumps()), very minor doctest formatting issues
I was not aware of line length limitation, I'll have a look at that tonight. For the eqns one, you are right, I just forgot to indent it correctly.
It's not hard and fast, but it makes it so that when it shows up in a terminal window it doesn't look weird.
For the INPUT and OUTPUT blocks, I just tried to follow http://www.sagemath.org/doc/developer/conventions.html as much as possible to get something consistent even if it is often redundant or empty.
Maybe we need to add something here about that...
It is fixed because I changed the check to something else.
Yes, I saw that the fix was the one you suggested earlier - sorry for not being clear about that.
The real problem is that this test gives a somewhat random output according to when it is run.
Well, not too bad. One would expect this, given the nature of the function.
Okay, so I'll put this to 'needs work' and then hopefully it will be very easy to produce a p1 of the doctests patch that has the loads/dumps and fixes the other very minor issues. I can try to review that patch tomorrow or Wednesday (US East Coast) and run tests.
Can you think of anything that you have done that hasn't been positively reviewed by Nils or Francois? It's a little hard to determine that from the comments. At any rate this will be one of the better-tested major changes in how we interface to a sub-program, thanks to the long gestation period.
comment:120 in reply to: ↑ 119 Changed 9 years ago by
Okay, so I'll put this to 'needs work' and then hopefully it will be very easy to produce a p1 of the doctests patch
For you, I mean :) I don't have access to the computer where I tested all this right now, and unfortunately not time to do it on this one today.
comment:121 follow-up: ↓ 122 Changed 9 years ago by
After applying the patches I am now getting:
sage -t -force_lib "devel/sage-main/sage/symbolic/assumptions.py" ********************************************************************** File "/usr/share/sage/devel/sage-main/sage/symbolic/assumptions.py", line 89: sage: decl2.assume() Expected: Traceback (most recent call last): ... ValueError: Assumption is inconsistent Got: Traceback (most recent call last): File "/usr/bin/ncadoctest.py", line 1231, in run_one_test self.run_one_example(test, example, filename, compileflags) File "/usr/bin/sagedoctest.py", line 38, in run_one_example OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags) File "/usr/bin/ncadoctest.py", line 1172, in run_one_example compileflags, 1) in test.globs File "<doctest __main__.example_3[7]>", line 1, in <module> decl2.assume()###line 89: sage: decl2.assume() File "/usr/lib64/python2.6/site-packages/sage/symbolic/assumptions.py", line 104, in assume maxima.eval("declare(%s, %s)" % (repr(self._var), self._assumption)) File "/usr/lib64/python2.6/site-packages/sage/interfaces/maxima_lib.py", line 395, in _eval_line if statement: result = ((result + '\n') if result else '') + max_to_string(maxima_eval("#$%s$"%statement)) File "ecl.pyx", line 619, in sage.libs.ecl.EclObject.__call__ (sage/libs/ecl.c:4422) File "ecl.pyx", line 202, in sage.libs.ecl.ecl_safe_apply (sage/libs/ecl.c:2606) RuntimeError: ECL says: Error executing code in Maxima: declare: inconsistent declaration declare(x,odd) ********************************************************************** File "/usr/share/sage/devel/sage-main/sage/symbolic/assumptions.py", line 294: sage: sum(a*q^k, k, 0, oo) Expected: Traceback (most recent call last): ... ValueError: Sum is divergent. Got: Traceback (most recent call last): File "/usr/bin/ncadoctest.py", line 1231, in run_one_test self.run_one_example(test, example, filename, compileflags) File "/usr/bin/sagedoctest.py", line 38, in run_one_example OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags) File "/usr/bin/ncadoctest.py", line 1172, in run_one_example compileflags, 1) in test.globs File "<doctest __main__.example_7[12]>", line 1, in <module> sum(a*q**k, k, Integer(0), oo)###line 294: sage: sum(a*q^k, k, 0, oo) NameError: name 'k' is not defined ********************************************************************** File "/usr/share/sage/devel/sage-main/sage/symbolic/assumptions.py", line 300: sage: sum(a*q^k, k, 0, oo) Exception raised: Traceback (most recent call last): File "/usr/bin/ncadoctest.py", line 1231, in run_one_test self.run_one_example(test, example, filename, compileflags) File "/usr/bin/sagedoctest.py", line 38, in run_one_example OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags) File "/usr/bin/ncadoctest.py", line 1172, in run_one_example compileflags, 1) in test.globs File "<doctest __main__.example_7[15]>", line 1, in <module> sum(a*q**k, k, Integer(0), oo)###line 300: sage: sum(a*q^k, k, 0, oo) NameError: name 'k' is not defined ********************************************************************** File "/usr/share/sage/devel/sage-main/sage/symbolic/assumptions.py", line 340: sage: assume(x,'odd') Expected: Traceback (most recent call last): ... ValueError: Assumption is inconsistent Got: Traceback (most recent call last): File "/usr/bin/ncadoctest.py", line 1231, in run_one_test self.run_one_example(test, example, filename, compileflags) File "/usr/bin/sagedoctest.py", line 38, in run_one_example OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags) File "/usr/bin/ncadoctest.py", line 1172, in run_one_example compileflags, 1) in test.globs File "<doctest __main__.example_7[32]>", line 1, in <module> assume(x,'odd')###line 340: sage: assume(x,'odd') File "/usr/lib64/python2.6/site-packages/sage/symbolic/assumptions.py", line 390, in assume x.assume() File "/usr/lib64/python2.6/site-packages/sage/symbolic/assumptions.py", line 104, in assume maxima.eval("declare(%s, %s)" % (repr(self._var), self._assumption)) File "/usr/lib64/python2.6/site-packages/sage/interfaces/maxima_lib.py", line 395, in _eval_line if statement: result = ((result + '\n') if result else '') + max_to_string(maxima_eval("#$%s$"%statement)) File "ecl.pyx", line 619, in sage.libs.ecl.EclObject.__call__ (sage/libs/ecl.c:4422) File "ecl.pyx", line 202, in sage.libs.ecl.ecl_safe_apply (sage/libs/ecl.c:2606) RuntimeError: ECL says: Error executing code in Maxima: declare: inconsistent declaration declare(x,odd) **********************************************************************
and
sage -t -force_lib "devel/sage-main/sage/symbolic/integration/integral.py" ********************************************************************** File "/usr/share/sage/devel/sage-main/sage/symbolic/integration/integral.py", line 356: sage: integrate(1/x^3,x,-1,3) Expected: Traceback (most recent call last): ... ValueError: Integral is divergent. Got: 4/9 ********************************************************************** File "/usr/share/sage/devel/sage-main/sage/symbolic/integration/integral.py", line 446: sage: integrate(1/(x^3 *(a+b*x)^(1/3)), x) Expected: Traceback (most recent call last): ... TypeError: Computation failed since Maxima requested additional constraints (try the command 'assume(a>0)' before integral or limit evaluation, for example): Is a positive or negative? Got: Traceback (most recent call last): File "/usr/bin/ncadoctest.py", line 1231, in run_one_test self.run_one_example(test, example, filename, compileflags) File "/usr/bin/sagedoctest.py", line 38, in run_one_example OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags) File "/usr/bin/ncadoctest.py", line 1172, in run_one_example compileflags, 1) in test.globs File "<doctest __main__.example_10[47]>", line 1, in <module> integrate(Integer(1)/(x**Integer(3) *(a+b*x)**(Integer(1)/Integer(3))), x)###line 446: sage: integrate(1/(x^3 *(a+b*x)^(1/3)), x) File "/usr/lib64/python2.6/site-packages/sage/misc/functional.py", line 718, in integral return x.integral(*args, **kwds) File "expression.pyx", line 8188, in sage.symbolic.expression.Expression.integral (sage/symbolic/expression.cpp:31363) File "/usr/lib64/python2.6/site-packages/sage/symbolic/integration/integral.py", line 601, in integrate return indefinite_integral(expression, v) File "function.pyx", line 419, in sage.symbolic.function.Function.__call__ (sage/symbolic/function.cpp:4504) File "/usr/lib64/python2.6/site-packages/sage/symbolic/integration/integral.py", line 85, in _eval_ res = integrator(f, x) File "/usr/lib64/python2.6/site-packages/sage/symbolic/integration/external.py", line 19, in maxima_integrator result = maxima.sr_integral(expression,v) File "/usr/lib64/python2.6/site-packages/sage/interfaces/maxima_lib.py", line 654, in sr_integral raise ValueError, "Computation failed since Maxima requested additional constraints; using the 'assume' command before integral evaluation *may* help (example of legal syntax is 'assume(" + s[4:k] +">0)', see `assume?` for more details)\n" + s ValueError: Computation failed since Maxima requested additional constraints; using the 'assume' command before integral evaluation *may* help (example of legal syntax is 'assume(a>0)', see `assume?` for more details) Is a positive or negative? ********************************************************************** File "/usr/share/sage/devel/sage-main/sage/symbolic/integration/integral.py", line 484: sage: res = integral(f,x,0.0001414, 1.); res Expected: Traceback (most recent call last): ... TypeError: Computation failed since Maxima requested additional constraints (try the command 'assume((y-1)*(y+1)>0)' before integral or limit evaluation, for example): Is (y-1)*(y+1) positive, negative, or zero? Got: Traceback (most recent call last): File "/usr/bin/ncadoctest.py", line 1231, in run_one_test self.run_one_example(test, example, filename, compileflags) File "/usr/bin/sagedoctest.py", line 38, in run_one_example OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags) File "/usr/bin/ncadoctest.py", line 1172, in run_one_example compileflags, 1) in test.globs File "<doctest __main__.example_10[56]>", line 1, in <module> res = integral(f,x,RealNumber('0.0001414'), RealNumber('1.')); res###line 484: sage: res = integral(f,x,0.0001414, 1.); res File "/usr/lib64/python2.6/site-packages/sage/misc/functional.py", line 718, in integral return x.integral(*args, **kwds) File "expression.pyx", line 8188, in sage.symbolic.expression.Expression.integral (sage/symbolic/expression.cpp:31363) File "/usr/lib64/python2.6/site-packages/sage/symbolic/integration/integral.py", line 603, in integrate return definite_integral(expression, v, a, b) File "function.pyx", line 414, in sage.symbolic.function.Function.__call__ (sage/symbolic/function.cpp:4443) File "/usr/lib64/python2.6/site-packages/sage/symbolic/integration/integral.py", line 174, in _eval_ return integrator(*args) File "/usr/lib64/python2.6/site-packages/sage/symbolic/integration/external.py", line 21, in maxima_integrator result = maxima.sr_integral(expression, v, a, b) File "/usr/lib64/python2.6/site-packages/sage/interfaces/maxima_lib.py", line 654, in sr_integral raise ValueError, "Computation failed since Maxima requested additional constraints; using the 'assume' command before integral evaluation *may* help (example of legal syntax is 'assume(" + s[4:k] +">0)', see `assume?` for more details)\n" + s ValueError: Computation failed since Maxima requested additional constraints; using the 'assume' command before integral evaluation *may* help (example of legal syntax is 'assume((y-1)*(y+1)>0)', see `assume?` for more details) Is (y-1)*(y+1) positive, negative, or zero?
Did I forget a patch or somehow something didn't apply?
comment:122 in reply to: ↑ 121 Changed 9 years ago by
- Work issues changed from loads(dumps()), very minor doctest formatting issues to loads(dumps()), very minor doctest formatting issues, a few remaining doctest errors
Replying to fbissey:
After applying the patches I am now getting:
Thank you so much! I knew I was tired when I made that patch, hence it not being quite ready for prime time. To be fair, I warned of this. But it shouldn't be too bad to make a p3 of it.
{{[
sage -t -force_lib "devel/sage-main/sage/symbolic/assumptions.py" File "/usr/share/sage/devel/sage-main/sage/symbolic/assumptions.py", line 89:
sage: decl2.assume()
Expected:
Traceback (most recent call last): ... ValueError?: Assumption is inconsistent RuntimeError?: ECL says: Error executing code in Maxima: declare: inconsistent declaration declare(x,odd)
File "/usr/share/sage/devel/sage-main/sage/symbolic/assumptions.py", line 340:
sage: assume(x,'odd')
Expected:
Traceback (most recent call last): ... ValueError?: Assumption is inconsistent RuntimeError?: ECL says: Error executing code in Maxima: declare: inconsistent declaration declare(x,odd)
}}} In this case, the new message is just as informative as the old one (though longer). So we could just replace all of those and remove the catch for inconsistent declarations in the code, I guess.
> ********************************************************************** > File "/usr/share/sage/devel/sage-main/sage/symbolic/assumptions.py", line 294: > sage: sum(a*q^k, k, 0, oo) > NameError: name 'k' is not defined
Oops. Sorry. Same for the next one.
> File "/usr/share/sage/devel/sage-main/sage/symbolic/assumptions.py", line 300: > sage: sum(a*q^k, k, 0, oo) > NameError: name 'k' is not defined
This is interesting. That means we can't just remove the piece about this in the integration code, as I thought. Since ECL returns the divergent error, it seemed like we could, but apparently skipping the error still outputs the principal value. I would need someone with knowledge of how the new interface works to figure out how to make sure this reports an error.
> sage -t -force_lib "devel/sage-main/sage/symbolic/integration/integral.py" > ********************************************************************** > File "/usr/share/sage/devel/sage-main/sage/symbolic/integration/integral.py", line 356: > sage: integrate(1/x^3,x,-1,3) > Expected: > Traceback (most recent call last): > ... > ValueError: Integral is divergent. > Got: > 4/9
Same thing for this one - we are catching it, but it still prints the question. How do we make sure it doesn't do that? I don't think it did that before, so it may be one of the apparently-not-innocuous things JP removed in the last patch.
> sage: integrate(1/(x^3 *(a+b*x)^(1/3)), x) > ValueError: Computation failed since Maxima requested additional constraints; using the 'assume' command before integral evaluation *may* help (example of legal syntax is 'assume(a>0)', see `assume?` for more details) > Is a positive or negative? > ********************************************************************** > File "/usr/share/sage/devel/sage-main/sage/symbolic/integration/integral.py", line 484: > sage: res = integral(f,x,0.0001414, 1.); res > ValueError: Computation failed since Maxima requested additional constraints; using the 'assume' command before integral evaluation *may* help (example of legal syntax is 'assume((y-1)*(y+1)>0)', see `assume?` for more details) > Is (y-1)*(y+1) positive, negative, or zero?
comment:123 follow-up: ↓ 124 Changed 9 years ago by
- Description modified (diff)
- Work issues loads(dumps()), very minor doctest formatting issues, a few remaining doctest errors deleted
I uploaded updated versions of both last patches. I accidently deleted two lines in the previous one which cause the principal error, they are restored now. I added pickling tests, not sure they make sense. Also some various fixes and cosmetic changes to reduce line lengths for sphynx and readibility.
Afterwards "make ptestlong" reported no errors on my computer.
Don't know if someone already took a look at what I did to split Interface class out of Expect class.
It seems functional now, but maybe I left some mistakes there.
comment:124 in reply to: ↑ 123 Changed 9 years ago by
Thanks, JP - I was planning on making the fixes today, but you beat me to it. They were all oversights of mine, except...
I uploaded updated versions of both last patches. I accidently deleted two lines in the previous one which cause the principal error, they are restored now.
Ah, I wondered if that ecl principal value thing was important.
I added pickling tests, not sure they make sense.
I don't know if they do either, but this is one of the things Sage has come to a consensus on, for better or for worse. Some were already there, as it turned out - in the __init__
, not class definition - but doesn't hurt to have the others.
Also some various fixes and cosmetic changes to reduce line lengths for sphynx and readibility.
I'll check that all out next, after running my own tests. There is one final 'evalutation' that I should be able to fix very easily.
Afterwards "make ptestlong" reported no errors on my computer.
Don't know if someone already took a look at what I did to split Interface class out of Expect class.
I'll try to look at it, but I fear there is a little too much ECL there for me to feel comfortable reviewing that.
It seems functional now, but maybe I left some mistakes there.
Maybe Francois can then give positive review :)
I should point out that if this depends on #10743, in principle this ticket's positive review wouldn't be very useful until that one is reviewed.
comment:125 Changed 9 years ago by
- Description modified (diff)
- Status changed from needs_work to needs_review
Coverage is great, I haven't tested formatting in built html but looks like it will be fine overall, and in general very impressive work here. The refactoring is at least working well with the interfaces in doctesting; it would be nice to have more testing of that by heavy users of (say) R or GAP, but at the very least we can set to 'needs review'.
comment:126 Changed 9 years ago by
Okay, the HTML docs look fine in general. Good catch on a few of the indentations that were incorrect before in any case.
1. Sage can currently only understand a subset of the output of Maxima, Maple and Mathematica, so even if the chosen backend can perform the summation the result might not be convertable into a Sage expression.
shouldn't be double-spaced, but this is not really a big deal because it still looks ok.
More importantly, but still not enough to stop positive review, is the fact that the new files are not in the documentation! We will need to fix interfaces.rst
in the sage/doc/en/ folder to be accurate, as well as to include the new sage/interfaces/maxima_lib
, sage/interfaces/maxima_abstract
, and sage/interfaces/interface
documentation. This is now #10942.
comment:127 Changed 9 years ago by
All done the long tests passed with flying colors. No more problems for me, I am happy with it.
comment:128 Changed 9 years ago by
It's embarrassing I hadn't recompiled with the patches in. Re-running the long test now.
comment:129 Changed 9 years ago by
I had made some extra comments yesterday but obviously it was during the time trac was having a fit. So I'll repeat. I have one failing test left
sage -t -long -force_lib "devel/sage-main/sage/symbolic/integration/integral.py" ********************************************************************** File "/usr/share/sage/devel/sage-main/sage/symbolic/integration/integral.py", line 359: sage: integrate(1/x^3,x,-1,3) Expected: Traceback (most recent call last): ... ValueError: Integral is divergent. Got: 4/9 **********************************************************************
comment:130 follow-up: ↓ 131 Changed 9 years ago by
Hmm, that shouldn't be failing now that JP put that back in - it was fine for me. Did you use attachment:trac_7377-doctests-p1.patch or attachment:trac_7377-doctests-p2.patch (either of these should be fine) instead of attachment:trac_7377-doctests.patch (bad)?
comment:131 in reply to: ↑ 130 Changed 9 years ago by
Replying to kcrisman:
Hmm, that shouldn't be failing now that JP put that back in - it was fine for me. Did you use attachment:trac_7377-doctests-p1.patch or attachment:trac_7377-doctests-p2.patch (either of these should be fine) instead of attachment:trac_7377-doctests.patch (bad)?
Not sure what the problem was. I did a bit of rewriting on how I apply the patches in sage-on-gentoo to make it a bit more transparent. Reapplied all the patches, rebuild and now the test looks fine
sage -t -long -force_lib "devel/sage-main/sage/symbolic/integration/integral.py" [4.6 s] ---------------------------------------------------------------------- All tests passed! Total time for all tests: 4.6 seconds
So I am OK with it :) At last!
comment:132 Changed 9 years ago by
It looks like then the only thing that remains is to officially review JP's refactoring of expect/interface and !maxima_abstract/maxima/maxima_lib. I am comfortable with it, and have checked the outlines of the refactoring which are more than satisfactory, but simply have not had the time (and will not) to go over that with a fine-toothed comb to check whether there is some missing function.
Presumably not! Since we never remove doctests, right? So in my opinion it's ready for positive review, since the interfaces to GAP and R and Pari etc. are used heavily elsewhere in Sage, so it's not like the interface stuff isn't tested (not to mention the Maxima stuff, of course, but that is not what is at issue here). Still, maybe someone else wants to comment on this. Otherwise we should be sure we get this in 4.7, before bitrot sets in.
comment:133 Changed 9 years ago by
The principal stuff should indeed be ok with the doctests p1 or p2 patch.
For patchbot which does not seem to read or understand the desciption:
Depends on #10766, #10773, #10743. Ticket #10818 is desirable but not essential.
Apply trac_7377-abstract-maxima_p2.patch, trac_7377-maximalib_p2.patch, trac_7377-fastcalculus_p2.patch, trac_7377-better-ask-error_p2.patch, trac_7377-split_and_refactor-p2.patch, trac_7377-lazy-maxlib.p2.patch, trac_7377-floatcast.patch, trac_7377-unicode_to_ecl-p1.patch, trac_7377-assumptions-p3.patch, trac_7377-doctests-p2.patch
comment:135 Changed 8 years ago by
I would definitely give the bits I haven't written a positive review. Great work, JP and KDC! Thank you very much for finishing off this project. Your knowledge of the system was definitely required to get the last bits right.
comment:136 Changed 8 years ago by
- Description modified (diff)
- Status changed from needs_review to positive_review
I am adding Karl to the list of authors, do a little fiddling and take the responsibility of switching that to positive review. I think we have a large consensus among the people involved that this works. Now is the time to have a bigger test.
comment:137 follow-up: ↓ 138 Changed 8 years ago by
That is extremely gracious of you - I don't feel like I did much. I definitely agree about the consensus and time to have a bigger test. Hopefully it will end up in alpha2 or alpha3.
comment:138 in reply to: ↑ 137 Changed 8 years ago by
Replying to kcrisman:
That is extremely gracious of you - I don't feel like I did much. I definitely agree about the consensus and time to have a bigger test. Hopefully it will end up in alpha2 or alpha3.
Not at all. You contributed, even if it has been revised by someone else afterwards. I doubt very much it will be in alpha2. I think (gut feeling) that Jeroen wants to have alpha2 out soon and won't add something that will delay it further.
I am not sure about alpha3 either, it is a big change. He may object to it for 4.7 altogether. In any case we'll be ready to be picked up at the next opportunity.
comment:139 Changed 8 years ago by
comment:140 Changed 8 years ago by
Added Robert Bradshaw to authors. He did the original splitting of the maxima_abstract interface, which was instrumental to making this project doable. JP can probably judge how much of Robert's work remained after his refactoring and is welcome to reverse this change if he feels that to be appropriate.
comment:141 Changed 8 years ago by
- Milestone changed from sage-feature to sage-4.7
- Status changed from positive_review to needs_work
Please rebase:
applying /scratch/jdemeyer/merger/downloads/trac_7377-split_and_refactor-p2.patch patching file sage/interfaces/expect.py Hunk #13 FAILED at 1025 Hunk #17 FAILED at 1285 Hunk #18 FAILED at 1339
comment:142 Changed 8 years ago by
- Description modified (diff)
- Status changed from needs_work to needs_review
I rebased the patches against sage 4.7.alpha3. I could run make ptestlong yet because upgrade from 4.6.2 failed (givaro problem) and the binary provided for 4.7.alpha3 would not run (some liblapack problem). However it should apply cleanly. I'm building 4.7.alpha3 from source and will test when finished.
comment:143 Changed 8 years ago by
- Status changed from needs_review to needs_work
After applying this patch, everything compiles but Sage doesn't run properly:
$ ./sage ---------------------------------------------------------------------- | Sage Version 4.7.alpha0, Release Date: 2011-03-04 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- ********************************************************************** * * * Warning: this is a prerelease version, and it may be unstable. * * * ********************************************************************** --------------------------------------------------------------------------- ImportError Traceback (most recent call last) /mnt/usb1/scratch/jdemeyer/merger/sage-4.7.alpha4/local/lib/python2.6/site-packages/IPython/ipmaker.pyc in force_import(modname) 64 reload(sys.modules[modname]) 65 else: ---> 66 __import__(modname) 67 68 /mnt/usb1/scratch/jdemeyer/merger/sage-4.7.alpha4/local/bin/ipy_profile_sage.py in <module>() 5 preparser(True) 6 ----> 7 import sage.all_cmdline 8 sage.all_cmdline._init_cmdline(globals()) 9 /mnt/usb1/scratch/jdemeyer/merger/sage-4.7.alpha4/local/lib/python2.6/site-packages/sage/all_cmdline.py in <module>() 12 try: 13 ---> 14 from sage.all import * 15 from sage.calculus.predefined import x 16 preparser(on=True) /mnt/usb1/scratch/jdemeyer/merger/sage-4.7.alpha4/local/lib/python2.6/site-packages/sage/all.py in <module>() 57 from time import sleep 58 ---> 59 from sage.misc.all import * # takes a while 60 61 from sage.misc.sh import sh /mnt/usb1/scratch/jdemeyer/merger/sage-4.7.alpha4/local/lib/python2.6/site-packages/sage/misc/all.py in <module>() 77 from func_persist import func_persist 78 ---> 79 from functional import (additive_order, 80 sqrt as numerical_sqrt, 81 arg, /mnt/usb1/scratch/jdemeyer/merger/sage-4.7.alpha4/local/lib/python2.6/site-packages/sage/misc/functional.py in <module>() 32 import sage.misc.latex 33 import sage.server.support ---> 34 import sage.interfaces.expect 35 import sage.interfaces.mathematica 36 /mnt/usb1/scratch/jdemeyer/merger/sage-4.7.alpha4/local/lib/python2.6/site-packages/sage/interfaces/expect.py in <module>() 56 import pexpect 57 from pexpect import ExceptionPexpect ---> 58 from sage.interfaces.interface import Interface, InterfaceElement, InterfaceFunction, InterfaceFunctionElement, AsciiArtString 59 60 from sage.structure.sage_object import SageObject ImportError: No module named interface Error importing ipy_profile_sage - perhaps you should run %upgrade? WARNING: Loading of ipy_profile_sage failed. sage:
comment:144 Changed 8 years ago by
interface.py is missing in the trac_7377-split_and_refactor-p3.patch, it must have been overlooked. That's the cause of the problem.
comment:145 Changed 8 years ago by
- Status changed from needs_work to needs_review
Currently, there is a patch at #10818 (ECL interrupts) which needs review. Is anyone able to review that?
comment:146 Changed 8 years ago by
- Status changed from needs_review to needs_work
Doctest failures most likely caused by this patch:
sage -t -force_lib devel/sage/sage/misc/sage_eval.py ********************************************************************** File "/mnt/usb1/scratch/jdemeyer/merger/sage-4.7.alpha4/devel/sage-main/sage/misc/sage_eval.py", line 237: sage: a._sage_() Exception raised: Traceback (most recent call last): File "/mnt/usb1/scratch/jdemeyer/merger/sage-4.7.alpha4/local/bin/ncadoctest.py", line 1231, in run_one_test self.run_one_example(test, example, filename, compileflags) File "/mnt/usb1/scratch/jdemeyer/merger/sage-4.7.alpha4/local/bin/sagedoctest.py", line 38, in run_one_example OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags) File "/mnt/usb1/scratch/jdemeyer/merger/sage-4.7.alpha4/local/bin/ncadoctest.py", line 1172, in run_one_example compileflags, 1) in test.globs File "<doctest __main__.example_2[12]>", line 1, in <module> a._sage_()###line 237: sage: a._sage_() File "/mnt/usb1/scratch/jdemeyer/merger/sage-4.7.alpha4/local/lib/python/site-packages/sage/interfaces/interface.py", line 855, in _sage_ raise NotImplementedError, "Unable to parse output: %s" % string NotImplementedError: Unable to parse output: 313131/811 **********************************************************************
sage -t -force_lib devel/sage/sage/groups/perm_gps/permgroup.py ********************************************************************** File "/mnt/usb1/scratch/jdemeyer/merger/sage-4.7.alpha4/devel/sage-main/sage/groups/perm_gps/permgroup.py", line 881: sage: G.orbits() Exception raised: Traceback (most recent call last): File "/mnt/usb1/scratch/jdemeyer/merger/sage-4.7.alpha4/local/bin/ncadoctest.py", line 1231, in run_one_test self.run_one_example(test, example, filename, compileflags) File "/mnt/usb1/scratch/jdemeyer/merger/sage-4.7.alpha4/local/bin/sagedoctest.py", line 38, in run_one_example OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags) File "/mnt/usb1/scratch/jdemeyer/merger/sage-4.7.alpha4/local/bin/ncadoctest.py", line 1172, in run_one_example compileflags, 1) in test.globs File "<doctest __main__.example_26[3]>", line 1, in <module> G.orbits()###line 881: sage: G.orbits() File "/mnt/usb1/scratch/jdemeyer/merger/sage-4.7.alpha4/local/lib/python/site-packages/sage/misc/cachefunc.py", line 555, in __call__ w = self._cachedmethod._instance_call(self._instance, *args, **kwds) File "/mnt/usb1/scratch/jdemeyer/merger/sage-4.7.alpha4/local/lib/python/site-packages/sage/misc/cachefunc.py", line 778, in _instance_call return self._cachedfunc.f(inst, *args, **kwds) File "/mnt/usb1/scratch/jdemeyer/merger/sage-4.7.alpha4/local/lib/python/site-packages/sage/groups/perm_gps/permgroup.py", line 896, in orbits return self._gap_().Orbits("[1..%d]" % self.largest_moved_point()).sage() File "/mnt/usb1/scratch/jdemeyer/merger/sage-4.7.alpha4/local/lib/python/site-packages/sage/interfaces/interface.py", line 869, in sage return self._sage_() File "/mnt/usb1/scratch/jdemeyer/merger/sage-4.7.alpha4/local/lib/python/site-packages/sage/interfaces/interface.py", line 855, in _sage_ raise NotImplementedError, "Unable to parse output: %s" % string NotImplementedError: Unable to parse output: [ [ 1, 3, 4 ], [ 2 ] ] ********************************************************************** [...lots more...]
comment:147 Changed 8 years ago by
Got the same failures here.
comment:148 Changed 8 years ago by
That's because of split_and_refactor (at least from p2, strange it did not occur before). Hopefully I fixed it. I'm currently trying to run make ptestlong. I'll post the patch this afternoon.
comment:149 Changed 8 years ago by
- Status changed from needs_work to needs_review
It should be ok now. It applied against 4.7.alpha3 and ran make ptestlong:
---------------------------------------------------------------------- All tests passed! Total time for all tests: 2519.7 seconds
comment:150 Changed 8 years ago by
- Description modified (diff)
I was finally able to build 4.7.alpha3 from source (previous test was with prebuilt binary) and encountered no problem either.
---------------------------------------------------------------------- All tests passed! Total time for all tests: 2601.1 seconds
comment:151 Changed 8 years ago by
- Status changed from needs_review to positive_review
I did a new build against 4.7.alpha3 as well. And finally managed to test it. So I am putting this back to positive review. Hopefully it won't be in vain.
comment:152 Changed 8 years ago by
- Merged in set to sage-4.7.alpha5
- Resolution set to fixed
- Status changed from positive_review to closed
comment:153 Changed 8 years ago by
- Merged in sage-4.7.alpha5 deleted
- Milestone changed from sage-4.7 to sage-4.7.1
- Resolution fixed deleted
- Status changed from closed to new
Because of some issues with #10818 on Mac OS X and because of comments at #10296, my "gut" feeling says that maybe it is best to postpone this patch to the sage-4.7.1 cycle. I can't point at anything particular which is wrong, but I think it is not justified to merge this patchbomb at this point in the sage-4.7 cycle.
Of course, I remain open for arguments stating the contrary.
comment:154 Changed 8 years ago by
- Status changed from new to needs_review
comment:155 Changed 8 years ago by
- Status changed from needs_review to positive_review
comment:156 follow-up: ↓ 158 Changed 8 years ago by
I'll admit that I was surprised you took that "patch bomb" in at all initially in alpha4 then alpha5. I am not completely sure but I think the new interface.py makes a number of components chatty. When I reviewed the test logs from my experiments with python-2.7 I have seen plenty of chatter of stuff going by pexpect that I don't remember being there before.
comment:157 Changed 8 years ago by
Well, if that is the case then I guess this is wise. I do think that it's not appropriate to ask JP or Nils or anyone else to make more fixes until it's tested on a more wide basis by being in an alpha - as long as JP has time to rebase to 4.7, if that's necessary! 150+ comments is enough.
comment:158 in reply to: ↑ 156 ; follow-up: ↓ 161 Changed 8 years ago by
- Status changed from positive_review to needs_work
Replying to fbissey:
I'll admit that I was surprised you took that "patch bomb" in at all initially in alpha4 then alpha5. I am not completely sure but I think the new interface.py makes a number of components chatty. When I reviewed the test logs from my experiments with python-2.7 I have seen plenty of chatter of stuff going by pexpect that I don't remember being there before.
Could you tell me where to have a look for those chatty things ? Don't have much time to investigate that alone right now.
It is also a little bit surprising because the splitting of the expect class into expect and interface classes should be kind of trivial (just take a bunch of methods in expect and paste them in a superclass).
At least for most classes inheriting expect it should not have dramatic consequences. Of course I could have screwed up something in the way.
Both Maxima classes are more problematic because of multiple inheritance. It "works" now thanks to python MRO, but IIRC, that MRO will change with python 3.0 and could break everything.
comment:159 Changed 8 years ago by
- Work issues set to investigate pexpect refactoring
comment:160 Changed 8 years ago by
I get the following error on SunOS 5.10-32 (marks) with a trial sage-4.7.alpha5. I'm sure whether the error is repeatable and whether it is related to this ticket, but I'm copying it here anyway:
sage -t -long -force_lib devel/sage/sage/misc/trace.py ********************************************************************** File "/home/buildbot/build/sage/mark2-1/mark_full/build/sage-4.7.alpha5/devel/sage-main/sage/misc/trace.py", line 54: sage: _ = s.expect('100') Exception raised: Traceback (most recent call last): File "/home/buildbot/build/sage/mark2-1/mark_full/build/sage-4.7.alpha5/local/bin/ncadoctest.py", line 1231, in run_one_test self.run_one_example(test, example, filename, compileflags) File "/home/buildbot/build/sage/mark2-1/mark_full/build/sage-4.7.alpha5/local/bin/sagedoctest.py", line 38, in run_one_example OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags) File "/home/buildbot/build/sage/mark2-1/mark_full/build/sage-4.7.alpha5/local/bin/ncadoctest.py", line 1172, in run_one_example compileflags, 1) in test.globs File "<doctest __main__.example_1[6]>", line 1, in <module> _ = s.expect('100')###line 54: sage: _ = s.expect('100') File "/home/buildbot/build/sage/mark2-1/mark_full/build/sage-4.7.alpha5/local/lib/python/site-packages/pexpect.py", line 912, in expect return self.expect_list(compiled_pattern_list, timeout, searchwindowsize) File "/home/buildbot/build/sage/mark2-1/mark_full/build/sage-4.7.alpha5/local/lib/python/site-packages/pexpect.py", line 989, in expect_list raise TIMEOUT (str(e) + '\n' + str(self)) TIMEOUT: Timeout exceeded in read_nonblocking(). <pexpect.spawn instance at 0x32b4990> version: 2.0 ($Revision: 1.151 $) command: /home/buildbot/build/sage/mark2-1/mark_full/build/sage-4.7.alpha5/sage args: ['/home/buildbot/build/sage/mark2-1/mark_full/build/sage-4.7.alpha5/sage'] patterns: 100 buffer (last 100 chars): before (last 100 chars): * ********************************************************************** after: <class 'pexpect.TIMEOUT'> match: None match_index: None exitstatus: None flag_eof: 0 pid: 24906 child_fd: 4 timeout: 30 delimiter: <class 'pexpect.EOF'> logfile: None maxread: 2000 searchwindowsize: None delaybeforesend: 0.1 ********************************************************************** File "/home/buildbot/build/sage/mark2-1/mark_full/build/sage-4.7.alpha5/devel/sage-main/sage/misc/trace.py", line 61: sage: print s.before[s.before.find('-'):] Expected: ---... ipdb> c 2 * 5 Got: ---------------------------------------------------------------------- | Sage Version 4.7.alpha5, Release Date: 2011-04-13 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- ********************************************************************** * * * Warning: this is a prerelease version, and it may be unstable. * * * ********************************************************************** <BLANKLINE> ********************************************************************** 1 items had failures: 2 of 11 in __main__.example_1
comment:161 in reply to: ↑ 158 ; follow-up: ↓ 162 Changed 8 years ago by
Replying to jpflori:
Replying to fbissey:
I'll admit that I was surprised you took that "patch bomb" in at all initially in alpha4 then alpha5. I am not completely sure but I think the new interface.py makes a number of components chatty. When I reviewed the test logs from my experiments with python-2.7 I have seen plenty of chatter of stuff going by pexpect that I don't remember being there before.
Could you tell me where to have a look for those chatty things ? Don't have much time to investigate that alone right now.
I have posted a log at #9958 (sage-4.7.alpha4-test.log.bz2) look for mwrank.py for example.
comment:162 in reply to: ↑ 161 Changed 8 years ago by
Replying to fbissey:
I have posted a log at #9958 (sage-4.7.alpha4-test.log.bz2) look for mwrank.py for example.
Are you sure that mwrank is related in any way to the expect.py/interface.py we've modified here ?
mwrank.pyx provides access to a C++ library and the interface.py in the same folder just provides direct python access to methods defined in the first file or am I completely missing something here ?
comment:163 Changed 8 years ago by
I've search through the logs for "interfaces" (the main directory wa are concerned with), "calculus" and "symbolic".
The only noise I found so far is:
File "/usr/share/sage/devel/sage-main/sage/symbolic/expression.pyx", line 7728: sage: f = 1 + x + sqrt(x+2); f.find_root(-2,10) Expected: -1.6180339887498949 Got: -1.618033988749895 #0: simplify_sum(expr='sum(q^k,k,0,inf)) #1: simplify_sum(expr=a*'sum(q^k,k,0,inf))
and:
File "/usr/share/sage/devel/sage-main/sage/calculus/calculus.py", line 223: sage: float(z) Expected: 4.6467837624329356 Got: 4.646783762432936 #0: simplify_sum(expr='sum(q^k,k,0,inf)) #1: simplify_sum(expr=a*'sum(q^k,k,0,inf))
Which does not cause any problem if the doctest passes (i.e. if we set the expected answer to the correct precision).
It's caused in some way by ECL (I've tried to redirect as much as possible toward "/dev/null" slightly modifying the first version of the patches but could not get better result, I'm no expert in Lisp) and not by the refactoring of expect.py into expect.py/interface.py
comment:164 Changed 8 years ago by
OK, no problem Jean-Pierre. There are a lot of things going on with python 2.7 that may just be one of them. I thought the mwrank executable was called by the expect interface. There probably wouldn't be anything to spot if it weren't for all these doctests failures. It doesn't cause the test failure either I think.
comment:165 Changed 8 years ago by
I definitely think the mwrank problem is complete unrelated to this ticket.
Could someone repoduce Jeroen bug ? I've got no problems on my debian amd64 with 4.7.alpha3, but I won't have the time to build the latest alpha today or next week, nor working on this ticket, but is there anything preventing it to go back to needs_review or even positive_review ?
comment:166 Changed 8 years ago by
This bug is most likely not related to this ticket.
comment:167 Changed 8 years ago by
- Status changed from needs_work to needs_review
- Work issues investigate pexpect refactoring deleted
comment:168 Changed 8 years ago by
- Status changed from needs_review to positive_review
I think we are now clear. The chattiness is likely to come from somewhere else and Jeroen says his bug is probably unrelated. I'll put that back to positive review - again.
comment:169 Changed 8 years ago by
- Merged in set to sage-4.7.1.alpha0
- Resolution set to fixed
- Status changed from positive_review to closed
example package for how to accomplish said interface