instance_id stringlengths 21 53 | repo stringclasses 188
values | language stringclasses 1
value | pull_number int64 20 148k | title stringlengths 6 144 | body stringlengths 0 83.4k | created_at stringdate 2015-09-25 03:17:17 2025-07-10 16:50:35 | problem_statement stringlengths 188 240k | hints_text stringlengths 0 145k | resolved_issues listlengths 1 6 | base_commit stringlengths 40 40 | commit_to_review dict | reference_review_comments listlengths 1 62 | merged_commit stringlengths 40 40 | merged_patch stringlengths 297 9.87M | metadata dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sympy__sympy-22540@d462325 | sympy/sympy | Python | 22,540 | Fixed issue with piecewise integration | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
Fixes #22533
#### Brief description of what is fixed or changed
Currently, `integrate(1/Abs(x))` (where x is real) gives `Piecewise((-log(x), x<= 0... | 2021-11-22T12:11:20Z | Integral(1/abs(x), x).doit() returns an incomplete answer as output
This was pointed out on the gitter channel a week back or two but I'm not sure if the user remembered to raise the issue on the github page and hence I am raising it before it gets lost in the chat !
On Master
```
>>> x = Symbol('x', real=True)
... | I would love to work on this issue! However, I'm a newbie to sympy contributing so someone might have to guide me through it. I've been playing around with the code and am trying to locate the cause of the issue.
Cool you should go forward with it , though I'm myself inexperienced with the Integrals module so I guess I... | [
{
"body": "This was pointed out on the gitter channel a week back or two but I'm not sure if the user remembered to raise the issue on the github page and hence I am raising it before it gets lost in the chat !\r\n\r\nOn Master\r\n```\r\n>>> x = Symbol('x', real=True)\r\n>>> Integral(1/abs(x), x).doit()\r\nPiec... | 555c8cbfabffb47fc89e12b936a94dea52fdbae5 | {
"head_commit": "d462325de4acf2a6a7808ce832fde19fe1c1cfd4",
"head_commit_message": "Piecewise: Fixed piecewise integration error\n\nBefore this change, when attempting to integrate a\npiecewise function (or a function that internally\ngets converted to a piecewise function\n(like 1/Abs(x)), if some part of the\nfu... | [
{
"diff_hunk": "@@ -512,7 +512,10 @@ def handler(ipw):\n cond = (x < b)\n else:\n cond = (x <= b)\n- args.append((sum, cond))\n+ if sum.has(oo, -oo, S.ComplexInfinity, Undefined):",
"line": null,
"original_line": 515,
"original_start_... | d6500fddfa3eb5220e5a72b76310ec21fc48a971 | diff --git a/sympy/functions/elementary/piecewise.py b/sympy/functions/elementary/piecewise.py
index ce288fb916a4..b38944ff711b 100644
--- a/sympy/functions/elementary/piecewise.py
+++ b/sympy/functions/elementary/piecewise.py
@@ -8,6 +8,7 @@
from sympy.functions.elementary.miscellaneous import Max, Min
from sympy.lo... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-22433@4a4746d | sympy/sympy | Python | 22,433 | create core.random | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2021-11-06T11:36:24Z | as_numer_denom non-deterministically influences the state of Python’s random number generator
When I apply `as_numer_denom` to a power expression, this changes the state of Python’s random number generator. This happens in a non-deterministic fashion, i.e., it isn’t just that random numbers are generated for whatever r... | We should be using a random.Random instance so that it doesn't affect the random seed for other applications.
As a workaround, I suggest doing the same in your own code, so that nothing else can mess with random like this.
> As a workaround, I suggest doing the same in your own code, so that nothing else can mess ... | [
{
"body": "When I apply `as_numer_denom` to a power expression, this changes the state of Python’s random number generator. This happens in a non-deterministic fashion, i.e., it isn’t just that random numbers are generated for whatever reason, but the state seems to be reset using some external information (lik... | 3a49fc4d134864a779258d9fca9ea45c4bbe3b3c | {
"head_commit": "4a4746db958937816635fc6ed2cd697437dd5b08",
"head_commit_message": "add seed function to core.random",
"patch_to_review": "diff --git a/sympy/benchmarks/bench_symbench.py b/sympy/benchmarks/bench_symbench.py\nindex 2ec37f7bb512..8ea700b44b67 100644\n--- a/sympy/benchmarks/bench_symbench.py\n+++ b... | [
{
"diff_hunk": "@@ -0,0 +1,209 @@\n+\"\"\"When you need to use random, import it from here so there is only\n+one generator working for SymPy. Imports from here should behave the\n+same as if they were being imported from Python's random module. But\n+only the routines currently used in SymPy are included here.... | b573b1c81dcfefaf682825d7fc64e9c08e2e84f8 | diff --git a/sympy/benchmarks/bench_symbench.py b/sympy/benchmarks/bench_symbench.py
index 2ec37f7bb512..8ea700b44b67 100644
--- a/sympy/benchmarks/bench_symbench.py
+++ b/sympy/benchmarks/bench_symbench.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-from random import random
+from sympy.core.random import random
from sym... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
xonsh__xonsh-4218@7d7e60d | xonsh/xonsh | Python | 4,218 | feat: Ability to call the program by name from callable alias with the same name without the infinite loop error | Closes #3159
Now we have transparent way to wrap commands into callable aliases.
Example 1:
```python
def _echo(args):
echo @(args)
aliases['echo'] = _echo
echo ok
# Before: freezed on infinite loop
# After: ok
```
Example 2 - elegant ExecAlias (it will be awesome with #4201):
```python
aliases['... | 2021-04-03T15:43:05Z | Infinite alias call
I'm trying to override 'ls' command to display dotfiles in my $DOTFILES directory.
This code goes into an endless loop because _ls function calls ls command and it calls _ls function.
```python
def _ls():
if $(pwd).rstrip(os.linesep) == $DOTFILES:
ls -Ga
else:
ls -G
... | Hi @miyashiiii, you can replace the inner `ls` calls with `@$(which -s ls)` which should resolve to your actual `ls` executable.
Hi @lacoch. Thank you for your answer.
I knew the way to avoid this issue, but I think the infinite alias call shouldn't happen.
cf. https://stackoverflow.com/questions/56492258/how-to-over... | [
{
"body": "I'm trying to override 'ls' command to display dotfiles in my $DOTFILES directory.\r\nThis code goes into an endless loop because _ls function calls ls command and it calls _ls function.\r\n\r\n```python\r\ndef _ls():\r\n if $(pwd).rstrip(os.linesep) == $DOTFILES:\r\n ls -Ga\r\n else:\r\... | 4dc08232e615a75a524fbf96f17402a7a5b353a5 | {
"head_commit": "7d7e60de486bfc40f2687af4924be0f14e1d60d0",
"head_commit_message": "Merge branch 'main' of github.com:xonsh/xonsh into fix_aliases_infinite_loop\n\n# Conflicts:\n#\ttests/test_commands_cache.py",
"patch_to_review": "diff --git a/news/fix_aliases_infinite_loop.rst b/news/fix_aliases_infinite_loop.... | [
{
"diff_hunk": "@@ -477,8 +511,13 @@ def _echo(args):\n @pytest.mark.parametrize(\"case\", ALL_PLATFORMS)\n def test_script(case):\n script, exp_out, exp_rtn = case\n+ if ON_WINDOWS and 'skip_if_on_windows' in script:",
"line": null,
"original_line": 514,
"original_start_line": null,
"pat... | eb8e9464bb5cbe93ee20c5046b4485e0ae145d87 | diff --git a/news/fix_aliases_infinite_loop.rst b/news/fix_aliases_infinite_loop.rst
new file mode 100644
index 0000000000..60a5ab3232
--- /dev/null
+++ b/news/fix_aliases_infinite_loop.rst
@@ -0,0 +1,23 @@
+**Added:**
+
+* Ability to call the tool by the name from callable alias with the same name without the infinite... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-22426@05cec82 | sympy/sympy | Python | 22,426 | Coverage doctest fix | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
Fixes #16716
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-clos... | 2021-11-05T05:36:40Z | bin/coverage_doctest.py does not work
```pytb
$./bin/coverage_doctest.py
DOCTEST COVERAGE for /Users/aaronmeurer/Documents/Python/sympy/sympy/sympy
======================================================================
Traceback (most recent call last):
File "./bin/coverage_doctest.py", line 601, in <module>
... | > look into the history of the file to see what that was
It was initially a way to skip testing of mpmath in 24eeabe2fe23a1d5103e61c3b8d1ed10c44d9795; it was removed in 9b204c3d1a3e4f6753a7d5186f3074ef13641f36 when mpmath (the only thing being skipped) was removed. The simple fix is to just define `skip_paths` as an... | [
{
"body": "```pytb\r\n$./bin/coverage_doctest.py\r\nDOCTEST COVERAGE for /Users/aaronmeurer/Documents/Python/sympy/sympy/sympy\r\n======================================================================\r\n\r\nTraceback (most recent call last):\r\n File \"./bin/coverage_doctest.py\", line 601, in <module>\r\n ... | 87cbdd9ac744e8c0c96eae71420f677970aa4e32 | {
"head_commit": "05cec82bd68167611a803f9f2e7923879ddf46b2",
"head_commit_message": "Removed commented out code",
"patch_to_review": "diff --git a/bin/coverage_doctest.py b/bin/coverage_doctest.py\nindex 87e4eb74cefb..0e7399414a8b 100755\n--- a/bin/coverage_doctest.py\n+++ b/bin/coverage_doctest.py\n@@ -72,8 +72,... | [
{
"diff_hunk": "@@ -425,19 +429,19 @@ def coverage(module_path, verbose=False, no_color=False, sphinx=True):\n return 0, 0, 0\n \n c_skipped = []\n- c_md = []\n- c_mdt = []\n+ c_missing_doc = []\n+ c_missing_doctest = []\n c_has_doctest = []\n- c_idt = []\n+ c_indierect_doctest... | e3e91177fef2661651bb5d53fa6ff1f429921ab4 | diff --git a/bin/coverage_doctest.py b/bin/coverage_doctest.py
index 87e4eb74cefb..7102dd562b97 100755
--- a/bin/coverage_doctest.py
+++ b/bin/coverage_doctest.py
@@ -72,8 +72,8 @@ def print_header(name, underline=None, color=None):
print(underline*len(name))
-def print_coverage(module_path, c, c_md, c_mdt... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-22403@44eebbe | sympy/sympy | Python | 22,403 | Added tests for different values of k for limit(x**n - x**(n - k), x, oo) | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2021-11-01T09:31:51Z | Incorrect value for limit(x**n-x**(n-k),x,oo) when k is a natural number
```
In [64]: x = Symbol('x', real=True , positive= True)
In [65]: n = Symbol('n', integer=True, positive=True);
In [66]: k=0 ... | This seems to be fixed on master , could close after adding relevant tests !
@sylee957 you could mark this as could close and easy to fix. Thank You
```
>>> k = Symbol('k')
>>> limit(x**n-x**(n-k),x,oo)
NotImplementedError: Result depends on the sign of sign(k)
>>> k = 1
>>> limit(x**n-x**(n-k), x, oo)
oo
>>> ... | [
{
"body": "```\r\nIn [64]: x = Symbol('x', real=True , positive= True) \r\n\r\nIn [65]: n = Symbol('n', integer=True, positive=True); \r\n\r\nIn [66]: k=0 ... | 9019765edb0d0b4bbd29674a58b93ef4e75b92f8 | {
"head_commit": "44eebbe8a9b3a2f1337c7061a35e87597fd64c0f",
"head_commit_message": "Added Appropriate tests to close the issue",
"patch_to_review": "diff --git a/sympy/series/tests/test_limits.py b/sympy/series/tests/test_limits.py\nindex 22201e479d45..28c16cb1cedd 100644\n--- a/sympy/series/tests/test_limits.py... | [
{
"diff_hunk": "@@ -880,6 +880,14 @@ def test_issue_18118():\n assert limit(sign(sin(x)), x, 0, \"-\") == -1\n assert limit(sign(sin(x)), x, 0, \"+\") == 1\n \n+def test_issue_18176():",
"line": null,
"original_line": 883,
"original_start_line": null,
"path": "sympy/series/tests/test_lim... | 62b37f54db5b0a57c77c352780c6dab4356eb07c | diff --git a/sympy/series/tests/test_limits.py b/sympy/series/tests/test_limits.py
index 22201e479d45..996e5d1fbc3d 100644
--- a/sympy/series/tests/test_limits.py
+++ b/sympy/series/tests/test_limits.py
@@ -607,13 +607,16 @@ def test_issue_8481():
limit(lamda**k * exp(-lamda) / factorial(k), k, oo) == 0
-def t... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} |
TheAlgorithms__Python-11008@8cb1561 | TheAlgorithms/Python | Python | 11,008 | Create ipv4_conversion.py | ### Describe your change:
Closes #9718
Closes #11013
* [x] Add an algorithm?
* [ ] Fix a bug or typo in an existing algorithm?
* [x] Add or change doctests? -- Note: Please avoid changing both code and tests in a single pull request.
* [ ] Documentation change?
### Checklist:
* [x] I have read [CONTRIBUTI... | 2023-10-26T17:50:04Z | Speedup our eight slowest pytests (one at a time please)
### Feature description
At the end of our GitHub Actions `build` jobs, there is a list of the slowest ones.
Are there ways to speed up these tests without reducing our functionality or our code coverage?
Please only fix one algorithm per pull request.
* [... | I pointed out in #8785 that `neural_network/simple_neural_network.py` has multiple issues (I don't think it even implements a neural network) and could do with a rewrite. Ideally whatever new implementation replaces it should run a lot more quickly.
I checked the maths/prime_numbers.py file. In this file, there are thr... | [
{
"body": "### Feature description\n\nAt the end of our GitHub Actions `build` jobs, there is a list of the slowest ones.\r\n\r\nAre there ways to speed up these tests without reducing our functionality or our code coverage?\r\n\r\nPlease only fix one algorithm per pull request.\r\n* [ ] 16.64s call neural_... | fe4aad0ec94a2d2f28470dd8eaad3ff1bf74c5c8 | {
"head_commit": "8cb1561f2cda9455073015f4d726388a4a429cfb",
"head_commit_message": "[pre-commit.ci] auto fixes from pre-commit.com hooks\n\nfor more information, see https://pre-commit.ci",
"patch_to_review": "diff --git a/conversions/ipconversion.py b/conversions/ipconversion.py\nnew file mode 100644\nindex 000... | [
{
"diff_hunk": "@@ -0,0 +1,62 @@\n+# https://www.geeksforgeeks.org/convert-ip-address-to-integer-and-vice-versa/\n+\n+\n+def ip_to_decimal(ip_address: str) -> int:\n+ \"\"\"\n+ Convert an IPv4 address to its decimal representation.\n+\n+ Args:\n+ ip_address (str): A string representing an IPv4 a... | 586fef389831097f864dd5b9b5673f2242081b5f | diff --git a/conversions/ipv4_conversion.py b/conversions/ipv4_conversion.py
new file mode 100644
index 000000000000..862309b7251e
--- /dev/null
+++ b/conversions/ipv4_conversion.py
@@ -0,0 +1,85 @@
+# https://www.geeksforgeeks.org/convert-ip-address-to-integer-and-vice-versa/
+
+
+def ipv4_to_decimal(ipv4_address: str... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Performance Optimizations"
} |
sympy__sympy-22369@6eb7e6a | sympy/sympy | Python | 22,369 | line - added fix to define horizontal and vertical lines using Eq instead of Point | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2021-10-25T17:34:13Z | Line with equation doesn't support horizontal or vertical lines
```
from sympy import Point, Eq, symbols
from sympy.geometry import Line, Segment
from sympy.abc import x, y
a, b, c, e, f, g, h = symbols('a, b, c, e, f, g, h')
AC = Line(Eq(y, a*x + c))
DF = Line(Eq(y, f))
```
SymPy throws `ValueError: could ... | Sympy throws `ValueError: could not find x` for `Line(Eq(y, f))`.
This error can be avoided by defining `x` as `f` .
```
>>> Line(Eq(y, f), x = f)
Line2D(Point2D(0, 0), Point2D(1, 1))
```
Yes. SymPy tries to "do the right thing" but sometimes you have to provide more input. The docstring, too, is helpful in resolv... | [
{
"body": "```\r\nfrom sympy import Point, Eq, symbols\r\nfrom sympy.geometry import Line, Segment\r\nfrom sympy.abc import x, y\r\n\r\na, b, c, e, f, g, h = symbols('a, b, c, e, f, g, h')\r\nAC = Line(Eq(y, a*x + c))\r\nDF = Line(Eq(y, f))\r\n```\r\n\r\nSymPy throws `ValueError: could not find x` in the last l... | 0e4bab73562d6f90fcdf5fa079731f26a455347c | {
"head_commit": "6eb7e6a42a9dd9dbdf9fe07922e083afa2932456",
"head_commit_message": "fixed error",
"patch_to_review": "diff --git a/sympy/geometry/tests/test_line.py b/sympy/geometry/tests/test_line.py\nindex 89af9cfc844d..7733c056a820 100644\n--- a/sympy/geometry/tests/test_line.py\n+++ b/sympy/geometry/tests/te... | [
{
"diff_hunk": "@@ -27,7 +27,9 @@ def find(x, equation):\n \n free = equation.free_symbols\n xs = [i for i in free if (i.name if isinstance(x, str) else i) == x]\n- if not xs:\n+ if not xs and (str(equation) != x):",
"line": null,
"original_line": 30,
"original_start_line": null,
"... | 4fca2b9b9a5b849cf56145506b371bbcf48deabe | diff --git a/sympy/geometry/line.py b/sympy/geometry/line.py
index 5bd1c1de553d..035201af0b9b 100644
--- a/sympy/geometry/line.py
+++ b/sympy/geometry/line.py
@@ -24,7 +24,7 @@
from sympy.core.evalf import N
from sympy.core.numbers import Rational, oo
from sympy.core.relational import Eq
-from sympy.core.symbol impo... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
TheAlgorithms__Python-9861@5442a69 | TheAlgorithms/Python | Python | 9,861 | Match a pattern and String using backtracking | ### Describe your change:
created a file with name match_word_pattern.py inside backtracking for Match a pattern and String using backtracking.
* [x] Add an algorithm?
* [ ] Fix a bug or typo in an existing algorithm?
* [ ] Documentation change?
### Checklist:
* [x] I have read [CONTRIBUTING.md](https://git... | 2023-10-05T18:32:19Z | Match a pattern and String using backtracking
### What would you like to share?
Given a string, find out if string follows a given pattern or not without using any regular expressions. We can solve this problem with the help of Backtracking.
### Additional information
_No response_ | Please accept the issue with hacktober tag | [
{
"body": "### What would you like to share?\n\nGiven a string, find out if string follows a given pattern or not without using any regular expressions. We can solve this problem with the help of Backtracking. \n\n### Additional information\n\n_No response_",
"number": 9844,
"title": "Match a pattern an... | cffdf99c55dcda89a5ce0fb2bf3cb685d168d136 | {
"head_commit": "5442a69bae2dc9865036aa077944f5b3698c6ef4",
"head_commit_message": "fix: issue #9844",
"patch_to_review": "diff --git a/backtracking/match_word_pattern.py b/backtracking/match_word_pattern.py\nnew file mode 100644\nindex 000000000000..f0399ae55118\n--- /dev/null\n+++ b/backtracking/match_word_pat... | [
{
"diff_hunk": "@@ -0,0 +1,54 @@\n+def matchWordPattern(pattern :str, input_string: str) -> bool:",
"line": null,
"original_line": 1,
"original_start_line": null,
"path": "backtracking/match_word_pattern.py",
"start_line": null,
"text": "@user1:\nVariable and function names should follow... | 8df08a3566bf2d0c58fa2f53b36676c4b11ce3ef | diff --git a/backtracking/match_word_pattern.py b/backtracking/match_word_pattern.py
new file mode 100644
index 000000000000..bfa9b1354d51
--- /dev/null
+++ b/backtracking/match_word_pattern.py
@@ -0,0 +1,61 @@
+def match_word_pattern(pattern: str, input_string: str) -> bool:
+ """
+ Determine if a given pattern ... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "New Feature Additions"
} |
sympy__sympy-22255@98637f3 | sympy/sympy | Python | 22,255 | allow for economical specification of `parse_expr` transformations | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2021-10-11T18:36:10Z | Make parse_expr with transformations easier to type
Right now to parse an expression with non-standard transformations like implicit multiplication, you have to do
```py
>>> from sympy.parsing.sympy_parser import standard_transformations, implicit_multiplication_application
>>> transformations = (standard_transfor... | I would like to implement this in order to practice the workflow.
Now you can just do this:
x = parse_expr("2x + 1", transformations="all")
print(x)
@ebab, you can still improve the answer.
@NtemKenyor I do not think that it is enough to check if a string was passed or not. Hence I decided to make my own pull re... | [
{
"body": "Right now to parse an expression with non-standard transformations like implicit multiplication, you have to do\r\n\r\n```py\r\n>>> from sympy.parsing.sympy_parser import standard_transformations, implicit_multiplication_application\r\n>>> transformations = (standard_transformations + (implicit_multi... | 7d104b61342ac4dbbb4e0cd21a3efc825861a4f3 | {
"head_commit": "98637f39f1db977d12c995f22b45ed59047862b6",
"head_commit_message": "add implicit and all keywords for parsing",
"patch_to_review": "diff --git a/sympy/matrices/common.py b/sympy/matrices/common.py\nindex e6e6da3fe095..8ebf90bc96f4 100644\n--- a/sympy/matrices/common.py\n+++ b/sympy/matrices/commo... | [
{
"diff_hunk": "@@ -975,6 +975,62 @@ def parse_expr(s, local_dict=None, transformations=standard_transformations,\n >>> b.args\n (x, 1)\n \n+ Note, however, that when these expressions are printed they will\n+ appear the same:\n+\n+ >>> assert str(a) == str(b)\n+\n+ As a convenience, transfo... | 1ddc3ba747869c3e52a6511dc901885403fea54a | diff --git a/sympy/matrices/common.py b/sympy/matrices/common.py
index e6e6da3fe095..8ebf90bc96f4 100644
--- a/sympy/matrices/common.py
+++ b/sympy/matrices/common.py
@@ -76,7 +76,7 @@ def __getitem__(self, key):
"""Implementations of __getitem__ should accept ints, in which
case the matrix is indexed... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "New Feature Additions"
} |
xonsh__xonsh-3937@6449364 | xonsh/xonsh | Python | 3,937 | Fallback for `print_color` if shell is not yet initialized | Added a fallback for `xonsh.tools.print_color` (and `xonsh.tools.format_color`) if shell is not yet initialized, thus enabling their use in `.xonshrc`.
Fixes #3840 .
| 2020-10-29T12:21:28Z | print_color raises exception from RC file
Hi! Xonsh is super incredible! Thanks!
I've found that `print_color` not working when it used in rc-file:
```bash
# bash
cd /tmp
echo 'from xonsh.tools import print_color' > rc
echo 'print_color("{RED}Hello!")' >> rc
XONSH_DEBUG=1 XONSH_SHOW_TRACEBACK=1 xonsh --rc rc
... | That would be weird if it is related to THREAD_SUBPROCS. In general, though I would not expect that `print_color()` to work until xonsh is fully started up. There may be some changes that could be made to use the ASCII printing prior to the shell being fully available as sort of a hack to get this working when xonshrc... | [
{
"body": "Hi! Xonsh is super incredible! Thanks!\r\n\r\nI've found that `print_color` not working when it used in rc-file:\r\n```bash\r\n# bash\r\ncd /tmp\r\necho 'from xonsh.tools import print_color' > rc\r\necho 'print_color(\"{RED}Hello!\")' >> rc\r\nXONSH_DEBUG=1 XONSH_SHOW_TRACEBACK=1 xonsh --rc rc\r\n```... | 4da940c0365b3686b4620490cbf26d9eea68c6ac | {
"head_commit": "6449364fbf5905e7ec70a60a8e4ee4df72aab55c",
"head_commit_message": "no, the news file is not md, it's rst",
"patch_to_review": "diff --git a/news/print_color_3840.rst b/news/print_color_3840.rst\nnew file mode 100644\nindex 0000000000..d6465f1b47\n--- /dev/null\n+++ b/news/print_color_3840.rst\n@... | [
{
"diff_hunk": "@@ -1837,15 +1837,26 @@ def format_color(string, **kwargs):\n shell instances method of the same name. The results of this function should\n be directly usable by print_color().\n \"\"\"\n- return builtins.__xonsh__.shell.shell.format_color(string, **kwargs)\n+ try:\n+ r... | 2dc5f87bc6912b06f9d1c19a5f38c9e56e4bbf87 | diff --git a/news/print_color_3840.rst b/news/print_color_3840.rst
new file mode 100644
index 0000000000..d6465f1b47
--- /dev/null
+++ b/news/print_color_3840.rst
@@ -0,0 +1,23 @@
+**Added:**
+
+* <news item>
+
+**Changed:**
+
+* <news item>
+
+**Deprecated:**
+
+* <news item>
+
+**Removed:**
+
+* <news item>
+
+**Fixe... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
TheAlgorithms__Python-9625@5923c92 | TheAlgorithms/Python | Python | 9,625 | serialize deserialize binary tree | ### Describe your change:
Fixes #9611
* [x] Add an algorithm?
* [ ] Fix a bug or typo in an existing algorithm?
* [ ] Documentation change?
### Checklist:
* [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md).
* [x] This pull request is all my own work ... | 2023-10-03T17:35:07Z | Serialize and Deserialize
### Feature description
Design an algorithm to serialize and deserialize a binary tree. You just need to ensure that a binary tree can be serialized to a string and this string can be deserialized to the original tree structure. | @Arunsiva003 I would like to work on this enhancement. Can you assign this to me?
> @Arunsiva003 I would like to work on this enhancement. Can you assign this to me?
You don't have to wait for any approval. make a pull request and proceed!
i started working on this | [
{
"body": "### Feature description\n\nDesign an algorithm to serialize and deserialize a binary tree. You just need to ensure that a binary tree can be serialized to a string and this string can be deserialized to the original tree structure.",
"number": 9611,
"title": "Serialize and Deserialize"
}
] | 0a84b8f842c4c72f400d96313d992b608d621d07 | {
"head_commit": "5923c9290dc765458cd698a20ca72e8e3c80645d",
"head_commit_message": "format files",
"patch_to_review": "diff --git a/data_structures/binary_tree/serialize_deserialize_binary_tree.py b/data_structures/binary_tree/serialize_deserialize_binary_tree.py\nnew file mode 100644\nindex 000000000000..e092ec... | [
{
"diff_hunk": "@@ -0,0 +1,140 @@\n+class TreeNode:\n+ \"\"\"\n+ A binary tree node has a value, left child, and right child.\n+\n+ Props:\n+ val(int): The value of the node.\n+ left: The left child of the node.\n+ right: The right child of the node.\n+ \"\"\"\n+\n+ def __ini... | 7cc2602e8bfc0503c92a9bb3106204e95c4a5d3a | diff --git a/data_structures/binary_tree/serialize_deserialize_binary_tree.py b/data_structures/binary_tree/serialize_deserialize_binary_tree.py
new file mode 100644
index 000000000000..7d3e0c61f96d
--- /dev/null
+++ b/data_structures/binary_tree/serialize_deserialize_binary_tree.py
@@ -0,0 +1,140 @@
+from __future__ i... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "New Feature Additions"
} |
sympy__sympy-22217@be7c4a8 | sympy/sympy | Python | 22,217 | Problem with solving simple separable ODE fixed | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2021-10-04T10:18:56Z | Problem with solving simple separable ODE
I want to solve by SymPy simple separable equation y'=e^(y-x), but SymPy can't solve it!
```
from sympy import *
x = symbols("x")
y = Function("y")
eq = Eq(Derivative(y(x), x), exp(y(x)-x))
dsolve(eq, y(x))
```
But it solves successfuly similar equation y'=e^(y+x).
F... | The problem is that the factorable hint calls `dsolve` recursively but for this example ODE the recursive call will also end up being handled by factorable again leading to infinite recursion. It looks like the last line here is intended to prevent the infinite recursion:
https://github.com/sympy/sympy/blob/19b187982f... | [
{
"body": "I want to solve by SymPy simple separable equation y'=e^(y-x), but SymPy can't solve it!\r\n```\r\nfrom sympy import *\r\nx = symbols(\"x\")\r\ny = Function(\"y\")\r\neq = Eq(Derivative(y(x), x), exp(y(x)-x))\r\ndsolve(eq, y(x))\r\n```\r\nBut it solves successfuly similar equation y'=e^(y+x).\r\n\r\n... | 570ad001d7f5a3c733c54635fec90edb8f778443 | {
"head_commit": "be7c4a8f6c37154928b16bda34d31172ddd1eb31",
"head_commit_message": "test case added",
"patch_to_review": "diff --git a/sympy/solvers/ode/ode.py b/sympy/solvers/ode/ode.py\nindex 5bc8b7d65273..d9f55bf4acc0 100644\n--- a/sympy/solvers/ode/ode.py\n+++ b/sympy/solvers/ode/ode.py\n@@ -931,7 +931,7 @@ ... | [
{
"diff_hunk": "@@ -231,4 +231,4 @@ def test_pdsolve_variable_coeff():\n \n eq = exp(2*x)*(u.diff(y)) + y*u - u\n sol = pdsolve(eq, hint='1st_linear_variable_coeff')\n- assert sol == Eq(u, exp((-y**2 + 2*y + 2*F(x))*exp(-2*x)/2))\n+ assert sol == Eq(f(x, y), F(x)*exp(-y*(y - 2)*exp(-2*x)/2))",
... | ec9e6cee61d6aedcd819bad2b2092929986a12bb | diff --git a/sympy/solvers/ode/ode.py b/sympy/solvers/ode/ode.py
index 5bc8b7d65273..d9f55bf4acc0 100644
--- a/sympy/solvers/ode/ode.py
+++ b/sympy/solvers/ode/ode.py
@@ -931,7 +931,7 @@ class in it. Note that a hint may do this anyway if
'1st_homogeneous_coeff_subs_indep_div_dep_Integral',
'1st_homogeneous_... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
xonsh__xonsh-3735@98e6d6a | xonsh/xonsh | Python | 3,735 | Add pip install xonsh [full] and rewrite install doc | Resolves #3622
Adds extras tag [full], which installs xonsh with pygments, prompt-toolkit and distro, with the intent that that's what most users will want.
Also update installation section of docs to include this option, but take the opportunity for a thorough rewrite:
collapse separate linux, osx and window... | 2020-08-29T21:47:51Z | Please, add 'prompt_toolkit' to general requirements.
I'm having errors in 'abbrevs' and a lot of things printed at the terminal startup.
I use Manjaro Linux and neither the system package, nor the "Arch User Repository" package, nor the package in the "pip" requires the installation of "prompt_toolkit" by DEFAULT.
I... | I would protest that the extras syntax is obscure for Pythonistas. It is extremely common and used by many packages with optional dependencies.
The rest of it is up for debate. It is arguable whether various packages should or should not include it. For example, I maintain the containers: `xonsh/xonsh` and `xonsh/ac... | [
{
"body": "I'm having errors in 'abbrevs' and a lot of things printed at the terminal startup.\r\nI use Manjaro Linux and neither the system package, nor the \"Arch User Repository\" package, nor the package in the \"pip\" requires the installation of \"prompt_toolkit\" by DEFAULT.\r\nIf possible, as it is undo... | 582b5a729abcbf50c2ce23305e5d0505df2221db | {
"head_commit": "98e6d6a6d1f1e55e2b20e25e189f2eee3a53a390",
"head_commit_message": "news!",
"patch_to_review": "diff --git a/.gitignore b/.gitignore\nindex 6382119f29..f16d3f9f76 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -37,7 +37,8 @@ bin/\n /lib/\n include/\n venv/\n-.venv/\n+.venv*/\n+\n \n # Mac\n .DS_S... | [
{
"diff_hunk": "@@ -0,0 +1,227 @@\n+Platform-specific tips and tricks\n+==================================\n+\n+Linux\n+------\n+\n+Possible conflicts with Bash\n+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n+\n+Depending on how your installation of Bash is configured, Xonsh may have trouble\n+loading certain shell modules. ... | 6f549ca6c3c1a684d6362bfe803688012c2c84a3 | diff --git a/.gitignore b/.gitignore
index 6382119f29..f16d3f9f76 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,7 +37,8 @@ bin/
/lib/
include/
venv/
-.venv/
+.venv*/
+
# Mac
.DS_Store
diff --git a/docs/appimage.rst b/docs/appimage.rst
index d5bae56fd2..61b5d179b5 100644
--- a/docs/appimage.rst
+++ b/docs/appim... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "Dependency Updates & Env Compatibility"
} |
sympy__sympy-22211@6704d77 | sympy/sympy | Python | 22,211 | Fix handling of zoo in evalf | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2021-10-03T04:54:09Z | (1/x).evalf(subs={x: 0}) produces 0
Here's how it looks like:
``` python
In [1]: sp.__version__
Out[1]: '0.7.5-git'
In [2]: x = sp.abc.x
In [3]: (1/x).evalf(subs={x: 0})
Out[3]: 0
In [4]: (1/x).subs({x: 0})
Out[4]: zoo
In [5]: (1/x).xreplace({x: 0})
Out[5]: zoo
```
I did investigate it some time ago and, AFAIR, i... | Another interesting and related issue: while
``` python
In [3]: x = Symbol('x', real=True)
In [4]: (1/x).subs({x: 0.})
Out[4]: +inf
In [5]: (1/x).xreplace({x: 0.})
Out[5]: +inf
```
the following
``` python
(1/x).evalf(subs={x: 0.})
```
raises
``` pytb
Traceback (most recent call last):
File "<ipython-input-6-2... | [
{
"body": "Here's how it looks like:\n\n``` python\nIn [1]: sp.__version__\nOut[1]: '0.7.5-git'\n\nIn [2]: x = sp.abc.x\n\nIn [3]: (1/x).evalf(subs={x: 0})\nOut[3]: 0\n\nIn [4]: (1/x).subs({x: 0})\nOut[4]: zoo\n\nIn [5]: (1/x).xreplace({x: 0})\nOut[5]: zoo\n```\n\nI did investigate it some time ago and, AFAIR, ... | d04fa46664c3aeda08fb41a2b2d62055056e8926 | {
"head_commit": "6704d77acb7ce10349c5d87c0c2f30d14e35f8d3",
"head_commit_message": "fix issue 8242",
"patch_to_review": "diff --git a/sympy/core/evalf.py b/sympy/core/evalf.py\nindex c9313200a434..c39e52f4637b 100644\n--- a/sympy/core/evalf.py\n+++ b/sympy/core/evalf.py\n@@ -12,7 +12,7 @@\n make_mpc, make_mp... | [
{
"diff_hunk": "@@ -1055,6 +1055,9 @@ def _eval_as_leading_term(self, x, logx=None, cdir=0):\n return self.func(x0) - 2*I*S.Pi\n return self.func(arg)\n \n+ def is_constant(self, *wrt, **flags):\n+ return self.args[0].is_constant(*wrt, **flags)",
"line": null,
"original_lin... | 20b5d8e4284d2aa1b8315905aebc91c37ec330ed | diff --git a/sympy/core/evalf.py b/sympy/core/evalf.py
index c9313200a434..c39e52f4637b 100644
--- a/sympy/core/evalf.py
+++ b/sympy/core/evalf.py
@@ -12,7 +12,7 @@
make_mpc, make_mpf, mp, mpc, mpf, nsum, quadts, quadosc, workprec)
from mpmath import inf as mpmath_inf
from mpmath.libmp import (from_int, from_man... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-22097@c98bccd | sympy/sympy | Python | 22,097 | 21942: remove match from solve (master) | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2021-09-14T00:59:10Z | Algebraic re-arrangement of exponential equations
Sympy version: 1.7.1
Environment: Google Colab
Python version: 3.7
I am trying to use Sympy 1.7.1 in a google Colab environment running python 3.7 to automate some tedious algebra in macroeconomic models, and I'm running into an issue when trying to re-arrange equa... | [
{
"body": "Sympy version: 1.7.1\r\nEnvironment: Google Colab\r\nPython version: 3.7\r\n\r\nI am trying to use Sympy 1.7.1 in a google Colab environment running python 3.7 to automate some tedious algebra in macroeconomic models, and I'm running into an issue when trying to re-arrange equations of the form:\r\n`... | fd94b018b0266fa9a04f463218a0d424ee11ae10 | {
"head_commit": "c98bccd22b7d40455cf79dc1cdfc97d0c2b37732",
"head_commit_message": "Initial fix for `matches`",
"patch_to_review": "diff --git a/sympy/core/add.py b/sympy/core/add.py\nindex 6b308069878a..0d3f574837ce 100644\n--- a/sympy/core/add.py\n+++ b/sympy/core/add.py\n@@ -518,8 +518,8 @@ def _combine_inver... | [
{
"diff_hunk": "@@ -518,23 +518,25 @@ def _combine_inverse(lhs, rhs):\n Returns lhs - rhs, but treats oo like a symbol so oo - oo\n returns 0, instead of a nan.\n \"\"\"\n- from sympy.simplify.simplify import signsimp\n from sympy.core.symbol import Dummy\n+ from sy... | 206da29ace24f88e4311906e26ac21019de6d2ee | diff --git a/sympy/core/add.py b/sympy/core/add.py
index 6b308069878a..697589271e89 100644
--- a/sympy/core/add.py
+++ b/sympy/core/add.py
@@ -527,14 +527,16 @@ def _combine_inverse(lhs, rhs):
S.Infinity: oo,
S.NegativeInfinity: -oo}
ireps = {v: k for k, v in reps.items()}... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} | |
TheAlgorithms__Python-9057@2fde552 | TheAlgorithms/Python | Python | 9,057 | Add MFCC Feature Extraction Algorithm | ### Describe your change:
Added MFCC Audio Signal Feature Extraction Algorithm.
Fixes https://github.com/TheAlgorithms/Python/issues/9026
* [x] Add an algorithm?
* [ ] Fix a bug or typo in an existing algorithm?
* [ ] Documentation change?
### Checklist:
* [x] I have read [CONTRIBUTING.md](https://github... | 2023-09-12T08:24:30Z | Adding MFCC Audio Signal Feature Extraction Algorithm
### Feature description
**Issue Title:**
Adding MFCC Audio Signal Feature Extraction Algorithm
**Issue Description:**
I am planning to contribute to this repository by implementing the MFCC (Mel Frequency Cepstral Coefficients) audio signal feature extraction... | check [audio_filters](https://github.com/TheAlgorithms/Python/tree/master/audio_filters) folder of this repo.
Thanks for your response. @rohan472000
I also checked the audio filter folder, but I didn't find an MFCC implementation there, so I will open a PR to add the MFCC Algorithm. MFCC is commonly categorized as... | [
{
"body": "### Feature description\n\n**Issue Title:** \r\nAdding MFCC Audio Signal Feature Extraction Algorithm\r\n\r\n**Issue Description:**\r\nI am planning to contribute to this repository by implementing the MFCC (Mel Frequency Cepstral Coefficients) audio signal feature extraction algorithm. MFCC is widel... | b203150ac481743a6d8c1ef01091712a54dfbf6c | {
"head_commit": "2fde552cb2561114acf792dd1a8cbb979f4396a2",
"head_commit_message": "Update review issues\n* Remove types from docstring\n* Rename dct\n* Add mfcc docstring\n* Add typing to several functions",
"patch_to_review": "diff --git a/machine_learning/mfcc.py b/machine_learning/mfcc.py\nnew file mode 1006... | [
{
"diff_hunk": "@@ -0,0 +1,484 @@\n+\"\"\"\n+Mel Frequency Cepstral Coefficients (MFCC) Calculation\n+\n+MFCC is a feature widely used in audio and speech processing to represent the\n+short-term power spectrum of a sound signal in a more compact and\n+discriminative way. It is particularly popular in speech an... | e143e5b12f88742e3739fd76f5c4e1bd06ec79dd | diff --git a/machine_learning/mfcc.py b/machine_learning/mfcc.py
new file mode 100644
index 000000000000..7ce8ceb50ff2
--- /dev/null
+++ b/machine_learning/mfcc.py
@@ -0,0 +1,479 @@
+"""
+Mel Frequency Cepstral Coefficients (MFCC) Calculation
+
+MFCC is an algorithm widely used in audio and speech processing to represe... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "New Feature Additions"
} |
TheAlgorithms__Python-9027@b5a4d22 | TheAlgorithms/Python | Python | 9,027 | Added Scaled Exponential Linear Unit Activation Function | Added Scaled Exponential Linear Unit Activation (SELU) Function under TheAlgorithms/Python/neural_network/activation_functions. Description of SELU taken from reference link provided in the top comment section in scaled_exponential_linear_unit.py
Fixes #9010
* [X] Add an algorithm?
### Checklist:
* [X] I h... | 2023-09-02T13:46:27Z | Other Activation Functions
### Feature description
Hi, I'm relatively new to open source and found this repo friendly for early contributions. But is there a reason as to why there are only two activations (ELU and Leaky ReLU), under neural_network / activation_functions.? Also, can I contribute new activations into i... | > But is there a reason as to why there are only two activations (ELU and Leaky ReLU), under neural_network / activation_functions.?
People simply haven't contributed any more activation functions. That being said, I think there are some activation functions currently placed under different directories (such as sigm... | [
{
"body": "### Feature description\n\nHi, I'm relatively new to open source and found this repo friendly for early contributions. But is there a reason as to why there are only two activations (ELU and Leaky ReLU), under neural_network / activation_functions.? Also, can I contribute new activations into it?",
... | 421ace81edb0d9af3a173f4ca7e66cc900078c1d | {
"head_commit": "b5a4d22184e7bd251d213105e5367796465e78c2",
"head_commit_message": "Update scaled_exponential_linear_unit.py",
"patch_to_review": "diff --git a/neural_network/activation_functions/scaled_exponential_linear_unit.py b/neural_network/activation_functions/scaled_exponential_linear_unit.py\nnew file m... | [
{
"diff_hunk": "@@ -0,0 +1,44 @@\n+\"\"\"\n+Implements the Scaled Exponential Linear Unit or SELU function.\n+The function takes a vector of K real numbers and two real numbers\n+alpha(default = 1.6732) & lambda (default = 1.0507) as input and\n+then applies the SELU function to each element of the vector.\n+SE... | 76a11d1ff74c89ccf19b4b7684920d3978e2ceb9 | diff --git a/neural_network/activation_functions/scaled_exponential_linear_unit.py b/neural_network/activation_functions/scaled_exponential_linear_unit.py
new file mode 100644
index 000000000000..f91dc6852136
--- /dev/null
+++ b/neural_network/activation_functions/scaled_exponential_linear_unit.py
@@ -0,0 +1,44 @@
+"""... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "New Feature Additions"
} |
xonsh__xonsh-3565@04ecb26 | xonsh/xonsh | Python | 3,565 | Fix column offset of unary operator AST node | Fixes #3564 | 2020-05-08T20:09:39Z | chaining other commands after `nix-store` causes "NameError: name 'nix' is not defined"
## xonfig
<details>
```
$ xonfig
+------------------+-----------------+
| xonsh | 0.9.17 |
| Python | 3.7.7 ... | This also occurs with aliases that contain a dash (`-`) if you pass a long option and chain some other command with `and` after that:
```xonsh
$ aliases['foo-bar'] = 'true'
$ foo-bar
$ foo-bar --version
true (GNU coreutils) 8.31
[...]
$ foo-bar and true
$ foo-bar --version and true ... | [
{
"body": "## xonfig\r\n\r\n<details>\r\n\r\n```\r\n$ xonfig \r\n+------------------+-----------------+\r\n| xonsh | 0.9.17 |\r\n| Python | 3.7.7 |\r\n| PLY | 3.11 |\r\n... | debb98ceabab474233068384a0cbfb960b2a3a92 | {
"head_commit": "04ecb2661f82612a32dd5a105b48da4aa2116e35",
"head_commit_message": "Fix unary operator AST node column offset\n\nThis acually fixes a bug in subprocess mode. Logical subrocess\noperators could not follow long subprocess arguments (e.g. --version).",
"patch_to_review": "diff --git a/xonsh/parsers/... | [
{
"diff_hunk": "@@ -0,0 +1,23 @@\n+**Added:**\n+\n+* <news item>\n+\n+**Changed:**\n+\n+* <news item>\n+\n+**Deprecated:**\n+\n+* <news item>\n+\n+**Removed:**\n+\n+* <news item>\n+\n+**Fixed:**\n+\n+* Logical sobprocess operators now work after long arguments (e.g. --version).",
"line": null,
"original... | 9654ba1d724b01097d637fc45e6b569a1b24b837 | diff --git a/news/fix-unary-position.rst b/news/fix-unary-position.rst
new file mode 100644
index 0000000000..61e9a9a161
--- /dev/null
+++ b/news/fix-unary-position.rst
@@ -0,0 +1,23 @@
+**Added:**
+
+* <news item>
+
+**Changed:**
+
+* <news item>
+
+**Deprecated:**
+
+* <news item>
+
+**Removed:**
+
+* <news item>
+
+... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-21952@233e209 | sympy/sympy | Python | 21,952 | enhanced int/even/odd detection | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2021-08-26T11:12:47Z | If n is even, n**2/2 should also be even
The following:
``` python
>>> n = Symbol('n', integer=True, even=True)
>>> (n**2/2).is_even
```
should return `True`, but it returns `None` (of course, this is also an enhancement).
That makes me think that perhaps symbolic integers should keep a more complex "assumptions" me... | I have added some handling for this instance in this [PR](https://github.com/sympy/sympy/pull/12320). I did put thought into generalizing this even more for any integer divisor, but because we don't have the factorizations for the symbols, this does not seem easily possible. | [
{
"body": "The following:\n\n``` python\n>>> n = Symbol('n', integer=True, even=True)\n>>> (n**2/2).is_even\n```\n\nshould return `True`, but it returns `None` (of course, this is also an enhancement).\n\nThat makes me think that perhaps symbolic integers should keep a more complex \"assumptions\" method, which... | b8156f36f0f3144c5e3b66002b9e8fcbe2ee66c4 | {
"head_commit": "233e2091bf4eb5087575f4aca3bb9e32426555eb",
"head_commit_message": "document Rational gcd=1 arg",
"patch_to_review": "diff --git a/sympy/core/mul.py b/sympy/core/mul.py\nindex 2c1d3b1ec8e5..d37b950fbc63 100644\n--- a/sympy/core/mul.py\n+++ b/sympy/core/mul.py\n@@ -1334,6 +1334,7 @@ def _eval_is_z... | [
{
"diff_hunk": "@@ -1364,13 +1368,35 @@ def _eval_is_integer(self):\n if not denominators:\n return True\n \n- odd = lambda ints: all(i.is_odd for i in ints)\n- even = lambda ints: any(i.is_even for i in ints)\n+ odd = lambda ints: all(i.is_odd for i in ints) # ALL\n+ ... | 7cc883ca13749f19c334d9a2125f9c81020d9a66 | diff --git a/sympy/core/mul.py b/sympy/core/mul.py
index 2c1d3b1ec8e5..0d293e64d11c 100644
--- a/sympy/core/mul.py
+++ b/sympy/core/mul.py
@@ -1334,6 +1334,7 @@ def _eval_is_zero(self):
#_eval_is_integer = lambda self: _fuzzy_group(
# (a.is_integer for a in self.args), quick_exit=True)
def _eval_is_in... | {
"difficulty": "high",
"estimated_review_effort": 4,
"problem_domain": "New Feature Additions"
} |
xonsh__xonsh-3277@c7e5b7b | xonsh/xonsh | Python | 3,277 | Add autovox xontrib | Add a xontrib to support automatic vox xontribs (such as avox).
This deals with all the mechanics of handling events, searching up the directory tree for venvs, and dealing with multiple policies.
Example policy:
```python
@events.autovox_policy
def dotvenv_policy(path, **_):
venv = path / '.venv'
... | 2019-08-19T01:20:45Z | Automatic Vox Policies?
One of the re-occuring feature requests for vox is automatic de/activation of venvs, based on various polices (avox is based on a concept of project directory, I think someone did it based on `.venv`, just saw one based on `pyenv-virtualenv` (which is based on the presence of a `.python-version`... | Yeah, that seems like a nice approach. | [
{
"body": "One of the re-occuring feature requests for vox is automatic de/activation of venvs, based on various polices (avox is based on a concept of project directory, I think someone did it based on `.venv`, just saw one based on `pyenv-virtualenv` (which is based on the presence of a `.python-version` file... | 59a042010f95e62f3be91368bd866a8580273174 | {
"head_commit": "c7e5b7b0f94bd55fce125538fc8dcc1d8c955f53",
"head_commit_message": "Add autovox xontrib to support automatic vox",
"patch_to_review": "diff --git a/xontrib/autovox.py b/xontrib/autovox.py\nnew file mode 100644\nindex 0000000000..d7240205fd\n--- /dev/null\n+++ b/xontrib/autovox.py\n@@ -0,0 +1,102 ... | [
{
"diff_hunk": "@@ -0,0 +1,102 @@\n+\"\"\"\n+A framework for automatic vox.\n+\n+This coordinates multiple automatic vox policies and deals with some of the\n+mechanics of venv searching and chdir handling.\n+\n+This provides no interface for end users.\n+\n+Developers should look at events.autovox_policy\n+\"\... | 14cf2265eb9f8fad8386d7a94211f5b7937154e3 | diff --git a/docs/python_virtual_environments.rst b/docs/python_virtual_environments.rst
index b744c11019..9ff824b3f0 100644
--- a/docs/python_virtual_environments.rst
+++ b/docs/python_virtual_environments.rst
@@ -102,3 +102,19 @@ Simply add the ``'{env_name}'`` variable to your ``$PROMPT``::
Note that you do **not... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "New Feature Additions"
} |
xonsh__xonsh-3342@af2c094 | xonsh/xonsh | Python | 3,342 | 👻 Spoooky! Ctrl+Z Fix! | This PR fixes the many job control issues we have had with suspending and presumably closes #1103, #2353, #2370, #2874, #3019, and #3216. I am writing this down so that we don't have to rediscover all of these points in the future.
TL;DR is that threadable subprocesses can't work with job suspension in their current... | 2019-10-06T00:47:40Z | ctrl-z problem on Linux
Launching a command (like emacs) followed by ctrl-z suspends
the process but doesn't return keyboard control to xonsh. So there
is no way to detach the process with bg and continue typing. The
documentation only mentions that ctrl-z doesn't work on Windows.
xonfig
+------------------+----------... | This one I can't reproduce. For me, the ctrl-z functionality is working just as I would expect (control goes back to the terminal).
Does this happen for all commands (e.g., `sleep 10`)? Or just for certain ones like `emacs`?
Okay, wait. I can reproduce this from within a graphical `emacs` window. I had been testi... | [
{
"body": "Launching a command (like emacs) followed by ctrl-z suspends\nthe process but doesn't return keyboard control to xonsh. So there\nis no way to detach the process with bg and continue typing. The\ndocumentation only mentions that ctrl-z doesn't work on Windows.\n\nxonfig\n+------------------+---------... | 50155c66e3eb465c1bc328fad515220899acd361 | {
"head_commit": "af2c094515a7dda2387df62980e6edfb41e51905",
"head_commit_message": "black",
"patch_to_review": "diff --git a/news/ctrlz.rst b/news/ctrlz.rst\nnew file mode 100644\nindex 0000000000..f9f43123e3\n--- /dev/null\n+++ b/news/ctrlz.rst\n@@ -0,0 +1,27 @@\n+**Added:**\n+\n+* New ``$TRHEAD_SUBPROCS`` envi... | [
{
"diff_hunk": "@@ -1159,6 +1161,26 @@ def DEFAULT_DOCS():\n \"not always happen.\",\n configurable=False,\n ),\n+ \"THREAD_SUBPROCS\": VarDocs(\n+ \"Whether or not to try to run subrocess mode in a Python thread, \"\n+ \"when applicable. There are va... | f5948f44d2415d1367594338adb07f1e90c7fbaa | diff --git a/news/ctrlz.rst b/news/ctrlz.rst
new file mode 100644
index 0000000000..fa8c5d3828
--- /dev/null
+++ b/news/ctrlz.rst
@@ -0,0 +1,27 @@
+**Added:**
+
+* New ``$THREAD_SUBPROCS`` environment variable allows you to
+ specify whether threadable subprocesses should actually be
+ run in a thread or not. Defaul... | {
"difficulty": "high",
"estimated_review_effort": 4,
"problem_domain": "Bug Fixes"
} |
TheAlgorithms__Python-8825@2f19c85 | TheAlgorithms/Python | Python | 8,825 | Simplex algorithm | ### Describe your change:
Fixes: #8820
Implements the simplex algorithm for solving linear programs.
Adds `linear_programming` folder.
* [x] Add an algorithm?
* [ ] Fix a bug or typo in an existing algorithm?
* [ ] Documentation change?
### Checklist:
* [x] I have read [CONTRIBUTING.md](https://github.com/T... | 2023-06-16T20:39:49Z | Create optimization folder
### Feature description
I have implemented the simplex algorithm in Python, but I can’t find the appropriate category to place it in.
The simplex algorithm finds the best value of a function, while restricted by inequality constraints. It enters the linear programming sub-field of mathema... | @cclauss @dhruvmanila
What are your opinions on the creation of this directory?
Let's go with `linear_programming`. Thanks. | [
{
"body": "### Feature description\n\nI have implemented the simplex algorithm in Python, but I can’t find the appropriate category to place it in.\r\n\r\nThe simplex algorithm finds the best value of a function, while restricted by inequality constraints. It enters the linear programming sub-field of mathemati... | 46379861257d43bb7140d261094bf17dc414950f | {
"head_commit": "2f19c85c779cd0d93bcc2cfbca88f8546e308e16",
"head_commit_message": "added docstrings",
"patch_to_review": "diff --git a/linear_programming/simplex.py b/linear_programming/simplex.py\nnew file mode 100644\nindex 000000000000..f6c17136da9a\n--- /dev/null\n+++ b/linear_programming/simplex.py\n@@ -0,... | [
{
"diff_hunk": "@@ -0,0 +1,327 @@\n+\"\"\"\n+Python implementation of the simplex algorithm for solving linear programs in\n+tabular form with\n+- `>=`, `<=`, and `=` constraints and\n+- each variable `x1, x2, ...>= 0`.\n+\n+See https://gist.github.com/imengus/f9619a568f7da5bc74eaf20169a24d98 for how\n+to conve... | 7593cbbb713a53e17261e17dab682824e4dac701 | diff --git a/linear_programming/simplex.py b/linear_programming/simplex.py
new file mode 100644
index 000000000000..ba64add40b5f
--- /dev/null
+++ b/linear_programming/simplex.py
@@ -0,0 +1,311 @@
+"""
+Python implementation of the simplex algorithm for solving linear programs in
+tabular form with
+- `>=`, `<=`, and `... | {
"difficulty": "high",
"estimated_review_effort": 4,
"problem_domain": "New Feature Additions"
} |
xonsh__xonsh-3200@344671b | xonsh/xonsh | Python | 3,200 | Fix `cat` can't read pseudo files with zero size | <!--- Thanks for opening a PR on xonsh! Please include a news entry with your PR
to help keep our changelog up to date! There are instructions available here:
https://xon.sh/devguide.html#changelog -->
<!--- If there is specific issue / feature request that this PR is addressing,
please link to the corresponding ... | 2019-07-05T16:49:06Z | coreutils cat can't read /proc/*
Hey ! cat from coreutils doesn't return anything when reading files from `/proc` :
```
$ cat /proc/cpuinfo
$ /us... | [
{
"body": "Hey ! cat from coreutils doesn't return anything when reading files from `/proc` :\r\n```\r\n$ cat /proc/cpuinfo \r\n$ /usr/bin/ca... | cb485817ea4fad44138b4e4b9d573fbd9cee60b0 | {
"head_commit": "344671ba42562cc4e52ebd10c06432d75c78d211",
"head_commit_message": "add to restore the deleted new line",
"patch_to_review": "diff --git a/news/3182-fix-cat-proc-file.rst b/news/3182-fix-cat-proc-file.rst\nnew file mode 100644\nindex 0000000000..c26c588255\n--- /dev/null\n+++ b/news/3182-fix-cat-... | [
{
"diff_hunk": "@@ -49,15 +52,11 @@ def _cat_single_file(opts, fname, stdin, out, err, line_count=1):\n print(\"cat: No such file or directory: {}\".format(fname), file=err)\n return True, line_count\n else:\n- fstat = os.stat(fname)\n- file_size = fstat.st_size\n- if fi... | 585a0e4d24c34354ef72184d779421f687de3889 | diff --git a/news/3182-fix-cat-proc-file.rst b/news/3182-fix-cat-proc-file.rst
new file mode 100644
index 0000000000..c26c588255
--- /dev/null
+++ b/news/3182-fix-cat-proc-file.rst
@@ -0,0 +1,23 @@
+**Added:**
+
+* <news item>
+
+**Changed:**
+
+* <news item>
+
+**Deprecated:**
+
+* <news item>
+
+**Removed:**
+
+* <ne... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} | |
xonsh__xonsh-2957@79da918 | xonsh/xonsh | Python | 2,957 | fix extra newlines in ptk2 | Weird that this is needed, but it does fix the problem. Closes #2910 | 2018-12-12T00:01:56Z | An extra newline character gets printed in Python mode
## xonfig
```
+------------------+----------------------+
| xonsh | 0.8.2 |
| Git SHA | 6159f449 |
| Commit Date | Sep 21 02:39:43 2018 |
| Python | 3.7.1 |
| PLY | 3.1... | If I understood him right, @scopatz suggested that the extra newline gets there from
https://github.com/xonsh/xonsh/blob/dca4a477150b55a7011078daba9da8bb0e95ceae/xonsh/base_shell.py#L382, but no, unfortunately that's not the case.
The extra EOL seems to be printed from within `exec()` call in codecache.py:run_compiled... | [
{
"body": "## xonfig\r\n```\r\n+------------------+----------------------+\r\n| xonsh | 0.8.2 |\r\n| Git SHA | 6159f449 |\r\n| Commit Date | Sep 21 02:39:43 2018 |\r\n| Python | 3.7.1 |\r\n| PLY | 3.11 |\r\... | 6d1b5e0842779dad1094e6c6c849cc68b196535a | {
"head_commit": "79da918e72bd6a3897d172bd341e82188295b75f",
"head_commit_message": "fix extra newlines in ptk2",
"patch_to_review": "diff --git a/news/extranl.rst b/news/extranl.rst\nnew file mode 100644\nindex 0000000000..73f7f346d5\n--- /dev/null\n+++ b/news/extranl.rst\n@@ -0,0 +1,24 @@\n+**Added:**\n+\n+* <n... | [
{
"diff_hunk": "@@ -0,0 +1,24 @@\n+**Added:**\n+\n+* <news item>\n+\n+**Changed:**\n+\n+* <news item>\n+\n+**Deprecated:**\n+\n+* <news item>\n+\n+**Removed:**\n+\n+* <news item>\n+\n+**Fixed:**\n+\n+* Fixed issues where the prompt-toolkit v2 shell would print an extra newline\n+ after Python evalutions in int... | f7ff9724210c5b468b80474b8fe1b0095bfd1f96 | diff --git a/news/extranl.rst b/news/extranl.rst
new file mode 100644
index 0000000000..586f5af4fc
--- /dev/null
+++ b/news/extranl.rst
@@ -0,0 +1,24 @@
+**Added:**
+
+* <news item>
+
+**Changed:**
+
+* <news item>
+
+**Deprecated:**
+
+* <news item>
+
+**Removed:**
+
+* <news item>
+
+**Fixed:**
+
+* Fixed issues wher... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-21883@418efae | sympy/sympy | Python | 21,883 | fix(solvers): split separable systems of equations properly | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2021-08-16T22:44:36Z | Incorrect solutions given by `solve`
The following code tries to find the solutions of a system of (multivariate quadratic) equations. However, the single solution returned by `solve` is not correct.
It seems like `f = 0` should be part of the solution but is not.
```python
from sympy import solve, sympify
equ... | I've bisected this to 67fbbe670dbf2e77b4fdebf6493ee4f32f9c8a79 from #18844.
A simple diff that fixes this is:
```diff
diff --git a/sympy/solvers/solvers.py b/sympy/solvers/solvers.py
index fd9e6a5fc8..aea9652aa2 100644
--- a/sympy/solvers/solvers.py
+++ b/sympy/solvers/solvers.py
@@ -1737,7 +1737,7 @@ def _sol... | [
{
"body": "The following code tries to find the solutions of a system of (multivariate quadratic) equations. However, the single solution returned by `solve` is not correct.\r\nIt seems like `f = 0` should be part of the solution but is not.\r\n\r\n```python\r\nfrom sympy import solve, sympify\r\n\r\nequations ... | ad4cbf280c381a08601405b4453e4a60a73b7e52 | {
"head_commit": "418efaea73e6eed5282a92ab96c066474369eaa4",
"head_commit_message": "fix(solvers): fix doctest after change to solve_system",
"patch_to_review": "diff --git a/doc/src/tutorial/solvers.rst b/doc/src/tutorial/solvers.rst\nindex f41f1d9f5979..7091ee6a0af1 100644\n--- a/doc/src/tutorial/solvers.rst\n+... | [
{
"diff_hunk": "@@ -1373,14 +1379,33 @@ def test_issue_5849_matrix():\n 2*I3 + 2*I5 + 3*I6 - Q2,\n I4 - 2*I5 + 2*Q4 + dI4\n )\n- assert solve(e, I1, I4, Q2, Q4, dI1, dI4, dQ2, dQ4) == {\n- I1: I2 + I6,\n- dI1: -4*I2 - 4*I3 - 4*I5 - 10*I6 + 24,\n- I4: -I5 + I6,\n- dQ4: -I5 + I6... | a8adad61b6edf0ec5e6cd775819d96e89286c3a4 | diff --git a/doc/src/tutorial/solvers.rst b/doc/src/tutorial/solvers.rst
index f41f1d9f5979..91a054a57e3a 100644
--- a/doc/src/tutorial/solvers.rst
+++ b/doc/src/tutorial/solvers.rst
@@ -142,6 +142,10 @@ In the ``solveset`` module, the non linear system of equations is solved using
``solve`` can be used for such ca... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "Bug Fixes"
} |
xonsh__xonsh-2221@edadbca | xonsh/xonsh | Python | 2,221 | fixes OSError: [Errno 22] Invalid argument | closes #2220 | 2017-02-19T04:54:19Z | Potential OSError: [Errno 22] Invalid argument
In current `proc.py:CommandPipeline` implementation, we built and run procs first, then give controlling terminal to them. There are cases that all the processes have finished, then the "give terminal to them" will raise errors.
```
$ ls
Traceback (most recent call la... | I think this just needs a try-except. Thanks for reporting @mitnk
@scopatz yes, PR is coming. | [
{
"body": "In current `proc.py:CommandPipeline` implementation, we built and run procs first, then give controlling terminal to them. There are cases that all the processes have finished, then the \"give terminal to them\" will raise errors.\r\n\r\n```\r\n$ ls\r\nTraceback (most recent call last):\r\n File \"/... | 684dce97da0c9a3c96293ca10833ceca4f48a53b | {
"head_commit": "edadbcab64f6e1b827e49836a5bb61eb6e85635a",
"head_commit_message": "fixes OSError: [Errno 22] Invalid argument",
"patch_to_review": "diff --git a/news/give-term-to-none.rst b/news/give-term-to-none.rst\nnew file mode 100644\nindex 0000000000..59016251c7\n--- /dev/null\n+++ b/news/give-term-to-non... | [
{
"diff_hunk": "@@ -135,9 +135,19 @@ def give_terminal_to(pgid):\n def give_terminal_to(pgid):\n oldmask = signal.pthread_sigmask(signal.SIG_BLOCK,\n _block_when_giving)\n- os.tcsetpgrp(FD_STDERR, pgid)\n- signal.pthread_sigm... | caa4b89954d79212fc0ac6d87fa07ed0c10803c5 | diff --git a/news/give-term-to-none.rst b/news/give-term-to-none.rst
new file mode 100644
index 0000000000..59016251c7
--- /dev/null
+++ b/news/give-term-to-none.rst
@@ -0,0 +1,14 @@
+**Added:** None
+
+**Changed:** None
+
+**Deprecated:** None
+
+**Removed:** None
+
+**Fixed:**
+
+* Fixed a potential "OSError: [Errno ... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
xonsh__xonsh-2172@2b6119b | xonsh/xonsh | Python | 2,172 | fix tcsetattr: Interrupted system call | try fixes #2170 | 2017-02-08T15:03:21Z | script that calls ssh gets interrupted
```
laerus@xonsh$ cat autossh
ssh laerus@192.168.1.10
laerus@xonsh$ ./autossh
^Z <--- didn't press anything here, this comes from xonsh or ssh
```
tried again with a non-lan remote
```
laerus@xonsh$ ./autossh
^Z
tcsetattr: Interrupted system call
``` | [
{
"body": "```\r\nlaerus@xonsh$ cat autossh \r\nssh laerus@192.168.1.10\r\nlaerus@xonsh$ ./autossh \r\n^Z <--- didn't press anything here, this comes from xonsh or ssh\r\n```\r\n\r\ntried again with a non-lan remote\r\n```\r\nlaerus@xonsh$ ./autossh\r\n^Z\r\ntcsetattr: Interrupted system call\r\n```",
"numb... | ff9d890846e01e81edbd0610e9acd70a042d9446 | {
"head_commit": "2b6119bf0ec62074664efbd51b7548636129380e",
"head_commit_message": "fix tcsetattr: Interrupted system call",
"patch_to_review": "diff --git a/news/xonsh-script-fix.rst b/news/xonsh-script-fix.rst\nnew file mode 100644\nindex 0000000000..e42eeec3ed\n--- /dev/null\n+++ b/news/xonsh-script-fix.rst\n... | [
{
"diff_hunk": "@@ -535,6 +535,9 @@ def prep_preexec_fn(self, kwargs, pipeline_group=None):\n \"\"\"Prepares the 'preexec_fn' keyword argument\"\"\"\n if not (ON_POSIX and self.cls is subprocess.Popen):\n return\n+ env = builtins.__xonsh_env__\n+ if not env['XONSH_INTER... | 3586a3580ac683ed3bd76a453e667613680231af | diff --git a/news/xonsh-script-fix.rst b/news/xonsh-script-fix.rst
new file mode 100644
index 0000000000..e42eeec3ed
--- /dev/null
+++ b/news/xonsh-script-fix.rst
@@ -0,0 +1,13 @@
+**Added:** None
+
+**Changed:** None
+
+**Deprecated:** None
+
+**Removed:** None
+
+**Fixed:**
+
+* Fixed a ``tcsetattr: Interrupted syste... | {
"difficulty": "medium",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} | |
TheAlgorithms__Python-8163@255e4b7 | TheAlgorithms/Python | Python | 8,163 | docs: add the other/miscellaneous form | ### Describe your change
- Add the other/miscellaneous form.
- Closes #8133.
### Checklist:
* [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md).
* [x] This pull request is all my own work -- I have not plagiarized.
* [x] I know that pull requests will not... | 2023-03-02T04:50:59Z | [DOCS] Add a miscellaneous issue form
### Feature description
By adding a miscellaneous/other issue template/form, we can make other types of issues that do not fit any of the provided templates.
The benefits of adding this would include the ability to:
- Create good first issues, which are beginner-friendly oppor... | Can you please specify that "adding miscellaneous/other issue template or form" means to add it to the repo or add it to one of the particular repo folders? And what type of output do you expect from the form?
I mean to the repository itself when reporting an issue.
What do you mean exactly by output? 🤔
By output I... | [
{
"body": "### Feature description\n\nBy adding a miscellaneous/other issue template/form, we can make other types of issues that do not fit any of the provided templates.\r\nThe benefits of adding this would include the ability to:\r\n\r\n- Create good first issues, which are beginner-friendly opportunities.\r... | 64543faa980b526f79d287a073ebb7554749faf9 | {
"head_commit": "255e4b7e1bfdfffe1147fbdf9cf43a86fc36898d",
"head_commit_message": "docs: add the other/miscellaneous form",
"patch_to_review": "diff --git a/.github/ISSUE_TEMPLATE/other.yml b/.github/ISSUE_TEMPLATE/other.yml\nnew file mode 100644\nindex 000000000000..f32dadef93be\n--- /dev/null\n+++ b/.github/I... | [
{
"diff_hunk": "@@ -0,0 +1,29 @@\n+name: Other\n+description: Use this for any other issues. PLEASE do not create blank issues\n+title: \"[OTHER]\"\n+labels: [\"awaiting triage\"]\n+body:\n+ - type: markdown\n+ attributes:\n+ value: \"# Other issue\"\n+ - type: textarea\n+ id: issuedescription\n+ ... | b93fd4535adb879bb34c603768d638c10772fe18 | diff --git a/.github/ISSUE_TEMPLATE/other.yml b/.github/ISSUE_TEMPLATE/other.yml
new file mode 100644
index 000000000000..44d6ff541506
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/other.yml
@@ -0,0 +1,19 @@
+name: Other
+description: Use this for any other issues. PLEASE do not create blank issues
+labels: ["awaiting tri... | {
"difficulty": "low",
"estimated_review_effort": 1,
"problem_domain": "New Feature Additions"
} |
xonsh__xonsh-2136@27ef724 | xonsh/xonsh | Python | 2,136 | ignore vc aliases in command_cache | I don't *think* this will have any side effects.
When we build the ``$PROMPT``, we lazily check for ``git`` and ``hg``
binaries to see if we should generate a ``<branch>`` field.
At the same time ``lazy_locate_binary`` doesn't return the path to a
command if it detects that that command is an alias (since alias... | 2017-01-31T23:16:50Z | Branch not shown if 'git' is aliased to 'hub'
I you do `brew install hub` and add `aliases['git'] = ['hub']` to ~/.xonshrc, git branches will no longer be shown in directories.
This is very strange since Hub is just a wrapper around git, and `hub branch` yields exactly the same output as `git branch`. In fact the fo... | Hey @moigagoo -- thanks for reporting.
Quick question: does the same behavior occur if you set `aliases['git'] = 'hub'`?
hmmm, interesting. I can duplicate this by setting `aliases['git'] = 'git'`
Yes, the same behavior occurs with `aliases['git'] = 'hub'`.
the `curr_branch` function in `$PROMPT_FIELDS` that fetche... | [
{
"body": "I you do `brew install hub` and add `aliases['git'] = ['hub']` to ~/.xonshrc, git branches will no longer be shown in directories.\r\n\r\nThis is very strange since Hub is just a wrapper around git, and `hub branch` yields exactly the same output as `git branch`. In fact the former just invokes the l... | cb62c0c3c336095fafd7dbf1f9767650bcc9ac73 | {
"head_commit": "27ef724927efebe2a8299dab244d1dfec281baff",
"head_commit_message": "remove special case ugliness\n\nReplace with something better.\nNo more special casing, now `allcmds` is a tuple of path and also alias\nif it exists (otherwise `None`). `locate_binary` and\n`lazy_locate_binary` also not take an ad... | [
{
"diff_hunk": "@@ -99,11 +99,11 @@ def all_commands(self):\n # entries at the back.\n for cmd in executables_in(path):\n key = cmd.upper() if ON_WINDOWS else cmd\n- allcmds[key] = (os.path.join(path, cmd), cmd in alss)\n+ allcmds[key] = (os.... | 21d05918aede6beb6edfd730c52e1721dae2e8c9 | diff --git a/news/vc_alias_fix.rst b/news/vc_alias_fix.rst
new file mode 100644
index 0000000000..9469b4d785
--- /dev/null
+++ b/news/vc_alias_fix.rst
@@ -0,0 +1,14 @@
+**Added:** None
+
+**Changed:** None
+
+**Deprecated:** None
+
+**Removed:** None
+
+**Fixed:**
+
+* Fixed issue wherein if ``git`` or (presumably) ``h... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
xonsh__xonsh-2756@a1c5b46 | xonsh/xonsh | Python | 2,756 | Jupyter Xernel | This fixes #2712, in so far as that issue is actually addressable.
I have completely removed the dependence on `ipykernel`, and instead forked the pyzmq-based [simple kernel](https://github.com/dsblank/simple_kernel/blob/master/simple_kernel.py). I needed to do this in order to avoid some of the AST transformation... | 2018-08-02T22:48:19Z | Issues with the Jupyter kernel
The Jupyter kernel seems nice, but it doesn't seem to work too well in a notebook:
- Output isn't printed until the command exits
- Commands like a git clone that clear the line aren't cleared (compare this to the standard IPython `!git clone`)
- It doesn't know that the output isn't... | Ok, so I think the issue might be that we are subclassing from `ipykernel`, which is leading to all sorts of wrong assumptions about the code being valid Python. We probably shouldn't be doing that anymore, but maybe @Carreau can weight in with his thoughts
> It doesn't know that the output isn't a tty. So something li... | [
{
"body": "The Jupyter kernel seems nice, but it doesn't seem to work too well in a notebook:\r\n\r\n- Output isn't printed until the command exits\r\n- Commands like a git clone that clear the line aren't cleared (compare this to the standard IPython `!git clone`)\r\n- It doesn't know that the output isn't a t... | 483591308c77a1def45df638d6b5be5b280c1778 | {
"head_commit": "a1c5b46a6961340b23eebfae7a7beff4c14885e4",
"head_commit_message": "fixed flake issue",
"patch_to_review": "diff --git a/docs/api/jupyter_shell.rst b/docs/api/jupyter_shell.rst\nnew file mode 100644\nindex 0000000000..dc2f277000\n--- /dev/null\n+++ b/docs/api/jupyter_shell.rst\n@@ -0,0 +1,10 @@\n... | [
{
"diff_hunk": "@@ -1,72 +1,398 @@\n # -*- coding: utf-8 -*-\n \"\"\"Hooks for Jupyter Xonsh Kernel.\"\"\"\n+import sys\n+import json\n+import hmac\n+import uuid\n+import errno\n+import hashlib\n+import datetime\n import builtins\n+import threading\n from pprint import pformat\n+from argparse import ArgumentPar... | abd568fcccdb2fc223b7a773c7b7b07655d8b78c | diff --git a/docs/api/index.rst b/docs/api/index.rst
index 50aa585c16..b659117709 100644
--- a/docs/api/index.rst
+++ b/docs/api/index.rst
@@ -77,6 +77,7 @@ For those of you who want the gritty details.
color_tools
pyghooks
jupyter_kernel
+ jupyter_shell
wizard
xonfig
codecache
diff --g... | {
"difficulty": "high",
"estimated_review_effort": 4,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-21864@723fd13 | sympy/sympy | Python | 21,864 | iterables - fixes issue 21863 and now multiset_permutations can handle [] | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2021-08-12T19:02:26Z | multiset_permutations needs to handle []
```diff
diff --git a/sympy/utilities/iterables.py b/sympy/utilities/iterables.py
index 83fc2f48d2..0a91615dde 100644
--- a/sympy/utilities/iterables.py
+++ b/sympy/utilities/iterables.py
@@ -1419,7 +1419,7 @@ def multiset_permutations(m, size=None, g=None):
do = [gi f... | [
{
"body": "```diff\r\ndiff --git a/sympy/utilities/iterables.py b/sympy/utilities/iterables.py\r\nindex 83fc2f48d2..0a91615dde 100644\r\n--- a/sympy/utilities/iterables.py\r\n+++ b/sympy/utilities/iterables.py\r\n@@ -1419,7 +1419,7 @@ def multiset_permutations(m, size=None, g=None):\r\n do = [gi for gi in g... | ec0fe8c5f3e59840e8aa5d3d6a7c976e40f76b64 | {
"head_commit": "723fd1320c3d6c5473ae6bd69dc47fef9f6f9024",
"head_commit_message": "fixed issue 21863",
"patch_to_review": "diff --git a/sympy/utilities/iterables.py b/sympy/utilities/iterables.py\nindex 83fc2f48d2e9..0a91615ddedd 100644\n--- a/sympy/utilities/iterables.py\n+++ b/sympy/utilities/iterables.py\n@@... | [
{
"diff_hunk": "@@ -1419,7 +1419,7 @@ def multiset_permutations(m, size=None, g=None):\n do = [gi for gi in g if gi[1] > 0]\n SUM = sum([gi[1] for gi in do])\n if not do or size is not None and (size > SUM or size < 1):\n- if size < 1:\n+ if not do and size is None or size < 1:",
"... | 581ec835bb1be83d7d22d9eb929e5dc827b1134b | diff --git a/sympy/utilities/iterables.py b/sympy/utilities/iterables.py
index 83fc2f48d2e9..77ccd453bd69 100644
--- a/sympy/utilities/iterables.py
+++ b/sympy/utilities/iterables.py
@@ -1419,7 +1419,7 @@ def multiset_permutations(m, size=None, g=None):
do = [gi for gi in g if gi[1] > 0]
SUM = sum([gi[1] for ... | {
"difficulty": "low",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} | |
TheAlgorithms__Python-7790@16ad3be | TheAlgorithms/Python | Python | 7,790 | Added Manhattan distance algorithm | ### Describe your change:
Added an algorithm to calculate Manhattan distance,
Added the algorithm twice, one in a mor traditional way and other using a one-liner.
Fixes: #7776
* [x] Add an algorithm?
* [ ] Fix a bug or typo in an existing algorithm?
* [ ] Documentation change?
### Checklist:
* [X] I h... | 2022-10-28T16:38:29Z | Add the calculation of Manhattan Distance
### Feature description
The Manhattan distance (also known as taxicab distance) measures the distance between two points in a n-dimensional grid only taking into account the diference between each coordinate point instead of using the Euclidean distance.
For example, you ... | Please, assing it to me, as soon as I finish at work, I'll commit and make the PR | [
{
"body": "### Feature description\r\n\r\nThe Manhattan distance (also known as taxicab distance) measures the distance between two points in a n-dimensional grid only taking into account the diference between each coordinate point instead of using the Euclidean distance.\r\n\r\nFor example, you want to go by t... | 26cecea27198848e2c1c0bc6d7f887d4ed7adb87 | {
"head_commit": "16ad3be296f51d31530cf1c764970649b2a5a664",
"head_commit_message": "Added Manhattan distance algorithm, Fixes: #7776",
"patch_to_review": "diff --git a/maths/manhattan_distance.py b/maths/manhattan_distance.py\nnew file mode 100644\nindex 000000000000..f0508d34d959\n--- /dev/null\n+++ b/maths/man... | [
{
"diff_hunk": "@@ -0,0 +1,133 @@\n+from typing import Any\n+\n+\n+def manhattan_distance(point_a: list, point_b: list) -> float:\n+ \"\"\"\n+ Expectts two list of numbers representing two points in the same\n+ n-dimensional space\n+\n+ https://en.wikipedia.org/wiki/Taxicab_geometry\n+\n+ >>> man... | ae57a5a8513826770292e5eed642073c7ff9446a | diff --git a/maths/manhattan_distance.py b/maths/manhattan_distance.py
new file mode 100644
index 000000000000..2711d4c8ccd6
--- /dev/null
+++ b/maths/manhattan_distance.py
@@ -0,0 +1,126 @@
+def manhattan_distance(point_a: list, point_b: list) -> float:
+ """
+ Expectts two list of numbers representing two point... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "New Feature Additions"
} |
xonsh__xonsh-2560@289af91 | xonsh/xonsh | Python | 2,560 | tutorial for subproc strings | Hopefully this closes #621 and #1432 | 2017-12-09T06:35:40Z | quote removal in subprocess mode does not behave as expected
Please have a look at the following two examples::
```
xonsh$ /bin/echo 'foo'
foo
xonsh$ /bin/echo 'foo'bar
'foo'bar
```
In the first case quotes are stripped from the second argument; in the
second, quotes are kept.
This is not consistent... | Hi @riccardomurri, you are correct that we are not consistent with how other shells treat string. Xonsh makes a willful departure from what other shells do, in part because what other shells do is not self-consistent. Rather, xonsh's literal string syntax sticks as close as possible to Python string behaviour, which w... | [
{
"body": "Please have a look at the following two examples::\n\n```\n xonsh$ /bin/echo 'foo'\n foo\n\n xonsh$ /bin/echo 'foo'bar\n 'foo'bar\n```\n\nIn the first case quotes are stripped from the second argument; in the\nsecond, quotes are kept.\n\nThis is not consistent with what other shells do, a... | c4e2ec5815ffb44eb449953743fb07398b3041cf | {
"head_commit": "289af915e1d04f3ac0867da1767691953d5e2f16",
"head_commit_message": "Thanks to @melund, tailing",
"patch_to_review": "diff --git a/docs/guides.rst b/docs/guides.rst\nindex c402ba016b..0f42e1f32a 100644\n--- a/docs/guides.rst\n+++ b/docs/guides.rst\n@@ -13,6 +13,7 @@ Guides\n tutorial_events\n ... | [
{
"diff_hunk": "@@ -0,0 +1,131 @@\n+.. _tutorial_subproc_strings:\n+\n+************************************\n+Tutorial: Subprocess Strings\n+************************************\n+Strings in xonsh follow two simple rules:\n+\n+1. Strings in xonsh are always parsed in the same way, and\n+2. Python always wins!\n... | 503c40c66ca10ce6298f0cbc03ddb78628f34766 | diff --git a/docs/guides.rst b/docs/guides.rst
index c402ba016b..0f42e1f32a 100644
--- a/docs/guides.rst
+++ b/docs/guides.rst
@@ -13,6 +13,7 @@ Guides
tutorial_events
tutorial_completers
tutorial_history_backend
+ tutorial_subproc_strings
tutorial_ptk
bash_to_xsh
python_virtual_environ... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} |
TheAlgorithms__Python-7547@60e5156 | TheAlgorithms/Python | Python | 7,547 | Add Cramer's rule for solving system of linear equations in two variables | ### Describe your change:
Fixes #7122
* [x] Add an algorithm?
* [ ] Fix a bug or typo in an existing algorithm?
* [] Documentation change?
### Checklist:
* [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md).
* [x] This pull request is all my own work -- ... | 2022-10-23T09:10:03Z | System of linear equation in 2 variable.
### Feature description
I want to implement a new module inside the matrix ... To solve the System of linear equations in 2 variables using Cramer's Rule.
### Would you like to work on this feature?
- [X] Yes, I want to work on this feature! | Please, assign me this, I want to work on this.
Bro, I want to work on this that's why I CREATED THIS ISSUE 🥲🥲 I m not maintainer ... I m contributor.
Please leave this, try other issues.
Please assign me this issue. | [
{
"body": "### Feature description\n\nI want to implement a new module inside the matrix ... To solve the System of linear equations in 2 variables using Cramer's Rule. \n\n### Would you like to work on this feature?\n\n- [X] Yes, I want to work on this feature!",
"number": 7122,
"title": "System of lin... | ed127032b303d06f2c1ceefd58a8680bb4c2ce50 | {
"head_commit": "60e5156b0756ce1e39bc48a53f9aea91a45f9158",
"head_commit_message": "added script for solving system of linear equations in two variables",
"patch_to_review": "diff --git a/matrix/system_of_linear_equation_in_2_variables.py b/matrix/system_of_linear_equation_in_2_variables.py\nnew file mode 100644... | [
{
"diff_hunk": "@@ -0,0 +1,84 @@\n+def calculate_x_and_y(eq1, eq2):\n+ \"\"\"\n+ Solves the system of linear equation in 2 variables.\n+ :param: eq1: list of 3 numbers\n+ :param: eq2: list of 3 numbers\n+ :return: String of result\n+ Theory:-\n+ https://www.mathsisfun.com/algebra/systems-li... | a832ad864ed079d78195ac9c6787186b13f77844 | diff --git a/matrix/cramers_rule_2x2.py b/matrix/cramers_rule_2x2.py
new file mode 100644
index 000000000000..a635d66fbb6c
--- /dev/null
+++ b/matrix/cramers_rule_2x2.py
@@ -0,0 +1,82 @@
+# https://www.chilimath.com/lessons/advanced-algebra/cramers-rule-with-two-variables
+# https://en.wikipedia.org/wiki/Cramer%27s_rul... | {
"difficulty": "low",
"estimated_review_effort": 3,
"problem_domain": "New Feature Additions"
} |
sympy__sympy-21817@ec2b195 | sympy/sympy | Python | 21,817 | stats - fixes issue#21057 by change value check to positive semi-definite | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2021-08-03T13:07:24Z | Cannot create joint normal distribution with positive semidefinite covariance matrix
I want to create a joint normal distributed random variable with a covariance matrix that is positive semidefinite but not positive definite. This seems to be impossible:
```python
import sympy.stats
sympy.stats.Normal("x", [0, ... | It seems like the fix is simply changing `sigma.is_positive_definite` to `sigma.is_positive_semidefinite` in https://github.com/sympy/sympy/blob/2346054bb4888ef7eec2f6dad6c3dd52bf1fe927/sympy/stats/joint_rv_types.py#L138-L144
Reminds me of [this](https://github.com/sympy/sympy/pull/19935) PR. I haven't checked the c... | [
{
"body": "I want to create a joint normal distributed random variable with a covariance matrix that is positive semidefinite but not positive definite. This seems to be impossible:\r\n\r\n```python\r\nimport sympy.stats\r\n\r\nsympy.stats.Normal(\"x\", [0, 0], [[0,0], [0,0]])\r\n```\r\ngives\r\n\r\n```\r\n Fi... | 746d7e5640fdeae864505eba8e9ce0a1ba7a1d52 | {
"head_commit": "ec2b195a43bb51d38156295b4a5b0423ded37fda",
"head_commit_message": "changed docstrings",
"patch_to_review": "diff --git a/sympy/stats/joint_rv_types.py b/sympy/stats/joint_rv_types.py\nindex 51ccb7089ba5..57b2ab20bd84 100644\n--- a/sympy/stats/joint_rv_types.py\n+++ b/sympy/stats/joint_rv_types.p... | [
{
"diff_hunk": "@@ -182,6 +182,7 @@ def MultivariateNormal(name, mu, sigma):\n mu : List representing the mean or the mean vector\n sigma : Positive definite square matrix",
"line": null,
"original_line": 183,
"original_start_line": null,
"path": "sympy/stats/joint_rv_types.py",
"sta... | ffab691c0aa47000b632e5381b7a46f3eef2f5a7 | diff --git a/sympy/stats/joint_rv_types.py b/sympy/stats/joint_rv_types.py
index 51ccb7089ba5..26e1d84a5d73 100644
--- a/sympy/stats/joint_rv_types.py
+++ b/sympy/stats/joint_rv_types.py
@@ -139,10 +139,10 @@ def set(self):
def check(mu, sigma):
_value_check(mu.shape[0] == sigma.shape[0],
"Si... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
TheAlgorithms__Python-7034@5e69a3b | TheAlgorithms/Python | Python | 7,034 | Convert snake_case to camelCase or PascalCase (#7028) | ### Describe your change:
Fixes #7028
* [X] Add an algorithm?
* [ ] Fix a bug or typo in an existing algorithm?
* [ ] Documentation change?
### Checklist:
* [X] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md).
* [X] This pull request is all my own work --... | 2022-10-12T09:48:09Z | Convert snake_case to camelCase or PascalCase
### Feature description
An algorithm that given a string formatted as snake_case returns it as camelCase or PascalCase depending on Boolean parameter.
Examples:
`def snake_to_camel_case(input: str, use_pascal: bool = False) -> str`
`snake_to_camel_case('some_string_... | Please assign it to me, I have almost finished it | [
{
"body": "### Feature description\n\nAn algorithm that given a string formatted as snake_case returns it as camelCase or PascalCase depending on Boolean parameter.\r\n\r\nExamples:\r\n\r\n`def snake_to_camel_case(input: str, use_pascal: bool = False) -> str`\r\n`snake_to_camel_case('some_string_in_snake_case')... | f0d1a42deb146bebcdf7b1b2ec788c815ede452a | {
"head_commit": "5e69a3b7992e7fa63e91c587d39c3f1c5e70e11c",
"head_commit_message": "Added snake_case to Camel or Pascal case Fixes: #7028",
"patch_to_review": "diff --git a/strings/snake_case_to_camel_pascal_case.py b/strings/snake_case_to_camel_pascal_case.py\nnew file mode 100644\nindex 000000000000..614cb841f... | [
{
"diff_hunk": "@@ -0,0 +1,58 @@\n+def snake_to_camel_case(input: str, use_pascal: bool = False) -> str:\n+ \"\"\"\n+ Transforms a snake_case fiven string to camelCase (or PascalCase if indicated)\n+ (defaults to not use Pascal)\n+\n+ >>> snake_to_camel_case(\"some_random_string\")\n+ 'someRandom... | 80dc427a5b9b82a04eda68f283778b67ac37b739 | diff --git a/strings/snake_case_to_camel_pascal_case.py b/strings/snake_case_to_camel_pascal_case.py
new file mode 100644
index 000000000000..7b2b61d1d1cf
--- /dev/null
+++ b/strings/snake_case_to_camel_pascal_case.py
@@ -0,0 +1,52 @@
+def snake_to_camel_case(input: str, use_pascal: bool = False) -> str:
+ """
+ ... | {
"difficulty": "low",
"estimated_review_effort": 3,
"problem_domain": "New Feature Additions"
} |
TheAlgorithms__Python-5882@966fe8d | TheAlgorithms/Python | Python | 5,882 | Minmum path sum | ### Describe your change:
Added an algorithm that takes a 2 dimensional grid of numbers, and finds the path starting from the top left and ending at the bottom right with the lowest possible sum of numbers along the path. It then returns the sum of all numbers along that path.
For Example:
Input: [
[1,3,1],
[... | 2021-12-24T22:40:15Z | DSA-Matrix-Python- Minimum Path sum
Hey there, I'm participating in #hactoberfest2k21, Please assign me the issue. Good day!
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of all numbers along its path.You can only move either down or right at an... | Please assign me this issue. I am a good programmer and a beginner at open source. I would give it my best!
Please assign me this issue. I want to take my first steps towards contributing in open-source.
Hello please assigne me this issue.I am a beginner at open source and want to hone my skills.
`I can do this! pleas... | [
{
"body": "Hey there, I'm participating in #hactoberfest2k21, Please assign me the issue. Good day!\r\nGiven a m x n grid filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of all numbers along its path.You can only move either down or right at any point in time... | 9af2eef9b3761bf51580dedfb6fa7136ca0c5c2c | {
"head_commit": "966fe8d6dda81e2376dbc10e5754e677973d6f36",
"head_commit_message": "added description to minimum_path_sum",
"patch_to_review": "diff --git a/graphs/minimum_path_sum.py b/graphs/minimum_path_sum.py\nnew file mode 100644\nindex 000000000000..faf104c2e107\n--- /dev/null\n+++ b/graphs/minimum_path_su... | [
{
"diff_hunk": "@@ -0,0 +1,60 @@\n+def min_path(grid):",
"line": null,
"original_line": 1,
"original_start_line": null,
"path": "graphs/minimum_path_sum.py",
"start_line": null,
"text": "@unknown:\nPlease provide return type hint for the function: `min_path`. **If the function does not r... | a77cb2f41ca1a9e184aa65d364f77ba0f90eb53f | diff --git a/graphs/minimum_path_sum.py b/graphs/minimum_path_sum.py
new file mode 100644
index 000000000000..df1e545df3d0
--- /dev/null
+++ b/graphs/minimum_path_sum.py
@@ -0,0 +1,63 @@
+def min_path_sum(grid: list) -> int:
+ """
+ Find the path from top left to bottom right of array of numbers
+ with the low... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "New Feature Additions"
} |
xonsh__xonsh-2530@534f496 | xonsh/xonsh | Python | 2,530 | Fixes spaces in readline tab completer | Should fix #2485 | 2017-11-10T02:40:52Z | Tab completion breaks on paths with spaces
```
de3lxl-106789 /tmp $ xonfig
+------------------+----------------------+
| xonsh | 0.5.12.dev47.dev102 |
| Git SHA | c787f9ab |
| Commit Date | Aug 16 00:10:57 2017 |
| Python | 3.4.3 |
| PLY ... | Thanks for reporting @Droggelbecher ! This seems like a regression.
I've occasionally seen similar issues with partial completes not substituting correctly.
I had the same issue but it was fixed when I upgraded to prompt_toolkit version 1.0.15
Ok! I am not seeing this issue anymore on PTK v1.015, however, I am still se... | [
{
"body": "```\r\nde3lxl-106789 /tmp $ xonfig\r\n+------------------+----------------------+\r\n| xonsh | 0.5.12.dev47.dev102 |\r\n| Git SHA | c787f9ab |\r\n| Commit Date | Aug 16 00:10:57 2017 |\r\n| Python | 3.4.3 |\r\n| PLY | 3.8 ... | 20dfda5d59a4d109e9c19bc73119c3cd6870d703 | {
"head_commit": "534f4967c2c4164fa3cfc9db5f05108842f2729c",
"head_commit_message": "indents",
"patch_to_review": "diff --git a/docs/intro.rst b/docs/intro.rst\nindex 6bc36d9bb8..43aec33c65 100644\n--- a/docs/intro.rst\n+++ b/docs/intro.rst\n@@ -42,6 +42,7 @@ the xonsh shell\n \"Conches for the xonsh god!... | [
{
"diff_hunk": "@@ -335,7 +336,8 @@ def bash_completions(prefix, line, begidx, endidx, env=None, paths=None,\n strip_len += 1\n \n if '-o noquote' not in complete_stmt:\n- out = quote_paths(out, '', '')\n+ out, need_qoutes = quote_paths(out, '', '')\n+ strip_len += int(need_qout... | 60365ff00c59f5e712bda98e889cd1987c9c625f | diff --git a/docs/intro.rst b/docs/intro.rst
index 56cf68a2b8..d946437ba6 100644
--- a/docs/intro.rst
+++ b/docs/intro.rst
@@ -42,6 +42,7 @@ the xonsh shell
"Conches for the xonsh god!",
"Python-powered, cross-platform, Unix-gazing shell",
"Tab completion in Alderaan places",
+ "This f... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-21547@4e8d1c1 | sympy/sympy | Python | 21,547 | Fix: Bug in MinMax which returned an incorrect simplication which is not true for all ranges of the variables | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2021-05-30T17:07:52Z | nested Max and Min give incorrect result
While working with different types of nested Max and Min expressions, I have encountered a problem in the following expression:
```
from sympy import sympify
sympify( "Max( Min(a, b), Min(a, b, c))" )
```
output: `Min(a, b, c)`
This simplification is not correct for a... | The issue isn't to do with sympify because it happens if you use Max/Min directly:
```python
In [1]: a, b, c = symbols('a, b, c')
In [2]: Max( Min(a, b), Min(a, b, c))
Out[2]: Min(a, b, c)
```
The logic for handling this is here:
https://github.com/sympy/sympy/blob/d43e9dc5aed4d2b695a3176cdf8ad4e3c79f0e5b/symp... | [
{
"body": "While working with different types of nested Max and Min expressions, I have encountered a problem in the following expression:\r\n```\r\nfrom sympy import sympify \r\nsympify( \"Max( Min(a, b), Min(a, b, c))\" )\r\n```\r\n\r\noutput: `Min(a, b, c)`\r\n\r\nThis simplification is not correct for all p... | b4736a507d0158a2a09a15bc61907a063d5fa674 | {
"head_commit": "4e8d1c1506cdbcad835bf36b030f90b35fbf134d",
"head_commit_message": "Fix: Bug in MinMax which returned an incorrect simplication which is not true for all ranges of the variables\nearlier, Max( Min(a, b), Min(a, b, c)) returned Min(a,b,c)\nnow, Max( Min(a, b), Min(a, b, c)) returns Min(a,b)\n\n- Add... | [
{
"diff_hunk": "@@ -432,7 +433,8 @@ def _collapse_arguments(cls, args, **assumptions):\n \n >>> Min(a, Max(b, Min(c, d, Max(a, e))))\n Min(a, Max(b, Min(a, c, d)))\n-\n+ >>> Max( Min(a, b), Min(a, b, c))\n+ Min(a,b)",
"line": null,
"original_line": 437,
"original_start_... | 2598335352740227c85857ac2b07d00200a98858 | diff --git a/sympy/functions/elementary/miscellaneous.py b/sympy/functions/elementary/miscellaneous.py
index 85b606e754bc..b458bd2af7c6 100644
--- a/sympy/functions/elementary/miscellaneous.py
+++ b/sympy/functions/elementary/miscellaneous.py
@@ -1,4 +1,5 @@
from sympy.core import Function, S, sympify
+from sympy.util... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
TheAlgorithms__Python-2467@0984075 | TheAlgorithms/Python | Python | 2,467 | Add Python type hints and doctests to other/two_sum.py | Fixes #2465
### **Describe your change:**
* [ ] Add an algorithm?
* [x] Fix a bug or typo in an existing algorithm?
* [ ] Documentation change?
### **Checklist:**
* [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md).
* [x] This pull request is all my ... | 2020-09-23T19:20:09Z | Add Python type hints and doctests to other/two_sum.py
@tonydelanuez Would you be willing to add Python type hints and doctests to [`other/two_sum.py`](../blob/master/other/two_sum.py)? The function comments say that it will return a `list[int]` but instead it either returns a `list[list[int]]` or `False`. | [
{
"body": "@tonydelanuez Would you be willing to add Python type hints and doctests to [`other/two_sum.py`](../blob/master/other/two_sum.py)? The function comments say that it will return a `list[int]` but instead it either returns a `list[list[int]]` or `False`.",
"number": 2465,
"title": "Add Python ... | 9200a2e54362ecd6be6cfc7e257a37e7a4f16013 | {
"head_commit": "09840756e3fd95eb21c4ea1ced077aac89929953",
"head_commit_message": "Add Python type hints and doctests to other/two_sum.py\n\n#2465",
"patch_to_review": "diff --git a/other/two_sum.py b/other/two_sum.py\nindex 8ac7a18ba9a4..7011ba049756 100644\n--- a/other/two_sum.py\n+++ b/other/two_sum.py\n@@ -... | [
{
"diff_hunk": "@@ -11,21 +11,36 @@\n Because nums[0] + nums[1] = 2 + 7 = 9,\n return [0, 1].\n \"\"\"\n+from typing import List",
"line": null,
"original_line": 14,
"original_start_line": null,
"path": "other/two_sum.py",
"start_line": null,
"text": "@user1:\n```suggestion\r\nfrom __fut... | 4203f373d15a52aecf360a96994bc0477a0097e7 | diff --git a/other/two_sum.py b/other/two_sum.py
index 8ac7a18ba9a4..5209acbc7e44 100644
--- a/other/two_sum.py
+++ b/other/two_sum.py
@@ -11,21 +11,37 @@
Because nums[0] + nums[1] = 2 + 7 = 9,
return [0, 1].
"""
+from __future__ import annotations
-def twoSum(nums, target):
+def two_sum(nums: list[int], target:... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Documentation Updates"
} | |
sympy__sympy-21527@bd2aad4 | sympy/sympy | Python | 21,527 | fix(matrices): Don't use DomainMatrix.rref for RR in linsolve | The DomainMatrix.rref method as implemented by the sdm_irref function
has not been well designed for handling matrices of floats as it does
not have a pivoting strategy that can mitigate errors arising from
erroneously choosing a zero pivot (that is nonzero only because of
roundoff). This commit makes linsolve use ... | 2021-05-26T23:53:16Z | linsolve fails simple system of two equations
```
import sympy
x,y = sympy.symbols('x, y')
sympy.linsolve([sympy.Eq(y, x), sympy.Eq(y, 0.0215 * x)], (x, y))
>> FiniteSet((0, 0))
sympy.linsolve([sympy.Eq(y, x), sympy.Eq(y, 0.0216 * x)], (x, y))
>> FiniteSet((-4.07992766242527e+17*y, 1.0*y))
sympy.linsolve([... | It seems that in rref the pivot is not fully cancelled due to a rounding error so e.g. we have something like:
```python
In [1]: M = Matrix([[1.0, 1.0], [3.1, 1.0]])
In [2]: M
Out[2]:
⎡1.0 1.0⎤
⎢ ⎥
⎣3.1 1.0⎦
```
Then one step of row reduction gives:
```python
In [3]: M = Matrix([[1.0, 1.0], [1e-1... | [
{
"body": "```\r\nimport sympy\r\nx,y = sympy.symbols('x, y')\r\n\r\nsympy.linsolve([sympy.Eq(y, x), sympy.Eq(y, 0.0215 * x)], (x, y))\r\n>> FiniteSet((0, 0))\r\n\r\nsympy.linsolve([sympy.Eq(y, x), sympy.Eq(y, 0.0216 * x)], (x, y))\r\n>> FiniteSet((-4.07992766242527e+17*y, 1.0*y))\r\n\r\nsympy.linsolve([sympy.E... | 31d469a5335c81ec4a437e36a861945a6b43d916 | {
"head_commit": "bd2aad45a6ab782e7e4f8fe08cabfa8836a25227",
"head_commit_message": "fix(matrices): Don't use DomainMatrix.rref for RR in linsolve\n\nThe DomainMatrix.rref method as implemented by the sdm_irref function\nhas not been well designed for handling matrices of floats as it does\nnot have a pivoting stra... | [
{
"diff_hunk": "@@ -73,6 +74,13 @@ def _linsolve(eqs, syms):\n Aaug = sympy_dict_to_dm(eqsdict, rhs, syms)\n K = Aaug.domain\n \n+ # sdm_irref has issues with float matrices. This uses the Matrix.rref()\n+ # method. When DomainMatrix.rref() can handle float matrices reasonably\n+ # this should ... | e49bddb241b36b34d0a9ebc8e11b5b8995cff57c | diff --git a/sympy/polys/constructor.py b/sympy/polys/constructor.py
index adcfd13dc3cc..3ae1babce9c0 100644
--- a/sympy/polys/constructor.py
+++ b/sympy/polys/constructor.py
@@ -48,7 +48,7 @@ def _construct_simple(coeffs, opt):
float_numbers.append(x)
if y.is_Float:
... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "Bug Fixes"
} |
TheAlgorithms__Python-2032@ab151ba | TheAlgorithms/Python | Python | 2,032 | Merge sort Update variable names | Fixes #2023
Merge sort variable name updated along with some comments are added | 2020-05-23T19:28:59Z | Mergesort Update Variable Names
I was looking over the mergesort.py file in the divide_and_conquer directory when I saw that all of the variable names are a single letter and there is not much documentation. Does anyone know enough about this file to improve the variable names and make the code more understandable? | Can I improve the file?
No need to wait for permission. Just go for it. Pull requests will be reviewed.
Only our competitors think that we should wait.
Can I Modify the Variables to Clarify There Meanings ?
What I can do
Hello folks @Robinson-Arivan @aditya-190 @avitomar12, welcome to the community and before you ... | [
{
"body": "I was looking over the mergesort.py file in the divide_and_conquer directory when I saw that all of the variable names are a single letter and there is not much documentation. Does anyone know enough about this file to improve the variable names and make the code more understandable?",
"number": ... | d8a4faf96d940737ddc488aa8817bc3563ab1a82 | {
"head_commit": "ab151baa0dd3d5913b5248d53523141a50a13ef1",
"head_commit_message": "Update Merge sort variable names",
"patch_to_review": "diff --git a/divide_and_conquer/mergesort.py b/divide_and_conquer/mergesort.py\nindex 328e3dca316f..51da8ba716e3 100644\n--- a/divide_and_conquer/mergesort.py\n+++ b/divide_a... | [
{
"diff_hunk": "@@ -1,45 +1,48 @@\n-def merge(a, b, m, e):\n- l = a[b : m + 1] # noqa: E741\n- r = a[m + 1 : e + 1]\n- k = b\n+def merge(arr, left, mid, right): \n+ # overall array will divided into 2 array\n+ # l contain left portion of array from left to mid of array\n+ # r contain right po... | d1c3e55cb788b62953cf7b92618618fcd4714782 | diff --git a/divide_and_conquer/mergesort.py b/divide_and_conquer/mergesort.py
index 328e3dca316f..f31a57251ce6 100644
--- a/divide_and_conquer/mergesort.py
+++ b/divide_and_conquer/mergesort.py
@@ -1,45 +1,48 @@
-def merge(a, b, m, e):
- l = a[b : m + 1] # noqa: E741
- r = a[m + 1 : e + 1]
- k = b
+def merge... | {
"difficulty": "low",
"estimated_review_effort": 1,
"problem_domain": "Code Refactoring / Architectural Improvement"
} |
sympy__sympy-21476@ecab539 | sympy/sympy | Python | 21,476 | fix(diffgeom): fix indirect transformation | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2021-05-16T07:53:41Z | diffgeom.CoordSystem.transform with indirect relation raises KeyError
Below code is a minimal example for an indirect transform via a temporary intermediate coordinate system. `parabolic2D.transform(poloidal)` raises a KeyError.
MWE:
```
"""
2D manifold coordinate systems
"""
import sympy
import sympy.diffgeom... | I started looking into this, I noticed another bug in addition to the type mismatch in the Dijkstra algorithm. Your example only gives the forward transformation from parabolic2D to cartesian2D, so in order to solve `poloidal.transform(parabolic2D)` the `transform `method will need to calculate the inverse transformat... | [
{
"body": "Below code is a minimal example for an indirect transform via a temporary intermediate coordinate system. `parabolic2D.transform(poloidal)` raises a KeyError.\r\n\r\nMWE:\r\n```\r\n\"\"\"\r\n2D manifold coordinate systems\r\n\"\"\"\r\nimport sympy\r\nimport sympy.diffgeom\r\n\r\nCARTESIAN2D = \"carte... | f6b0190377be37f93f5e431951e66b562ef5dc35 | {
"head_commit": "ecab539228b95d9dd9de48f035daa5da377aa1fc",
"head_commit_message": "fix(diffgeom): fix indirect transformation\n\nAllow indirect transformation\nChange signature of relation in order to allow indirect transformation",
"patch_to_review": "diff --git a/sympy/diffgeom/diffgeom.py b/sympy/diffgeom/di... | [
{
"diff_hunk": "@@ -396,52 +401,66 @@ def transformation(self, sys):\n if self == sys:\n expr = Matrix(self.symbols)\n elif key in self.relations:\n- expr = Matrix(self.relations[key])\n+ expr = Matrix(self.relations[key][1])\n elif key[::-1] in self.rel... | d76f3b9abe2d417d8f27f6b5dfa4c40c95bc001c | diff --git a/sympy/diffgeom/diffgeom.py b/sympy/diffgeom/diffgeom.py
index ba82beebbab6..f4f1aa444d41 100644
--- a/sympy/diffgeom/diffgeom.py
+++ b/sympy/diffgeom/diffgeom.py
@@ -193,8 +193,9 @@ class CoordSystem(Basic):
relations : dict, optional
Key is a tuple of two strings, who are the names of the ... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "Bug Fixes"
} |
TheAlgorithms__Python-1203@79531e5 | TheAlgorithms/Python | Python | 1,203 | Added Matrix Exponentiation | Fixes #1180 Added the **matrix_exponentiation.py** file in **maths directory** | 2019-09-25T08:51:44Z | Adding Matrix Exponentiation
I was just browsing through the algorithms and data structures but couldn't find Matrix Exponentiation, which is useful for solving linear recurrences in logarithmic time. So, is this something you guys think should be added? If yes then I can work on it and submit a PR. Thanks | 👍 Go for it!
sure
Please show us side-by-sige benchmarks (using [timeit](https://docs.python.org/3.7/library/timeit.html) or similar) of the two methods running on the same square matrices so we can see the performance.
Initially I thought of using the simple problem of finding the nth element of fibonacci series in O... | [
{
"body": "I was just browsing through the algorithms and data structures but couldn't find Matrix Exponentiation, which is useful for solving linear recurrences in logarithmic time. So, is this something you guys think should be added? If yes then I can work on it and submit a PR. Thanks",
"number": 1180,... | 01601e6382e92b5a3806fb3a44357460dff97ee7 | {
"head_commit": "79531e5bc8ffd94cb10d72fc370bef1761bc152c",
"head_commit_message": "Added the matrix_exponentiation.py file in maths directory",
"patch_to_review": "diff --git a/maths/matrix_exponentiation.py b/maths/matrix_exponentiation.py\nnew file mode 100644\nindex 000000000000..17b243baf7ca\n--- /dev/null\... | [
{
"diff_hunk": "@@ -0,0 +1,134 @@\n+\"\"\"Matrix Exponentiation\"\"\"\n+\n+import timeit\n+\n+\"\"\"\n+Matrix Exponentiation is a technique to solve linear recurrences in logarithmic time.\n+You read more about it here: \n+http://zobayer.blogspot.com/2010/11/matrix-exponentiation.html\n+https://www.hackerearth.... | 8e64f021cc0ad35494bb130f77ec7a46d24f65b0 | diff --git a/maths/matrix_exponentiation.py b/maths/matrix_exponentiation.py
new file mode 100644
index 000000000000..ee9e1757687c
--- /dev/null
+++ b/maths/matrix_exponentiation.py
@@ -0,0 +1,99 @@
+"""Matrix Exponentiation"""
+
+import timeit
+
+"""
+Matrix Exponentiation is a technique to solve linear recurrences in... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "New Feature Additions"
} |
sympy__sympy-21436@02ee02f | sympy/sympy | Python | 21,436 | Raise warning if relation of frames is looped. | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2021-05-06T06:38:29Z | Support orienting adjacent reference frames in arbitrary orders
Suppose you want to establish relative orientation among frames A, B, C, D, and E as such:
```
A ----- B
|
|-------C----D
|
|----E
```
A is the root of the tree, B, D, and E are leaves. You do this now with code that looks like:... | @angadhn I've opened an issue for this topic that we discussed last night.
A minimum enhancement here would be to explain in the various `.orient*()` documentation that any call to `X.orient*()` will remove any prior relationships to `X` and that to construct a chain or tree of relative oriented reference frames requir... | [
{
"body": "Suppose you want to establish relative orientation among frames A, B, C, D, and E as such:\r\n\r\n```\r\nA ----- B\r\n|\r\n|-------C----D\r\n |\r\n |----E\r\n```\r\n\r\nA is the root of the tree, B, D, and E are leaves. You do this now with code that looks like:\r\n\r\n```python\r\nB.or... | 45d4e5f7fe1ac8bcdfa425bbac722481d2ec183f | {
"head_commit": "02ee02ffd64f86addf136dffb52ef0f023f7d551",
"head_commit_message": "Add `Warns` section to all orient functions' docstring",
"patch_to_review": "diff --git a/sympy/physics/vector/frame.py b/sympy/physics/vector/frame.py\nindex aa9e21e4b561..b3c7a1547ea0 100644\n--- a/sympy/physics/vector/frame.py... | [
{
"diff_hunk": "@@ -579,6 +600,12 @@ def orient_axis(self, parent, axis, angle):\n angle : sympifiable\n Angle in radians by which it the frame is to be rotated.\n \n+ Warns\n+ ======\n+\n+ UserWarning\n+ If frames are looped.",
"line": null,
"original... | a2b81fb9e4ab650bf8d0259787adaeaff5ee1279 | diff --git a/sympy/physics/vector/frame.py b/sympy/physics/vector/frame.py
index aa9e21e4b561..e181a7d36701 100644
--- a/sympy/physics/vector/frame.py
+++ b/sympy/physics/vector/frame.py
@@ -4,6 +4,8 @@
from sympy.physics.vector.vector import Vector, _check_vector
from sympy.utilities.misc import translate
+from wa... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Code Refactoring / Architectural Improvement"
} |
sympy__sympy-21452@7f98847 | sympy/sympy | Python | 21,452 | Modified Heaviside(t) to have a standard value at Heaviside(0)=1/2 | #### References to other Issues or PRs
related to https://github.com/sympy/sympy/pull/20411
fixes #21392
#### Brief description of what is fixed or changed
Modified Heaviside(t) to have a standard value at Heaviside(0)=1/2 with all tests adapted.
The test_issue_15923() are removed, they are not necessary a... | 2021-05-10T14:31:10Z | get_points() generates error when used with Heaviside() function
The following code used to work with older versions of sympy (e.g. 1.3) but generates an error with 1.7.1
```
import sympy as sym
t = sym.symbols('t')
p = sym.plot(sym.Heaviside(t), (t, -5, 5), show=False)
points = p[0].get_points()
```
resul... | [
{
"body": "The following code used to work with older versions of sympy (e.g. 1.3) but generates an error with 1.7.1\r\n\r\n```\r\nimport sympy as sym\r\n\r\nt = sym.symbols('t')\r\np = sym.plot(sym.Heaviside(t), (t, -5, 5), show=False)\r\npoints = p[0].get_points()\r\n```\r\n\r\nresults in\r\n\r\n`AttributeErr... | 92e7cb0b27bb810d67013a2cdbbd1f8e7f7aba45 | {
"head_commit": "7f9884733f767dc032d7f95e310f224803f5f02b",
"head_commit_message": "Post-review changes:\n* Heaviside(0,nan) now evaluates and returns nan\n* Tests tidied up\n* Documentation improved",
"patch_to_review": "diff --git a/sympy/functions/elementary/complexes.py b/sympy/functions/elementary/complexes... | [
{
"diff_hunk": "@@ -7224,8 +7224,8 @@ def test_pretty_misc_functions():\n assert upretty(fresnelc(x)) == 'C(x)'\n assert pretty(fresnels(x)) == 'S(x)'\n assert upretty(fresnels(x)) == 'S(x)'\n- assert pretty(Heaviside(x)) == 'Heaviside(x)'\n- assert upretty(Heaviside(x)) == 'θ(x)'\n+ assert... | 8247a096aca4d9f8cf9def4307a0f90bd0a8cc67 | diff --git a/sympy/functions/elementary/complexes.py b/sympy/functions/elementary/complexes.py
index 1c3b4e50c4ef..66a96335ebc5 100644
--- a/sympy/functions/elementary/complexes.py
+++ b/sympy/functions/elementary/complexes.py
@@ -442,7 +442,7 @@ def _eval_rewrite_as_Piecewise(self, arg, **kwargs):
def _eval_rewri... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} | |
sympy__sympy-21286@5bf16b4 | sympy/sympy | Python | 21,286 | corrections for symbolic Range | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
fixes #21269
#### Brief description of what is fixed or changed
#### Other comments
* to return or to raise
Symbolic Range is tricky bec... | 2021-04-10T12:15:40Z | make symbolic Range more canonical
Whereas a Range with numerical args is canonical, the Range containing symbols is not:
```python
>>> [Range(3,j,2) for j in range(4,10)]
[Range(3, 5, 2), Range(3, 5, 2), Range(3, 7, 2), Range(3, 7, 2), Range(3, 9, 2), Range(3, 9, 2)]
vs
>>> [Range(i,i+j,5) for j in range(1,6)... | [
{
"body": "Whereas a Range with numerical args is canonical, the Range containing symbols is not:\r\n```python\r\n>>> [Range(3,j,2) for j in range(4,10)]\r\n[Range(3, 5, 2), Range(3, 5, 2), Range(3, 7, 2), Range(3, 7, 2), Range(3, 9, 2), Range(3, 9, 2)]\r\n\r\nvs\r\n\r\n>>> [Range(i,i+j,5) for j in range(1,6)]\... | 546e10799fe55b3e59dea8fa6b3a6d6e71843d33 | {
"head_commit": "5bf16b49c0029f307a74bc5eaae0303b7b27930f",
"head_commit_message": "enforce step range with condition",
"patch_to_review": "diff --git a/sympy/sets/fancysets.py b/sympy/sets/fancysets.py\nindex 45404f2862ae..0eae37f619b9 100644\n--- a/sympy/sets/fancysets.py\n+++ b/sympy/sets/fancysets.py\n@@ -10... | [
{
"diff_hunk": "@@ -731,6 +755,9 @@ def is_finite_set(self):\n return self.size.is_finite\n \n def __bool__(self):\n+ # this only distinguishes between definite null range\n+ # and non-null/unknown null; getting True doesn't mean\n+ # that it actually is not null\n retur... | b3a2a7bbbac0281314fecfa64c2d06a2e1c413bd | diff --git a/sympy/sets/fancysets.py b/sympy/sets/fancysets.py
index 45404f2862ae..861737b25760 100644
--- a/sympy/sets/fancysets.py
+++ b/sympy/sets/fancysets.py
@@ -6,11 +6,11 @@
from sympy.core.function import Lambda
from sympy.core.logic import fuzzy_not, fuzzy_or, fuzzy_and
from sympy.core.numbers import oo
-fr... | {
"difficulty": "high",
"estimated_review_effort": 4,
"problem_domain": "Code Refactoring / Architectural Improvement"
} | |
sympy__sympy-21326@d19a52e | sympy/sympy | Python | 21,326 | Fix irrational exponent case in solveset._invert_real | Fixes #21236
Original code would raise ValueError on 'not base.is_positive'
assuming that the only situation for this case is when the
exponent is irrational. Issue 21236 showed that this case is
reached even when exponent is a Float. Also, the 'not base.is_positive'
is invalid for three-valued logic. solveset r... | 2021-04-15T17:47:56Z | computing probability involving a weibull distribution raises ValueError
OS: Linux Ubuntu 20.04
Python: 3.9.3
SymPy: 1.7.1
```python
>>> import sympy
>>> sympy.__version__
'1.7.1'
>>> from sympy.stats import Weibull, P
>>> X = Weibull("x", 8000, 1.5)
>>> P(X <= 4000)
...
ValueError: x**w where w is irratio... | I'd like to work on this issue.
The particular issue described here could be fixed by this diff:
```diff
diff --git a/sympy/solvers/solveset.py b/sympy/solvers/solveset.py
index 17da5ae025..786041be5e 100644
--- a/sympy/solvers/solveset.py
+++ b/sympy/solvers/solveset.py
@@ -258,7 +258,7 @@ def _invert_real(f, g_... | [
{
"body": "OS: Linux Ubuntu 20.04\r\nPython: 3.9.3\r\nSymPy: 1.7.1\r\n\r\n```python\r\n>>> import sympy\r\n>>> sympy.__version__\r\n'1.7.1'\r\n>>> from sympy.stats import Weibull, P\r\n>>> X = Weibull(\"x\", 8000, 1.5)\r\n>>> P(X <= 4000)\r\n...\r\nValueError: x**w where w is irrational is not defined for negat... | 0a2f378e73f6e1f1f992aab63b2516b12439b728 | {
"head_commit": "d19a52e01fdc6be0155a4ed3dda079a9700b842e",
"head_commit_message": "Refactor and add test",
"patch_to_review": "diff --git a/sympy/solvers/solveset.py b/sympy/solvers/solveset.py\nindex 17da5ae0255d..bbfbb47a5494 100644\n--- a/sympy/solvers/solveset.py\n+++ b/sympy/solvers/solveset.py\n@@ -239,29... | [
{
"diff_hunk": "@@ -2811,3 +2817,7 @@ def test_substitution_with_infeasible_solution():\n (0, Complement(FiniteSet(p01), FiniteSet(0)), 0, p11, 0, 0, 0, 0, 0, 0, 0, -l2*p11/p01, -l3*p11/p01, l2, l3),\n )\n assert sol != nonlinsolve(system, solvefor)\n+\n+def test_issue_21236():\n+ x, y, z = s... | 2c1a01652547c31ca7eaff81753178ffd5bab8ce | diff --git a/sympy/solvers/solveset.py b/sympy/solvers/solveset.py
index 17da5ae0255d..f02b58af8043 100644
--- a/sympy/solvers/solveset.py
+++ b/sympy/solvers/solveset.py
@@ -239,30 +239,38 @@ def _invert_real(f, g_ys, symbol):
expo_has_sym = expo.has(symbol)
if not expo_has_sym:
- res = ... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-21279@1c3b514 | sympy/sympy | Python | 21,279 | feat(assumptions): reorganize facts for new assumptions | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2021-04-09T15:38:42Z | Incorrect assumption for is_hermitian
An object being antihermitian implies it being not hermitian in new assumption system. (and vice versa)
```python
>>> ask(Q.hermitian(x), Q.antihermitian(x))
False
```
But in old assumptions system, it does not.
```python
>>> x = Symbol('x', antihermitian=True)
>>> pr... | A matrix or operator can be neither hermitian nor antihermitian so that's a bug in the new assumptions.
I don't think that hermitian/antihermitian should be part of the old assumptions.
It is true that an operator being not hermitian does not mean that it is antihermitian. But doesn't an operator ***being hermitia... | [
{
"body": "An object being antihermitian implies it being not hermitian in new assumption system. (and vice versa)\r\n\r\n```python\r\n>>> ask(Q.hermitian(x), Q.antihermitian(x))\r\nFalse\r\n```\r\n\r\nBut in old assumptions system, it does not.\r\n\r\n```python\r\n>>> x = Symbol('x', antihermitian=True)\r\n>>>... | e4e840ca8e83c0e206a8bf17525a6490d89665d4 | {
"head_commit": "1c3b514896cb2720b261b73687fedc7e1f4c9dc1",
"head_commit_message": "feat(assumptions) : reorganize new assumption fact\n\nFix test_known_facts_consistent()",
"patch_to_review": "diff --git a/bin/ask_update.py b/bin/ask_update.py\nindex 97d0485b3682..345d0e4759e8 100755\n--- a/bin/ask_update.py\n+... | [
{
"diff_hunk": "@@ -143,7 +143,27 @@ def to_NNF(expr):\n \"\"\"\n Generates the Negation Normal Form of any boolean expression in terms\n of AND, OR, and Literal objects.\n+\n+ Examples\n+ ========\n+\n+ >>> from sympy import Q\n+ >>> from sympy.assumptions.cnf import to_NNF\n+ >>> fr... | d9eb7850ad8eac45df07113de6b5347a80481f6e | diff --git a/bin/ask_update.py b/bin/ask_update.py
index 97d0485b3682..345d0e4759e8 100755
--- a/bin/ask_update.py
+++ b/bin/ask_update.py
@@ -21,7 +21,7 @@
if os.path.isdir(sympy_dir):
sys.path.insert(0, sympy_top)
-from sympy.assumptions.ask import (compute_known_facts,
+from sympy.assumptions.facts import (c... | {
"difficulty": "high",
"estimated_review_effort": 4,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-21459@382ea94 | sympy/sympy | Python | 21,459 | [WIP] Rational Riccati solver | This PR introduces a Rational Riccati ODE solver. This code can also be used to solve a subclass of 2nd order ODEs solvable by [Kovacic's Algorithm](https://cs.uwaterloo.ca/research/tr/1984/CS-84-35.pdf)
#### References to other Issues or PRs
Partial Fix #19183, #21503
#### Brief description of what is fixed or ... | 2021-05-11T16:56:48Z | Riccati's equation
Hello
I have a question regarding using Sympy for solving Riccati's equation:
y’ = -y**2 + x*y + 1
It seems that Sympy is not able to solve this equation, while a closed-formed solution in terms of the error function exists (Mathematica has no problem finding this solution).
Would someone h... | Sympy currently gives a series solution:
```
In [3]: dsolve(Eq(f(x).diff(x), -f(x)**2 + f(x)*x + 1))
Out[3]:
3 ⎛ 2 ⎛ 2⎞ ⎛ 2 ⎞ ⎞ 5 ⎛ 2 ⎛ 2⎞ 2 ⎛ 2⎞ ⎛ 2 ⎞ ⎛
... | [
{
"body": "Hello\r\nI have a question regarding using Sympy for solving Riccati's equation:\r\ny’ = -y**2 + x*y + 1 \r\nIt seems that Sympy is not able to solve this equation, while a closed-formed solution in terms of the error function exists (Mathematica has no problem finding this solution).\r\nWould s... | 49470f4c02543337647b9dd37ac900c40e208b0c | {
"head_commit": "382ea94adcef2474e7578701fb248e7a25300766",
"head_commit_message": "Added riccati submodule",
"patch_to_review": "diff --git a/sympy/solvers/ode/ode.py b/sympy/solvers/ode/ode.py\nindex 98bad219834d..d97d155371fe 100644\n--- a/sympy/solvers/ode/ode.py\n+++ b/sympy/solvers/ode/ode.py\n@@ -332,6 +3... | [
{
"diff_hunk": "@@ -0,0 +1,500 @@\n+r\"\"\"\n+This module contains :py:meth:`~sympy.solvers.ode.riccati.RationalRiccati`,\n+a solver class which gives rational solutions to first order Riccati ODEs.\n+A general first order Riccati ODE is given by\n+\n+.. math:: y' = b_0(x) + b_1(x)w + b_2(x)w^2\n+\n+where `b_0,... | b74008ab706238dede78b5cef12060aa65371820 | diff --git a/doc/src/modules/solvers/ode.rst b/doc/src/modules/solvers/ode.rst
index 8f9c74fe856c..2076a36ba830 100644
--- a/doc/src/modules/solvers/ode.rst
+++ b/doc/src/modules/solvers/ode.rst
@@ -100,6 +100,11 @@ factorable
.. autoclass:: sympy.solvers.ode.single::FirstLinear
:members:
+1st_rational_riccati
+... | {
"difficulty": "high",
"estimated_review_effort": 4,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-21171@bd5489e | sympy/sympy | Python | 21,171 | Patched the latex printing error in _print_SingularityFunction() | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2021-03-26T07:48:35Z | _print_SingularityFunction() got an unexpected keyword argument 'exp'
On a Jupyter Notebook cell, type the following:
```python
from sympy import *
from sympy.physics.continuum_mechanics import Beam
# Young's modulus
E = symbols("E")
# length of the beam
L = symbols("L")
# concentrated load at the end tip of ... | Could you provide a fully working example? Copying and pasting your code leaves a number of non-defined variables. Thanks for the report.
@moorepants Sorry for that, I've just updated the code in the original post.
This is the string printed version from `b2..shear_force()`:
```
Out[5]: -F*SingularityFunction(x, L/... | [
{
"body": "On a Jupyter Notebook cell, type the following:\r\n\r\n```python\r\nfrom sympy import *\r\nfrom sympy.physics.continuum_mechanics import Beam\r\n# Young's modulus\r\nE = symbols(\"E\")\r\n# length of the beam\r\nL = symbols(\"L\")\r\n# concentrated load at the end tip of the beam\r\nF = symbols(\"F\"... | aa22709cb7df2d7503803d4b2c0baa7aa21440b6 | {
"head_commit": "bd5489ee747e40084c44989b526ea891dafb0846",
"head_commit_message": "remove trailing whitespace",
"patch_to_review": "diff --git a/sympy/printing/latex.py b/sympy/printing/latex.py\nindex 43f9e6ad8d93..6a713e8098ec 100644\n--- a/sympy/printing/latex.py\n+++ b/sympy/printing/latex.py\n@@ -1968,10 +... | [
{
"diff_hunk": "@@ -1968,10 +1968,12 @@ def _print_DiracDelta(self, expr, exp=None):\n tex = r\"\\left(%s\\right)^{%s}\" % (tex, exp)\n return tex\n \n- def _print_SingularityFunction(self, expr):\n+ def _print_SingularityFunction(self, expr, exp=None):\n shift = self._print(ex... | f24da7a32face8a0858fabbb0ade82a8d0d937ca | diff --git a/sympy/printing/latex.py b/sympy/printing/latex.py
index 43f9e6ad8d93..e9d404021ecc 100644
--- a/sympy/printing/latex.py
+++ b/sympy/printing/latex.py
@@ -1968,10 +1968,12 @@ def _print_DiracDelta(self, expr, exp=None):
tex = r"\left(%s\right)^{%s}" % (tex, exp)
return tex
- def _... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-21165@9eebefe | sympy/sympy | Python | 21,165 | Fixes 21079 issue, periodicity, solvify for piecewise | `solvify` is now able to solve `piecewise` expressions.
Fixes #21079 as it was giving an error due to a bug in `periodicity`.
Hence, periodicity for `piecewise` is fixed as `None` as the period of `piecewise` should also be `piecewise`.(which is an inconsistent return type)
```
>>> p = Piecewise((0, x < -10), (x... | 2021-03-25T14:38:04Z | Solvify cannot solve Piecewise
```
>>> p = Piecewise((0, x < -1), (x**2, x <= 1), (log(x), True))
>>> solvify(p,x,S.Reals)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/sayandip/sympy/sympy/solvers/solveset.py", line 2446, in solvify
period = periodicity(f, symbol)
... | Related: #20881. | [
{
"body": "```\r\n>>> p = Piecewise((0, x < -1), (x**2, x <= 1), (log(x), True))\r\n>>> solvify(p,x,S.Reals)\r\nTraceback (most recent call last):\r\n File \"<stdin>\", line 1, in <module>\r\n File \"/home/sayandip/sympy/sympy/solvers/solveset.py\", line 2446, in solvify\r\n period = periodicity(f, symbol)... | aa22709cb7df2d7503803d4b2c0baa7aa21440b6 | {
"head_commit": "9eebefe313809e0d95fa07b3adff652c04d99163",
"head_commit_message": "docs",
"patch_to_review": "diff --git a/sympy/calculus/tests/test_util.py b/sympy/calculus/tests/test_util.py\nindex 510fb12741ba..d29f1edfbe55 100644\n--- a/sympy/calculus/tests/test_util.py\n+++ b/sympy/calculus/tests/test_util... | [
{
"diff_hunk": "@@ -511,6 +511,11 @@ def _check(orig_f, period):\n symbol not in n.free_symbols):\n period = Abs(n / a.diff(symbol))\n \n+ elif isinstance(f, Piecewise):\n+ # Returning None, as the return type, period of the `piecewise`\n+ # also should be a piecewis... | 7856abc70ad9657afb0a068e6cb3ef199f2395bf | diff --git a/sympy/calculus/tests/test_util.py b/sympy/calculus/tests/test_util.py
index 510fb12741ba..d29f1edfbe55 100644
--- a/sympy/calculus/tests/test_util.py
+++ b/sympy/calculus/tests/test_util.py
@@ -1,6 +1,6 @@
from sympy import (Symbol, S, exp, log, sqrt, oo, E, zoo, pi, tan, sin, cos,
cot... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-20925@27e8652 | sympy/sympy | Python | 20,925 | added _eval_derivative for products | This PR adds the `_eval_derivative` method based on the `Leibniz rule`.
Fixes #20848
Added `_eval_derivative` method based on the `Leibniz rule`.
Also added test cases for the same.
Credits to @Maelstrom6 and @asmeurer
<!-- BEGIN RELEASE NOTES -->
NO ENTRY
<!-- END RELEASE NOTES --> | 2021-02-08T11:18:32Z | diff(Product(...)) does not evaluate the derivative
Usually Derivative gives an unevaluated derivative and doit is used to evaluate it:
```python
In [4]: Derivative(x**2, x)
Out[4]:
d ⎛ 2⎞
──⎝x ⎠
dx
In [5]: Derivative(x**2, x).doit()
Out[5]: 2⋅x
In [6]: diff(x**2, x)
Out[6]: 2⋅x
```
The diff functi... | Probably because it doesn't actually know how to differentiate a Product. [9] only works because the original Product evaluates first and then the derivative does. We could implement the general Leibniz rule (https://en.wikipedia.org/wiki/Product_rule#A_product_of_more_than_two_factors). I'm not sure if there are conce... | [
{
"body": "Usually Derivative gives an unevaluated derivative and doit is used to evaluate it:\r\n```python\r\nIn [4]: Derivative(x**2, x)\r\nOut[4]: \r\nd ⎛ 2⎞\r\n──⎝x ⎠\r\ndx \r\n\r\nIn [5]: Derivative(x**2, x).doit()\r\nOut[5]: 2⋅x\r\n\r\nIn [6]: diff(x**2, x)\r\nOut[6]: 2⋅x\r\n```\r\nThe diff function is... | ef14666d718f147878b51ed7ba9a5192e16c04f3 | {
"head_commit": "27e86526a175ca44aa23faf581bc5013b4b6548a",
"head_commit_message": "added test cases",
"patch_to_review": "diff --git a/sympy/concrete/products.py b/sympy/concrete/products.py\nindex 6ff6a06f66b9..3ea873c8d6e9 100644\n--- a/sympy/concrete/products.py\n+++ b/sympy/concrete/products.py\n@@ -399,6 +... | [
{
"diff_hunk": "@@ -382,3 +382,13 @@ def test_rewrite_Sum():\n def test_KroneckerDelta_Product():\n y = Symbol('y')\n assert Product(x*KroneckerDelta(x, y), (x, 0, 1)).doit() == 0\n+\n+def test_issue_20848():\n+ _i = Dummy('_i')",
"line": null,
"original_line": 387,
"original_start_line":... | de93c0379e4db59a0dbcd709f4673f4defe77eb4 | diff --git a/sympy/concrete/products.py b/sympy/concrete/products.py
index 6ff6a06f66b9..90b193352a0d 100644
--- a/sympy/concrete/products.py
+++ b/sympy/concrete/products.py
@@ -5,6 +5,8 @@
from sympy.functions.elementary.exponential import exp, log
from sympy.polys import quo, roots
from sympy.simplify import pows... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-20663@018c18e | sympy/sympy | Python | 20,663 | core: fixed _eval_is_zero() and added test | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
Fixes #17130
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-clos... | 2020-12-25T18:17:15Z | IndexError from jordan_form
I get an error computing the Jordan form of this Matrix:
```julia
In [6]: M = Matrix([
...: [exp(t**3/3 - t**2/2)/2 + exp(t**3/3 + t**2/2)/2, exp(t**3/3 - t**2/2)/2 - exp(t**3/3 + t**2/2)/2],
...: [exp(t**3/3 - t**2/2)/2 - exp(t**3/3 + t**2/2)/2, exp(t**3/3 - t**2/2)/2 + exp(t**3... | Same here, with much simplier matrix. Consider
```
from numpy import array
from sympy import Matrix, pprint
S0 = array([ [-0.7, 0.0, 0.0, 0.5],
[0.5, -0.2, 0.0, 0.25],
[0.0, 0.2, -0.2, 0.0],
[0.2, 0.0, 0.2, -0.75]
])
S1 = array([ [-1.25, 0.5, 0., 0.],
... | [
{
"body": "I get an error computing the Jordan form of this Matrix:\r\n```julia\r\nIn [6]: M = Matrix([ \r\n ...: [exp(t**3/3 - t**2/2)/2 + exp(t**3/3 + t**2/2)/2, exp(t**3/3 - t**2/2)/2 - exp(t**3/3 + t**2/2)/2], \r\n ...: [exp(t**3/3 - t**2/2)/2 - exp(t**3/3 + t**2/2)/2, exp(t**3/3 - t**2/2)/2 + exp(t**3/... | dd9188277caada7161b64bfb56cf900b5480772b | {
"head_commit": "018c18e3051290a4d2b05103138f7ffbce3d966a",
"head_commit_message": "core: fixed _eval_is_zero() and added test, fixing issue #17130\n\n_eval_is_zero() would give wrong result with imaginary numbers,\nresolved as directed by @oscarbenjamin, and added\nappropriate test.",
"patch_to_review": "diff -... | [
{
"diff_hunk": "@@ -625,10 +625,12 @@ def _eval_is_zero(self):\n return None\n b = self.func(*nz)\n if b.is_zero:\n- if not im_or_z and not im:\n- return True\n- if im and not im_or_z:\n- return False\n+ if not im_or_z:\n... | a5737ebc45cd4446f9cc4048a3ef5d4062e3855b | diff --git a/sympy/core/add.py b/sympy/core/add.py
index 6a3d10ac0e66..209020649430 100644
--- a/sympy/core/add.py
+++ b/sympy/core/add.py
@@ -604,7 +604,7 @@ def _eval_is_zero(self):
nz = []
z = 0
im_or_z = False
- im = False
+ im = 0
for a in self.args:
i... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-20573@bbd941a | sympy/sympy | Python | 20,573 | Added test for sin(x + a) - sin(x) (for a) | References to other Issues or PRs
Fixes #10426
Brief description of what is fixed or changed
Here we added tests to address the above issue by comparing the given equation with the specified answer for a. In the solution, we found out a can be dependent on x also, so we covered all the possible solutions in the te... | 2020-12-10T17:08:28Z | Can't solve sin(x + a) - sin(x) (for a)
```
In [9]: solveset(sin(x + a) - sin(x), a)
Out[9]: {a | a ∊ ℂ ∧ -sin(x) + sin(a + x) = 0}
In [10]: solveset(sin(x + a) - sin(x), a, domain=S.Reals)
Out[10]:
⎧ ⎛ ⎛ ⅈ⋅(-a - x) ⅈ⋅(a + x)⎞ ⅈ⋅x 2⋅ⅈ⋅x ⎞ -ⅈ⋅x ⎫
⎪ ⅈ⋅⎝- ⎝- ℯ + ℯ ... | For a start, `a = 2*pi*n` is not the complete solution to the equation. Since `sin(x+a) - sin(x) = 2*cos(x+a/2)*sin(a/2)`, `a = 2*pi*n` corresponds only to the part of solution where `sin(a/2) = 0`, whereas `cos(x + a/2) = 0` gives `a = (2*n + 1) * pi - 2*x`.
SymPy seems to give the correct answer if we assume `x` to b... | [
{
"body": "```\nIn [9]: solveset(sin(x + a) - sin(x), a)\nOut[9]: {a | a ∊ ℂ ∧ -sin(x) + sin(a + x) = 0}\n\nIn [10]: solveset(sin(x + a) - sin(x), a, domain=S.Reals)\nOut[10]:\n⎧ ⎛ ⎛ ⅈ⋅(-a - x) ⅈ⋅(a + x)⎞ ⅈ⋅x 2⋅ⅈ⋅x ⎞ -ⅈ⋅x ⎫\n⎪ ⅈ⋅⎝- ⎝- ℯ + ℯ ⎠⋅ℯ + ℯ ... | e5c901e5f30bcc9bd0cb91f03d0696815b96bd1a | {
"head_commit": "bbd941a94c724f11df2ce6017ad84a286b63fd9f",
"head_commit_message": "Added test for sin(x + a) - sin(x) (for a)",
"patch_to_review": "diff --git a/sympy/solvers/tests/test_solveset.py b/sympy/solvers/tests/test_solveset.py\nindex cb91957b79bd..9335f0596773 100644\n--- a/sympy/solvers/tests/test_so... | [
{
"diff_hunk": "@@ -2472,6 +2472,14 @@ def test_issue_17276():\n FiniteSet((5**(S(1)/5), 25*5**(S(3)/10)))\n \n \n+def test_issue_10426():\n+ x=Dummy('x')\n+ a=Symbol('a')\n+ n=Symbol('n')\n+ assert solveset(sin(x + a) - sin(x), a) == \\\n+ Union(ImageSet(Lambda(n, 2*pi*n), S.Integers),Inter... | 675ab8eefba302f7de7d49cac5b531934e09afaf | diff --git a/sympy/solvers/tests/test_solveset.py b/sympy/solvers/tests/test_solveset.py
index cb91957b79bd..fb7e360b002c 100644
--- a/sympy/solvers/tests/test_solveset.py
+++ b/sympy/solvers/tests/test_solveset.py
@@ -2472,6 +2472,16 @@ def test_issue_17276():
FiniteSet((5**(S(1)/5), 25*5**(S(3)/10)))
+def t... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-20618@ef99c69 | sympy/sympy | Python | 20,618 | Make complex exponential algebraic | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2020-12-16T23:59:25Z | Complex exponentials are not recognized by domains
```python3
>>> from sympy import *
>>> x = Symbol('x')
>>> w = exp(I*2*pi/3)
>>> Poly([w**2, w, 1], x, extension=True)
Poly(exp(-2*I*pi/3)*x**2 + exp(2*I*pi/3)*x + 1, x, domain='ZZ(exp(I*pi/3))')
>>> w = w.expand(complex=True)
>>> Poly([w**2, w, 1], x, extensi... | I think it's because `_eval_is_algebraic` gives None | [
{
"body": "```python3\r\n>>> from sympy import *\r\n\r\n>>> x = Symbol('x')\r\n>>> w = exp(I*2*pi/3)\r\n>>> Poly([w**2, w, 1], x, extension=True)\r\nPoly(exp(-2*I*pi/3)*x**2 + exp(2*I*pi/3)*x + 1, x, domain='ZZ(exp(I*pi/3))')\r\n>>> w = w.expand(complex=True)\r\n>>> Poly([w**2, w, 1], x, extension=True)\r\nPoly... | 989300eda95d4a7661479d64bb7dac44240c036d | {
"head_commit": "ef99c69f2edf35c7846f9d0c81ddfe0a126d73fe",
"head_commit_message": "Make complex exponential algebraic",
"patch_to_review": "diff --git a/sympy/functions/elementary/exponential.py b/sympy/functions/elementary/exponential.py\nindex fd360934c67c..a035927e2a22 100644\n--- a/sympy/functions/elementar... | [
{
"diff_hunk": "@@ -445,15 +445,15 @@ def complex_extended_negative(arg):\n return fuzzy_or(complex_extended_negative(self.args[0]))\n \n def _eval_is_algebraic(self):\n- s = self.func(*self.args)\n- if s.func == self.func:\n- if fuzzy_not(self.exp.is_zero):\n- ... | 86fa5d6440e2dbd63150af19de229dd4cbedc72e | diff --git a/sympy/functions/elementary/exponential.py b/sympy/functions/elementary/exponential.py
index fd360934c67c..c4b0231395d5 100644
--- a/sympy/functions/elementary/exponential.py
+++ b/sympy/functions/elementary/exponential.py
@@ -445,15 +445,13 @@ def complex_extended_negative(arg):
return fuzzy_or(co... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-20639@3127e5e | sympy/sympy | Python | 20,639 | Pretty printing bug fix | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2020-12-21T07:42:53Z | inaccurate rendering of pi**(1/E)
This claims to be version 1.5.dev; I just merged from the project master, so I hope this is current. I didn't notice this bug among others in printing.pretty.
```
In [52]: pi**(1/E)
Out[52]:
-1___
╲╱ π
```
LaT... | I can confirm this bug on master. Looks like it's been there a while
https://github.com/sympy/sympy/blob/2d700c4b3c0871a26741456787b0555eed9d5546/sympy/printing/pretty/pretty.py#L1814
`1/E` is `exp(-1)` which has totally different arg structure than something like `1/pi`:
```
>>> (1/E).args
(-1,)
>>> (1/pi).ar... | [
{
"body": "This claims to be version 1.5.dev; I just merged from the project master, so I hope this is current. I didn't notice this bug among others in printing.pretty.\r\n\r\n```\r\nIn [52]: pi**(1/E) \r\nOut[52]: \r\n-1___\r\n╲╱ π \r\n\r\n```\r\n... | eb926a1d0c1158bf43f01eaf673dc84416b5ebb1 | {
"head_commit": "3127e5ec0b7b34e1f59586a50040f67674c36582",
"head_commit_message": "Removed use of assumptions in pretty printing",
"patch_to_review": "diff --git a/sympy/printing/pretty/pretty.py b/sympy/printing/pretty/pretty.py\nindex df7452ee873f..b0b297d93103 100644\n--- a/sympy/printing/pretty/pretty.py\n+... | [
{
"diff_hunk": "@@ -1916,12 +1916,15 @@ def _print_nth_root(self, base, expt):\n _zZ = xobj('/', 1)\n rootsign = xobj('\\\\', 1) + _zZ\n # Make exponent number to put above it\n+ #print(dir(expt))",
"line": null,
"original_line": 1919,
"original_start_line": null,
... | 336f93fe0b4e7cf18e1b520f21487ba0b534ba75 | diff --git a/sympy/printing/pretty/pretty.py b/sympy/printing/pretty/pretty.py
index df7452ee873f..fbe9edb63229 100644
--- a/sympy/printing/pretty/pretty.py
+++ b/sympy/printing/pretty/pretty.py
@@ -1902,12 +1902,12 @@ def _print_Mul(self, product):
return prettyForm.__mul__(*a)/prettyForm.__mul__(*b)
... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-20390@e7617d3 | sympy/sympy | Python | 20,390 | Correct the -oo case in degree. | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2020-11-06T20:57:16Z | TypeError: Argument of Integer should be of numeric type, got -oo.
The present expression generates the previous error.
```python
sp.degree(sp.sympify('_R*_X34*(_X35**2*_X26 - _X26*_X35*(_X35 + 1) + 2*_X26*_X35 - _X26*(_X35 + 1) + _X26 - _X29*_X32*_X35 + _X29*_X32*(_X35 + 1) - _X29*_X32)'), sp.Symbol('_R'))
```
... | A simpler way to reproduce this:
```python
In [32]: degree(x*(x + 1) - x**2 - x, x)
---------------------------------------------------------------------------
TypeError ... | [
{
"body": "The present expression generates the previous error.\r\n\r\n```python\r\nsp.degree(sp.sympify('_R*_X34*(_X35**2*_X26 - _X26*_X35*(_X35 + 1) + 2*_X26*_X35 - _X26*(_X35 + 1) + _X26 - _X29*_X32*_X35 + _X29*_X32*(_X35 + 1) - _X29*_X32)'), sp.Symbol('_R'))\r\n```\r\n\r\nThe return statement does not take ... | 579929113f2d663c2d69846ded0b0b19cf7dbbaf | {
"head_commit": "e7617d3e3d7a42c758d0b87fd13d766dd94ed706",
"head_commit_message": "Solve and check the issue #20389\n\nAdded a check to see if the polygon degree is infinite, and provide the correct result.",
"patch_to_review": "diff --git a/sympy/polys/polytools.py b/sympy/polys/polytools.py\nindex 70112de3b65... | [
{
"diff_hunk": "@@ -4480,8 +4480,8 @@ def degree(f, gen=0):\n expression like func = %s, e.g. degree(func, gen = %s) instead of\n degree(func, gen = %s).\n ''' % (f, next(ordered(f.free_symbols)), gen)))\n-\n- return Integer(p.degree(gen))\n+ result = p.degree(gen)\n+ return I... | 6eaa11873aa9abb93558c8bed92608f826666f1d | diff --git a/sympy/polys/polytools.py b/sympy/polys/polytools.py
index 70112de3b65f..18655988a8dc 100644
--- a/sympy/polys/polytools.py
+++ b/sympy/polys/polytools.py
@@ -4480,8 +4480,8 @@ def degree(f, gen=0):
expression like func = %s, e.g. degree(func, gen = %s) instead of
degree(func, gen = %s).... | {
"difficulty": "medium",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-20353@5cd584c | sympy/sympy | Python | 20,353 | Added test case for GramSchimdt | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2020-10-29T10:35:07Z | FiniteSets can be filled with other objects than numbers, but this is not supported by other classes.
```
>>> FiniteSet([Matrix([1,2,0]), Matrix([1,3,0])])
{Matrix([
[1],
[2],
[0]]), Matrix([
[1],
[3],
[0]])}
```
But
```
>>> L= FiniteSet([Matrix([1,2,0]), Matrix([1,3,0])])
>>> GramSchmidt(L)
Traceback (most recent ca... | I agree about adding the exception, since it's clearly not supported yet in other classes.
Hi,
in the tests_sets.py the following line can be found:
```
s = FiniteSet((1, 2), Float, A, -5, x, 'eggs', x**2, Interval)
```
so this should be fixed, too, and we should test if
```
FiniteSet(3,2,complex('5+j'), Number(3)... | [
{
"body": "```\n>>> FiniteSet([Matrix([1,2,0]), Matrix([1,3,0])])\n{Matrix([\n[1],\n[2],\n[0]]), Matrix([\n[1],\n[3],\n[0]])}\n```\n\nBut\n\n```\n>>> L= FiniteSet([Matrix([1,2,0]), Matrix([1,3,0])])\n>>> GramSchmidt(L)\nTraceback (most recent call last):\n File \"<stdin>\", line 1, in <module>\n File \"/usr/l... | 153864a6ed7432256022a13c78499e558d04fa31 | {
"head_commit": "5cd584c2f1519a1d98f24376e90bb08a940011e7",
"head_commit_message": "Added test case for GramSchimdt",
"patch_to_review": "diff --git a/sympy/matrices/tests/test_matrices.py b/sympy/matrices/tests/test_matrices.py\nindex 101a16d977d3..8e3b9ae2d16f 100644\n--- a/sympy/matrices/tests/test_matrices.p... | [
{
"diff_hunk": "@@ -2276,6 +2276,11 @@ def test_GramSchmidt():\n assert GramSchmidt([Matrix([3, 1]), Matrix([2, 2])], True) == [\n Matrix([3*sqrt(10)/10, sqrt(10)/10]),\n Matrix([-sqrt(10)/10, 3*sqrt(10)/10])]\n+ # Issue #9488\n+ from sympy import FiniteSet\n+ L = FiniteSet(Matrix([... | b5fc055507b8bb28f95c2dd20f58be0101bb53a6 | diff --git a/sympy/matrices/tests/test_matrices.py b/sympy/matrices/tests/test_matrices.py
index 101a16d977d3..eeb5fc1c90c4 100644
--- a/sympy/matrices/tests/test_matrices.py
+++ b/sympy/matrices/tests/test_matrices.py
@@ -4,7 +4,7 @@
from sympy import (
Abs, Add, E, Float, I, Integer, Max, Min, Poly, Pow, PurePo... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-20322@23490db | sympy/sympy | Python | 20,322 | fixed is_integer of Mul by not using fraction but collecting numerators and denominators directly | #### References to other Issues or PRs
Fixes #20161
#### Brief description of what is fixed or changed
In Mul._eval_is_integer instead of using the function fraction the args are scanned for contributions to the numerator and denominator.
#### Other comments
#### Release Notes
<!-- BEGIN RELEASE NOTES -... | 2020-10-22T20:39:24Z | Inconsistent behavior for sympify/simplify with ceiling
In sympy v1.5.1:
```python
In [16]: sympy.sympify('4*ceiling(x/4 - 3/4)', evaluate=False).simplify()
Out[16]: 4*ceiling(x/4 - 3/4)
In [17]: sympy.sympify('4*ceiling(x/4 - 3/4)', evaluate=True).simplify()
Out[17]: 4*ceiling(x/4 - 3/4)
```
In sympy v.1.6.... | `4*ceiling(x/4) - 3` is simply wrong:
```python
>>> x = Symbol('x')
>>> (4*ceiling(x/4 - 3/4)).subs({x:0})
0
>>> (4*ceiling(x/4) - 3).subs({x:0})
-3
```
Boiling the problem further down we find that already a simpler expression is evaluated/transformed incorrectly:
```python
>>> sympy.sympify('ceiling(x-1/2)',... | [
{
"body": "In sympy v1.5.1:\r\n```python\r\nIn [16]: sympy.sympify('4*ceiling(x/4 - 3/4)', evaluate=False).simplify()\r\nOut[16]: 4*ceiling(x/4 - 3/4)\r\n\r\nIn [17]: sympy.sympify('4*ceiling(x/4 - 3/4)', evaluate=True).simplify()\r\nOut[17]: 4*ceiling(x/4 - 3/4)\r\n```\r\n\r\nIn sympy v.1.6.2:\r\n```python\r\n... | ab864967e71c950a15771bb6c3723636026ba876 | {
"head_commit": "23490db348daa38b7f53faf09f7dbbdf196cc482",
"head_commit_message": "convention: make symbol name equal to variable name",
"patch_to_review": "diff --git a/sympy/core/mul.py b/sympy/core/mul.py\nindex 46f310b122a3..94a0ba8a0aca 100644\n--- a/sympy/core/mul.py\n+++ b/sympy/core/mul.py\n@@ -1262,7 +... | [
{
"diff_hunk": "@@ -1262,27 +1262,47 @@ def _eval_is_zero(self):\n zero = None\n return zero\n \n+ #_eval_is_integer = lambda self: _fuzzy_group(\n+ # (a.is_integer for a in self.args), quick_exit=True)\n def _eval_is_integer(self):\n+ #return _fuzzy_group(\n+ ... | de4cc9624ecaabd405fd2c938beed293c3f2fc3a | diff --git a/sympy/core/mul.py b/sympy/core/mul.py
index 46f310b122a3..251b7fa4c731 100644
--- a/sympy/core/mul.py
+++ b/sympy/core/mul.py
@@ -7,7 +7,7 @@
from .singleton import S
from .operations import AssocOp, AssocOpDispatcher
from .cache import cacheit
-from .logic import fuzzy_not, _fuzzy_group, fuzzy_and
+fro... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-20806@773d7fa | sympy/sympy | Python | 20,806 | printing: Remove curly braces from subscripted variables in python() and pycode() | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2021-01-15T17:22:21Z | pycode of latex expression with subscript leads to syntax error
Hey guys, while generating python code from a simple latex expression works
```python
expr = parse_latex(r'a \cdot b')
print(sympy.pycode(expr))
`>>> a*b
print(sympy.python(expr))
>>> a = Symbol('a')
>>> b = Symbol('b')
>>> e = a*b
```
for anyt... | Would something like this fix the issue in `python`?
```diff
diff --git a/sympy/printing/python.py b/sympy/printing/python.py
index ac6d95a06c..f60719b497 100644
--- a/sympy/printing/python.py
+++ b/sympy/printing/python.py
@@ -51,7 +51,13 @@ def python(expr, **settings):
# Returning found symbols and fun... | [
{
"body": "Hey guys, while generating python code from a simple latex expression works\r\n\r\n```python\r\nexpr = parse_latex(r'a \\cdot b')\r\nprint(sympy.pycode(expr))\r\n`>>> a*b\r\nprint(sympy.python(expr))\r\n>>> a = Symbol('a')\r\n>>> b = Symbol('b')\r\n>>> e = a*b\r\n```\r\nfor anything with a subscript ... | c181470266243ffdefa3c4129165e0e1e009195f | {
"head_commit": "773d7fa818464b19e13c16ca3ec9de1151f4d710",
"head_commit_message": "Add tests",
"patch_to_review": "diff --git a/sympy/printing/pycode.py b/sympy/printing/pycode.py\nindex b7315a4c559c..7c7898612407 100644\n--- a/sympy/printing/pycode.py\n+++ b/sympy/printing/pycode.py\n@@ -456,6 +456,21 @@ def _... | [
{
"diff_hunk": "@@ -51,7 +51,13 @@ def python(expr, **settings):\n # Returning found symbols and functions\n renamings = {}\n for symbolname in printer.symbols:\n- newsymbolname = symbolname\n+ # Remove curly braces from subscripted variables\n+ if '{' in symbolname:\n+ ... | 29ff5424ac78361dcdf5bc25c079441e60ead5cf | diff --git a/sympy/printing/pycode.py b/sympy/printing/pycode.py
index 63ccfec7517d..b669a2c783d2 100644
--- a/sympy/printing/pycode.py
+++ b/sympy/printing/pycode.py
@@ -456,6 +456,21 @@ def _print_frac(self, expr):
from sympy import Mod
return self._print_Mod(Mod(expr.args[0], 1))
+ def _print_... | {
"difficulty": "low",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-20348@a3ebdad | sympy/sympy | Python | 20,348 | Support for Symbolic Queries in Discrete and Continuous Markov Chains |
#### References to other Issues or PRs
Fixes #19012
#### Brief description of what is fixed or changed
Added code to process symbolic queries of the type `P(Eq(Y[a], b), Eq(Y[c], d))`, `P(Gt(Y[a], b), Eq(Y[c], d))`, `P(Ge(Y[a], b), Eq(Y[c], d))`, `P(Lt(Y[a], b), Eq(Y[c], d))` and `P(Le(Y[a], b), Eq(Y[c], d))`. ... | 2020-10-28T04:44:55Z | How to generate results for queries like `P(Eq(X(j), 2), Eq(X(1), i))`?
In the query, `P(Eq(X(j), 2), Eq(X(1), i))`, X represents a Markov chain(discrete/continuous). Here, i and j are symbols.
Currently,
```python
>>> from sympy import symbols
>>> i, j = symbols('i, j', integer=True)
>>> P(Eq(X[j], 2), Eq(X[1], i... | `X` is which process?
> X represents a Markov chain(discrete/continuous).
I understand how discreet markov chains work and I can see that you want after the j-1th "jump" a person lands on the state "2" given that currently they're sitting on state "i", what I dont get is what sort of input and output formats are you lo... | [
{
"body": "In the query, `P(Eq(X(j), 2), Eq(X(1), i))`, X represents a Markov chain(discrete/continuous). Here, i and j are symbols.\r\nCurrently,\r\n```python\r\n>>> from sympy import symbols\r\n>>> i, j = symbols('i, j', integer=True)\r\n>>> P(Eq(X[j], 2), Eq(X[1], i))\r\nTraceback (most recent call last):\r\... | b3cae120dad022dd83e338df69c45f60dd95efd9 | {
"head_commit": "a3ebdadf8cf540ff5e9166381c61b537b3cb16ca",
"head_commit_message": "Removed unused import",
"patch_to_review": "diff --git a/sympy/stats/stochastic_process_types.py b/sympy/stats/stochastic_process_types.py\nindex 446d417c1887..ffa3fc5a5537 100644\n--- a/sympy/stats/stochastic_process_types.py\n+... | [
{
"diff_hunk": "@@ -658,6 +680,37 @@ def probability(self, condition, given_condition=None, evaluate=True, **kwargs):\n raise NotImplementedError(\"Mechanism for handling (%s, %s) queries hasn't been \"\n \"implemented yet.\"%(condition, given_condition))\n \n+ def sym... | 13ffdf4890c3301d8f2eed7854e5c76071496fd8 | diff --git a/sympy/stats/stochastic_process_types.py b/sympy/stats/stochastic_process_types.py
index e40774553df7..de912f97638f 100644
--- a/sympy/stats/stochastic_process_types.py
+++ b/sympy/stats/stochastic_process_types.py
@@ -10,7 +10,7 @@
Union, Expr, Function, exp, cacheit, sqrt, pi, gamma,
... | {
"difficulty": "high",
"estimated_review_effort": 4,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-20212@e676833 | sympy/sympy | Python | 20,212 | zero raised to power -infinity gives zoo | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2020-10-06T11:34:13Z | 0**-oo produces 0, the documentation says it should produce zoo
Using SymPy 1.5.1, evaluate `0**-oo` produces `0`.
The documentation for the Pow class states that it should return `ComplexInfinity`, aka `zoo`
| expr | value | reason |
| :-- | :-- | :--|
| `0**-oo` | `zoo` | This is not strictly true, as 0**oo m... | [
{
"body": "Using SymPy 1.5.1, evaluate `0**-oo` produces `0`.\r\n\r\nThe documentation for the Pow class states that it should return `ComplexInfinity`, aka `zoo`\r\n\r\n| expr | value | reason |\r\n| :-- | :-- | :--|\r\n| `0**-oo` | `zoo` | This is not strictly true, as 0**oo may be oscillating between positiv... | a106f4782a9dbe7f8fd16030f15401d977e03ae9 | {
"head_commit": "e676833404bb19c01482b098331c31dd4d5cbf5b",
"head_commit_message": "zero raised to power -infinity gives zoo",
"patch_to_review": "diff --git a/sympy/core/power.py b/sympy/core/power.py\nindex 984398c760e0..85d1d2e892a9 100644\n--- a/sympy/core/power.py\n+++ b/sympy/core/power.py\n@@ -291,6 +291,... | [
{
"diff_hunk": "@@ -579,3 +579,7 @@ def _(a, b):\n assert power(a, b) == NewPow(a, b)\n assert power(b, a) == NewPow(b, a)\n assert power(b, b) == NewPow(b, b)\n+\n+def test_issue_19572():\n+ assert 0 ** -oo is zoo\n+ assert power(0, -oo) is zoo",
"line": null,
"original_line": 585,
... | 7e10ac3987817107408433840298f4450171b6c0 | diff --git a/sympy/core/power.py b/sympy/core/power.py
index 984398c760e0..85d1d2e892a9 100644
--- a/sympy/core/power.py
+++ b/sympy/core/power.py
@@ -291,6 +291,8 @@ def __new__(cls, b, e, evaluate=None):
).warn()
if evaluate:
+ if b is S.Zero and e is S.NegativeInfinity:
+ ... | {
"difficulty": "low",
"estimated_review_effort": 1,
"problem_domain": "Bug Fixes"
} | |
sympy__sympy-20208@540dfc8 | sympy/sympy | Python | 20,208 | Fixed set is equal to set only | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2020-10-05T12:25:27Z | FiniteSet not Value False
A=FiniteSet(1,2)
B=(FiniteSet(1,2),FiniteSet(1))
{1} in A
AttributeError Traceback (most recent call last)
<ipython-input-80-becd25ec8a42> in <module>()
----> 1 {1} in A
/usr/lib/python3/dist-packages/sympy/sets/sets.py in __contains__(self, other)
577... | 
Hi! Can you please clarify the issue further?
This is what I get with sympy 1.6.2:
```julia
In [8]: A = FiniteSet(1, 2) ... | [
{
"body": "A=FiniteSet(1,2)\r\nB=(FiniteSet(1,2),FiniteSet(1))\r\n\r\n{1} in A\r\nAttributeError Traceback (most recent call last)\r\n<ipython-input-80-becd25ec8a42> in <module>()\r\n----> 1 {1} in A\r\n\r\n/usr/lib/python3/dist-packages/sympy/sets/sets.py in __contains__(self, other)... | a106f4782a9dbe7f8fd16030f15401d977e03ae9 | {
"head_commit": "540dfc8e3029c263c876d0b91770663f1db75c61",
"head_commit_message": "Fixed sets eq function('in' , 'subset')",
"patch_to_review": "diff --git a/sympy/sets/handlers/comparison.py b/sympy/sets/handlers/comparison.py\nindex e21ab30b4312..6f7a19fccfaf 100644\n--- a/sympy/sets/handlers/comparison.py\n+... | [
{
"diff_hunk": "@@ -1581,3 +1581,11 @@ def test_DisjointUnion_len():\n assert len(DisjointUnion(FiniteSet(3, 5, 7, 9), FiniteSet(x, y, z))) == 7\n assert len(DisjointUnion(S.EmptySet, S.EmptySet, FiniteSet(x, y, z), S.EmptySet)) == 3\n raises(ValueError, lambda: len(DisjointUnion(Interval(0, 1), S.E... | 387c3cf37f367188107587bf59f0769472794535 | diff --git a/sympy/sets/handlers/comparison.py b/sympy/sets/handlers/comparison.py
index e21ab30b4312..6f7a19fccfaf 100644
--- a/sympy/sets/handlers/comparison.py
+++ b/sympy/sets/handlers/comparison.py
@@ -1,8 +1,9 @@
from sympy.core.relational import Eq, is_eq
+from sympy.core.basic import Basic
from sympy.core.log... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-20159@0de3dae | sympy/sympy | Python | 20,159 | NotImplemented for matrix and tensor addition | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2020-09-28T07:19:19Z | Addition of tensor and matrix with same shape
Little example:
```
import sympy as sp
A = sp.Array([[1, 2], [3, 4]])
B = sp.eye(2)
```
```
A + B
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython... | Instead of raising `TypeError` it should return `NotImplemented`. Both examples should raise though so `Matrix.__add__` should also return `NotImplemented`.
I think that one of the problem in the sympy codebase are there are so many different array classes inter-operating badly.
I may have different ideas like `Matrix... | [
{
"body": "Little example:\r\n\r\n```\r\nimport sympy as sp\r\nA = sp.Array([[1, 2], [3, 4]])\r\nB = sp.eye(2)\r\n```\r\n\r\n```\r\nA + B\r\n\r\n---------------------------------------------------------------------------\r\nTypeError Traceback (most recent call last)\r\n<ipython-... | 7566e6db93738ea3145082d7071e5d5816d00cf8 | {
"head_commit": "0de3daee8b2687a205fae0d8a2e68c103a2e94d1",
"head_commit_message": "NotImplemented for matrix and tensor addition and vice versa",
"patch_to_review": "diff --git a/sympy/matrices/common.py b/sympy/matrices/common.py\nindex 44a3cdc795cf..bbe1c4a69ddf 100644\n--- a/sympy/matrices/common.py\n+++ b/s... | [
{
"diff_hunk": "@@ -2535,6 +2536,8 @@ def __abs__(self):\n \n @call_highest_priority('__radd__')\n def __add__(self, other):\n+ if isinstance(other, NDimArray):\n+ return NotImplemented\n \"\"\"Return self + other, raising ShapeError if shapes don't match.\"\"\"",
"line": 2... | f8042703c0fe965e2bafbdbb1572168e63dd5b92 | diff --git a/sympy/matrices/common.py b/sympy/matrices/common.py
index 44a3cdc795cf..d2f6dcb9f930 100644
--- a/sympy/matrices/common.py
+++ b/sympy/matrices/common.py
@@ -26,6 +26,7 @@
from sympy.utilities.exceptions import SymPyDeprecationWarning
from sympy.utilities.iterables import flatten
from sympy.utilities.mi... | {
"difficulty": "medium",
"estimated_review_effort": 2,
"problem_domain": "New Feature Additions"
} |
sympy__sympy-20321@adb756b | sympy/sympy | Python | 20,321 | Fixed `FiniteSet.evalf(...)` with a subs argument | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2020-10-22T13:04:52Z | [bug] subs option to evalf isn't working for sets
Evalf does not seem to work on solveset.
Code to replicate:
```
from sympy.stats import Uniform, cdf
from sympy import Symbol, Eq, solveset, solve
x = Symbol("x")
a = Symbol("a")
b = Symbol("b")
D = Uniform("d", a, b)
F_x = cdf(D)(x)
u = Symbol("u")
... | Looks like `Set.evalf` with a subs argument does not work. That is, `FiniteSet(a).evalf(subs={a: 1})` returns `FiniteSet(a)`. As a workaround for now, I suggest you do `expr.subs({u: 0.6, a: 0, b: 2}).evalf()`.
I'll have a PR out as soon as I know my changes don't break the build somewhere else.
Note that between... | [
{
"body": "Evalf does not seem to work on solveset. \r\n\r\nCode to replicate:\r\n```\r\nfrom sympy.stats import Uniform, cdf\r\nfrom sympy import Symbol, Eq, solveset, solve\r\n\r\nx = Symbol(\"x\")\r\na = Symbol(\"a\")\r\nb = Symbol(\"b\")\r\n\r\nD = Uniform(\"d\", a, b)\r\nF_x = cdf(D)(x)\r\n\r\nu = Symbol(\... | 07a6388bc237a2c43e65dc3cf932373e4d06d91b | {
"head_commit": "adb756b913c0fb28876067a58bdade966941aa5a",
"head_commit_message": "Added `isinstance(self, Basic)` check",
"patch_to_review": "diff --git a/sympy/core/evalf.py b/sympy/core/evalf.py\nindex 812e9de5f8d6..862d7385e4ee 100644\n--- a/sympy/core/evalf.py\n+++ b/sympy/core/evalf.py\n@@ -1473,7 +1473,1... | [
{
"diff_hunk": "@@ -1473,7 +1473,11 @@ def evalf(self, n=15, subs=None, maxn=100, chop=False, strict=False, quad=None,\n result = evalf(self, prec + 4, options)\n except NotImplementedError:\n # Fall back to the ordinary evalf\n- v = self._eval_evalf(prec)\n+ ... | 66edfc65d8d0a000d80ffed2a19ee3f2ff47c726 | diff --git a/sympy/core/evalf.py b/sympy/core/evalf.py
index 812e9de5f8d6..5901d06fa2f3 100644
--- a/sympy/core/evalf.py
+++ b/sympy/core/evalf.py
@@ -1473,7 +1473,10 @@ def evalf(self, n=15, subs=None, maxn=100, chop=False, strict=False, quad=None,
result = evalf(self, prec + 4, options)
except N... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-20049@97e9aa8 | sympy/sympy | Python | 20,049 | point.vel() calculates velocity | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2020-09-05T09:37:44Z | Point.vel() should calculate the velocity if possible
If you specify the orientation of two reference frames and then ask for the angular velocity between the two reference frames the angular velocity will be calculated. But if you try to do the same thing with velocities, this doesn't work. See below:
```
In [1]: ... | Hi @moorepants, I think I could fix this. It would be implemented as a part of `ReferenceFrame` in `sympy/physics/vector/frame.py`, right?
No, it is part of Point. There are some nuances here and likely not a trivial PR to tackle. I'd recommend some simpler ones first if you are new to sympy and dynamics.
Sure, underst... | [
{
"body": "If you specify the orientation of two reference frames and then ask for the angular velocity between the two reference frames the angular velocity will be calculated. But if you try to do the same thing with velocities, this doesn't work. See below:\r\n\r\n```\r\nIn [1]: import sympy as sm ... | d57aaf064041fe52c0fa357639b069100f8b28e1 | {
"head_commit": "97e9aa872cbbf4032c82ef6861f620b747e08a11",
"head_commit_message": "Added Comments",
"patch_to_review": "diff --git a/sympy/physics/vector/point.py b/sympy/physics/vector/point.py\nindex ddb3a4d09265..7a3b44764d11 100644\n--- a/sympy/physics/vector/point.py\n+++ b/sympy/physics/vector/point.py\n@... | [
{
"diff_hunk": "@@ -483,19 +522,54 @@ def vel(self, frame):\n Examples\n ========\n \n- >>> from sympy.physics.vector import Point, ReferenceFrame\n+ >>> from sympy.physics.vector import Point, ReferenceFrame, dynamicsymbols\n >>> N = ReferenceFrame('N')\n >>> p1 = ... | c57dd28b995cb4d1d35d4d11c8d199a60c93b0cd | diff --git a/sympy/physics/vector/point.py b/sympy/physics/vector/point.py
index ddb3a4d09265..3b6e3fe2ad80 100644
--- a/sympy/physics/vector/point.py
+++ b/sympy/physics/vector/point.py
@@ -483,19 +483,49 @@ def vel(self, frame):
Examples
========
- >>> from sympy.physics.vector import Point... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "New Feature Additions"
} |
sympy__sympy-19990@dfd9c21 | sympy/sympy | Python | 19,990 | [GSoC] Functions: Fixes limit evaluations related to uppergamma and besselk function | Fixes: #13571
Fixes: #14874
#### Brief description of what is fixed or changed
1) Adds `_eval_is_meromorphic` method and `_eval_aseries` to `class lowergamma`
2) Adds `_eval_is_meromorphic` method and `_eval_rewrite_as_tractable` method to `class uppergamma`
3) Rectifies `eval` method of `class bess... | 2020-08-20T07:14:07Z | Incorrect limit of uppergamma(n, 1) / gamma(n)
>>> from sympy import *
>>> from sympy.abc import n
>>> limit(uppergamma(n, 1) / gamma(n), n, oo)
0
The answer should be 1.
Limit x --> oo for besselk
When I try
from sympy import symbols, besselk, limit, oo
x = symbols("x", real=True)
... | How can I help in this issue ? | [
{
"body": " >>> from sympy import *\r\n >>> from sympy.abc import n\r\n >>> limit(uppergamma(n, 1) / gamma(n), n, oo)\r\n 0\r\n\r\nThe answer should be 1.",
"number": 13571,
"title": "Incorrect limit of uppergamma(n, 1) / gamma(n)"
},
{
"body": "When I try\r\n\r\n from sympy impor... | ba43dda5be251e6ea9834f15e99b939fa1065670 | {
"head_commit": "dfd9c217ddd425e9c23d3ab5c0794c930dd31833",
"head_commit_message": "Fixes limit evaluations related to uppergamma and besselk function",
"patch_to_review": "diff --git a/sympy/functions/special/bessel.py b/sympy/functions/special/bessel.py\nindex ab04eeea24cf..aba153792479 100644\n--- a/sympy/fun... | [
{
"diff_hunk": "@@ -464,6 +464,8 @@ def eval(cls, nu, z):\n return S.Zero\n \n if nu.is_integer:\n+ if z is S.Infinity:",
"line": null,
"original_line": 467,
"original_start_line": null,
"path": "sympy/functions/special/bessel.py",
"start_line": null,
"text... | f7d6d05428df8096d4b0ab56a0c4037067894ff8 | diff --git a/sympy/functions/special/bessel.py b/sympy/functions/special/bessel.py
index ab04eeea24cf..37d99648d2c1 100644
--- a/sympy/functions/special/bessel.py
+++ b/sympy/functions/special/bessel.py
@@ -460,7 +460,7 @@ def eval(cls, nu, z):
return S.ComplexInfinity
elif re(nu).is_zero:... | {
"difficulty": "high",
"estimated_review_effort": 4,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-20190@3bd28f7 | sympy/sympy | Python | 20,190 | Fix for fundamental matrix of markov chains | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2020-10-02T19:56:43Z | Unable to find fundamental matrix for regular markov chains
Currently, it is not possible to calculate the fundamental matrix for regular markov chains as of now ``` fundamental_matrix()``` was only implemented for the absorbing Markov chains.
For example
```python
>>> T = Matrix([[0.5, 0.25, 0.25], [0.5, 0, 0.5], ... | [
{
"body": "Currently, it is not possible to calculate the fundamental matrix for regular markov chains as of now ``` fundamental_matrix()``` was only implemented for the absorbing Markov chains. \r\nFor example\r\n```python\r\n>>> T = Matrix([[0.5, 0.25, 0.25], [0.5, 0, 0.5], [0.25, 0.25, 0.5]])\r\n>>> Y = Disc... | 1e5d400c948b85647f953abcdb87457b7bc53ff7 | {
"head_commit": "3bd28f7528b163cacb9033d02fbf6e8e76fd2570",
"head_commit_message": "added support for fundamental matrix for regular markov chains",
"patch_to_review": "diff --git a/sympy/stats/stochastic_process_types.py b/sympy/stats/stochastic_process_types.py\nindex 0e84402c3964..8775b0c1e497 100644\n--- a/s... | [
{
"diff_hunk": "@@ -846,9 +846,16 @@ def fundamental_matrix(self):\n if Q == None:\n return None\n I = eye(Q.shape[0])\n- if (I - Q).det() == 0:\n- raise ValueError(\"Fundamental matrix doesn't exists.\")\n- return ImmutableMatrix((I - Q).inv().tolist())\n+ ... | f28f833171646e00b09f1dc3f186f6d7a7a6e6ee | diff --git a/sympy/stats/stochastic_process_types.py b/sympy/stats/stochastic_process_types.py
index 0de4d3eeaa63..fdac9cb8cc1f 100644
--- a/sympy/stats/stochastic_process_types.py
+++ b/sympy/stats/stochastic_process_types.py
@@ -1055,13 +1055,32 @@ def communication_classes(self) -> tList[tTuple[tList[Basic], Boolean... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "Bug Fixes"
} | |
sympy__sympy-19819@b3c369f | sympy/sympy | Python | 19,819 | [GSoC]Change return type of `P` and `E` with `evaluate=False` | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2020-07-22T11:00:18Z | stats: Should `P(X > 1, evaluate=False)` return `Probability(X > 1)` or unevaluated Integral?
On current master, `P(X > 1, evaluate=False)` produces unevaluated Integral. However, according to the discussions on Gitter, it was suggested by @czgdp1807 that we should make `P(X > 1, evaluate=False)` to return a Symbolic p... | What about:
1. `P(X > 1, evaluate=False)` ==> return `Probability` object,
2. `P(X > 1).doit(evaluate=False)` ==> return unevaluated integral.
Agreed with @Upabjojr , seems like a good idea and will also help in making APIs unambiguous.
> `P(X > 1).doit(evaluate=False)` ==> return unevaluated integral.
Do you m... | [
{
"body": "On current master, `P(X > 1, evaluate=False)` produces unevaluated Integral. However, according to the discussions on Gitter, it was suggested by @czgdp1807 that we should make `P(X > 1, evaluate=False)` to return a Symbolic probability object as `Probability(X > 1)`. Symbolic `Probability` class has... | 7389f1959f56e416a9f6c8060a4cbf5d98f830a8 | {
"head_commit": "b3c369fb2e018b39c7871edacffe2ae5e173394b",
"head_commit_message": "remove import Integral",
"patch_to_review": "diff --git a/sympy/stats/rv.py b/sympy/stats/rv.py\nindex 2d2c6f67ada1..b84c6a895b5c 100644\n--- a/sympy/stats/rv.py\n+++ b/sympy/stats/rv.py\n@@ -20,7 +20,7 @@\n \n from sympy import ... | [
{
"diff_hunk": "@@ -757,7 +757,11 @@ def expectation(expr, condition=None, numsamples=None, evaluate=True, **kwargs):\n from sympy.stats.symbolic_probability import Expectation\n if evaluate:\n return Expectation(expr, condition).doit(**kwargs)\n- return Expectation(expr, condition).rewrite(I... | b2db510dd36af5a031d2d9dd7a118242910bee59 | diff --git a/sympy/stats/rv.py b/sympy/stats/rv.py
index 2d2c6f67ada1..c1bc92676621 100644
--- a/sympy/stats/rv.py
+++ b/sympy/stats/rv.py
@@ -20,7 +20,7 @@
from sympy import (Basic, S, Expr, Symbol, Tuple, And, Add, Eq, lambdify, Or,
Equality, Lambda, sympify, Dummy, Ne, KroneckerDelta,
- ... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "New Feature Additions"
} |
sympy__sympy-19913@d466e06 | sympy/sympy | Python | 19,913 | lambdify loggamma now works for mpmath | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2020-08-07T05:06:19Z | lambdify loggamma doesn't work for mpmath
Lambdifying an expression with loggamma doesn't work for mpmath
```julia
In [6]: lambdify(x, loggamma(x), 'mpmath')
-----------------------------------------------------------------------... | `lgamma` is the name in `math`. There seems to be some code to harvest all mpmath names and add them, but it doesn't seem to work (or some other magic happens, see "Other comments" in #17394, the printer does one thing, but lambdify another...).
Is it possible to write a test that automatically tries to import everythi... | [
{
"body": "Lambdifying an expression with loggamma doesn't work for mpmath\r\n```julia\r\nIn [6]: lambdify(x, loggamma(x), 'mpmath') \r\n---------------------------------------------------------------------------\r\nImportErr... | 1b9a569fd62ca548149705652dfd6eefcba0ef38 | {
"head_commit": "d466e06844dd3c6558e20e5ed621d50e631c1aa3",
"head_commit_message": "Added testcase for loggamma",
"patch_to_review": "diff --git a/sympy/printing/pycode.py b/sympy/printing/pycode.py\nindex 5862c8fb514e..c35def62cdd2 100644\n--- a/sympy/printing/pycode.py\n+++ b/sympy/printing/pycode.py\n@@ -502,... | [
{
"diff_hunk": "@@ -75,6 +76,7 @@ def test_MpmathPrinter():\n assert p.doprint(S.NaN) == 'mpmath.nan'\n assert p.doprint(S.Infinity) == 'mpmath.inf'\n assert p.doprint(S.NegativeInfinity) == 'mpmath.ninf'\n+ assert p.doprint(loggamma(x)) == 'mpmath.lgamma(x)'",
"line": null,
"original_lin... | adf1b437bc3671c8340515acd6e2167011b6ce0f | diff --git a/sympy/printing/pycode.py b/sympy/printing/pycode.py
index 5862c8fb514e..c35def62cdd2 100644
--- a/sympy/printing/pycode.py
+++ b/sympy/printing/pycode.py
@@ -502,6 +502,7 @@ def pycode(expr, **settings):
'fresnelc': 'fresnelc',
'fresnels': 'fresnels',
'sign': 'sign',
+ 'loggamma': 'loggam... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-19783@bfb4989 | sympy/sympy | Python | 19,783 | Dagger() * IdentityOperator() now simplifies by default | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
Fixes #19747
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-clos... | 2020-07-16T09:40:38Z | Dagger() * IdentityOperator() is not simplified
As discussed on the mailing list the following does not work.
```
from sympy.physics.quantum.dagger import Dagger
from sympy.physics.quantum.operator import Operator
from sympy.physics.quantum import IdentityOperator
A = Operators('A')
Identity = IdentityOperator()
... | [
{
"body": "As discussed on the mailing list the following does not work.\r\n```\r\nfrom sympy.physics.quantum.dagger import Dagger\r\nfrom sympy.physics.quantum.operator import Operator\r\nfrom sympy.physics.quantum import IdentityOperator\r\nA = Operators('A')\r\nIdentity = IdentityOperator()\r\nA * Identity #... | 586a43201d0357e92e8c93548d69a9f42bf548f4 | {
"head_commit": "bfb49895171b7e73d2a56028d3cde8079f77c130",
"head_commit_message": "Dagger() * IdentityOperator() now simplifies by default\n\nFixes #19747",
"patch_to_review": "diff --git a/sympy/physics/quantum/dagger.py b/sympy/physics/quantum/dagger.py\nindex 17da3cfd2c5c..9e3435165c48 100644\n--- a/sympy/ph... | [
{
"diff_hunk": "@@ -85,5 +85,13 @@ def __new__(cls, arg):\n return obj\n return Expr.__new__(cls, arg)\n \n+ def __mul__(self, other):\n+ from sympy.physics.quantum import IdentityOperator\n+\n+ if isinstance(other, IdentityOperator):\n+ return self\n+\n+ r... | d91e3fe121b13d81cd74838e324fc51e87be80b1 | diff --git a/sympy/physics/quantum/dagger.py b/sympy/physics/quantum/dagger.py
index 17da3cfd2c5c..a557073a0f07 100644
--- a/sympy/physics/quantum/dagger.py
+++ b/sympy/physics/quantum/dagger.py
@@ -1,8 +1,6 @@
"""Hermitian conjugation."""
-from __future__ import print_function, division
-
-from sympy.core import Ex... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} | |
sympy__sympy-19993@e148ef8 | sympy/sympy | Python | 19,993 | upgrades to manualintegrate | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2020-08-21T10:00:38Z | Sympy doesn't Integrate when expr contains asec / acsc
```python3
>>> integrate(asin(x))
x*asin(x) + sqrt(1 - x**2)
>>> integrate(x*asin(x))
x**2*asin(x)/2 + x*sqrt(1 - x**2)/4 - asin(x)/4
>>> integrate(acos(x))
x*acos(x) - sqrt(1 - x**2)
>>> integrate(x*acos(x))
x**2*acos(x)/2 - x*sqrt(1 - x**2)/4 - acos(x)/4... | 346d9f1f34ce1f729f860fd98c188a5a38efe12a I've tried to implement this in manual-integrate

)\r\nx*asin(x) + sqrt(1 - x**2)\r\n>>> integrate(x*asin(x))\r\nx**2*asin(x)/2 + x*sqrt(1 - x**2)/4 - asin(x)/4\r\n>>> integrate(acos(x))\r\nx*acos(x) - sqrt(1 - x**2)\r\n>>> integrate(x*acos(x))\r\nx**2*acos(x)/2 - x*sqrt(1 - x**2)/4 - acos(x)/4\r\n>>> integrate(ata... | e975b8a7b339ee2e209f6d92e8ac58ee278ad5d9 | {
"head_commit": "e148ef8740d8eca19de2a51c4ff20bcef99445da",
"head_commit_message": "upgrades to manualintegrate",
"patch_to_review": "diff --git a/sympy/integrals/manualintegrate.py b/sympy/integrals/manualintegrate.py\nindex d1d61fb96250..5633db7d8867 100644\n--- a/sympy/integrals/manualintegrate.py\n+++ b/symp... | [
{
"diff_hunk": "@@ -535,14 +535,14 @@ def pull_out_u_rl(integrand):\n \n return pull_out_u_rl\n \n- liate_rules = [pull_out_u(sympy.log), pull_out_u(sympy.atan, sympy.asin, sympy.acos),\n+ liate_rules = [pull_out_u(sympy.log), pull_out_u(sympy.atan, sympy.asin, sympy.acos, sympy.acot, sympy.acsc, ... | d3719efcceb175acfa7bd82cf56806f0507b4467 | diff --git a/sympy/integrals/manualintegrate.py b/sympy/integrals/manualintegrate.py
index d1d61fb96250..5c89088058c6 100644
--- a/sympy/integrals/manualintegrate.py
+++ b/sympy/integrals/manualintegrate.py
@@ -174,6 +174,9 @@ def manual_subs(expr, *args):
# Method based on that on SIN, described in "Symbolic Integrat... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-19753@71618fc | sympy/sympy | Python | 19,753 | Added examples for hyper.appellf1 and Znm | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2020-07-12T17:10:07Z | Add missing docstring sections in Special submodule
As part of my Google Season of Docs project with SymPy, I copy edited all of the docstrings in the Special submodule to reflect the new SymPy Docstring Style Guide. While editing, I came across some docstrings that were missing sections or had other issues that need t... | For anyone fixing this be sure to follow the documentation style guide https://docs.sympy.org/dev/documentation-style-guide.html
Hey can you assign me this issue? Also, where can I reach out for questions?
Contributors are not assigned with issues here. Anyone can start working and send a relevant PR solving that issue... | [
{
"body": "As part of my Google Season of Docs project with SymPy, I copy edited all of the docstrings in the Special submodule to reflect the new SymPy Docstring Style Guide. While editing, I came across some docstrings that were missing sections or had other issues that need to be addressed. Here is a list of... | 1eaefeb714cc05d87ea2f938813e5e859caa2b32 | {
"head_commit": "71618fc94b43297fb320c96fe5ee784937587001",
"head_commit_message": "Added examples for hyper.appellf1 and Znm",
"patch_to_review": "diff --git a/sympy/functions/special/hyper.py b/sympy/functions/special/hyper.py\nindex 51d9507f76ed..ad4ef38e5965 100644\n--- a/sympy/functions/special/hyper.py\n++... | [
{
"diff_hunk": "@@ -1100,6 +1100,16 @@ class appellf1(Function):\n \\frac{(a)_{m+n} (b_1)_m (b_2)_n}{(c)_{m+n}}\n \\frac{x^m y^n}{m! n!}.\n \n+ Examples\n+ ========\n+ >>> from sympy.functions.special.hyper import appellf1\n+ >>> appellf1(2., 1., 6., 4., 5., 6.)\n+ 0.0063339426292... | 9bdf5960a623e3619182bbfbf66079db16f926ad | diff --git a/sympy/functions/special/hyper.py b/sympy/functions/special/hyper.py
index 51d9507f76ed..469299059985 100644
--- a/sympy/functions/special/hyper.py
+++ b/sympy/functions/special/hyper.py
@@ -1100,6 +1100,25 @@ class appellf1(Function):
\frac{(a)_{m+n} (b_1)_m (b_2)_n}{(c)_{m+n}}
\frac{x^m ... | {
"difficulty": "low",
"estimated_review_effort": 1,
"problem_domain": "Documentation Updates"
} |
sympy__sympy-19730@8cb7282 | sympy/sympy | Python | 19,730 | Added tests for issue 16735 | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2020-07-09T14:18:55Z | Sum.is_convergent uses the incorrect results from limit_seq
`limit_seq` gives the following wrong results:
```
In [1]: limit_seq(5**n/factorial(n),n)
Out[1]: ∞
```
```
... | On current master:
```
In [1]: limit_seq(5**n/factorial(n),n)
Out[1]: 0
In [2]: limit_seq(5**n/gamma(n+1),n)
Out[2]: 0
In [3]: Sum(5**n/gamma(n+1), (n, 1, oo)).is_convergent()
Out[3]: True
```
This issue seems fixed. Only requires a test in order to be closed.
Will adding the lines
```python
def test_i... | [
{
"body": "`limit_seq` gives the following wrong results:\r\n```\r\nIn [1]: limit_seq(5**n/factorial(n),n) \r\nOut[1]: ∞\r\n```\r\n```\r\nIn [2]: limit_seq(5**n/gamma(... | c0bfc81f3ffee97c6d6732ac5e5ccf399e5ab3e2 | {
"head_commit": "8cb7282cf58d1b6f0043850e8df1d6d926ece85a",
"head_commit_message": "Added tests for issue 16735",
"patch_to_review": "diff --git a/sympy/concrete/tests/test_sums_products.py b/sympy/concrete/tests/test_sums_products.py\nindex 18a9f850d573..7c8aa5e92258 100644\n--- a/sympy/concrete/tests/test_sums... | [
{
"diff_hunk": "@@ -1317,6 +1317,11 @@ def test_issue_14313():\n assert Sum(S.Half**floor(n/2), (n, 1, oo)).is_convergent()\n \n \n+@XFAIL",
"line": null,
"original_line": 1320,
"original_start_line": null,
"path": "sympy/concrete/tests/test_sums_products.py",
"start_line": null,
"te... | 2bd9171c226c827ba9f9a4c90da8033ff3f4f68c | diff --git a/sympy/concrete/tests/test_sums_products.py b/sympy/concrete/tests/test_sums_products.py
index 18a9f850d573..90b6f8aecec9 100644
--- a/sympy/concrete/tests/test_sums_products.py
+++ b/sympy/concrete/tests/test_sums_products.py
@@ -1317,6 +1317,10 @@ def test_issue_14313():
assert Sum(S.Half**floor(n/2)... | {
"difficulty": "low",
"estimated_review_effort": 1,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-19546@b777e46 | sympy/sympy | Python | 19,546 | Modified order.py | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2020-06-13T13:20:39Z | is_convergent() returns a wrong result
The code
```
expr1 = 1/n - 3/(3*n +2)
res1 = Sum(expr1, (n, 1, oo)).is_convergent()
```
returns the wrong result `False`.
The code
```
expr2 = simplify(expr1)
res2 = Sum(expr2, (n, 1, oo)).is_convergent()
```
returns the correct result `True`.
The different behavio... | [
{
"body": "The code\r\n```\r\nexpr1 = 1/n - 3/(3*n +2)\r\nres1 = Sum(expr1, (n, 1, oo)).is_convergent()\r\n```\r\nreturns the wrong result `False`.\r\n\r\nThe code\r\n```\r\nexpr2 = simplify(expr1)\r\nres2 = Sum(expr2, (n, 1, oo)).is_convergent()\r\n```\r\nreturns the correct result `True`.\r\n\r\nThe different... | bfd2fa05de2db76a73c16e5c94604cdfd9d74e60 | {
"head_commit": "b777e4693084cf731595594d5389c5cd7901fbb8",
"head_commit_message": "Modified order.py\n\nReferences to other Issues or PRs\nFixes #19545\n\nBrief description of what is fixed or changed\n\nThe code `Order(1/n - 3/(3*n +2), (n, oo))` returns `1/n`, which\nis not a sharp result.\nAs a consequence `Su... | [
{
"diff_hunk": "@@ -212,6 +212,8 @@ def __new__(cls, expr, *args, **kwargs):\n # x*y (wrong order term!). That's why we want to deal with\n # expand()'ed expr (handled in \"if expr.is_Add\" branch below).\n expr = expr.expand()\n+ else:\n+ ... | 7ab97483ca459ed90421e1c92d2d523c421d6a6c | diff --git a/sympy/concrete/tests/test_sums_products.py b/sympy/concrete/tests/test_sums_products.py
index 258f98acdd63..18a9f850d573 100644
--- a/sympy/concrete/tests/test_sums_products.py
+++ b/sympy/concrete/tests/test_sums_products.py
@@ -1050,6 +1050,8 @@ def test_is_convergent():
assert Sum(1/(x**3), (x, 1, ... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} | |
sympy__sympy-19406@f6e5af5 | sympy/sympy | Python | 19,406 | Clean up flake8 warnings from doctests | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2020-05-22T23:46:05Z | Clean up flake8 warnings from doctests
Currently flake8 runs on the main code but not on doctests. It has a `--doctests` argument to check the doctests as well.
For example:
```console
$ flake8 --doctests sympy/matrices/determinant.py
sympy/matrices/determinant.py:545:9: F401 'sympy.MatrixSymbol' imported but un... | I'd like to take up on the task of cleaning the imports if I may
Yes, go ahead.
I was working on this cleanup and I found a curious situation:
sympy supports multiple dispatch per argument type, as defined in the docs of `sympy/multipledispatch/core.py`(lines 22-38):
```
Examples
--------
>>> from symp... | [
{
"body": "Currently flake8 runs on the main code but not on doctests. It has a `--doctests` argument to check the doctests as well.\r\n\r\nFor example:\r\n```console\r\n$ flake8 --doctests sympy/matrices/determinant.py \r\nsympy/matrices/determinant.py:545:9: F401 'sympy.MatrixSymbol' imported but unused\r\nsy... | 6de346061821d2bc5b7e11be0382baaf2b22083d | {
"head_commit": "f6e5af56777605bd33872ab1a91db003fb697edd",
"head_commit_message": "quality(doc): Test doctests with flake8 on Travis\n\nMostly removes no longer needed imports.\n\nCo-authored-by: Marijan Smetko <marijansmetko123@gmail.com>",
"patch_to_review": "diff --git a/bin/test_travis.sh b/bin/test_travis.... | [
{
"diff_hunk": "@@ -7,6 +7,7 @@ set -x\n \n if [[ \"${TEST_FLAKE8}\" == \"true\" ]]; then\n flake8 sympy;\n+ flake8 --doctests --per-file-ignores='sympy/interactive/session.py:F821' sympy;",
"line": null,
"original_line": 10,
"original_start_line": null,
"path": "bin/test_travis.sh",
... | e30d6003d3a7d4d5f446ad579660554000aa38b9 | diff --git a/setup.cfg b/setup.cfg
index 894363b62eb4..9fb55ed67489 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -3,12 +3,14 @@ long_description = file: README.md
long_description_content_type = text/markdown
[flake8]
+doctests = True
ignore = F403
select = F,E722
exclude = sympy/parsing/latex/_antlr/*,
... | {
"difficulty": "low",
"estimated_review_effort": 1,
"problem_domain": "Code Style, Linting, Formatting Fixes"
} |
sympy__sympy-19463@53d2c02 | sympy/sympy | Python | 19,463 | Introduce general add, mul, and pow function | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2020-05-30T05:28:37Z | Connecting Add, Mul to MatAdd, MatMul
Current matrix module uses `Basic._exec_constructor_postprocessor` method to convert `Add` and `Mul` containing `MatrixExpr` to `MatAdd` and `MatMul`, respectly.
However, this behavior seems to be somewhat unefficient...
1. It does not pass any option to `MatAdd` and `MatMul`... | [
{
"body": "Current matrix module uses `Basic._exec_constructor_postprocessor` method to convert `Add` and `Mul` containing `MatrixExpr` to `MatAdd` and `MatMul`, respectly. \r\nHowever, this behavior seems to be somewhat unefficient...\r\n\r\n1. It does not pass any option to `MatAdd` and `MatMul`.\r\n ```p... | 4063fa8437fc4319bdbdf1735075a2f9853f4498 | {
"head_commit": "53d2c02bcbf22e76efdcc56add548e3dec9472cf",
"head_commit_message": "Apply suggestions from code review\n\nCo-authored-by: Eric Wieser <wieser.eric@gmail.com>",
"patch_to_review": "diff --git a/sympy/core/add.py b/sympy/core/add.py\nindex a37140b836cc..651f6b627caa 100644\n--- a/sympy/core/add.py\... | [
{
"diff_hunk": "@@ -21,6 +25,20 @@ class AssocOp(Basic):\n \n This is an abstract base class, concrete derived classes must define\n the attribute `identity`.\n+\n+ Parameters\n+ ==========\n+\n+ *args :\n+ Arguments which are operated\n+\n+ sympify : bool, optional",
"line": null... | 1f289377e24ade8f8f2c040602914a75bf03d02d | diff --git a/sympy/core/add.py b/sympy/core/add.py
index a37140b836cc..651f6b627caa 100644
--- a/sympy/core/add.py
+++ b/sympy/core/add.py
@@ -5,7 +5,7 @@
from .parameters import global_parameters
from .logic import _fuzzy_group, fuzzy_or, fuzzy_not
from .singleton import S
-from .operations import AssocOp
+from .op... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "Code Refactoring / Architectural Improvement"
} | |
sympy__sympy-19485@9615d1f | sympy/sympy | Python | 19,485 | feat(polys): Add Gaussian domains to Poly | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2020-06-03T22:50:42Z | Gaussian integer division raises TypeError
Gaussian integer division raises error when `auto=True` is enabled, which is default behavior.
```python3
>>> from sympy import *
>>> from sympy.polys.domains.gaussiandomains import ZZ_I, QQ_I
>>> x = Symbol('x')
>>> p = Poly(2+3*I, x, domain=ZZ_I)
>>> q = Poly(1-I, x, ... | [
{
"body": "Gaussian integer division raises error when `auto=True` is enabled, which is default behavior. \r\n```python3\r\n>>> from sympy import *\r\n>>> from sympy.polys.domains.gaussiandomains import ZZ_I, QQ_I\r\n>>> x = Symbol('x')\r\n>>> p = Poly(2+3*I, x, domain=ZZ_I)\r\n>>> q = Poly(1-I, x, domain=ZZ_I)... | 25e8a795088c33abfa68021e2a5f22a4fc312447 | {
"head_commit": "9615d1fd7005e50e5e6739b5f93f43d5a83e08f0",
"head_commit_message": "feat(polys): Add Gaussian domains to Poly\n\nUse AlgebraicField instead of the Gaussian domains for factoring in\napart. The factorisation algorithms are not provided for Gaussian\ndomains yet.",
"patch_to_review": "diff --git a/... | [
{
"diff_hunk": "@@ -116,6 +116,16 @@ def apart(f, x=None, full=False, **options):\n pass\n return f.xreplace(dict(reps))\n \n+ # Factorization over ZZ_I or QQ_I is not supported so we use the\n+ # factorization routines for AlgebraicField instead.\n+ dom = P.domain\n+ ... | 23a1d9ccf81c5208e0f0e6aea2d86d2527cdb8f3 | diff --git a/sympy/__init__.py b/sympy/__init__.py
index 4603b62f94eb..d7d1863af367 100644
--- a/sympy/__init__.py
+++ b/sympy/__init__.py
@@ -95,7 +95,7 @@ def __sympy_debug():
GMPYFiniteField, PythonIntegerRing, GMPYIntegerRing, PythonRational,
GMPYRationalField, AlgebraicField, PolynomialRing, Frac... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "Bug Fixes"
} | |
sympy__sympy-19368@83edeba | sympy/sympy | Python | 19,368 | Make classes in diffgeom module immutable | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2020-05-19T13:24:16Z | Idea to implement CoordSystem's _fill_gaps_in_transformations
Currently, `CoordSystem` in `diffgeom` module has unimplemented method called `_fill_gaps_in_transformations`. This method is supposed to establish the transformation relation between two non-directly connected coordinate systems.
I am planning to impleme... | I think that some classes in the `diffgeom` are using mutable objects like `transforms` or `coord_systems`, but they shouldn't be using them extensively than cacheing.
And I think that this makes the future unclear about whether `transforms` dict should be replaced by other stuff and be deprecated.
@sylee957
I total... | [
{
"body": "Currently, `CoordSystem` in `diffgeom` module has unimplemented method called `_fill_gaps_in_transformations`. This method is supposed to establish the transformation relation between two non-directly connected coordinate systems.\r\n\r\nI am planning to implement this method. Using path finding algo... | c0bfc81f3ffee97c6d6732ac5e5ccf399e5ab3e2 | {
"head_commit": "83edebae76094cbb5606a29aa9d1bc2ef5d0cf08",
"head_commit_message": "Fix References underline length",
"patch_to_review": "diff --git a/doc/src/modules/diffgeom.rst b/doc/src/modules/diffgeom.rst\nindex 02fc0416af80..764d9f31412d 100644\n--- a/doc/src/modules/diffgeom.rst\n+++ b/doc/src/modules/di... | [
{
"diff_hunk": "@@ -321,85 +514,133 @@ def coord_tuple_transform_to(self, to_sys, coords):\n \n def jacobian(self, to_sys, coords):\n \"\"\"Return the jacobian matrix of a transformation.\"\"\"\n+ SymPyDeprecationWarning(",
"line": null,
"original_line": 517,
"original_start_line"... | 3430cbf6bf8546544b9309e4b542f99c1c34b8af | diff --git a/doc/src/modules/diffgeom.rst b/doc/src/modules/diffgeom.rst
index 02fc0416af80..764d9f31412d 100644
--- a/doc/src/modules/diffgeom.rst
+++ b/doc/src/modules/diffgeom.rst
@@ -18,6 +18,9 @@ Base Class Reference
.. autoclass:: CoordSystem
:members:
+.. autoclass:: CoordinateSymbol
+ :members:
+
.. a... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "New Feature Additions"
} |
sympy__sympy-19596@7097b50 | sympy/sympy | Python | 19,596 | Improved simplification for expressions containing sign() | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2020-06-19T11:03:13Z | sympy cannot simplify sign(x) * abs(x)
```
>>> from sympy import Symbol, sign
>>> x = Symbol('x', real=True)
>>> x_new = abs(x)*sign(x)
>>> x_new
Abs(x)*sign(x)
>>> x_new.simplify()
Abs(x)*sign(x)
```
I would expect the result to be just `x`. gh-19277 may be related. | The rewrite suggested in #19277 would be able to make this work:
```julia
In [19]: e = sign(x)*Abs(x)
In [20]: e ... | [
{
"body": "```\r\n>>> from sympy import Symbol, sign\r\n>>> x = Symbol('x', real=True)\r\n>>> x_new = abs(x)*sign(x)\r\n>>> x_new\r\nAbs(x)*sign(x)\r\n>>> x_new.simplify()\r\nAbs(x)*sign(x)\r\n```\r\n\r\nI would expect the result to be just `x`. gh-19277 may be related.\r\n",
"number": 19484,
"title": "... | 4fa55af041c632f522e622de4b175f03927a7f95 | {
"head_commit": "7097b50fb410dc4c4fd30b504e861ef10f258447",
"head_commit_message": "Impoved simplification for sign()\n\nSimplify() for sign(x)*Abs(x) now works due to\nsign._eval_rewrite_as_Abs().",
"patch_to_review": "diff --git a/sympy/functions/elementary/piecewise.py b/sympy/functions/elementary/piecewise.p... | [
{
"diff_hunk": "@@ -615,6 +615,10 @@ def done(e):\n from sympy.simplify.hyperexpand import hyperexpand\n from sympy.functions.special.bessel import BesselBase\n from sympy import Sum, Product, Integral\n+ from sympy.functions.elementary.complexes import sign, Abs\n+\n+ if expr.has(sign):",
... | f9bd1d432b59f6487044519d1db9d44b56453a8a | diff --git a/sympy/functions/elementary/piecewise.py b/sympy/functions/elementary/piecewise.py
index c4a3d60fb6f5..7b8eea208e20 100644
--- a/sympy/functions/elementary/piecewise.py
+++ b/sympy/functions/elementary/piecewise.py
@@ -1238,9 +1238,10 @@ def piecewise_simplify(expr, **kwargs):
if eqs and not ot... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-19387@1d00f17 | sympy/sympy | Python | 19,387 | [GSoC] Added Poisson, Wiener and Gamma Process | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
Added Poisson, Wiener and Gamma Process
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
htt... | 2020-05-21T03:57:13Z | [GSoC Discussion] Adding Poisson Process
Currently, we have DTMC, CTMC, and Bernoulli Process as the stochastic processes in `stats/stochatic_process_types.py`. Therefore, I plan to add more such processes.
We can divide(for API discussion) the stochastic processes into two categories:
**Case 1** The processes whi... | I'd suggest to start with designing APIs with the help of some use cases(like picking up examples from textbooks, wikipedia, research papers). In addition, some processes can be built on top of Markov chains.
For, the examples of using the processes in the **Case 1**, I have found some real-life example problems relate... | [
{
"body": "Currently, we have DTMC, CTMC, and Bernoulli Process as the stochastic processes in `stats/stochatic_process_types.py`. Therefore, I plan to add more such processes.\r\nWe can divide(for API discussion) the stochastic processes into two categories:\r\n\r\n**Case 1** The processes which follow certai... | 726b440029153fa25d8582c577c709c2350be720 | {
"head_commit": "1d00f17959839d8494ce34bf923bfd3bd487de44",
"head_commit_message": "add poisson process",
"patch_to_review": "diff --git a/sympy/stats/rv.py b/sympy/stats/rv.py\nindex cd0014de6914..7e042340b312 100644\n--- a/sympy/stats/rv.py\n+++ b/sympy/stats/rv.py\n@@ -742,6 +742,10 @@ def expectation(expr, c... | [
{
"diff_hunk": "@@ -998,10 +1069,58 @@ def probability(self, condition, given_condition=None, evaluate=True, **kwargs):\n % (new_condition))\n if new_givencondition is not None: # If there is a condition\n # Recompute on new conditional expr\n- return self.probabi... | 1e5404a892b031e1ef50f8190becbf8bb2182248 | diff --git a/sympy/core/tests/test_args.py b/sympy/core/tests/test_args.py
index 3bc13f6db3a8..1c8941760975 100644
--- a/sympy/core/tests/test_args.py
+++ b/sympy/core/tests/test_args.py
@@ -1676,6 +1676,22 @@ def test_sympy__stats__stochastic_process_types__BernoulliProcess():
from sympy.stats.stochastic_process_... | {
"difficulty": "high",
"estimated_review_effort": 4,
"problem_domain": "New Feature Additions"
} |
sympy__sympy-19346@b8b80cf | sympy/sympy | Python | 19,346 | Fixed: srepr not printing dict and set properly | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2020-05-17T12:23:33Z | srepr not printing dict and set properly
`srepr` prints the element in `list` and `tuple` correctly.
```python
>>> from sympy import srepr
>>> from sympy.abc import x,y
>>> srepr([x,y])
[Symbol('x'), Symbol('y')]
>>> srepr((x,y))
(Symbol('x'), Symbol('y'))
```
However, `srepr` prints the elements in `dict` a... | [
{
"body": "`srepr` prints the element in `list` and `tuple` correctly.\r\n```python\r\n>>> from sympy import srepr\r\n>>> from sympy.abc import x,y\r\n>>> srepr([x,y])\r\n[Symbol('x'), Symbol('y')]\r\n>>> srepr((x,y))\r\n(Symbol('x'), Symbol('y'))\r\n```\r\n\r\nHowever, `srepr` prints the elements in `dict` and... | 94fb720696f5f5d12bad8bc813699fd696afd2fb | {
"head_commit": "b8b80cf44b9fdcb7198911784aba8b707309d99f",
"head_commit_message": "fixed: srepr not printing dict and set properly",
"patch_to_review": "diff --git a/sympy/printing/repr.py b/sympy/printing/repr.py\nindex c936a692c0cd..3c6aa1264f6b 100644\n--- a/sympy/printing/repr.py\n+++ b/sympy/printing/repr.... | [
{
"diff_hunk": "@@ -318,3 +318,23 @@ def test_diffgeom():\n assert srepr(rect) == \"CoordSystem('rect', Patch('P', Manifold('M', 2)), ('rect_0', 'rect_1'))\"\n b = BaseScalarField(rect, 0)\n assert srepr(b) == \"BaseScalarField(CoordSystem('rect', Patch('P', Manifold('M', 2)), ('rect_0', 'rect_1')),... | 2a7b8a475b4a9883d6821bb3412518381d4fa797 | diff --git a/sympy/printing/repr.py b/sympy/printing/repr.py
index c936a692c0cd..04cfee5c3e61 100644
--- a/sympy/printing/repr.py
+++ b/sympy/printing/repr.py
@@ -144,6 +144,16 @@ def _print_EmptySequence(self, expr):
def _print_list(self, expr):
return "[%s]" % self.reprify(expr, ", ")
+ def _print_... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} | |
yt-dlp__yt-dlp-1200@b2685d5 | yt-dlp/yt-dlp | Python | 1,200 | [on24] Add new extractor | ## Please follow the guide below
- You will be asked some questions, please read them **carefully** and answer honestly
- Put an `x` into all the boxes [ ] relevant to your *pull request* (like that [x])
- Use *Preview* tab to see how your *pull request* will actually look like
---
### Before submitting a *p... | 2021-10-07T22:40:24Z | Add on24 downloader
## Checklist
- [x] I'm reporting a feature request
- [x] I've verified that I'm running youtube-dl version **2020.03.24**
- [x] I've searched the bugtracker for similar feature requests including closed ones
## Description
ON24 is used for online trainings like from the O'Reilly learnin... | @chbndrhnns you need to find **stream.mpd** file using chrome developer tool.
then use the command
`youtube-dl -f bestvideo+bestaudio https://dashod.akamaized.net/media/cv/events/XYZ/stream.mpd`
you need ffmpeg for merging formats.
see this stackoverflow [link](https://stackoverflow.com/a/55071769)
I've used this... | [
{
"body": "## Checklist\r\n\r\n- [x] I'm reporting a feature request\r\n- [x] I've verified that I'm running youtube-dl version **2020.03.24**\r\n- [x] I've searched the bugtracker for similar feature requests including closed ones\r\n\r\n\r\n## Description\r\n\r\nON24 is used for online trainings like from the... | 6ff34542d2ddfe3369f7e1b321891f155690ae80 | {
"head_commit": "b2685d5223b50ae22eca47ff5e088a07d00271e5",
"head_commit_message": "Remove whitespace\n\nFixes Flake8 warning",
"patch_to_review": "diff --git a/yt_dlp/extractor/extractors.py b/yt_dlp/extractor/extractors.py\nindex 8c5b8b16077a..7ed8fb450cb3 100644\n--- a/yt_dlp/extractor/extractors.py\n+++ b/yt... | [
{
"diff_hunk": "@@ -0,0 +1,105 @@\n+# coding: utf-8\n+from __future__ import unicode_literals\n+\n+import re\n+\n+from .common import InfoExtractor\n+from ..compat import (\n+ compat_str,\n+ compat_urlparse,\n+)\n+from ..utils import strip_or_none\n+\n+\n+class On24IE(InfoExtractor):\n+ IE_NAME = 'on24... | 5b4071da360c7d2681418724107096d79758b90b | diff --git a/yt_dlp/extractor/extractors.py b/yt_dlp/extractor/extractors.py
index 8c5b8b16077a..7ed8fb450cb3 100644
--- a/yt_dlp/extractor/extractors.py
+++ b/yt_dlp/extractor/extractors.py
@@ -983,6 +983,7 @@
from .odnoklassniki import OdnoklassnikiIE
from .oktoberfesttv import OktoberfestTVIE
from .olympics impor... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "New Feature Additions"
} |
sympy__sympy-19297@49641ad | sympy/sympy | Python | 19,297 | [GSoC] Series: Fixing incorrect limit evaluations caused due to bug in rewriting | Fixes: #18378
Fixes: #18482
Closes #18947
#### Brief description of what is fixed or changed
**Incorrect limit evaluation** takes place because of **bug in rewriting.**
The function `xreplace()` in the `rewrite()` function of `gruntz.py` is not substituting properly.
As a result, it has been replaced by th... | 2020-05-12T08:29:38Z | Invalid result in Limit
`Limit(ln(exp(3*x)+x)/ln(exp(x)+x**100), x, oo).doit()` gives the output of `9` although `3` was expected.
Sympy 1.5 on CPython 3.7.4 on Windows 10 64 bit.
Incorrect evaluation of limit
`limit(sqrt (x**2 + 6*x) + (x**3 + x**2)/(x**2 + 1),x,-oo)` is `2`
`limit((x**3 + x**2 + sqrt(x*(x + 6))*(x... | On 1.6.dev, I get this:
```
In [10]: Limit(ln(exp(3*x)+x)/ln(exp(x)+x**100), x, oo).doit()
Out[10]: 3
```
1.5.1 also gives 9
Also, `limit((2*exp(3*x)/(exp(2*x) + 1))**(1/x),x,oo)` should be `E`.
Same as above.
`limit(x + (1 - x**2)*exp(1/x)/(x + 2),x,oo)` is `1`. `imit((x*(x + 2) + (1 - x**2)*exp(1/x))/(x + 2),x,o... | [
{
"body": "`Limit(ln(exp(3*x)+x)/ln(exp(x)+x**100), x, oo).doit()` gives the output of `9` although `3` was expected.\r\nSympy 1.5 on CPython 3.7.4 on Windows 10 64 bit.",
"number": 18378,
"title": "Invalid result in Limit"
},
{
"body": "`limit(sqrt (x**2 + 6*x) + (x**3 + x**2)/(x**2 + 1),x,-oo)... | 7a3e06478304045a54000341ff81ab20ab074a05 | {
"head_commit": "49641ad4938b2ce2d0324732a6d51dc15a6b6f74",
"head_commit_message": "Fixing incorrect limit evaluations caused due to bug in rewriting",
"patch_to_review": "diff --git a/sympy/series/gruntz.py b/sympy/series/gruntz.py\nindex e857f14c9d2f..12aa2dd467cb 100644\n--- a/sympy/series/gruntz.py\n+++ b/sy... | [
{
"diff_hunk": "@@ -652,10 +652,18 @@ def test_issue_18306():\n assert limit(sin(sqrt(x))/sqrt(sin(x)), x, 0, '+') == 1\n \n \n+def test_issue_18378():\n+ assert limit(log(exp(3*x) + x)/log(exp(x) + x**100), x, oo).doit() == 3",
"line": null,
"original_line": 656,
"original_start_line": null,... | 53adee580afb2ce4a31ccd2909d6e272b0c65245 | diff --git a/sympy/series/gruntz.py b/sympy/series/gruntz.py
index e857f14c9d2f..12aa2dd467cb 100644
--- a/sympy/series/gruntz.py
+++ b/sympy/series/gruntz.py
@@ -628,7 +628,7 @@ def rewrite(e, Omega, x, wsym):
# Some parts of sympy have difficulty computing series expansions with
# non-integral exponents. Th... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-19254@8adfdbe | sympy/sympy | Python | 19,254 | Improvement_of_dup_zz_mignotte_bound(f, K) | So, this is our change in the `dup_zz_mignotte_bound(f, K)` method. Also, we have replace the old value in the test_factortools.py file. If it is asked, we can cite our test_file with the comparison of the bounds. As it was mentioned, we have not create a new method but just change the code in the `dup_zz_mignotte_boun... | 2020-05-04T13:38:13Z | sympy.polys.factortools.dmp_zz_mignotte_bound improvement
The method `dup_zz_mignotte_bound(f, K)` can be significantly improved by using the **Knuth-Cohen bound** instead. After our research with Prof. Ag.Akritas we have implemented the Knuth-Cohen bound among others, and compare them among dozens of polynomials with ... | [
{
"body": "The method `dup_zz_mignotte_bound(f, K)` can be significantly improved by using the **Knuth-Cohen bound** instead. After our research with Prof. Ag.Akritas we have implemented the Knuth-Cohen bound among others, and compare them among dozens of polynomials with different degree, density and coefficie... | e0ef1da13e2ab2a77866c05246f73c871ca9388c | {
"head_commit": "8adfdbed18e6a0e06d862213752d2cb96a84218a",
"head_commit_message": "19253_Replacement_of_dup_zz_mignotte_bound(f, K)\n\nSo, this is our change in the `dup_zz_mignotte_bound(f, K)` method. Also, we have replace the old value in the test_factortools.py file. If it is asked, we can cite our test_file ... | [
{
"diff_hunk": "@@ -124,13 +124,29 @@ def dmp_trial_division(f, factors, u, K):\n \n \n def dup_zz_mignotte_bound(f, K):\n- \"\"\"Mignotte bound for univariate polynomials in `K[x]`. \"\"\"\n- a = dup_max_norm(f, K)\n- b = abs(dup_LC(f, K))\n- n = dup_degree(f)\n-\n- return K.sqrt(K(n + 1))*2**n*... | ad5638b5189f92bcda642b93d195a5e4746c8166 | diff --git a/sympy/polys/factortools.py b/sympy/polys/factortools.py
index 93298f47e671..cfa59ae9b8b5 100644
--- a/sympy/polys/factortools.py
+++ b/sympy/polys/factortools.py
@@ -124,13 +124,64 @@ def dmp_trial_division(f, factors, u, K):
def dup_zz_mignotte_bound(f, K):
- """Mignotte bound for univariate polyn... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "Performance Optimizations"
} | |
sympy__sympy-19093@bcb7880 | sympy/sympy | Python | 19,093 | Various block matrix improvements | #### References to other Issues or PRs
Fixes #2460
#### Brief description of what is fixed or changed
Various improvements regarding BlockMatrix:
- Improve inversion of 2x2 block matrices
- Add assumption handlers for OneMatrix
- Raise more correct and more specific exceptions for matrices
- Allow creating Blo... | 2020-04-08T21:22:25Z | Regression: can't make expressions with mutable BlockDiagMatrix's
This used to work in 0.7.3 :
``` Python
>>> from sympy import Matrix, BlockDiagMatrix
>>> from sympy.abc import x, y, z
>>> bdm1 = BlockDiagMatrix(Matrix([x]), Matrix([y]))
>>> bdm2 = BlockDiagMatrix(Matrix([y]), Matrix([z]))
>>> bdm1 + bdm2
TypeError: ... | The solution clearly is that BlockDiagMatrix should convert MutableMatrix to ImmutableMatrix.
I bisected to b085bab7427ce6b5c2ad7657f216445659b5c4a1 | [
{
"body": "This used to work in 0.7.3 :\n\n``` Python\n>>> from sympy import Matrix, BlockDiagMatrix\n>>> from sympy.abc import x, y, z\n>>> bdm1 = BlockDiagMatrix(Matrix([x]), Matrix([y]))\n>>> bdm2 = BlockDiagMatrix(Matrix([y]), Matrix([z]))\n>>> bdm1 + bdm2\nTypeError: unhashable type: 'MutableDenseMatrix'\n... | 64d28fe0534f6993695d11244ea740f783958dc8 | {
"head_commit": "bcb78804ce7ff60864697ccf023fd31c66a98721",
"head_commit_message": "Improve inversion of 2x2 block matrices\n\nIt previously tried to apply the formula even when A wasn't square. It now\nalso considers invertibility of matrices to choose which formula to apply.",
"patch_to_review": "diff --git a... | [
{
"diff_hunk": "@@ -306,6 +309,7 @@ class BlockDiagMatrix(BlockMatrix):\n sympy.matrices.dense.diag\n \"\"\"\n def __new__(cls, *mats):\n+ mats = [m.as_immutable() if isinstance(m, MutableMatrix) else m for m in mats]",
"line": null,
"original_line": 312,
"original_start_line": nu... | 4987d2ea0a218b9c698bcbec98b91ec95e5b5e88 | diff --git a/sympy/assumptions/handlers/matrices.py b/sympy/assumptions/handlers/matrices.py
index 98762511fab7..e1f60893e7a8 100644
--- a/sympy/assumptions/handlers/matrices.py
+++ b/sympy/assumptions/handlers/matrices.py
@@ -78,6 +78,8 @@ def MatrixSymbol(expr, assumptions):
def ZeroMatrix(expr, assumptions):
... | {
"difficulty": "high",
"estimated_review_effort": 4,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-19037@a927b13 | sympy/sympy | Python | 19,037 | Functions: Resolves Extraneous Variable in Limit results | Fixes: #18501
Fixes: #18997
Fixes: #19026
The root cause of the issue is the `_eval_nseries() function of Abs() class`.
#### Brief description of what is fixed or changed
**Previously:**
```
In[1]: limit(Abs(log(x - 1)**3 - 1), x, 1, '+')
Out[1]: -oo*sign(log(_w)**3)
```
A bit of substitution was missi... | 2020-03-31T14:07:57Z | Extraneous variable in limit result
`limit(Abs(log(x - 1)**3 - 1),x,1,'+')` returns expression involving `w`:
```python
>>> limit(Abs(log(x - 1)**3 - 1),x,1,'+')
-oo*sign(log(_w)**3)
```
Incorrect limit result involving Abs, returns expression involving a symbol
`limit(Abs(log(x)),x,0)` returns incorrect result. S... | [
{
"body": "`limit(Abs(log(x - 1)**3 - 1),x,1,'+')` returns expression involving `w`:\r\n```python\r\n>>> limit(Abs(log(x - 1)**3 - 1),x,1,'+')\r\n-oo*sign(log(_w)**3)\r\n```",
"number": 18501,
"title": "Extraneous variable in limit result"
},
{
"body": "`limit(Abs(log(x)),x,0)` returns incorrect... | 2586bae98d76d12d98d2b21b33f9931df9dccac4 | {
"head_commit": "a927b13f1e6f423f22b2f7d5bf0f5a4e8ac1b258",
"head_commit_message": "Made changes to fix a minor bug",
"patch_to_review": "diff --git a/sympy/functions/elementary/complexes.py b/sympy/functions/elementary/complexes.py\nindex fad4b28dae82..ac5e7a658568 100644\n--- a/sympy/functions/elementary/compl... | [
{
"diff_hunk": "@@ -242,5 +242,5 @@ def limit_seq(expr, n=None, trials=5):\n # Maybe the absolute value is easier to deal with (though not if\n # it has a Sum). If it tends to 0, the limit is 0.\n elif not expr.has(Sum):\n- if _limit_seq(Abs(expr.xreplace({n: n_})), n_, trials... | 0007815efa13cdbf265a29038eadf26fa38dbb22 | diff --git a/sympy/functions/elementary/complexes.py b/sympy/functions/elementary/complexes.py
index fad4b28dae82..ac5e7a658568 100644
--- a/sympy/functions/elementary/complexes.py
+++ b/sympy/functions/elementary/complexes.py
@@ -591,6 +591,8 @@ def _eval_power(self, exponent):
def _eval_nseries(self, x, n, log... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} | |
sympy__sympy-18993@44a510f | sympy/sympy | Python | 18,993 | Solves key error in creating polycyclic group, Improves _sift, induced_pcgs | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2020-03-28T16:43:16Z | KeyError in creating a polycylic group from Dihedral Group
I am getting this error when `n>2`and `n` is `even` is there any reason we are getting this?if yes should we raise a `exception` instead?
```
>>> G = DihedralGroup(10)
>>> A = G.polycyclic_group()
Traceback (most recent call last):
File "<stdin>", line 1... | Ping @jksuom @divyanshu132
I think this should work, may be there is some problem with the collection of word.
The problem seems in the `pc_relators` function because on line `335` of `pc_groups.py` this (`self.pc_presentation[key]`) is returning a `x2**4` which is a exponential value.
Mapped value can be exponential... | [
{
"body": "I am getting this error when `n>2`and `n` is `even` is there any reason we are getting this?if yes should we raise a `exception` instead?\r\n```\r\n>>> G = DihedralGroup(10)\r\n>>> A = G.polycyclic_group()\r\nTraceback (most recent call last):\r\n File \"<stdin>\", line 1, in <module>\r\n File \"/h... | 3f305ce157071f9667a9c9dc395eeee537d1f939 | {
"head_commit": "44a510fbe31bb89a7dc0ecbefb553295568718d9",
"head_commit_message": "changes example",
"patch_to_review": "diff --git a/sympy/combinatorics/pc_groups.py b/sympy/combinatorics/pc_groups.py\nindex 3080f5970ef1..a68be2b382c3 100644\n--- a/sympy/combinatorics/pc_groups.py\n+++ b/sympy/combinatorics/pc... | [
{
"diff_hunk": "@@ -73,18 +73,18 @@ def test_exponent_vector():\n \n \n def test_induced_pcgs():\n- G = SymmetricGroup(9).sylow_subgroup(3)\n- PcGroup = G.polycyclic_group()\n- collector = PcGroup.collector\n- gens = [G[0], G[1]]\n- ipcgs = collector.induced_pcgs(gens)\n- order = [gen.order() ... | 3cb3027afa22219dfd6eca9e56f71b605143e171 | diff --git a/sympy/combinatorics/pc_groups.py b/sympy/combinatorics/pc_groups.py
index 3080f5970ef1..a68be2b382c3 100644
--- a/sympy/combinatorics/pc_groups.py
+++ b/sympy/combinatorics/pc_groups.py
@@ -332,7 +332,9 @@ def collected_word(self, word):
key = ((w[0][0], re), )
key = free_... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-19304@ce9d4e1 | sympy/sympy | Python | 19,304 | [GSoC] Added `is_random` to check random expressions of stats | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
Added `is_random` function to check if expression contains random variables.
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
... | 2020-05-13T06:19:30Z | SymPy stats expansion
Add
- `is_random` to every SymPy object (returns true if expression contains random symbols).
- test `is_random` on undefined functions and indexed bases.
- stats functions such as `P`, `E`, `var`, and `cov` should return their respective objects in case the `RandomSymbol` has no specified pr... | May be, `is_random` property can be added to `Basic` class(or whatever is the top most parent class) which can compute it's value by using the `OR` over all the `is_random` values of the objects args. Default value of `Symbol.is_random` should be `False` and `RandomSymbol.is_random` should be `True` and since every exp... | [
{
"body": "Add\r\n\r\n- `is_random` to every SymPy object (returns true if expression contains random symbols).\r\n- test `is_random` on undefined functions and indexed bases.\r\n- stats functions such as `P`, `E`, `var`, and `cov` should return their respective objects in case the `RandomSymbol` has no specifi... | 94fb720696f5f5d12bad8bc813699fd696afd2fb | {
"head_commit": "ce9d4e16be9d15032046e991f13aae609f4d946a",
"head_commit_message": "return objects when no pspace",
"patch_to_review": "diff --git a/sympy/stats/crv.py b/sympy/stats/crv.py\nindex 61a8fb7a1935..c38f6966ef3f 100644\n--- a/sympy/stats/crv.py\n+++ b/sympy/stats/crv.py\n@@ -21,7 +21,7 @@\n from sympy... | [
{
"diff_hunk": "@@ -66,7 +66,6 @@ def test_literal_probability():\n assert Covariance(X, X**2).doit() == Covariance(X, X**2)\n assert Covariance(X, sin(X)).doit() == Covariance(sin(X), X)\n assert Covariance(X**2, sin(X)*Y).doit() == Covariance(sin(X)*Y, X**2)\n- assert Covariance(w, X).evaluate_... | aae8109eec5d00097e87b36edb6429829dd891aa | diff --git a/sympy/stats/crv.py b/sympy/stats/crv.py
index 61a8fb7a1935..c38f6966ef3f 100644
--- a/sympy/stats/crv.py
+++ b/sympy/stats/crv.py
@@ -21,7 +21,7 @@
from sympy.solvers.inequalities import reduce_rational_inequalities
from sympy.core.sympify import _sympify
from sympy.external import import_module
-from s... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "New Feature Additions"
} |
sympy__sympy-18927@c18ff69 | sympy/sympy | Python | 18,927 | expand log terms using factor. | #### References to other Issues or PRs
Fixes #18674, #18865
#### Brief description of what is fixed or changed
expand log term into its prime factors if factor flag is True
example:
`x = log(12)/log(2)`
`expand(x, factor=True) = log(3)/log(2) + 2
`
### Release Notes
<!-- BEGIN RELEASE NOTES -->
* funct... | 2020-03-22T09:41:20Z | rewrite log(12)/log(2) as 2 + log(3)/log(2)
I am not sure how to rewrite the quotient of logs to remove powers of the denominator's factors. I thought it could be recognized in `logcombine` but that function already does this
```python
>>> logcombine(log(12)/log(2))
log(12**(1/log(2)))
```
So maybe this is somethi... | I think logcombine is too aggressive with the power rule. I've noticed in other places that it can mess up other potential simplifications. Perhaps a good start here would be to have flags in logcombine() to selectively disable the two types of combination rules it does. But more generally, it should try to do power co... | [
{
"body": "I am not sure how to rewrite the quotient of logs to remove powers of the denominator's factors. I thought it could be recognized in `logcombine` but that function already does this\r\n```python\r\n>>> logcombine(log(12)/log(2))\r\nlog(12**(1/log(2)))\r\n```\r\nSo maybe this is something that should ... | c770bc7ede4c22962bacce96bb2388e5df1c47b7 | {
"head_commit": "c18ff69aeb32cd3744a6152434ee45b48f0e8485",
"head_commit_message": "update expand_log to expand when factor is false.",
"patch_to_review": "diff --git a/sympy/core/function.py b/sympy/core/function.py\nindex 95301137d113..11e7ad07dc85 100644\n--- a/sympy/core/function.py\n+++ b/sympy/core/functio... | [
{
"diff_hunk": "@@ -754,17 +754,28 @@ def taylor_term(n, x, *previous_terms): # of log(1+x)\n return (1 - 2*(n % 2)) * x**(n + 1)/(n + 1)\n \n def _eval_expand_log(self, deep=True, **hints):\n- from sympy import unpolarify, expand_log\n+ from sympy import unpolarify, expand_log, facto... | 97f540708a1d4a997bea946965e18f4c88e3747e | diff --git a/sympy/core/function.py b/sympy/core/function.py
index 95301137d113..482cfe10dedf 100644
--- a/sympy/core/function.py
+++ b/sympy/core/function.py
@@ -2820,7 +2820,7 @@ def expand_multinomial(expr, deep=True):
power_base=False, basic=False, multinomial=True, log=False)
-def expand_log(expr, deep=Tr... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "Code Refactoring / Architectural Improvement"
} |
sympy__sympy-18896@b650dae | sympy/sympy | Python | 18,896 | Remove reference to Python2 in round | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2020-03-18T04:43:18Z | remove Py2 code from `round` when dropping Python 2 support
The Notes section and two places in Expr.round (with inlines about Py2) need to be changed when Python 2 support is dropped. In the first case, all the rounding semantics can be handled by builtin `round` instead of the Expr.round code that follows in the if-b... | [
{
"body": "The Notes section and two places in Expr.round (with inlines about Py2) need to be changed when Python 2 support is dropped. In the first case, all the rounding semantics can be handled by builtin `round` instead of the Expr.round code that follows in the if-block; in the second, the handling can be ... | 126485017c60e249c21dd68c46f70ea7b0584e1e | {
"head_commit": "b650dae3d337a0a1c859c25cc1c6b94f050467ed",
"head_commit_message": "Remove reference to Python2 in round",
"patch_to_review": "diff --git a/sympy/core/expr.py b/sympy/core/expr.py\nindex bd3cf4e36cbb..e3a71c74ac96 100644\n--- a/sympy/core/expr.py\n+++ b/sympy/core/expr.py\n@@ -3641,17 +3641,8 @@ ... | [
{
"diff_hunk": "@@ -3641,17 +3641,8 @@ def round(self, n=None):\n Notes\n =====\n \n- The Python builtin function, round, always returns a\n- float in Python 2 while the SymPy round method (and\n- round with a Number argument in Python 3) returns a\n- Number.\n-\n- ... | 2f3cac8d7b9a9688cf8e5ae8b40d6900f7ddbb52 | diff --git a/sympy/core/expr.py b/sympy/core/expr.py
index bd3cf4e36cbb..a41a68c4dcea 100644
--- a/sympy/core/expr.py
+++ b/sympy/core/expr.py
@@ -3641,17 +3641,8 @@ def round(self, n=None):
Notes
=====
- The Python builtin function, round, always returns a
- float in Python 2 while th... | {
"difficulty": "low",
"estimated_review_effort": 1,
"problem_domain": "Code Refactoring / Architectural Improvement"
} | |
sympy__sympy-18802@cf7e36a | sympy/sympy | Python | 18,802 | Update solvers to handle binomial. | #### References to other Issues or PRs
Fixes #10993
#### Brief description of what is fixed or changed
Added conditions to expand binomial in solvers
Update expand function for binomial
#### Other comments
Please suggest changes.
### Release Notes
<!-- BEGIN RELEASE NOTES -->
* solvers
- Fix solvers ... | 2020-03-08T12:24:51Z | Solving equations with binomial coefficients should expand them first
When trying to solve an equation with a binomial coefficient with a symbol, the solver fails:
``` python
>>> solve(Eq(binomial(x, 3), 1000))
```
``` pytb
Traceback (most recent call last):
File "<ipython-input-7-e56e9952e4b8>", line 1, in <module... | I think it is expected because input for `solve` is :
- a single Expr or Poly that must be zero,
- an Equality
- a Relational expression or boolean
- iterable of one or more of the above
and `binomial` is a function.
But `binomial` is nothing more than a polynomial, in fact. Shouldn't... | [
{
"body": "When trying to solve an equation with a binomial coefficient with a symbol, the solver fails:\n\n``` python\n>>> solve(Eq(binomial(x, 3), 1000))\n```\n\n``` pytb\nTraceback (most recent call last):\n File \"<ipython-input-7-e56e9952e4b8>\", line 1, in <module>\n solve(Eq(binomial(x, 3), 1000))\n ... | f469375c923d8dc50c6632b21f39b7da3d252548 | {
"head_commit": "cf7e36a14ace26cb03d6fcffec752e18fb338c57",
"head_commit_message": "Add test.",
"patch_to_review": "diff --git a/sympy/solvers/solvers.py b/sympy/solvers/solvers.py\nindex 54023e468260..bf4e42c3ac87 100644\n--- a/sympy/solvers/solvers.py\n+++ b/sympy/solvers/solvers.py\n@@ -14,7 +14,7 @@\n \n fro... | [
{
"diff_hunk": "@@ -1027,6 +1027,11 @@ def _sympified_list(w):\n bare_f = False\n f[i: i + 1] = [fr, fi]\n \n+ #expand binomial terms\n+ for i, fi in enumerate(f):\n+ if fi.has(binomial):\n+ f[i] = fi.replace(lambda exp: binomial, lambda exp: expand_fu... | bdb47f3d5ce4dd3aa472dcc8912f2a8402aa48de | diff --git a/sympy/functions/combinatorial/factorials.py b/sympy/functions/combinatorial/factorials.py
index 7f58a2863cc0..60381774b6e4 100644
--- a/sympy/functions/combinatorial/factorials.py
+++ b/sympy/functions/combinatorial/factorials.py
@@ -1012,7 +1012,7 @@ def _eval_expand_func(self, **hints):
retu... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-18765@528d346 | sympy/sympy | Python | 18,765 | Add 'evaluate' option to MatAdd and MatMul | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more i... | 2020-03-03T08:49:21Z | Introduce 'evaluate' keyword argument in MatAdd and MatMul
``MatAdd`` and ``MatMul`` are behaving differently from ``Add`` and ``Mul``.
Here is an example:
```python
>>> from sympy import Add, MatAdd, Symbol, MatrixSymbol
>>> x = Symbol('x')
>>> Add(x, x, evaluate=True)
2*x
>>> Add(x, x, evaluate=False)
x + x... | I had seen https://github.com/sympy/sympy/issues/16484#issuecomment-477878619 that things were not originally designed to use any automatic evaluation.
But I think that things can look different at this moment, and I also didn't like the inconsistency there before. But this may need some agreements because this is mor... | [
{
"body": "``MatAdd`` and ``MatMul`` are behaving differently from ``Add`` and ``Mul``.\r\n\r\nHere is an example:\r\n```python\r\n>>> from sympy import Add, MatAdd, Symbol, MatrixSymbol\r\n>>> x = Symbol('x')\r\n>>> Add(x, x, evaluate=True)\r\n2*x\r\n>>> Add(x, x, evaluate=False)\r\nx + x\r\n\r\n>> A = MatrixS... | 8501526ca26a80ac1b7866a4c1678fcf0045e971 | {
"head_commit": "528d3461b8bf15d77be9b8de1c48796e6b0aba40",
"head_commit_message": "Improve code quality",
"patch_to_review": "diff --git a/sympy/core/parameters.py b/sympy/core/parameters.py\nindex 3c5ad8d6be5f..4db5fe371417 100644\n--- a/sympy/core/parameters.py\n+++ b/sympy/core/parameters.py\n@@ -65,7 +65,11... | [
{
"diff_hunk": "@@ -65,7 +65,11 @@ def __setattr__(self, name, value):\n clear_cache()\n return super(_global_parameters, self).__setattr__(name, value)\n \n-global_parameters = _global_parameters(evaluate=True, distribute=True)\n+global_parameters = _global_parameters(\\\n+ evaluate=True... | f9b08dffd2098e7eda96a86283e65f35f86d1a46 | diff --git a/sympy/matrices/expressions/hadamard.py b/sympy/matrices/expressions/hadamard.py
index 06ab396a498d..c152ece87736 100644
--- a/sympy/matrices/expressions/hadamard.py
+++ b/sympy/matrices/expressions/hadamard.py
@@ -60,13 +60,16 @@ class HadamardProduct(MatrixExpr):
"""
is_HadamardProduct = True
... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "New Feature Additions"
} |
sympy__sympy-19107@7150674 | sympy/sympy | Python | 19,107 | 18778 fuzzy comparisons | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
#### References to other Issues or PRs
Fixes #18778
#### Brief description of what is fixed or changed
Add to relational a function called cmp(lhs, rhs, op). Where op can be one of
In ... | 2020-04-11T20:55:17Z | Add fuzzy logic comparison functions
There are many bugs in sympy that come from using inequalities in a bool context e.g.:
```julia
In [5]: def f(x):
...: if x < 0:
...: return 'negative'
...: else:
...: return 'nonnegative'
...: ... | > works but creates a new expression needlessly
Wouldn't that happen internally anyway?
I only have concerns that this can make things like `is_eq` big because it can accept any expressions.
So managing such things would be an another concern.
I was also undecided about how things like `x > 2` should be handled ... | [
{
"body": "There are many bugs in sympy that come from using inequalities in a bool context e.g.:\r\n```julia\r\nIn [5]: def f(x): \r\n ...: if x < 0: \r\n ...: return 'negative' \r\n ...: else: \r\n ...: return 'nonnegative' \r\n ...: ... | f46f4488c7cb7aff9666e26ce1bfb980f98e97a7 | {
"head_commit": "715067463fffbbe855ae35fd305c8f02f2671ef0",
"head_commit_message": "feat(core): Add fuzzy comparison functions\n\nRemove unneeded imports and blank lines",
"patch_to_review": "diff --git a/sympy/calculus/util.py b/sympy/calculus/util.py\nindex 50a9be1c8282..71ecb0050754 100644\n--- a/sympy/calcul... | [
{
"diff_hunk": "@@ -141,25 +141,27 @@ def index(self, value, start=None, stop=None):\n else:\n return self.args.index(value, start, stop)\n \n- def _eval_Eq(self, other):\n- from sympy.core.function import AppliedUndef\n- from sympy.core.logic import fuzzy_and, fuzzy_bool\n-... | b42109d76a8a2864be37602614f72119d35dff4e | diff --git a/sympy/calculus/util.py b/sympy/calculus/util.py
index 09ee391ae71e..006dfafdd873 100644
--- a/sympy/calculus/util.py
+++ b/sympy/calculus/util.py
@@ -5,6 +5,7 @@
from sympy.core.expr import AtomicExpr, Expr
from sympy.core.function import expand_mul
from sympy.core.numbers import _sympifyit, oo
+from sy... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "New Feature Additions"
} |
sympy__sympy-18717@ef8c567 | sympy/sympy | Python | 18,717 | Add class DiophantineEquationType and move classification logic | #### References to other Issues or PRs
#18493
Closes #18370.
#### Brief description of what is fixed or changed
Introduce new class `DiophantineEquationType`. The class has various attributes for properties of the equation such as `homogeneous` and `total_degree`.
Move classification logic out of `classify_d... | 2020-02-24T18:27:41Z | Confusing test cases in test_classify_diop
We have these two test cases:
```
assert classify_diop(x*y + z) == (
[x, y, z], {x*y: 1, z: 1}, 'inhomogeneous_ternary_quadratic')
assert classify_diop(x*y + z + w + x**2) == (
[w, x, y, z], {x*y: 1, w: 1, x**2: 1, z: 1}, 'inhomogeneous_general_quadratic... | ~~Unfortunately it would not be the first time that dubious test results made their way into the test suite...~~
~~I'd say the tests you cited are bugs in `classify_diop`. (Or at least badly chosen default names for some classes of equations that diophantine is not currently capable of solving.) IMO it should be fix... | [
{
"body": "We have these two test cases:\r\n\r\n```\r\nassert classify_diop(x*y + z) == (\r\n [x, y, z], {x*y: 1, z: 1}, 'inhomogeneous_ternary_quadratic')\r\nassert classify_diop(x*y + z + w + x**2) == (\r\n [w, x, y, z], {x*y: 1, w: 1, x**2: 1, z: 1}, 'inhomogeneous_general_quadratic')\r\n```\r\... | 31e815f084dc22977c6a2222aa8d4f45bda17188 | {
"head_commit": "ef8c5672e1cded9d96cb1ae946398ca23063be1f",
"head_commit_message": "introduce DiophantineEquationType; simplify classify_diop; update diop_known",
"patch_to_review": "diff --git a/sympy/solvers/diophantine/diophantine.py b/sympy/solvers/diophantine/diophantine.py\nindex be94c6fcd30d..efa1dfa32740... | [
{
"diff_hunk": "@@ -152,6 +136,223 @@ def __call__(self, *args):\n return self.subs(zip(self.parameters, args))\n \n \n+class DiophantineEquationType:\n+ \"\"\"\n+ Internal representation of a particular diophantine equation type.\n+\n+ Parameters\n+ ==========\n+\n+ equation\n+ Th... | 3bb4dab755ba5c1b0340315b0a232b95cf81da60 | diff --git a/sympy/solvers/diophantine/diophantine.py b/sympy/solvers/diophantine/diophantine.py
index be94c6fcd30d..293f52629055 100644
--- a/sympy/solvers/diophantine/diophantine.py
+++ b/sympy/solvers/diophantine/diophantine.py
@@ -36,22 +36,6 @@
__all__ = ['diophantine', 'classify_diop']
-# these types are kno... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "Documentation Updates"
} |
sympy__sympy-18698@70b501b | sympy/sympy | Python | 18,698 | Fixes sqf_list to combine same multiplicity factors | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
Fixes sqf_list to combine same multiplicity factors
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234... | 2020-02-21T05:46:56Z | sqf and sqf_list output is not consistant
The example below is wrong in the sense that we should have (x*_2 - 5_x + 6, 3) and not 2 factors of multiplicity 3.
```
> sqf_list( (x**2 + 1) * (x - 1)**2 * (x - 2)**3 * (x - 3)**3 )
> (1, [(x**2 + 1, 1), (x - 1, 2), (x - 3, 3), (x - 2, 3)])
```
whereas below is corre... | I guess correct can be either the first or the second. But we should stick to it.
This [SO post](https://stackoverflow.com/questions/57536689/sympys-sqf-and-sqf-list-give-different-results-once-i-use-poly-or-as-pol) highlights another problem, too:
```python
>>> v = (x1 + 2) ** 2 * (x2 + 4) ** 5
>>> sqf(v)
(x1 +... | [
{
"body": "The example below is wrong in the sense that we should have (x*_2 - 5_x + 6, 3) and not 2 factors of multiplicity 3.\n\n```\n> sqf_list( (x**2 + 1) * (x - 1)**2 * (x - 2)**3 * (x - 3)**3 )\n\n> (1, [(x**2 + 1, 1), (x - 1, 2), (x - 3, 3), (x - 2, 3)])\n```\n\nwhereas below is correct --- one fact... | 3dff1b98a78f28c953ae2140b69356b8391e399c | {
"head_commit": "70b501ba7dcfd5b2ae39b4957cb6023d67446fb3",
"head_commit_message": "corrected docs",
"patch_to_review": "diff --git a/doc/src/modules/polys/basics.rst b/doc/src/modules/polys/basics.rst\nindex 5b5a4e1635e8..6df5105390d8 100644\n--- a/doc/src/modules/polys/basics.rst\n+++ b/doc/src/modules/polys/b... | [
{
"diff_hunk": "@@ -5949,6 +5947,9 @@ def _symbolic_factor_list(expr, opt, method):\n other.append((f, k))\n \n factors.append((_factors_product(other), exp))\n+ if method == 'sqf':\n+ factors = [(reduce(mul, (f for f, _ in factors if _ == k)), k)\n+ ... | 7dc6fd979304b76428243082672266ed096688d2 | diff --git a/doc/src/modules/polys/basics.rst b/doc/src/modules/polys/basics.rst
index 5b5a4e1635e8..6df5105390d8 100644
--- a/doc/src/modules/polys/basics.rst
+++ b/doc/src/modules/polys/basics.rst
@@ -536,11 +536,13 @@ factors (not necessarily irreducible) of degree 1, 2 etc.::
>>> f = 2*x**2 + 5*x**3 + 4*x**4 +... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-18688@2ee4194 | sympy/sympy | Python | 18,688 | ntheory: divisor_sigma symbolic case recognition | Fixes: #16123
#### Brief description of what is fixed or changed
**Previously**, the only case which was recognized symbolically by divisor_sigma() function was: `divisor_sigma(a) -> a + 1.`
**Now**, it also recognizes:
`divisor_sigma(a**j*b**k)` where` a and b are prime` and` j and k are positive integers`
`d... | 2020-02-19T22:11:19Z | symbolic divisor_sigma
`divisor_sigma(a**k*b**j, 1)` where `a` and `b` are prime and `k` and `j` are positive integers is `(a**(k+1)-1)/(a-1)*(b**(j + 1) -1)/(b - 1)`. Right now, the only case that is recognized symbolically is `divisor_sigma(a) -> a + 1`.
```python
def eval(cls, n):
...
if n.is_integer:
... | I'm taking this.
@smichr can you please crosscheck the result of above substitution will be `1944` and for the current master I'm able to evaluate it.
sorry, I misunderstood the purpose of divisor_sigma(). I will do the required changes.
```
>>> divisors(1944)
[1, 2, 3, 4, 6, 8, 9, 12, 18, 24, 27, 36, 54, 72, 81, ... | [
{
"body": "`divisor_sigma(a**k*b**j, 1)` where `a` and `b` are prime and `k` and `j` are positive integers is `(a**(k+1)-1)/(a-1)*(b**(j + 1) -1)/(b - 1)`. Right now, the only case that is recognized symbolically is `divisor_sigma(a) -> a + 1`.\r\n```python\r\ndef eval(cls, n):\r\n ...\r\n if n.is_integer... | a7606272bb8a9c8d05448b7d30505822db6af20e | {
"head_commit": "2ee4194713db00e044ebe084b3e0fbca6383bb68",
"head_commit_message": "Made the function recognise any value of k",
"patch_to_review": "diff --git a/sympy/ntheory/factor_.py b/sympy/ntheory/factor_.py\nindex 504c1e1ae674..b1811013d6e1 100644\n--- a/sympy/ntheory/factor_.py\n+++ b/sympy/ntheory/facto... | [
{
"diff_hunk": "@@ -2039,8 +2039,20 @@ class divisor_sigma(Function):\n def eval(cls, n, k=1):\n n = sympify(n)\n k = sympify(k)\n+\n if n.is_prime:\n return 1 + n**k\n+\n+ if n.is_integer and not n.is_Integer:\n+ p = []\n+ for b, e in (_.as_b... | 24ae6a224adefcd73bce9c051c5bbacfbd4196b5 | diff --git a/sympy/ntheory/factor_.py b/sympy/ntheory/factor_.py
index 504c1e1ae674..be2d654f592d 100644
--- a/sympy/ntheory/factor_.py
+++ b/sympy/ntheory/factor_.py
@@ -2039,8 +2039,10 @@ class divisor_sigma(Function):
def eval(cls, n, k=1):
n = sympify(n)
k = sympify(k)
+
if n.is_prim... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Code Refactoring / Architectural Improvement"
} |
sympy__sympy-18651@b31b94b | sympy/sympy | Python | 18,651 | Fix for numpy arrays when the size 1 arrays were treated as scalars | #### References to other Issues or PRs
Revives and closes #14720
Fixes #14706
#### Brief description of what is fixed or changed
--> Added a bug fix in sympify whereby the numpy arrays of size 1 won't be treated as scalars
#### Other comments
Example:
```
>>> from sympy import *
>>> from sympy.abc imp... | 2020-02-13T18:56:45Z | Symbol violates the commutativity of addition when it sometimes converts one-element arrays to scalar
```
from sympy import symbols
import numpy as np
for i in [2, 1]:
z = np.zeros(i)
xz = symbols('x') + z
print(z.shape)
print(xz.shape)
print()
```
prints:
```
(2,)
(2,)
(1,)
-----... | Basic SymPy objects don't carry a shape attribute, `ImmutableDenseNDimArray` does however, have you had a look at: http://docs.sympy.org/latest/modules/tensor/array.html#module-sympy.tensor.array ?
Thanks for taking a look! Unfortunately, I don't think `Array` helps me.
I have a function, say `f`, that transforms n... | [
{
"body": "```\r\nfrom sympy import symbols\r\nimport numpy as np\r\n\r\nfor i in [2, 1]:\r\n z = np.zeros(i)\r\n xz = symbols('x') + z\r\n print(z.shape)\r\n print(xz.shape)\r\n print()\r\n```\r\nprints:\r\n```\r\n(2,)\r\n(2,)\r\n\r\n(1,)\r\n------------------------------------------------------... | fcefd30cfbc6c929fb50b99403a5764ca019a603 | {
"head_commit": "b31b94bcb81ec36fbd6897bd90dd9f1c51816c15",
"head_commit_message": "core: More test cases for sympify\n\nParticularly related to the new changes, new tests were added to\nincrease the coverage.",
"patch_to_review": "diff --git a/sympy/core/numbers.py b/sympy/core/numbers.py\nindex 8ff2149dcf03..6... | [
{
"diff_hunk": "@@ -695,3 +696,39 @@ def test_issue_16759():\n def test_issue_17811():\n a = Function('a')\n assert sympify('a(x)*5', evaluate=False) == Mul(a(x), 5, evaluate=False)\n+\n+\n+def test_issue_14706():\n+ if not numpy:\n+ skip(\"numpy not installed.\")\n+\n+ from sympy import sy... | 6a03bc304d7ab3990a3d6f43b9ca173a39c14eb9 | diff --git a/sympy/core/numbers.py b/sympy/core/numbers.py
index 8ff2149dcf03..6933aae2b7d7 100644
--- a/sympy/core/numbers.py
+++ b/sympy/core/numbers.py
@@ -7,7 +7,8 @@
import re as regex
from .containers import Tuple
-from .sympify import converter, sympify, _sympify, SympifyError, _convert_numpy_types
+from .sy... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
sympy__sympy-18614@76fc537 | sympy/sympy | Python | 18,614 | Fixed DiscreteUniform to produce correct density and cdf | <!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->
Fixed DiscreteUniform to produce correct density and cdf
#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes ... | 2020-02-09T16:20:45Z | Incorrect density, cdf calculation in DiscreteUniform
```
>>> from sympy.stats import density, DiscreteUniform, cdf
>>> X = DiscreteUniform('X', [1, 1, 1, 2, 2])
>>> dict(density(X).items())
{1: 1/5, 2: 1/5}
>>> cdf(X)
{1: 1/5, 2: 2/5}
```
Issue is:
Considering that the arguments in the `DiscreteUniformDistrib... | [
{
"body": "```\r\n>>> from sympy.stats import density, DiscreteUniform, cdf\r\n>>> X = DiscreteUniform('X', [1, 1, 1, 2, 2])\r\n>>> dict(density(X).items())\r\n{1: 1/5, 2: 1/5}\r\n>>> cdf(X)\r\n{1: 1/5, 2: 2/5}\r\n```\r\nIssue is:\r\nConsidering that the arguments in the `DiscreteUniformDistribution`, it should... | 928864c6cd1bcc339af60c2170a3821e77ca6fef | {
"head_commit": "76fc53728884908731ed40a30891d58c33a1155b",
"head_commit_message": "corrected to set of args",
"patch_to_review": "diff --git a/sympy/stats/frv_types.py b/sympy/stats/frv_types.py\nindex d5b35606dc67..4dcdeee4773e 100644\n--- a/sympy/stats/frv_types.py\n+++ b/sympy/stats/frv_types.py\n@@ -92,7 +9... | [
{
"diff_hunk": "@@ -104,7 +104,7 @@ def set(self):\n return set(self.args)\n \n def pmf(self, x):\n- if x in self.args:\n+ if x in set(self.args):",
"line": null,
"original_line": 107,
"original_start_line": null,
"path": "sympy/stats/frv_types.py",
"start_line": nu... | 62bd4c1a9df0c2ae5135df62dcdb1826d92d6c4f | diff --git a/sympy/stats/frv_types.py b/sympy/stats/frv_types.py
index d5b35606dc67..b4c23833339b 100644
--- a/sympy/stats/frv_types.py
+++ b/sympy/stats/frv_types.py
@@ -90,6 +90,24 @@ def FiniteRV(name, density):
return rv(name, FiniteDistributionHandmade, density)
class DiscreteUniformDistribution(SingleFini... | {
"difficulty": "low",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
Subsets and Splits
Review Test Instances
Retrieves basic metadata about code review instances but doesn't provide any analytical insights or patterns beyond raw data access.