-
-
Notifications
You must be signed in to change notification settings - Fork 482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Symbolic Ring to Maxima via EclObject #7377
Comments
Attachment: sagemax.py.gz example package for how to accomplish said interface |
I think the following email might be of interest to other people wanting to hack maxima:
lib/ecl.pyx has nothing to do with maxima-specific stuff. That is all in There is So
and see what token the maxima reader puts in. I imagine you get something
back, So do:
Indeed:
So
would give you a string representation. Be aware that #$...$ suffers from
Yes, that would be an approach virtually orthogonal to the one taken in sagemax.py.
To illustrate the inner workings:
So my guess is that "load" is trying to append to an improperly initialized |
Attachment: 7377-abstract-maxima.patch.gz |
comment:3
Finally success! Recipe for getting calculus use
|
comment:4
Updated maxlib.patch. Changes made:
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 Go at it! |
Maxima via library; used by calculus |
comment:5
Attachment: maxlib.patch.gz Another update:
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:7
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! |
Patch to get faster calculus routines |
comment:8
Attachment: fastcalculus.patch.gz The latest patch must be applied after to go back and forth, 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:
where old were
It is easy to swap the old and new interfaces: simply comment/uncomment the appropriate lines in There are 7 doctest failures in |
comment:11
Does this need any rebasing? I am willing to give it a spin in sage-on-gentoo |
comment:12
Replying to @kiwifb:
Unfortunately, it does. Since Robert split off the Maxima pexpect interface, there were a few minor changes to 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
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
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.
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. |
Attachment: trac_7377-abstract-maxima-rebased.patch.gz Rebased on Sage 4.6.1 |
Rebased on Sage 4.6.1 |
comment:15
Attachment: trac_7377-maximalib-rebased.patch.gz What happens if you just remove that line? |
comment:16
It fails later, here is the piece of code involved:
Tried to google that, but couldn't find anything meaningful to me. |
comment:17
me neither :( |
comment:18
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. |
Attachment: trac_7377-fastcalculus-rebased.patch.gz Rebased on Sage 4.6.1, fixed changes in sage.symbolic.integration.external |
comment:19
Ok I will give it a spin in sage-on-gentoo. |
comment:156
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
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
Replying to @kiwifb:
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. |
Work Issues: investigate pexpect refactoring |
comment:160
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:
|
comment:161
Replying to @jpflori:
I have posted a log at #9958 (sage-4.7.alpha4-test.log.bz2) look for mwrank.py for example. |
comment:162
Replying to @kiwifb:
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
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:
and:
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
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
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
This bug is most likely not related to this ticket. |
Changed work issues from investigate pexpect refactoring to none |
comment:168
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. |
Merged: sage-4.7.1.alpha0 |
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:
CC: @burcin @saliola @jpflori
Component: symbolics
Author: Robert Bradshaw, Nils Bruin, Jean-Pierre Flori, Karl-Dieter Crisman
Reviewer: Jean-Pierre Flori, François Bissey, Karl-Dieter Crisman, Nils Bruin
Merged: sage-4.7.1.alpha0
Issue created by migration from https://trac.sagemath.org/ticket/7377
The text was updated successfully, but these errors were encountered: