-
-
Notifications
You must be signed in to change notification settings - Fork 487
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
erf(0) should return 0 #8983
Comments
comment:2
Here is the relevant thread on sage-devel: http://groups.google.com/group/sage-devel/t/d236e80bf7826bff The main problem is this:
We should just return 0. |
Changed author from RossK to none |
Changed keywords from erf zero to erf |
comment:5
Beginner reporting for duty! So I have a patch which sets erf(0) to 0 -- or, rather, to parent(x)(0) if x==0, so that it's the "right" zero; I think this is the right idiom -- and adds complex arguments from mpmath. But I have a few questions that came up along the way: (1) In 4.6.1, solve(erf(x)==0,x) seems to work for me already, before the patch. Did I get my binaries confused somehow, or did something change elsewhere? (2) It'd be nice if #8720 (fixing str(CC(0))) were finished, it surprised me when writing tests for the zero type preservation. Maybe I should have a look, I think it's mostly fixing some doctests left. (3) My patch broke a doctest in functions/special.py, which expected erf(0.5) to be evaluated to 0.520499877813047, but the existing doctests for erf demand that erf(2) = erf(2). I can get that behaviour, namely to evaluate for reals and to hold for integers except for zero, but I don't quite follow it. (4) Since I'm doing a bit more, should I open an enhancement ticket instead? |
comment:6
You should always feel free to add patches - it's MUCH easier to tell what people are talking about, even if the patch is really, really preliminary.
This must be from an improvement in Maxima during the several recent upgrades. I've updated the description.
No, the usual practice is to not evaluate (give symbolic back) for "exact" rings and evaluate (give numeric back) for "inexact" rings. There is some disagreement among developers about exactly what these words mean, but basically
I believe there already is a ticket for the complex pieces at #1173, similarly at #9044. If you have a good solution to the whole thing, you could do it at one of those and then say this ticket can be closed when they are (if you have also documented that it's fixed. |
This comment has been minimized.
This comment has been minimized.
comment:9
I think the right thing to do here is to depend on #11513. There are several ways one could address the issue in the summary about erf(0) not returning 0, but when a good patch for 11513 appears, the code being touched here would need to be changed again. |
Attachment: trac_8983.patch.gz make erf(0) return 0 |
Author: Benjamin Jones |
comment:10
I uploaded a simple patch now that #11513 is merged. |
comment:11
Looks good, but I think we should return a Sage zero (or at least match the type):
|
comment:12
That's a good point, this patch addresses the issue by returning the input
|
Attachment: trac_8983_v2.patch.gz make erf(0) return 0 |
This comment has been minimized.
This comment has been minimized.
comment:14
Okay, looks good to me (or at least none of my obvious tricks could break it). |
Reviewer: Burcin Erocal, Douglas McNeil |
comment:15
Thanks for the patch Benjamin. It looks great and gets the job done. However, I'd be much happier if there were a couple more doctests. There are quite a few branches in the new One more suggestion: It might be better to leave the last
|
comment:16
Replying to @sagetrac-dsm:
Is this what you were referring to at #10133 comment:2, dsm? More generally, does anyone think the present way of ensuring |
comment:17
Replying to @burcin: |
This comment has been minimized.
This comment has been minimized.
comment:19
Replying to @benjaminfjones:
It's not overkill at all, after adding BTW, |
Attachment: trac_8983_v3.patch.gz make erf(0) return 0, with added doctests and simplified branching in |
comment:20
Ok, I simplified that last doctest in |
Merged: sage-5.0.beta5 |
Currently it doesnt...
Apply:
$SAGE_ROOT/devel/sage
CC: @burcin @kcrisman
Component: symbolics
Keywords: erf
Author: Benjamin Jones
Reviewer: Burcin Erocal, Douglas McNeil
Merged: sage-5.0.beta5
Issue created by migration from https://trac.sagemath.org/ticket/8983
The text was updated successfully, but these errors were encountered: