Ticket #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 | Work issues: | |
| Report Upstream: | N/A | Reviewers: | Rob Beezer |
| Authors: | Jason Grout | Merged in: | sage-4.5.2.alpha0 |
| Dependencies: | Stopgaps: |
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
Change History
comment:1 Changed 3 years ago by jason
- Cc rbeezer added
- Status changed from new to needs_work
- Work issues set to doctests
- Milestone set to sage-4.4.2
comment:2 Changed 3 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:4 Changed 3 years ago by jason
#5506 adds some further ideas about what to do about this class.
comment:5 Changed 3 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: ↓ 7 Changed 3 years ago by rbeezer
Hi Jason,
Nice patch.
- 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.
- Do you want to add it into the documentation, doesn't seem to be included when I build the docs?
- 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: ↓ 9 Changed 3 years ago by jason
Replying to rbeezer:
Hi Jason,
Nice patch.
- 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
- Do you want to add it into the documentation, doesn't seem to be included when I build the docs?
- 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:9 in reply to: ↑ 7 Changed 3 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 3 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 3 years ago by jason
-
attachment
trac-8947-doctest-fix.patch
added
apply on top of previous patches
comment:11 Changed 3 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 3 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 3 years ago by mpatel
- Status changed from positive_review to closed
- Resolution set to fixed
- Merged in set to sage-4.5.2.alpha0

Doctests need to be fixed up.