Ticket #8174 (closed enhancement: fixed)
maxima_methods wrapper for symbolic expressions
| Reported by: | burcin | Owned by: | burcin |
|---|---|---|---|
| Priority: | major | Milestone: | sage-4.4.2 |
| Component: | symbolics | Keywords: | |
| Cc: | kcrisman, jason, robert.marik | Work issues: | |
| Report Upstream: | N/A | Reviewers: | Robert Mařík, Karl-Dieter Crisman |
| Authors: | Burcin Erocal | Merged in: | sage-4.4.2.alpha0 |
| Dependencies: | Stopgaps: |
Description
Attached patch provides a .maxima_methods() function in symbolic expressions to give access to various methods of simplification, etc. available in Maxima. The return values of functions called through this interface are Sage expressions. Tab completion and docstrings work as expected.
This was proposed on sage-devel:
http://groups.google.com/group/sage-devel/t/3899a578da747009
Attachments
Change History
comment:2 follow-up: ↓ 3 Changed 3 years ago by kcrisman
- Status changed from needs_review to needs_work
Overall this is very nice. I have two questions.
- If I do type(u) (for instance), I just get 'instance' as the type, whereas for something like t._maxima_() I get type giving a Maxima interface element or something. Is there any way to make type(u) give something more useful (perhaps inheriting from another class? I don't know.).
- Tab-completion works great, and just like as with other Maxima things (which means getting functions which don't actually apply, such as triangularize, but whatever, since it's the same behavior). But one of the doctests for it doesn't seem to work - I get [] instead of the appropriate list. Do you have some extra initialization in your Maxima that allows u.trigs to complete to the appropriate thing, but not u.simplify (this is the one that returns [] for me)? I should point out that u.simplify[tab] doesn't work either for me, so the doctest is behaving 'correctly in that sense.
comment:3 in reply to: ↑ 2 Changed 3 years ago by burcin
- Status changed from needs_work to needs_review
Replying to kcrisman:
- If I do type(u) (for instance), I just get 'instance' as the type, whereas for something like t._maxima_() I get type giving a Maxima interface element or something. Is there any way to make type(u) give something more useful (perhaps inheriting from another class? I don't know.).
Inheriting from SageObject fixed this. I also added _repr_ and __reduce__ methods.
- Tab-completion works great, and just like as with other Maxima things (which means getting functions which don't actually apply, such as triangularize, but whatever, since it's the same behavior). But one of the doctests for it doesn't seem to work - I get [] instead of the appropriate list. Do you have some extra initialization in your Maxima that allows u.trigs to complete to the appropriate thing, but not u.simplify (this is the one that returns [] for me)? I should point out that u.simplify[tab] doesn't work either for me, so the doctest is behaving 'correctly in that sense.
On 4.3.3.alpha1, u.trigs was triggering different completions for me too. I changed the doctest to look for completions to airy_ and elliptic_. The output of these is less likely to change between maxima versions. I don't know why tab completion with simplify doesn't work for you, perhaps this was related to #8223.
Changed 3 years ago by burcin
-
attachment
trac_8174-maxima_methods.take2.patch
added
apply only this patch
comment:6 Changed 3 years ago by robert.marik
- Status changed from needs_review to positive_review
- Reviewers set to Robert Mařík
Very useful patch, thanks. Long tests passed on 4.4.rc0.
Positive review. Apply only trac_8174-maxima_methods.take2.patch
