-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Prevent RecursionError in nc_simplify for floating point coefficients #26557
Conversation
✅ Hi, I am the SymPy bot. I'm here to help you write a release notes entry. Please read the guide on how to write release notes. Your release notes are in good order. Here is what the release notes will look like:
This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.13. Click here to see the pull request description that was parsed.
Update The release notes on the wiki have been updated. |
sympy/simplify/simplify.py
Outdated
@@ -1758,7 +1758,7 @@ def compare(s, alt_s): | |||
# get the non-commutative part | |||
c_args, args = expr.args_cnc() | |||
com_coeff = Mul(*c_args) | |||
if com_coeff != 1: | |||
if com_coeff != 1 and com_coeff != 1.0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might get floats of different precision.
It would be better to use from sympy.core.numbers import equal_valued
.
.mailmap
Outdated
@@ -1654,3 +1654,4 @@ zzj <29055749+zjzh@users.noreply.github.com> | |||
Łukasz Pankowski <lukpank@o2.pl> | |||
彭于斌 <1931127624@qq.com> | |||
袁野 (Yuan Ye) <yuanyelele@tutanota.com> | |||
rrodenbusch <rrodenbusch@gmail.com> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You will need to rerun bin/mailmap_check.py
to sort the file.
Don't worry about the failing mpmath tests (mpmath/mpmath#704 (comment)) |
.mailmap
Outdated
@@ -1616,6 +1616,7 @@ richierichrawr <richierichrawr@users.noreply.github.com> | |||
rimibis <33387803+rimibis@users.noreply.github.com> | |||
risubaba <risubhjain1010@gmail.com> | |||
ritikBhandari <ritikbhandari68@gmail.com> | |||
rrodenbusch <rrodenbusch@gmail.com> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually the idea is to add a .mailmap entry like:
Richard Rodenbusch <rrodenbusch@gmail.com> rrodenbusch <rrodenbusch@gmail.com>
The first name and email address is what will eventually go in the AUTHORS file. The second is what is recorded in the commit metadata. This line in the .mailmap file associates the author name with the corresponding commits.
There are a number of entries not like that in the .mailmap file that mostly come from people who have misunderstood what these entries are intended to do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will update my entry. The entry in the documentation for this process mentions the dual entry format after the step to commit the change to .mailmap. Perhaps we should re-order that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe. I'm not sure which part you are referring to. Is it this:
https://docs.sympy.org/dev/contributing/new-contributors-guide/workflow-process.html#add-your-name-and-email-address-to-the-mailmap-file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. That is the document I was following. I'd tweak the document so it shows the two entry option in the initial section, then links to the section below with the more detailed description on the entries. I'm attaching changes here so you can look at it before I add it to the PR.
first section
The first time you make a pull request you will need to add your name and email address to the .mailmap file by adding a line like
Joe Bloggs <joe@bloggs.com> joeb <joe@bloggs.com>
This line in the .mailmap file associates the author name with the corresponding commits. The first name and email address is what will eventually go in the AUTHORS file. The second entry is what is recorded in the commit metadata. (see Mapping user names to AUTHORS file entry)
The commit metadata name and email should exactly match the name and email that you have configured with git before making the commits (see "Configure git settings" above). The bin/mailmap_check.py
script can check that this has been done correctly.
then below
(mailmap-mapping-names)=
Mapping user names to AUTHORS file entry
Sometimes a commit will be made with an incorrect name or email address or an author will make multiple commits with different names and email addresses or an author wishes to use a proper name that differs from their github name. In this case a line should be added to the .mailmap file where the first name and email address is what should be recorded in the AUTHORS file and the others are the name and email address that was incorrectly used in the other commits.
the updated md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, maybe that is better.
The premise of the way it is written currently is that you will configure git to have the right name and email address first:
$ git config user.name
Oscar Benjamin
It seems that it refers to "configure git settings" that is not present in the document though.
The two entry version is only needed if the name configured in git is not the name that should be in the authors file. It seems to be very common though that the name and/or email in the commits is not the right one for the authors file so it is probably more common to need the two entry version. I agree that
Joe Bloggs <joe@bloggs.com> joeb <joe@bloggs.com>
is probably the best thing to suggest by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found 'configure git settings' in dev-setup.md and added the links. Do I add these changes be added to this PR or should I generate a new one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say go with a new PR for the workflow changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the new PR you won't have the problems because you are already in the .mailmap file (unless you change your git config...).
Looks good. Thanks! |
I will submit the documentation changes in another PR. Maybe we can help
those who follow avoid the mistake I made.
…On Tue, Apr 30, 2024, 15:31 Oscar Benjamin ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In .mailmap
<#26557 (comment)>:
> @@ -1616,6 +1616,7 @@ richierichrawr ***@***.***>
rimibis ***@***.***>
risubaba ***@***.***>
ritikBhandari ***@***.***>
+rrodenbusch ***@***.***>
In the new PR you won't have the problems because you are already in the
.mailmap file (unless you change your git config...).
—
Reply to this email directly, view it on GitHub
<#26557 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AE3FKCYJ6BVP4PTKSB2X4WDY775RXAVCNFSM6AAAAABHAJZSS6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDAMZSGQ3DMOJVHA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
References to other Issues or PRs
Fixes #26556
Brief description of what is fixed or changed
Allow simplification of expressions with floating point coefficients for non-commutative symbols
Other comments
Release Notes