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

Homomorphism shows error for relator element not in generator #16394

Merged
merged 1 commit into from
Jun 10, 2019

Conversation

divyanshu132
Copy link
Member

Brief description of what is fixed or changed

Previously:

>>> G = PermutationGroup([Permutation(1,2,3,4), Permutation(1,3)])
>>> a = Permutation(1,2,3,4)
>>> homomorphism(G, G, [a], [a])
Traceback (most recent call last): File "<string>", line 1, in <module> File "/base/data/home/apps/s~sympy-live-hrd/56.412575950366508090/sympy/sympy/combinatorics/homomorphisms.py", line 304, in homomorphism if check and not _check_homomorphism(domain, codomain, images): File "/base/data/home/apps/s~sympy-live-hrd/56.412575950366508090/sympy/sympy/combinatorics/homomorphisms.py", line 363, in _check_homomorphism s = _image(r).is_identity File "/base/data/home/apps/s~sympy-live-hrd/56.412575950366508090/sympy/sympy/combinatorics/homomorphisms.py", line 335, in _image s = domain.generators[gens.index(r[i])] 
ValueError: tuple.index(x): x not in tuple

Now:

>>> G = PermutationGroup([Permutation(1,2,3,4), Permutation(1,3)])
>>> a = Permutation(1,2,3,4)
>>> homomorphism(G, G, [a], [a])
raise ValueError("The given images do not define a homomorphism")
ValueError: The given images do not define a homomorphism

Other comments

Release Notes

  • combinatorics
    • fix check_homomorphism for elements in relator not in generator

@sympy-bot
Copy link

sympy-bot commented Mar 23, 2019

Hi, I am the SymPy bot (v147). 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:

  • combinatorics

This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.5.

Note: This comment will be updated with the latest check if you edit the pull request. You need to reload the page to see it.

Click here to see the pull request description that was parsed.

<!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->

<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234". See
https://github.com/blog/1506-closing-issues-via-pull-requests . Please also
write a comment on that issue linking back to this pull request once it is
open. -->


#### Brief description of what is fixed or changed
Previously:
```
>>> G = PermutationGroup([Permutation(1,2,3,4), Permutation(1,3)])
>>> a = Permutation(1,2,3,4)
>>> homomorphism(G, G, [a], [a])
Traceback (most recent call last): File "<string>", line 1, in <module> File "/base/data/home/apps/s~sympy-live-hrd/56.412575950366508090/sympy/sympy/combinatorics/homomorphisms.py", line 304, in homomorphism if check and not _check_homomorphism(domain, codomain, images): File "/base/data/home/apps/s~sympy-live-hrd/56.412575950366508090/sympy/sympy/combinatorics/homomorphisms.py", line 363, in _check_homomorphism s = _image(r).is_identity File "/base/data/home/apps/s~sympy-live-hrd/56.412575950366508090/sympy/sympy/combinatorics/homomorphisms.py", line 335, in _image s = domain.generators[gens.index(r[i])] 
ValueError: tuple.index(x): x not in tuple
```

Now:
```
>>> G = PermutationGroup([Permutation(1,2,3,4), Permutation(1,3)])
>>> a = Permutation(1,2,3,4)
>>> homomorphism(G, G, [a], [a])
raise ValueError("The given images do not define a homomorphism")
ValueError: The given images do not define a homomorphism

```

#### Other comments


#### Release Notes

<!-- Write the release notes for this release below. See
https://github.com/sympy/sympy/wiki/Writing-Release-Notes for more information
on how to write release notes. The bot will check your release notes
automatically to see if they are formatted correctly. -->

<!-- BEGIN RELEASE NOTES -->
*  combinatorics
   *  fix check_homomorphism for elements in relator not in generator
<!-- END RELEASE NOTES -->

Update

The release notes on the wiki have been updated.

@divyanshu132
Copy link
Member Author

@jksuom please have a look!!

@codecov
Copy link

codecov bot commented Mar 23, 2019

Codecov Report

Merging #16394 into master will increase coverage by 0.051%.
The diff coverage is 50%.

@@              Coverage Diff              @@
##            master    #16394       +/-   ##
=============================================
+ Coverage   73.571%   73.623%   +0.051%     
=============================================
  Files          618       618               
  Lines       158471    158472        +1     
  Branches     37183     37184        +1     
=============================================
+ Hits        116590    116673       +83     
+ Misses       36447     36366       -81     
+ Partials      5434      5433        -1

@divyanshu132
Copy link
Member Author

@jksuom please review this as well.

@oscarbenjamin
Copy link
Collaborator

This needs a review. I don't know the combinatorics module well enough though...

@jksuom
Copy link
Member

jksuom commented Jun 10, 2019

This looks good. Sorry for missing this. Thanks for the reminder, Oscar.

@jksuom jksuom merged commit 7e38c02 into sympy:master Jun 10, 2019
@divyanshu132 divyanshu132 deleted the fix-check_homomorphism branch June 10, 2019 07:28
@divyanshu132
Copy link
Member Author

Ohh.. I also forgot this once GSoC started! Thanks @oscarbenjamin!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants