Opened 12 years ago
Closed 12 years ago
#1771 closed defect (fixed)
[with patch, positive review] latex bug with symbolics
Reported by: | was | Owned by: | was |
---|---|---|---|
Priority: | major | Milestone: | sage-2.10 |
Component: | calculus | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | Work issues: | ||
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
Peter.Jipsen Hi, with lprint() on, I calculated diff(1/x-1/ln(x)) followed by factor(_) and the displayed answer is incorrect because prefix negation is not handled correctly in the _latex_ method. The same error in a simpler setting can be observed with: (-(x-1)/2)._latex_(simplify=False) output: '\\frac{-x - 1}{2}' (The error is usually masked by the fact that symbolic expressions are normalized to avoid prefix negation.) I think the last two lines of the _latex_ method should probably change from elif op is operator.neg: return '-%s' % s[0] to something like: elif op is operator.neg: if ops[0]._has_op(operator.add) or ops[0]._has_op(operator.sub): s[0] = r'\left( %s \right)' %s[0] return '-%s' % s[0] Sorry, I haven't figured out how to turn this into a hg patch (if the solution is even appropriate). --Peter
Attachments (1)
Change History (4)
comment:1 Changed 12 years ago by
- Summary changed from latex bug with symbolics [with fix] to [with patch] latex bug with symbolics
Changed 12 years ago by
comment:2 Changed 12 years ago by
- Summary changed from [with patch] latex bug with symbolics to [with patch, positive review] latex bug with symbolics
comment:3 Changed 12 years ago by
- Milestone changed from sage-2.10.1 to sage-2.10
- Resolution set to fixed
- Status changed from new to closed
Merged in Sage 2.10.alpha3.
Note: See
TracTickets for help on using
tickets.
This looks good to me. Thanks for turning it into a patch Mike!