Ticket #1166 (closed defect: fixed)
[with patch; with positive review] 2D terminal output is inconsistent and corrupted
| Reported by: | zimmerma | Owned by: | was |
|---|---|---|---|
| Priority: | major | Milestone: | sage-2.10.1 |
| Component: | user interface | Keywords: | |
| Cc: | Work issues: | ||
| Report Upstream: | Reviewers: | ||
| Authors: | Merged in: | ||
| Dependencies: | Stopgaps: |
Description
sage: f = (exp(x)-1)/(exp(x/2)+1)
sage: g = exp(x/2)-1
sage: print f(10.0), g(10.0)
147.4131591025766 \
147.4131591025766
sage: print 1, 2
1 2
sage: print f(10), g(10)
10
e - 1
--------
5
e + 1 \
5
e - 1
The output of f(10.0), g(10.0) [with many spaces] seems inconsistent with that of 1, 2 [no spaces]. With f(10), g(10) the exponent 5 of g(10) wraps around the terminal line, and is thus not properly aligned with e - 1. (all this in a 80-column xterm)
Attachments
Change History
comment:2 Changed 5 years ago by was
- Summary changed from 2D terminal output is inconsistent and corrupted to [with patch; needs review] 2D terminal output is inconsistent and corrupted
comment:3 Changed 5 years ago by zimmerma
- Summary changed from [with patch; needs review] 2D terminal output is inconsistent and corrupted to [with patch; with positive review] 2D terminal output is inconsistent and corrupted
[this is my first review, thus please take with care]
I get with this patch applied in 2.10:
sage: f=(exp(x)-1)/(exp(x/2)+1)
sage: g=exp(x/2)-1
sage: print f(10.0), g(10.0)
147.4131591025766
147.4131591025766
sage: print 1, 2
1 2
sage: print f(10), g(10)
10
e - 1
--------
5
e + 1
5
e - 1
The output is much better, but I would expect:
sage: print f(10.0), g(10.0)
147.4131591025766, 147.4131591025766
or
sage: print f(10.0), g(10.0) 147.4131591025766 147.4131591025766
However, since this is an improvement, I give a positive review.
comment:4 Changed 5 years ago by mabshoff
The potential solution to the adding an extra newlines in situations like
sage: print f(10.0), g(10.0) 147.4131591025766 147.4131591025766
might be that we need to check if the string returned from f(10.0 contains a newline in which case we need to add the extra newline to separate the the two multiline outputs. If that is doable please open another ticket.
Cheers,
Michael


It looks like a newline at the end of the multi line expression of f(10) would fix the issue:
---------------------------------------------------------------------- | SAGE Version 2.9, Release Date: 2007-12-16 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- sage: f = (exp(x)-1)/(exp(x/2)+1) sage: g = exp(x/2)-1 sage: print f(10.0), g(10.0) 147.4131591025766 147.4131591025766 sage: print 1, 2 1 2 sage: print f(10), g(10) 10 e - 1 -------- 5 e + 1 5 e - 1 sage: print f(10) 10 e - 1 -------- 5 e + 1 sage: print g(10) 5 e - 1 sage:Cheers,
Michael