Ticket #8174 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

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

trac_8174-maxima_methods.patch Download (6.4 KB) - added by burcin 3 years ago.
trac_8174-maxima_methods.take2.patch Download (7.3 KB) - added by burcin 3 years ago.
apply only this patch

Change History

Changed 3 years ago by burcin

comment:1 Changed 3 years ago by burcin

  • Status changed from new to needs_review

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.

  1. 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.).
  1. 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:

  1. 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.

  1. 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

apply only this patch

comment:4 Changed 3 years ago by jason

  • Cc jason added

comment:5 Changed 3 years ago by robert.marik

  • Cc robert.marik added

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

comment:7 Changed 3 years ago by mvngu

  • Status changed from positive_review to closed
  • Reviewers changed from Robert Mařík to Robert Mařík, Karl-Dieter Crisman
  • Resolution set to fixed
  • Merged in set to sage-4.4.2.alpha0
Note: See TracTickets for help on using tickets.