Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exp(x) is broken at x=Infinity and x=-Infinity #6377

Closed
golam-m-hossain opened this issue Jun 21, 2009 · 10 comments
Closed

exp(x) is broken at x=Infinity and x=-Infinity #6377

golam-m-hossain opened this issue Jun 21, 2009 · 10 comments

Comments

@golam-m-hossain
Copy link

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.

Component: symbolics

Keywords: symbolic exp

Author: Burcin Erocal

Reviewer: Golam Mortuza Hossain

Merged: Sage 4.1.1.rc1

Issue created by migration from https://trac.sagemath.org/ticket/6377

@burcin
Copy link

burcin commented Jun 22, 2009

comment:1

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.

@burcin burcin self-assigned this Jun 22, 2009
@burcin burcin added this to the sage-4.1 milestone Jun 22, 2009
@burcin
Copy link

burcin commented Jul 31, 2009

Attachment: trac_6377-exp_infinity.patch.gz

doctests for the fix

@burcin
Copy link

burcin commented Jul 31, 2009

Author: Burcin Erocal

@burcin
Copy link

burcin commented Jul 31, 2009

comment:2

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.

@burcin
Copy link

burcin commented Aug 1, 2009

comment:3

This now depends on the package linked from #6404.

Please follow the instructions on that ticket to apply & test.

@golam-m-hossain
Copy link
Author

comment:4

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.

@golam-m-hossain
Copy link
Author

comment:5

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.

@golam-m-hossain
Copy link
Author

Reviewer: Golam Mortuza Hossain

@golam-m-hossain golam-m-hossain changed the title exp(x) is broken at x=Infinity and x=-Infinity [positive review partial] exp(x) is broken at x=Infinity and x=-Infinity Aug 2, 2009
@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Aug 3, 2009

Merged: Sage 4.1.1.rc1

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Aug 3, 2009

comment:6

I applied patches in the following order:

  1. the spkg pynac-0.1.8.p2.spkg at Typeseting for conjugate() of symbolic function is inadequate #6404
  2. trac_6404-conjugate_typesetting.patch
  3. trac_6401-real_imag_typesetting.patch
  4. trac_6377-exp_infinity.patch
  5. trac_6243-fderivative_hash.patch
    All doctests pass in my merge tree. So I'm changing Typeseting for conjugate() of symbolic function is inadequate #6404, Typesettings of real() and imag() are broken #6401, exp(x) is broken at x=Infinity and x=-Infinity #6377 and hashes for derivatives of symbolic functions w.r.t. different variables are the same #6243 to positive review as per Golam's request.

@sagetrac-mvngu sagetrac-mvngu mannequin removed the s: needs review label Aug 3, 2009
@sagetrac-mvngu sagetrac-mvngu mannequin closed this as completed Aug 3, 2009
@sagetrac-mvngu sagetrac-mvngu mannequin changed the title [positive review partial] exp(x) is broken at x=Infinity and x=-Infinity exp(x) is broken at x=Infinity and x=-Infinity Aug 3, 2009
@sagetrac-mvngu sagetrac-mvngu mannequin reopened this Aug 3, 2009
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants