Opened 10 months ago
Last modified 3 months ago
#31401 new defect
Segmentation fault when calculating the taylor series of a specific function
Reported by: | gh-frcl | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-9.5 |
Component: | calculus | Keywords: | maxima, taylor series |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | Reported upstream. No feedback yet. | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
The following code evaluated in Sage 9.2 leads to a segmentation fault
sin(4*arctan(1/(sqrt(3) + 2))-x).taylor(x, 0, 1)
The error message is
;;; ;;; Detected access to protected memory, also known as 'bus or segmentation fault'. ;;; Jumping to the outermost toplevel prompt ;;;
Changing the constant slightly gives the desired result, e.g.
sin(4*arctan(1/(sqrt(3) + 1))-x).taylor(x, 0, 1)
evaluates to
-x*cos(4*arctan(1/2*sqrt(3) - 1/2)) + sin(4*arctan(1/2*sqrt(3) - 1/2))
Upstream report:
Change History (7)
comment:1 follow-up: ↓ 2 Changed 10 months ago by
- Keywords maxima taylor series added
comment:2 in reply to: ↑ 1 Changed 10 months ago by
Replying to gh-DaveWitteMorris:
I tested with some other nonzero integers
a
andb
in the place of3
and2
. It seems that the crash happens whenevera < b^2
(including all cases wherea < 0
).
This seems to be the case, except if a
is a square number. I guess the sqrt
is evaluated first in that case. This implies that the sqrt
is somehow involved in triggering the bug.
I will file a bug report on the maxima bug tracker. Should I close the ticket here?
comment:3 Changed 10 months ago by
Thanks for volunteering to report the bug to maxima (and for clarifying that a
should not be a square).
Please keep this ticket open. The "Report Upstream" field of this ticket should be set to "Reported upstream. No feedback yet", and that field can be updated as the situation progresses. It would also be helpful if you can add a comment here with a link to the maxima bug report, so it is easy for sage trac followers to check on the status in maxima.
comment:4 Changed 10 months ago by
PS If you need a workaround for the bug, you can replace 2
with a variable, and then substitute at the end:
sage: var('a'); sage: sin(4*arctan(1/(sqrt(3) + a))-x).taylor(x, 0, 1).subs(a=2) -x*cos(4*arctan(1/(sqrt(3) + 2))) + sin(4*arctan(1/(sqrt(3) + 2)))
comment:5 Changed 10 months ago by
- Description modified (diff)
- Report Upstream changed from N/A to Reported upstream. No feedback yet.
Upstream ticket in the Maxima bug tracker:
comment:6 Changed 7 months ago by
- Milestone changed from sage-9.3 to sage-9.4
Moving to 9.4, as 9.3 has been released.
comment:7 Changed 3 months ago by
- Milestone changed from sage-9.4 to sage-9.5
This is a maxima bug:
I tested with some other nonzero integers
a
andb
in the place of3
and2
. It seems that the crash happens whenevera < b^2
(including all cases wherea < 0
).