Opened 5 years ago
Closed 5 years ago
#6377 closed defect (fixed)
[with patch, positive review] exp(x) is broken at x=Infinity and x=-Infinity
Reported by: | gmhossain | Owned by: | burcin |
---|---|---|---|
Priority: | major | Milestone: | sage-4.1.1 |
Component: | symbolics | Keywords: | symbolic exp |
Cc: | Merged in: | Sage 4.1.1.rc1 | |
Authors: | Burcin Erocal | Reviewers: | Golam Mortuza Hossain |
Report Upstream: | Work issues: | ||
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
exponetial function exp(x) is broken at both x=-Infinity
and x=Infinity
sage: exp(-Infinity) --------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) .... RuntimeError: x*Infinity with non real x encountered.
sage: exp(Infinity) --------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) .... RuntimeError: x*Infinity with non real x encountered.
Attachments (1)
Change History (7)
comment:1 Changed 5 years ago by burcin
- Milestone set to sage-4.1
- Owner set to burcin
- Status changed from new to assigned
comment:2 Changed 5 years ago by burcin
I have a fix for this in my local pynac tree. I will make a new pynac package available soon.
I checked all the functions defined in inifcns_trans.cpp in pynac. The remaining functions still need to be fixed.
comment:3 Changed 5 years ago by burcin
- Summary changed from exp(x) is broken at x=Infinity and x=-Infinity to [with patch, needs review] exp(x) is broken at x=Infinity and x=-Infinity
This now depends on the package linked from #6404.
Please follow the instructions on that ticket to apply & test.
comment:4 Changed 5 years ago by gmhossain
Hi Burcin,
I tested this out. It looks fine to me.
I guess, it would be good if we could follow some standard convention for
values of these functions at their poles, brunch cuts. For example, following
looks odd to me
sage: arctan(-Infinity) -1/2*pi sage: tan(-pi/2) Infinity
May be we should discuss this in sage-devel for adopting a convention for
these special values.
There are some other issues that would need future work. For example, you have
fixed values of log at 0
sage: SR(0).log() -Infinity
However, following still raises error
sage: log(0) ValueError ...
In any case, this patch fixes lot of issues and should be included.
The remaining issues should be fixed later. I am going to give a positive
review shortly.
comment:5 Changed 5 years ago by gmhossain
- Reviewers set to Golam Mortuza Hossain
- Summary changed from [with patch, needs review] exp(x) is broken at x=Infinity and x=-Infinity to [with patch, positive review partial] exp(x) is broken at x=Infinity and x=-Infinity
Note: I am giving partial positive review because I tested this patch against my stable sage-4.1. So if it applies cleanly on Sage-4.1.1.rc1 then that would be full positive from me.
comment:6 Changed 5 years ago by mvngu
- Merged in set to Sage 4.1.1.rc1
- Resolution set to fixed
- Status changed from assigned to closed
- Summary changed from [with patch, positive review partial] exp(x) is broken at x=Infinity and x=-Infinity to [with patch, positive review] exp(x) is broken at x=Infinity and x=-Infinity
I applied patches in the following order:
- the spkg pynac-0.1.8.p2.spkg at #6404
- trac_6404-conjugate_typesetting.patch
- trac_6401-real_imag_typesetting.patch
- trac_6377-exp_infinity.patch
- trac_6243-fderivative_hash.patch
All doctests pass in my merge tree. So I'm changing #6404, #6401, #6377 and #6243 to positive review as per Golam's request.
Good catch! After adding support for infinity in pynac, I forgot to add cases to handle infinity in the eval functions of special functions.
The fix for exp() needs to go into pynac. I don't know what other functions are effected by this. It would be good to try other special functions defined by Sage to see if they handle infinity, or other constants defined by Sage properly.