Opened 11 years ago

Closed 11 years ago

#8947 closed enhancement (fixed)

pretty printing of vectors over callable symbolic rings

Reported by: jason Owned by: jason, was
Priority: major Milestone: sage-4.5.2
Component: linear algebra Keywords:
Cc: rbeezer, was, robertwb Merged in: sage-4.5.2.alpha0
Authors: Jason Grout Reviewers: Rob Beezer
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

This patch makes vectors of callable symbolic rings print nicer, in the form arguments mapsto vector

sage: f(x,y)=[3*x,e^x,2*x*y]
sage: f
(x, y) |--> (3*x, e^x, 2*x*y)

Attachments (2)

trac-8947-callable-SR-vectors-print.patch (5.0 KB) - added by jason 11 years ago.
trac-8947-doctest-fix.patch (4.5 KB) - added by jason 11 years ago.
apply on top of previous patches

Download all attachments as: .zip

Change History (15)

comment:1 Changed 11 years ago by jason

  • Cc rbeezer added
  • Milestone set to sage-4.4.2
  • Status changed from new to needs_work
  • Work issues set to doctests

Doctests need to be fixed up.

comment:2 Changed 11 years ago by jason

  • Cc was robertwb added
  • Status changed from needs_work to needs_review

The doctests depend on a patch in 4.4.2.alpha0.

I think the right way to change printing for a vector over callable symbolic expressions is to subclass as I did in the patch and override the _repr_ and _latex_ methods. Can was or robertwb comment on this?

comment:3 Changed 11 years ago by jason

  • Work issues doctests deleted

comment:4 Changed 11 years ago by jason

#5506 adds some further ideas about what to do about this class.

comment:5 Changed 11 years ago by robertwb

Yep, that's the way to do it. The code looks good, but I only glanced at it quickly haven't tested it.

comment:6 follow-up: Changed 11 years ago by rbeezer

Hi Jason,

Nice patch.

  1. Do you think this should be called "free_module_element_callable_symbolic_dense"? Technically these don't have to be vectors, and they do have entries over a ring? Yes, that's an unwieldy name. ;-) Just asking.
  1. Do you want to add it into the documentation, doesn't seem to be included when I build the docs?
  1. Docstring for _latex_ looks like it has an indentation problem that needs fixing.

Running tests right now.

Rob

comment:7 in reply to: ↑ 6 ; follow-up: Changed 11 years ago by jason

Replying to rbeezer:

Hi Jason,

Nice patch.

  1. Do you think this should be called "free_module_element_callable_symbolic_dense"? Technically these don't have to be vectors, and they do have entries over a ring? Yes, that's an unwieldy name. ;-) Just asking.

Well, Sage thinks that it is a field:

sage: f(x,y)=x^2+y                             
sage: R=f.parent()
sage: R 
Callable function ring with arguments (x, y)
sage: R.is_field()
True
  1. Do you want to add it into the documentation, doesn't seem to be included when I build the docs?
  1. Docstring for _latex_ looks like it has an indentation problem that needs fixing.

Looks like (2) and (3) both probably need to be fixed.

comment:8 Changed 11 years ago by jason

  • Status changed from needs_review to needs_work

comment:9 in reply to: ↑ 7 Changed 11 years ago by rbeezer

Replying to jason:

Callable function ring with arguments (x, y) sage: R.is_field() True

And I trusted the _repr_ output?

Failing a few tests, in the obvious way, in

/sage/dev/devel/sage-main/sage/symbolic/expression.pyx
/sage/dev/devel/sage-main/sage/calculus/calculus.py

(and not done testing).

comment:10 Changed 11 years ago by rbeezer

  • Reviewers set to Rob Beezer

On 4.4.2.rc0 I get the following failures. The one for R is totally unrelated I believe, the others I saw are just the obvious differences in format for functions involved in this patch.

The following tests failed:

        sage -t  devel/sage-main/sage/symbolic/expression.pyx # 4 doctests failed
        sage -t  devel/sage-main/sage/calculus/calculus.py # 2 doctests failed   
        sage -t  devel/sage-main/sage/interfaces/r.py # 1 doctests failed        
        sage -t  devel/sage-main/sage/modules/free_module_element.pyx # 3 doctests failed

Changed 11 years ago by jason

apply on top of previous patches

comment:11 Changed 11 years ago by jason

  • Status changed from needs_work to needs_review

Okay, the doctest issues you mentioned should all be fixed now.

comment:12 Changed 11 years ago by rbeezer

  • Status changed from needs_review to positive_review

sage/calculus, sage/modules, sage/symbolic directories pass all tests, and documentation for vector_callable_symbolic_dense looks good.

Positive review.

comment:13 Changed 11 years ago by mpatel

  • Merged in set to sage-4.5.2.alpha0
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.