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-18630@9ca7e3a
sympy/sympy
Python
18,630
Implemented _eval_nseries() for Hyper
<!-- 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-02-10T20:55:10Z
AttributeError: integrate(1 / (1 + x**4)**(S(1)/4), [x, 0, oo]) ``` >>> from sympy import * >>> x = Symbol('x') >>> integrate(1 / (1 + x**4)**(S(1)/4), [x, 0, oo]) Traceback (most recent call last): File "test.py", line 40, in <module> print(integrate(1 / (1 + x**4)**(S(1)/4), [x, 0, oo])) File "/home/ew...
It seems that `hyper` (and other special functions) should have a private `_eval_nseries` method implemented. I would like to work on this. Could someone please guide where should i start. I would start by studying the existing implementations. Those can be found by running `git grep 'def _eval_nseries'`. Why are the f...
[ { "body": "```\r\n>>> from sympy import *\r\n>>> x = Symbol('x')\r\n>>> integrate(1 / (1 + x**4)**(S(1)/4), [x, 0, oo])\r\nTraceback (most recent call last):\r\n File \"test.py\", line 40, in <module>\r\n print(integrate(1 / (1 + x**4)**(S(1)/4), [x, 0, oo]))\r\n File \"/home/eward/se/sympy/integrals/integ...
44664d9f625a1c68bc492006cfe1012cb0b49ee4
{ "head_commit": "9ca7e3a08569ff3d574d3a8aceeb9f9523c0d4aa", "head_commit_message": "Implemented _eval_nseries() for Hyper\n\nIn reference to Issue #18193 the function was implemented. Example of\nthe working code is as follows:\n\nIn [1]: from sympy import hyper\n\nIn [2]: from sympy.abc import x, y\n\nIn [3]: hyp...
[ { "diff_hunk": "@@ -220,6 +220,33 @@ def _eval_rewrite_as_Sum(self, ap, bq, z, **kwargs):\n return Piecewise((Sum(coeff * z**n / factorial(n), (n, 0, oo)),\n self.convergence_statement), (self, True))\n \n+ def _eval_nseries(self, x, n, logx):\n+\n+ from sympy.function...
49528a69b52887d86b49fde442de2e1b1f074649
diff --git a/sympy/functions/special/hyper.py b/sympy/functions/special/hyper.py index ffda6bac2b0a..1923476dc3df 100644 --- a/sympy/functions/special/hyper.py +++ b/sympy/functions/special/hyper.py @@ -220,6 +220,34 @@ def _eval_rewrite_as_Sum(self, ap, bq, z, **kwargs): return Piecewise((Sum(coeff * z**n / f...
{ "difficulty": "high", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-18605@a356458
sympy/sympy
Python
18,605
Fixes Idx object to accept non-integer bound
<!-- Your title above should be a short description of what was changed. Do not include the issue number in the title. --> Fixes Idx object to accept non-integer bound #### 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 ...
2020-02-08T18:04:45Z
Idx object can accepts non-integer bounds It is my understanding that this code should not work: the lower and upper bounds should be integers. Instead it runs without any errors: ``` import sympy as sp m, n = sp.symbols("m, n", real=True) i = sp.Idx("i", (m, n)) ``` Note however that: ``` sp.Idx("i", m) ...
I think it should be okay to use something that is possibly an integer like a plain `Symbol('n')`. So this is correct: ```julia In [4]: x = Symbol('x', integer=False) In [5]: Idx('i', (x, y)) ...
[ { "body": "It is my understanding that this code should not work: the lower and upper bounds should be integers. Instead it runs without any errors:\r\n\r\n```\r\nimport sympy as sp\r\nm, n = sp.symbols(\"m, n\", real=True)\r\ni = sp.Idx(\"i\", (m, n))\r\n```\r\n\r\nNote however that:\r\n\r\n```\r\nsp.Idx(\"i\"...
c0a02c3c928dbbc42c008ed460bb662fc602f9d4
{ "head_commit": "a35645804aa33eb8d3d9c9d0470991cc9616377b", "head_commit_message": "fix issue 18604", "patch_to_review": "diff --git a/sympy/tensor/indexed.py b/sympy/tensor/indexed.py\nindex cde31f71f8c4..8abd3946f3a1 100644\n--- a/sympy/tensor/indexed.py\n+++ b/sympy/tensor/indexed.py\n@@ -111,7 +111,7 @@\n fr...
[ { "diff_hunk": "@@ -663,7 +663,7 @@ def __new__(cls, label, range=None, **kw_args):\n raise TypeError(\"Idx object requires integer bounds.\")\n args = label, Tuple(*range)\n elif isinstance(range, Expr):\n- if not (range.is_integer or range is S.Infinity):\n+ ...
f78af662c960b5bd42b0b01fc1ddb9071cdceadb
diff --git a/sympy/tensor/indexed.py b/sympy/tensor/indexed.py index cde31f71f8c4..a4fde4cb72ea 100644 --- a/sympy/tensor/indexed.py +++ b/sympy/tensor/indexed.py @@ -111,7 +111,7 @@ from sympy.core.symbol import _filter_assumptions, Symbol from sympy.core.compatibility import (is_sequence, NotIterable, ...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-18535@25bf6a1
sympy/sympy
Python
18,535
Fixes polynomial solve with GoldenRatio and TribonacciConstant
<!-- Your title above should be a short description of what was changed. Do not include the issue number in the title. --> Fixes polynomial solve with GoldenRatio and TribonacciConstant #### References to other Issues or PRs <!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact format, e.g. "...
2020-02-02T05:40:40Z
Polynomial solve with GoldenRatio causes Traceback Found during issue 11538 investigation. The GoldenRatio::NumberSymbol is the only NumberSymbol currently treated as an algebraic expression. However when solve is called on the GoldenRatio a Traceback occurs where GoldenRatio is not being treated algebraically. ``` P...
It seems that `GoldenRatio` should be treated in the same way as `I` in `_minpoly_compse`. So, the following should be added: ``` if ex is GoldenRatio: return x**2 - x - 1 ``` I think in general it shouldn't assume that `is_algebraic` means that it can find its minimal polynomial. It should check more dir...
[ { "body": "Found during issue 11538 investigation. The GoldenRatio::NumberSymbol is the only NumberSymbol currently treated as an algebraic expression. However when solve is called on the GoldenRatio a Traceback occurs where GoldenRatio is not being treated algebraically. \n\n```\nPython 2.7.12 (v2.7.12:d33e0cf...
2ee06f3b3359ef3986878825e403c806b2b0c6ef
{ "head_commit": "25bf6a1d39e67e9d723929a1ab12df8dfbe564ff", "head_commit_message": "added goldenratio check", "patch_to_review": "diff --git a/sympy/polys/numberfields.py b/sympy/polys/numberfields.py\nindex ff501a91e026..b0d7132f6be5 100644\n--- a/sympy/polys/numberfields.py\n+++ b/sympy/polys/numberfields.py\n...
[ { "diff_hunk": "@@ -517,6 +517,8 @@ def _minpoly_compose(ex, x, dom):\n if ex is I:\n _, factors = factor_list(x**2 + 1, x, domain=dom)\n return x**2 + 1 if len(factors) == 1 else x - I\n+ if ex is GoldenRatio:\n+ return x**2 - x - 1", "line": null, "original_line": 521, ...
5ec5d415377e57c3acbea4ff1edcad9a9168cfdf
diff --git a/sympy/polys/numberfields.py b/sympy/polys/numberfields.py index ff501a91e026..d10f04eb1e56 100644 --- a/sympy/polys/numberfields.py +++ b/sympy/polys/numberfields.py @@ -3,9 +3,10 @@ from __future__ import print_function, division from sympy import ( - S, Rational, AlgebraicNumber, + S, Rational,...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-18591@5505065
sympy/sympy
Python
18,591
improving is_perfect and is_mersenne_prime methods
<!-- 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-02-06T18:10:37Z
shortcut for is_perfect Since "Every even perfect number ends in 6 or 28 base 10" that would be a good first check for the newly added `is_perfect` function in ntheory: ```python last2 = n%100 if last2 != 28 and last2%10 != 6: return False ```
I will take this @Mohitbalwani26 , @jhanwar has already submitted a PR for this issue. If you are new, I suggest you to look issues under _Easy to Fix_ label.
[ { "body": "Since \"Every even perfect number ends in 6 or 28 base 10\" that would be a good first check for the newly added `is_perfect` function in ntheory: \r\n```python\r\nlast2 = n%100\r\nif last2 != 28 and last2%10 != 6:\r\n return False\r\n```", "number": 16144, "title": "shortcut for is_perfec...
afbffa714654e4c8e8e853b7689d324e7146e40f
{ "head_commit": "5505065e2cc83cdf743f021d035ae79323db8047", "head_commit_message": "fixes errors", "patch_to_review": "diff --git a/sympy/ntheory/factor_.py b/sympy/ntheory/factor_.py\nindex 9083b52e0113..ab7d8e99de56 100644\n--- a/sympy/ntheory/factor_.py\n+++ b/sympy/ntheory/factor_.py\n@@ -19,6 +19,7 @@\n fro...
[ { "diff_hunk": "@@ -2222,30 +2234,90 @@ def is_perfect(n):\n Examples\n ========\n \n- >>> from sympy.ntheory.factor_ import is_perfect, divisors\n+ >>> from sympy.ntheory.factor_ import is_perfect, divisors, divisor_sigma\n >>> is_perfect(20)\n False\n >>> is_perfect(6)\n True\n- ...
747b894ff735a9bd442e7fe033d5e81a60ce4f52
diff --git a/sympy/ntheory/factor_.py b/sympy/ntheory/factor_.py index 9083b52e0113..c78a1fe84d4c 100644 --- a/sympy/ntheory/factor_.py +++ b/sympy/ntheory/factor_.py @@ -13,12 +13,13 @@ from sympy.core.expr import Expr from sympy.core.function import Function from sympy.core.logic import fuzzy_and -from sympy.core....
{ "difficulty": "high", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
sympy__sympy-18472@32a4a32
sympy/sympy
Python
18,472
Handling Integrals containing I
<!-- Your title above should be a short description of what was changed. Do not include the issue number in the title. --> Handling Integrals containing I #### 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://tiny...
2020-01-26T16:27:33Z
integrate throws error for rational functions involving I Relatively simple integrals such as ```python x = symbols('x') f = diff(1/(x**2+x+I),x) integrate(f,x) ``` fail with the error ``` sympy.polys.polyerrors.PolynomialDivisionFailed: couldn't reduce degree in a polynomial division algorithm when dividing [E...
The presence of `I` makes the expression domain `EX` the coefficient domain of the denominator polynomial. This is problematic because `EX` has no reliable zero detection algorithm. The relevant polynomial division actually works correctly but the (unsimplified) coefficient expressions that are expected to be zero are ...
[ { "body": "Relatively simple integrals such as\r\n```python\r\nx = symbols('x')\r\nf = diff(1/(x**2+x+I),x)\r\nintegrate(f,x)\r\n```\r\nfail with the error\r\n```\r\nsympy.polys.polyerrors.PolynomialDivisionFailed: couldn't reduce degree in a polynomial division algorithm when dividing [EX(-2), EX(-1)] by [EX(-...
10126b7d2484f81836c9f23ef947705c1926b07b
{ "head_commit": "32a4a327478f17e6f432f35c17a34585591f8d33", "head_commit_message": "issue 17841", "patch_to_review": "diff --git a/sympy/integrals/tests/test_integrals.py b/sympy/integrals/tests/test_integrals.py\nindex 0179054d6ed6..2970b2cb7d70 100644\n--- a/sympy/integrals/tests/test_integrals.py\n+++ b/sympy...
[ { "diff_hunk": "@@ -9,6 +9,9 @@\n from sympy.polys.polyutils import PicklableWithSlots\n from sympy.utilities import public\n \n+eflags = dict(mul=True, power_exp=False, power_base=False,", "line": null, "original_line": 12, "original_start_line": null, "path": "sympy/polys/domains/expressiondom...
6b982e569586da1984431dab7d72f812f979e1db
diff --git a/sympy/integrals/tests/test_integrals.py b/sympy/integrals/tests/test_integrals.py index 0179054d6ed6..2970b2cb7d70 100644 --- a/sympy/integrals/tests/test_integrals.py +++ b/sympy/integrals/tests/test_integrals.py @@ -1648,3 +1648,7 @@ def test_issue_2975(): C = Symbol('C') y = Symbol('y') a...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-18578@0173025
sympy/sympy
Python
18,578
Fixes bug in Series
<!-- 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-02-05T10:44:45Z
Series return an incorrect result The latest sympy master: ``` In [1]: f=exp(x**3)*cos(x**6) In [2]: f.series(x, 0, 14) Out[2]: 6 9 12 3 x x x ⎛ 14⎞ 1 + x + ── + ── + ─── + O⎝x ⎠ 2 6 24 In [3]: f.series(x, 0, 19) Out[3]: 6 9 1...
This appears to be caused by the way `range(nterms)` works: `nterms` itself is not included on [this line](https://github.com/sympy/sympy/blob/master/sympy/core/function.py#L646). This is taken care of in many cases by the addition of 2 to the number of terms, but after division by the order `cf` of the argument the ef...
[ { "body": "The latest sympy master:\n\n```\nIn [1]: f=exp(x**3)*cos(x**6)\n\nIn [2]: f.series(x, 0, 14)\nOut[2]: \n 6 9 12 \n 3 x x x ⎛ 14⎞\n1 + x + ── + ── + ─── + O⎝x ⎠\n 2 6 24 \n\nIn [3]: f.series(x, 0, 19)\nOut[3]: \n 6 9 12...
a8a3a3b026cc55aa14010fc7cd7909806b6e116c
{ "head_commit": "01730253a846cda00212880498420382d6aaa384", "head_commit_message": "added spaces around '='", "patch_to_review": "diff --git a/sympy/core/function.py b/sympy/core/function.py\nindex 386141961350..547235801e34 100644\n--- a/sympy/core/function.py\n+++ b/sympy/core/function.py\n@@ -716,17 +716,15 @...
[ { "diff_hunk": "@@ -716,17 +716,15 @@ def _eval_nseries(self, x, n, logx):\n return e1.nseries(x, n=n, logx=logx)\n arg = self.args[0]\n l = []\n+ i = 0\n g = None\n- # try to predict a number of terms needed\n- nterms = n + 2\n- cf = Order(arg.as_...
c1c97924b0056adee87a56604696395b878b93c3
diff --git a/sympy/core/function.py b/sympy/core/function.py index 386141961350..af1207faf180 100644 --- a/sympy/core/function.py +++ b/sympy/core/function.py @@ -721,7 +721,7 @@ def _eval_nseries(self, x, n, logx): nterms = n + 2 cf = Order(arg.as_leading_term(x), x).getn() if cf != 0: - ...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-18532@a65f815
sympy/sympy
Python
18,532
atoms() method return value updated
#### References to other Issues or PRs Fixes #10152 and aims to complete the work started in PR #10246 #### Brief description of what is fixed or changed --> Updated the atoms() method of class Basic to check if .args value of an object is empty or not to check if a sympy object is a leaf node or not. #### ...
2020-02-01T17:26:30Z
expr.atoms() should return objects with no args instead of subclasses of Atom `expr.atoms()` with no arguments returns subclasses of `Atom` in `expr`. But the correct definition of a leaf node should be that it has no `.args`. This should be easy to fix, but one needs to check that this doesn't affect the performance...
The docstring should also be updated. Hi, can i work on this? Sure. Did you read https://github.com/sympy/sympy/wiki/Introduction-to-contributing? How should I remove .args? Should I try to remove ._args from object instance or add a new attribute to class Atom(), is_leave. Which when assigned as false, will raise...
[ { "body": "`expr.atoms()` with no arguments returns subclasses of `Atom` in `expr`. But the correct definition of a leaf node should be that it has no `.args`. \n\nThis should be easy to fix, but one needs to check that this doesn't affect the performance. \n", "number": 10152, "title": "expr.atoms() sh...
74227f900b05009d4eed62e34a166228788a32ca
{ "head_commit": "a65f815db3aa9c9a0d43b91fc3dcb01f0391661e", "head_commit_message": "codegen: Added an updated to an existing test case\n\nA test case in test_cnodes.py used a test which considered\nthe old definition of .atoms() method. This test case was\nupdated accordingly.", "patch_to_review": "diff --git a/...
[ { "diff_hunk": "@@ -503,11 +503,11 @@ def atoms(self, *types):\n if types:\n types = tuple(\n [t if isinstance(t, type) else type(t) for t in types])\n- else:\n- types = (Atom,)\n result = set()\n for expr in preorder_traversal(self):\n- ...
074da7d9305b4e016268dd8138f7749af7df2776
diff --git a/sympy/codegen/tests/test_cnodes.py b/sympy/codegen/tests/test_cnodes.py index 3050fffa1a2f..d442a9f99dec 100644 --- a/sympy/codegen/tests/test_cnodes.py +++ b/sympy/codegen/tests/test_cnodes.py @@ -1,6 +1,6 @@ from sympy.core.symbol import symbols from sympy.printing.ccode import ccode -from sympy.codege...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-18583@45792ae
sympy/sympy
Python
18,583
Added a new test case for the issue #7724 in polys
<!-- Your title above should be a short description of what was changed. Do not include the issue number in the title. --> #### Added a new test case for the issue #7724 in polys <!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact format, e.g. "Fixes #1234" (see https://tinyurl.com/auto-c...
2020-02-06T07:14:41Z
roots should find the roots of x**4*I + x**2 + I ``` In [34]: roots(x**4*I + x**2 + I, x) Out[34]: {} ``` surprisingly if we replace `I` with variable coefficients we get an answer. ``` In [35]: roots(x**4*a + x**2 + b, x) Out[35]: {sqrt(2)*sqrt(-sqrt(-4*a*b + 1)/a - 1/a)/2: 1, sqrt(2)*sqrt(sqrt(-4*a*b + 1)/a - 1/a...
This works: ``` In [3]: Poly(I*x**4 - x**2 + I, x, domain='ZZ[I]') Out[3]: Poly(I*x**4 - x**2 + I, x, domain='ZZ[I]') In [4]: len(roots(_,x)) Out[4]: 4 ``` I suppose `ZZ` is for the integer domain, because this fails: ``` In [43]: roots(x**2 + I*sqrt(2), x, domain='ZZ[I]') ------------------------------------------...
[ { "body": "```\nIn [34]: roots(x**4*I + x**2 + I, x)\nOut[34]: {}\n```\n\nsurprisingly if we replace `I` with variable coefficients we get an answer.\n\n```\nIn [35]: roots(x**4*a + x**2 + b, x)\nOut[35]: \n{sqrt(2)*sqrt(-sqrt(-4*a*b + 1)/a - 1/a)/2: 1,\n sqrt(2)*sqrt(sqrt(-4*a*b + 1)/a - 1/a)/2: 1,\n -sqrt(2)*...
d7e2b239842ea2ab69ef64b8e1d692fb78a1bccd
{ "head_commit": "45792ae6c8743ad67e1a46f19cde2e4cec0aee1f", "head_commit_message": "added a new test case for the issue #7724 in test_polyroots.py", "patch_to_review": "diff --git a/sympy/polys/tests/test_polyroots.py b/sympy/polys/tests/test_polyroots.py\nindex 838dc76ef12d..0e24710dc2e5 100644\n--- a/sympy/pol...
[ { "diff_hunk": "@@ -73,6 +73,13 @@ def test_roots_quadratic():\n roots = roots_quadratic(f)\n assert roots == _nsort(roots)\n \n+\n+def test_issue_7724():\n+ eq = Poly(x**4*I + x**2 + I, x)\n+ roots_d = roots(eq)\n+ assert len(roots_d) == 4", "line": null, "original_line": 80, ...
973aba941d02b22235de15e552163568969e938f
diff --git a/sympy/polys/tests/test_polyroots.py b/sympy/polys/tests/test_polyroots.py index 838dc76ef12d..786d534afd7e 100644 --- a/sympy/polys/tests/test_polyroots.py +++ b/sympy/polys/tests/test_polyroots.py @@ -73,6 +73,16 @@ def test_roots_quadratic(): roots = roots_quadratic(f) assert roots == _...
{ "difficulty": "low", "estimated_review_effort": 1, "problem_domain": "Bug Fixes" }
sympy__sympy-18410@189871b
sympy/sympy
Python
18,410
Added hyperbolic function in undetermined coefficients
<!-- 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-01-20T17:09:26Z
classify_ode doesn't recognise nth_linear_constant_coeff_undetermined_coefficients > ```julia > In [58]: eq = f(x).diff(x, 2) - 49*f(x) - sinh(3*x) > > In [59]: classify_ode(eq) ...
It doesn't look like `sinh` or `cosh` are checked for at all. `sinh(x)` can be written as `(exp(x) - exp(-x))/2` so shouldn't the classifiers identify this? Yes. We can do that now: ```julia In [1]: eq = f(x).diff(x, 2) - 49*f(x) - sinh(3*x) In [2]: classify_ode(eq) Out[2]: ('nth_linear_constant_coeff_variation...
[ { "body": "> ```julia\r\n> In [58]: eq = f(x).diff(x, 2) - 49*f(x) - sinh(3*x) \r\n> \r\n> In [59]: classify_ode(eq) \r\n> O...
aaf43fc338cf3fe7bd9fb8b8b3d71d9212bf963c
{ "head_commit": "189871bd6e702ee1853bf35af4842b89467173ae", "head_commit_message": "synching", "patch_to_review": "diff --git a/sympy/solvers/ode.py b/sympy/solvers/ode.py\nindex 2b6bca431c44..a41ba1851236 100644\n--- a/sympy/solvers/ode.py\n+++ b/sympy/solvers/ode.py\n@@ -253,7 +253,7 @@\n \n from sympy.logic.b...
[ { "diff_hunk": "@@ -3830,3 +3830,15 @@ def test_issue_15996():\n sol = Eq(f(x), C1 + (C2 + C3*x - x**2/8 + 5*exp(2*I*x)/16)*sin(x) + (C4 + C5*x + I*x**2/8 + 5*I*exp(2*I*x)/16)*cos(x) - I*exp(I*x))\n assert sol == dsolve(eq, hint='nth_linear_constant_coeff_variation_of_parameters')\n assert checkodes...
b687450d05b27d49cf0ed1bfc29b0a6bd579e752
diff --git a/sympy/solvers/ode.py b/sympy/solvers/ode.py index 2b6bca431c44..a41ba1851236 100644 --- a/sympy/solvers/ode.py +++ b/sympy/solvers/ode.py @@ -253,7 +253,7 @@ from sympy.logic.boolalg import (BooleanAtom, And, Not, BooleanTrue, BooleanFalse) -from sympy.functions import c...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-18339@0254050
sympy/sympy
Python
18,339
Return sympy integers instead of python integers
<!-- 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://github.com/blog/1506-closing-issues...
2020-01-15T06:13:43Z
Clean up gotchas in _eval_Mod Things like ```python Mod(factorial(4, evaluate=False), 3) Mod(factorial(5, evaluate=False), 6) ``` shouldn't return python integers, but sympy integers. I see `_eval_Mod` in `factorial` and `binomial` have such pitfalls. When you see `return 0`, it should be changed to `return S....
Shouldn't it be automatically sympified? I don’t think that it is. I see a lot of _eval does not sympify, and I thought that this was left on purpose that post-sympify can slow down things slightly for stuff which can be resolved in a more careful review. I'm working on this issue.
[ { "body": "Things like\r\n```python\r\nMod(factorial(4, evaluate=False), 3)\r\nMod(factorial(5, evaluate=False), 6)\r\n```\r\nshouldn't return python integers, but sympy integers.\r\n\r\nI see `_eval_Mod` in `factorial` and `binomial` have such pitfalls.\r\nWhen you see `return 0`, it should be changed to `retu...
f3c949f043adc907179b5dd12e736ecf9a75a9c6
{ "head_commit": "02540505b0c872955d88dff856eb99976dd52f81", "head_commit_message": "Add more tests to improve coverage", "patch_to_review": "diff --git a/sympy/functions/combinatorial/factorials.py b/sympy/functions/combinatorial/factorials.py\nindex 69378c4a0c26..ed77c4343a13 100644\n--- a/sympy/functions/combi...
[ { "diff_hunk": "@@ -497,6 +499,9 @@ def test_binomial_Mod_slow():\n assert Mod(binomial(9734, 451, evaluate=False), q) == Mod(binomial(9734, 451), q)\n assert Mod(binomial(-10733, 4459, evaluate=False), q) == Mod(binomial(-10733, 4459), q)\n assert Mod(binomial(-15733, 4458, evaluate=False), q) == M...
7373c1cdb7139794331a41bd33959ec99fba1370
diff --git a/sympy/functions/combinatorial/factorials.py b/sympy/functions/combinatorial/factorials.py index 69378c4a0c26..ed77c4343a13 100644 --- a/sympy/functions/combinatorial/factorials.py +++ b/sympy/functions/combinatorial/factorials.py @@ -209,7 +209,7 @@ def _eval_Mod(self, q): aq = abs(q) ...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Code Refactoring / Architectural Improvement" }
sympy__sympy-18398@8bc01e9
sympy/sympy
Python
18,398
fixed is_nthpow_residue
Fixes #18394 <!-- BEGIN RELEASE NOTES --> * ntheory * `is_nthpow_residue` no longer raises ValueError when a < 0 * `polynomial_congruence` recognizes x**n + a = 0 mod m as a special case <!-- END RELEASE NOTES -->
2020-01-19T19:42:15Z
Noticed several bugs in residue.py (1) is_nthpow_residue(3, 0, 2) in the test case is wrong because x**0 = 3 mod 2 has solutions {0, 1} (2) is_nthpow_residue(a, n, m) when a < 0 there should not be an assertion error. (3) nthroot_mod(a, n, p, all_roots=False) when a < 0, it gives assertion error due to bug in is_nthp...
@oscarbenjamin @smichr @jksuom please check if these are correct issue, and i will start working on it.
[ { "body": "(1) is_nthpow_residue(3, 0, 2) in the test case is wrong because x**0 = 3 mod 2 has solutions {0, 1}\r\n(2) is_nthpow_residue(a, n, m) when a < 0 there should not be an assertion error.\r\n(3) nthroot_mod(a, n, p, all_roots=False) when a < 0, it gives assertion error due to bug in is_nthpow_residue(a...
9f98339b3344de9109f4d2780faf9822fb110848
{ "head_commit": "8bc01e970e1b5b93fcc4f7fb6c64b93a7e57f26c", "head_commit_message": "minor improvements", "patch_to_review": "diff --git a/sympy/ntheory/residue_ntheory.py b/sympy/ntheory/residue_ntheory.py\nindex cb5d11022f13..f1924336dcbb 100644\n--- a/sympy/ntheory/residue_ntheory.py\n+++ b/sympy/ntheory/resid...
[ { "diff_hunk": "@@ -1526,13 +1525,16 @@ def polynomial_congruence(expr, m):\n [3257]\n \"\"\"\n coefficients = _valid_expr(expr)\n+ coefficients = [num % m for num in coefficients]\n rank = len(coefficients)\n if rank == 3:\n return quadratic_congruence(coefficients[0], coefficien...
3c097bca62c24e74635d1f2c0f3f9362c1732a87
diff --git a/sympy/ntheory/residue_ntheory.py b/sympy/ntheory/residue_ntheory.py index cb5d11022f13..df5c8bbd8849 100644 --- a/sympy/ntheory/residue_ntheory.py +++ b/sympy/ntheory/residue_ntheory.py @@ -628,18 +628,17 @@ def is_nthpow_residue(a, n, m): .. [1] P. Hackman "Elementary Number Theory" (2009), page 76 ...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-18168@087860a
sympy/sympy
Python
18,168
Fix Rationals.boundary, Rationals.is_open, Rationals.is_closed
<!-- 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://github.com/blog/1506-closing-issu...
2019-12-29T16:55:35Z
Are `is_closed, is_open` of `S.Rationals`'s properties valid? currently, there properties `is_closed, is_open` aren't initialized . ```python from sympy import S S.Rationals.is_closed, S.Rationals.is_open > True, None ``` if there properties are thought wheather Q(S.Rationals) is open or closed set in R (S....
Generally in SymPy `is_` properties return fuzzy-bools which use 3-way logic: True, False or None. None means that the the answer to the question is not known. Often that is because the code to answer the question has not been written/implemented. Right now the `is_closed` property returns `self.boundary.is_subset(s...
[ { "body": "currently, there properties `is_closed, is_open` aren't initialized .\r\n\r\n```python\r\nfrom sympy import S\r\n\r\nS.Rationals.is_closed, S.Rationals.is_open\r\n> True, None\r\n```\r\n\r\nif there properties are thought wheather Q(S.Rationals) is open or closed set in R (S.Reals), should return `is...
80a00842e7164f7865d0933306a94d33ad7ca602
{ "head_commit": "087860a255526cd95fe8a984aa34ef552d1ff907", "head_commit_message": "Fix Rationals.boundary, Rationals.is_open, Rationals.is_closed\n\nThis commit fixes #18134 by\n- correcting Rationals.boundary,\n- improving the `is_open` logic by using `is_empty`\n (previously `is_open` could never return `False...
[ { "diff_hunk": "@@ -555,25 +555,29 @@ def boundary(self):\n def is_open(self):\n \"\"\"\n Property method to check whether a set is open.\n+\n A set is open if and only if it has an empty intersection with its\n- boundary.\n+ boundary. The openness of a subset of the re...
dfd87b738d7e26c727c4fbe6f4d79486af150471
diff --git a/sympy/sets/fancysets.py b/sympy/sets/fancysets.py index f74693b4705c..0e859867eed2 100644 --- a/sympy/sets/fancysets.py +++ b/sympy/sets/fancysets.py @@ -66,7 +66,7 @@ def __iter__(self): @property def _boundary(self): - return self + return S.Reals class Naturals(with_metacl...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-18107@e76bcb4
sympy/sympy
Python
18,107
Fix bug in cancel 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://github.com/blog/1506-closing-issues...
2019-12-23T14:00:32Z
Noninteger coefficients in cancel function Documentation says that in output of 'cancel' function "leading coefficients of numerator and denominator are integers" which isn't always true. For example `>>> cancel('(x/2+1)/y')` returns `(x + 2)/(2*y)` which is fine, but `>>> cancel('(x/2+1)')` returns `x/2 + 1` ...
@oscarbenjamin Can I take up this issue? And can you please give some pointers on how I should proceed to do that? Because I haven't contributed to sympy before. I'm not sure what `cancel` is supposed to do in this situation. The docstring says ``` Help on function cancel in module sympy.polys.polytools: cancel(f...
[ { "body": "Documentation says that in output of 'cancel' function \"leading coefficients of numerator and denominator are integers\" which isn't always true. For example\r\n`>>> cancel('(x/2+1)/y')`\r\nreturns\r\n`(x + 2)/(2*y)` \r\nwhich is fine, but\r\n`>>> cancel('(x/2+1)')`\r\nreturns\r\n`x/2 + 1`\r\nand I ...
0ce30022ec57027cfbb6a5848996996e0fedd4a7
{ "head_commit": "e76bcb4ad1cbdd979119a24b4d0361ed0be15705", "head_commit_message": "Update polytools.py", "patch_to_review": "diff --git a/sympy/polys/polytools.py b/sympy/polys/polytools.py\nindex ec7e536e9bdf..97759d70d951 100644\n--- a/sympy/polys/polytools.py\n+++ b/sympy/polys/polytools.py\n@@ -6651,7 +6651...
[ { "diff_hunk": "@@ -6651,7 +6651,7 @@ def cancel(f, *gens, **args):\n c, P, Q = F.cancel(G)\n \n if not isinstance(f, (tuple, Tuple)):\n- return c*(P.as_expr()/Q.as_expr())\n+ return c * Mul(1/Q.as_expr(), P.as_expr(), evaluate=False)", "line": null, "original_line": 6654, "ori...
a8903375f60845d459a8e673df29f7ea2d5a2a8f
diff --git a/sympy/polys/polytools.py b/sympy/polys/polytools.py index ec7e536e9bdf..1021611ea7f1 100644 --- a/sympy/polys/polytools.py +++ b/sympy/polys/polytools.py @@ -6588,7 +6588,7 @@ def cancel(f, *gens, **args): Examples ======== - >>> from sympy import cancel, sqrt, Symbol + >>> from sympy imp...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-18160@374ef1b
sympy/sympy
Python
18,160
Fixed wrapper for NumPy matrices so SymPy iteration and indexing works correctly
#### References to other Issues or PRs Fixes #17522 #### Brief description of what is fixed or changed Fixed wrapper for NumPy matrices so SymPy iteration and indexing works correctly. #### Other comments #### Release Notes formatted correctly. --> <!-- BEGIN RELEASE NOTES --> * matrices * Fixed wr...
2019-12-29T00:36:23Z
_MatrixWrapper does not wrap iteration of numpy matrix properly The `_MatrixWrapper` class should make it possible to wrap a numpy matrix and use it like a SymPy Matrix but iteration does not work properly: ```julia In [1]: from numpy import matrix ...
numpy array iteration scheme is different. I don't think that `_MatrixWrapper` had intended to change that but I have made the diff like below. ``` diff --git a/sympy/matrices/common.py b/sympy/matrices/common.py index 881dc8a532..390b5b42d3 100644 --- a/sympy/matrices/common.py +++ b/sympy/matrices/common.py ...
[ { "body": "The `_MatrixWrapper` class should make it possible to wrap a numpy matrix and use it like a SymPy Matrix but iteration does not work properly:\r\n```julia\r\nIn [1]: from numpy import matrix \r\n\r\nIn [2...
551f6fe60fe6d4251a0ac76e64197f23063af261
{ "head_commit": "374ef1bdd7424fcf7860f04a82922b9469fc0b05", "head_commit_message": "added _MatrixWrapperRowIndexing", "patch_to_review": "diff --git a/sympy/matrices/common.py b/sympy/matrices/common.py\nindex 996a51937866..5a9bdf5b32d0 100644\n--- a/sympy/matrices/common.py\n+++ b/sympy/matrices/common.py\n@@ -...
[ { "diff_hunk": "@@ -2621,7 +2653,11 @@ def _matrixify(mat):\n return mat\n if hasattr(mat, 'shape'):\n if len(mat.shape) == 2:\n- return _MatrixWrapper(mat)\n+ try: # test indexing behavior of matrix-like object\n+ e = mat[0][0]\n+ return _...
5ec698c0424bc442a3a4d68d050dd4421a598c74
diff --git a/sympy/matrices/common.py b/sympy/matrices/common.py index 996a51937866..1a3906846631 100644 --- a/sympy/matrices/common.py +++ b/sympy/matrices/common.py @@ -8,6 +8,7 @@ from collections import defaultdict from inspect import isfunction +from itertools import chain from sympy.assumptions.refine impo...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
sympy__sympy-18204@059f343
sympy/sympy
Python
18,204
Fix bug in `ask` related to custom AskHandler
<!-- 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://github.com/blog/1506-closing-issues...
2020-01-02T03:45:48Z
`ask` function needs `except KeyError: ` condition I am deeply interested in new assumption system, and trying with custom queries. But this led to an error when I meddled with assumptions. I'll exemplify with `Q.mersenne`, which is provided as an example in sympy's documentation page. ``` >>> from sympy.assumpt...
Hi @JSS95, I'm glad that you are interested in New Assumptions. The whole system is still not mature. This error comes from the fact that the `straight-forward conclusion` portion of code checks on pre-compiled data stored in `ask_generated.py` file. This ask_generated file has to be manually generated from the alre...
[ { "body": "I am deeply interested in new assumption system, and trying with custom queries. But this led to an error when I meddled with assumptions.\r\n\r\nI'll exemplify with `Q.mersenne`, which is provided as an example in sympy's documentation page.\r\n\r\n```\r\n>>> from sympy.assumptions import register_h...
c559a8421ac4865ebfe66024be6cd43a6103a62b
{ "head_commit": "059f3435bdff5673b8528fb2cb57e162b463ca89", "head_commit_message": "Fixes #18106", "patch_to_review": "diff --git a/sympy/assumptions/ask.py b/sympy/assumptions/ask.py\nindex b699fdab8727..d3595be56cba 100644\n--- a/sympy/assumptions/ask.py\n+++ b/sympy/assumptions/ask.py\n@@ -1294,32 +1294,35 @@...
[ { "diff_hunk": "@@ -1294,32 +1294,35 @@ def ask(proposition, assumptions=True, context=global_assumptions):\n if local_facts.clauses and satisfiable(enc_cnf) is False:\n raise ValueError(\"inconsistent assumptions %s\" % assumptions)\n \n- if local_facts.clauses:\n- local_facts_ = CNF.CNF_...
7d171e1377fab8dac1a16b5ea072591251a2eed8
diff --git a/sympy/assumptions/ask.py b/sympy/assumptions/ask.py index b699fdab8727..2c071b7eafe6 100644 --- a/sympy/assumptions/ask.py +++ b/sympy/assumptions/ask.py @@ -1295,32 +1295,22 @@ def ask(proposition, assumptions=True, context=global_assumptions): raise ValueError("inconsistent assumptions %s" % ass...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-18094@62b523d
sympy/sympy
Python
18,094
Fixed as_poly() by making it raise error with unsupported data types eg: tuples
<!-- 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://github.com/blog/1506-closing-issues...
2019-12-21T20:08:37Z
What is the result of integrate of a tuple (i.e. integrate((x, x)))? I just accidently discovered unexpected (at least, for me) behaviour of `integrate` if its first argument is a tuple: ``` In [60]: integrate((x, x)) Out[60]: 3 x 2 ── + x 2 In [61]: integrate((x, x, x)) Out[61]: 4 3 x x ...
Looks like this is entirely accidental. It stems from ``` >>> Tuple(x, x).as_poly(x) Poly(x*x + x, x, domain='ZZ[x]') ``` which doesn't seem like it should be something that works to me. `.as_poly()` should probably reject invalid polynomial representations: ``` --- a/sympy/core/basic.py +++ b/sympy/core/b...
[ { "body": "I just accidently discovered unexpected (at least, for me) behaviour of `integrate` if its first argument is a tuple:\r\n\r\n```\r\nIn [60]: integrate((x, x))\r\nOut[60]:\r\n 3\r\nx 2\r\n── + x\r\n2\r\n\r\nIn [61]: integrate((x, x, x))\r\nOut[61]:\r\n 4 3\r\nx x 2\r\n── + ── + x\r\n3 ...
378cb9c22dd0a8e961a165520849ea56ec97072c
{ "head_commit": "62b523db759e92f48ff4a3dc9b575ca0af66fd63", "head_commit_message": "Fixed as_poly() by making it raise error with unsupported data types eg:\ntuples\n\nThe commit fixes Issue #18038 in which as_poly() would work with tuples and give wrong output. This was fixed by making it an attribute of Expr as ...
[ { "diff_hunk": "@@ -215,6 +215,10 @@ def test_issue_3560():\n assert integrate(1/sqrt(x)**3, x) == -2/sqrt(x)\n \n \n+def test_issue_18038():\n+ raises(AttributeError, lambda: integrate((x, x))", "line": null, "original_line": 219, "original_start_line": null, "path": "sympy/integrals/tes...
002452480451beb182b98b8282f061dbc2989c7b
diff --git a/doc/src/modules/polys/basics.rst b/doc/src/modules/polys/basics.rst index 34e6fe89a7a5..5b5a4e1635e8 100644 --- a/doc/src/modules/polys/basics.rst +++ b/doc/src/modules/polys/basics.rst @@ -69,7 +69,7 @@ keyword parameter. By default, it is determined by the coefficients of the polynomial arguments. Po...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Documentation Updates" }
sympy__sympy-18087@7ff451a
sympy/sympy
Python
18,087
Fix Factors().as_expr(): don't multiply rational exponents
<!-- 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://github.com/blog/1506-closing-issues...
2019-12-20T12:38:00Z
Simplify of simple trig expression fails trigsimp in various versions, including 1.5, incorrectly simplifies cos(x)+sqrt(sin(x)**2) as though it were cos(x)+sin(x) for general complex x. (Oddly it gets this right if x is real.) Embarrassingly I found this by accident while writing sympy-based teaching material...
I guess you mean this: ```julia In [16]: cos(x) + sqrt(sin(x)**2) Out[16]: _________ ╱ 2 ╲╱ sin (x) + cos(x) In [17]: simplify(cos(x) + sqrt(sin(x)**2)) ...
[ { "body": "trigsimp in various versions, including 1.5, incorrectly simplifies cos(x)+sqrt(sin(x)**2) as though it were cos(x)+sin(x) for general complex x. (Oddly it gets this right if x is real.)\r\n\r\nEmbarrassingly I found this by accident while writing sympy-based teaching material...\r\n", "number": ...
9da013ad0ddc3cd96fe505f2e47c63e372040916
{ "head_commit": "7ff451a582e0467b226a8420f020a2cd3e570037", "head_commit_message": "Fix Factors().as_expr(): don't multiply rational exponents\n\nThis commit fixes an invalid simplification in exprtools.py:\n\nBefore:\n`Factors(sqrt(x**2)).as_expr() == x`\nAfter:\n`Factors(sqrt(x**2)).as_expr() == sqrt(x**2)`\n\nT...
[ { "diff_hunk": "@@ -448,14 +448,12 @@ def as_expr(self): # Factors\n args = []\n for factor, exp in self.factors.items():\n if exp != 1:\n- b, e = factor.as_base_exp()\n if isinstance(exp, int):", "line": null, "original_line": 451, "origin...
34f84ca719814469a6084976ff41bf510a0d04bb
diff --git a/sympy/core/exprtools.py b/sympy/core/exprtools.py index 57fad7040760..9d25da2675f1 100644 --- a/sympy/core/exprtools.py +++ b/sympy/core/exprtools.py @@ -358,8 +358,8 @@ def __init__(self, factors=None): # Factors for f in list(factors.keys()): if isinstance(f, Rational) and ...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-18199@9fcb418
sympy/sympy
Python
18,199
Composite number for nthroot_mod
Fixes #17373 Fixes #17377 Fixes #18212 <!-- BEGIN RELEASE NOTES --> * ntheory * `nthroot_mod` now supports composite moduli <!-- END RELEASE NOTES -->
2020-01-01T19:08:59Z
wrong result for nthroot_mod with composite modulus It seems there's something wrong with `nthroot_mod`: ``` In [1]: Mod(3**4, 17) Out[1]: 13 In [2]: nthroot_mod(13, 4, 17, all_roots=True) Out[2]: [3, 5, 12, 14] ``` ... as expected. But: ``` In [3]: Mod(3**4, 14) Out[3]: 11 In [4]: nthroot_mod(11, 4, 14,...
I looks like the algorithm would expect that all roots satisfy `x**(p - 1) - 1 == 0 (mod p)`: https://github.com/sympy/sympy/blob/36c2e2abec058d0011102cda59d9848055de086c/sympy/ntheory/residue_ntheory.py#L781-L782 That is true generally only for `p` a prime. https://github.com/sympy/sympy/blob/36c2e2abec058d0011102cd...
[ { "body": "It seems there's something wrong with `nthroot_mod`:\r\n```\r\nIn [1]: Mod(3**4, 17)\r\nOut[1]: 13\r\n\r\nIn [2]: nthroot_mod(13, 4, 17, all_roots=True)\r\nOut[2]: [3, 5, 12, 14]\r\n```\r\n... as expected. But:\r\n```\r\nIn [3]: Mod(3**4, 14)\r\nOut[3]: 11\r\n\r\nIn [4]: nthroot_mod(11, 4, 14, all_ro...
ba80d1e493f21431b4bf729b3e0452cd47eb9566
{ "head_commit": "9fcb418fa957705f557062cf034b2d52bfcf30a4", "head_commit_message": "Root can be 0 , corrected the code", "patch_to_review": "diff --git a/sympy/ntheory/residue_ntheory.py b/sympy/ntheory/residue_ntheory.py\nindex 9a3052d4c3b7..224995a2669b 100644\n--- a/sympy/ntheory/residue_ntheory.py\n+++ b/sym...
[ { "diff_hunk": "@@ -742,6 +743,48 @@ def _nthroot_mod1(s, q, p, all_roots):\n return res\n return min(res)\n \n+def _nthroot_mod_composite(a, n, m):\n+ \"\"\"\n+ Find the solutions to ``x**n = a mod m`` when m is not prime.\n+ \"\"\"\n+ from sympy.ntheory.modular import crt\n+ f = fac...
c885a6283eaf08c37487f17e9305b8c04dcd18af
diff --git a/sympy/ntheory/residue_ntheory.py b/sympy/ntheory/residue_ntheory.py index 9a3052d4c3b7..fd0acecd59ca 100644 --- a/sympy/ntheory/residue_ntheory.py +++ b/sympy/ntheory/residue_ntheory.py @@ -2,6 +2,7 @@ from sympy.core.compatibility import as_int, range from sympy.core.function import Function +from sym...
{ "difficulty": "high", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
sympy__sympy-18061@03710fa
sympy/sympy
Python
18,061
Added assumptions in Dynamicsymbols
<!-- Your title above should be a short description of what was changed. Do not include the issue number in the title. --> Added assumptions to dynamicsymbols #### 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://...
2019-12-17T11:43:09Z
dynamicsymbols needs to accept assumptions This is the current behavior: ``` Python 3.6.7 | packaged by conda-forge | (default, Nov 21 2018, 02:32:25) Type 'copyright', 'credits' or 'license' for more information IPython 7.8.0 -- An enhanced Interactive Python. Type '?' for help. In [1]: import sympy as sm ...
It also doesn't seem like the assumption of a function carries to its derivative. I'm not sure how to specify that the derivative can also be assumed to be real. ``` In [13]: fd = f.diff() ...
[ { "body": "This is the current behavior:\r\n\r\n```\r\nPython 3.6.7 | packaged by conda-forge | (default, Nov 21 2018, 02:32:25) \r\nType 'copyright', 'credits' or 'license' for more information\r\nIPython 7.8.0 -- An enhanced Interactive Python. Type '?' for help.\r\n\r\nIn [1]: import sympy as sm ...
7501960ea18912f9055a32be50bda30805fc0c95
{ "head_commit": "03710faf7f6fe52195215ba341146f6a8e08a7ae", "head_commit_message": "Added test of dynamicsymbols", "patch_to_review": "diff --git a/sympy/physics/vector/functions.py b/sympy/physics/vector/functions.py\nindex 6ae2e7369965..a2addcc770ed 100644\n--- a/sympy/physics/vector/functions.py\n+++ b/sympy/...
[ { "diff_hunk": "@@ -488,3 +488,12 @@ def test_partial_velocity():\n \n raises(TypeError, lambda: partial_velocity(Dmc.vel(N), u_list, N))\n raises(TypeError, lambda: partial_velocity(vel_list, u1, N))\n+\n+def test_dynamicsymbols():\n+ #tests to check the assumptions applied to dynamicsymbols\n+ f...
efe133d45f30908cc8f5dc8eff63fae20c5d2d28
diff --git a/sympy/physics/vector/functions.py b/sympy/physics/vector/functions.py index 6ae2e7369965..81cbac044660 100644 --- a/sympy/physics/vector/functions.py +++ b/sympy/physics/vector/functions.py @@ -572,7 +572,7 @@ def partial_velocity(vel_vecs, gen_speeds, frame): return vec_partials -def dynamicsymbo...
{ "difficulty": "low", "estimated_review_effort": 3, "problem_domain": "New Feature Additions" }
sympy__sympy-18198@8a0c402
sympy/sympy
Python
18,198
Make global parameters thread-local
<!-- 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://github.com/blog/1506-closing-issues...
2020-01-01T16:58:50Z
Suggestion on `core.evaluate` module As I understand, `core.evaluate` module is first developed to handle the global value of `evaluate` parameter. Then, it is extended to handle `distribute` parameter as well. Since more global parameters might appear in the future, I think this module can be renamed to `core.paramet...
Is your code thread-safe? > Is your code thread-safe? I didn't check it. `global_parameters` is singleton and relegates every operations to `global_foo` it contains, so hopefully it will cause no problem as long as `global_foo` does the job right. Can you suggest the way to check its thread safety? We should rea...
[ { "body": "As I understand, `core.evaluate` module is first developed to handle the global value of `evaluate` parameter. Then, it is extended to handle `distribute` parameter as well.\r\nSince more global parameters might appear in the future, I think this module can be renamed to `core.parameters` for clarity...
74b8046b46c70b201fe118cc36b29ce6c0d3b9ec
{ "head_commit": "8a0c402f71a1e91bc99f8fc91bb54cdd792c5be8", "head_commit_message": "Make global parameters thread-local\n\nFixes issue #18161.\nChanged the name of sympy/core/evaluate to sympy/core/parameters.\nMade the global parameters thread-local. However, cache must be cleared \nat the beginning and end of ea...
[ { "diff_hunk": "@@ -0,0 +1,120 @@\n+\"\"\"Thread-safe global parameters\"\"\"\n+\n+from .cache import clear_cache\n+from contextlib import contextmanager\n+from threading import local\n+\n+class _global_parameters(local):\n+ \"\"\"\n+ Thread-local global parameters.\n+\n+ Explanation\n+ ===========\...
41f4dead546c621180a45af958f1d79d07792665
diff --git a/sympy/combinatorics/permutations.py b/sympy/combinatorics/permutations.py index 79946ad7a3a3..f132a97bb762 100644 --- a/sympy/combinatorics/permutations.py +++ b/sympy/combinatorics/permutations.py @@ -4,7 +4,7 @@ from collections import defaultdict from sympy.core.basic import Atom, Basic -from sympy....
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Code Refactoring / Architectural Improvement" }
sympy__sympy-17927@361c5e6
sympy/sympy
Python
17,927
Added LICENSE for PyDy
<!-- 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://github.com/blog/1506-closing-issues...
2019-11-19T17:09:33Z
PyDy examples need to include the PyDy license There is a new directory in `sympy/parsing/autolev/tests`: ``` │   ├── pydy-example-repo │   │   ├── chaos_pendulum.al │   │   ├── chaos_pendulum.py │   │   ├── double_pendulum.al │   │   ├── double_pendulum.py │   │   ├── __init__.py │   │   ├── mass_spring_damp...
@NikhilPappu fyi @moorepants Sure, I shall include it. i am not able to find PyDy license ? do you mean including this [citation](http://proceedings.asmedigitalcollection.asme.org/proceeding.aspx?articleid=1830918) ? https://github.com/pydy/pydy/blob/master/LICENSE.txt I am interested in working on this issue. is it s...
[ { "body": "There is a new directory in `sympy/parsing/autolev/tests`:\r\n\r\n```\r\n│   ├── pydy-example-repo\r\n│   │   ├── chaos_pendulum.al\r\n│   │   ├── chaos_pendulum.py\r\n│   │   ├── double_pendulum.al\r\n│   │   ├── double_pendulum.py\r\n│   │   ├── __init__.py\r\n│   │   ├── mass_spring_damper.al\r\n│...
da58ee6a554db6f3f1f1c47250a0684c24d63803
{ "head_commit": "361c5e6a32e454704e7c6dee7f5ec04b4583d786", "head_commit_message": "shifted py-dy license", "patch_to_review": "diff --git a/LICENSE b/LICENSE\nindex 697f50363ff3..e7ef8be66055 100644\n--- a/LICENSE\n+++ b/LICENSE\n@@ -95,3 +95,34 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR...
[ { "diff_hunk": "@@ -95,3 +95,34 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH\n DAMAGE.\n+\n+-----------------------------------------...
f4b034ad35ad554ed7c5c438eeb48b816707f669
diff --git a/LICENSE b/LICENSE index 697f50363ff3..ccbd2d030207 100644 --- a/LICENSE +++ b/LICENSE @@ -95,3 +95,34 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POS...
{ "difficulty": "low", "estimated_review_effort": 1, "problem_domain": "Documentation Updates" }
sympy__sympy-17860@4911e35
sympy/sympy
Python
17,860
Fix two issues related to infinite Range objects
#### References to other Issues or PRs Fixes #17858. Fixes #17857. #### Brief description of what is fixed or changed Check if both sides are infinite and print `{..., -1, 0, 1, ...}`. Fix membership checking if both sides are infinite. #### Release Notes <!-- BEGIN RELEASE NOTES --> NO ENTRY <!-- END R...
2019-11-06T23:14:49Z
Pretty print Range(-oo, oo) raises ```python >>> from sympy import * >>> init_printing() >>> Range(-oo, oo) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/enojb/current/sympy/sympy/sympy/interactive/printing.py", line 30, in _displayhook print(stringify_func(arg, **se...
What is a good thing to print here? `{…}` looks confusing. We have ```julia In [1]: Range(-oo, 0) Out[1]: {…, -2, -1} In [2]: Range(oo) ...
[ { "body": "```python\r\n>>> from sympy import *\r\n>>> init_printing()\r\n>>> Range(-oo, oo)\r\nTraceback (most recent call last):\r\n File \"<stdin>\", line 1, in <module>\r\n File \"/Users/enojb/current/sympy/sympy/sympy/interactive/printing.py\", line 30, in _displayhook\r\n print(stringify_func(arg, **...
951523ef94ce3256eb38505609f3e0934ac75648
{ "head_commit": "4911e35e9faff89b4f81569b076d10eff88dedb2", "head_commit_message": "test_issue_17858", "patch_to_review": "diff --git a/sympy/printing/pretty/pretty.py b/sympy/printing/pretty/pretty.py\nindex 92f1f7f36a07..0280f2e46c23 100644\n--- a/sympy/printing/pretty/pretty.py\n+++ b/sympy/printing/pretty/pr...
[ { "diff_hunk": "@@ -659,8 +659,11 @@ def _contains(self, other):\n _ = self.size # validate\n except ValueError:\n return\n- ref = self.start if self.start.is_finite else self.stop\n- if (ref - other) % self.step: # off sequence\n+ if self.start...
41222ddf2c946734b83c1111a357618f7cccb05d
diff --git a/sympy/printing/latex.py b/sympy/printing/latex.py index 1857611e04ea..bbeca077d763 100644 --- a/sympy/printing/latex.py +++ b/sympy/printing/latex.py @@ -1903,7 +1903,12 @@ def _print_set(self, s): def _print_Range(self, s): dots = r'\ldots' - if s.start.is_infinite: + if s.st...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-17814@cdc167b
sympy/sympy
Python
17,814
Solvers: ValueError when linear_coeffs is used on pure sp.numbers.Float expressions
Fixes #17774 > In [19]: import sympy as sp ...: from sympy.solvers.solveset import linear_coeffs ...: syms = sp.symbols('x y') ...: x, y = syms In [20]: linear_coeffs(1, *syms) # works as expected Out[20]: [0, 0, 1] In [21]: linear_coeffs(sp.numbers.One(), *syms) # works as expected Out[21]: [0...
2019-10-28T14:05:39Z
linear_coeffs fails for pure sp.numbers.Float expressions The `sympy.solvers.solveset.linear_coeffs` method (and therefore also the `linear_eq_to_matrix` method) throws an unjustified error if the input expression `eq` is a constant numerical value of type `sympy.numbers.Float`. For other built-in numerical types (and ...
Perhaps ```python eq = _sympify(eq) if not eq.has(*syms): return [S.Zero]*len(syms) + [eq] c, terms = eq.as_coeff_add(*syms) ``` tested with ```python >>> linear_coeffs(1.,x) [0, 1.00000000000000] >>> linear_coeffs(1.) [1.00000000000000] ``` Thanks @smichr, that does the job. I was patc...
[ { "body": "The `sympy.solvers.solveset.linear_coeffs` method (and therefore also the `linear_eq_to_matrix` method) throws an unjustified error if the input expression `eq` is a constant numerical value of type `sympy.numbers.Float`. For other built-in numerical types (and implicit conversion of integers) this w...
21183076095704d7844a832d2e7f387555934f0c
{ "head_commit": "cdc167bda70cf68c8d391423f86840a9cdfcafe8", "head_commit_message": "Added a testcase", "patch_to_review": "diff --git a/sympy/solvers/solveset.py b/sympy/solvers/solveset.py\nindex 5ad6b3b248c7..7b307b1e45a6 100644\n--- a/sympy/solvers/solveset.py\n+++ b/sympy/solvers/solveset.py\n@@ -2193,7 +219...
[ { "diff_hunk": "@@ -2092,6 +2095,7 @@ def test_linear_coeffs():\n raises(ValueError, lambda:\n linear_coeffs(1/x*(x - 1) + 1/x, x))\n assert linear_coeffs(a*(x + y), x, y) == [a, a, 0]\n+ assert linear_coeffs(sp.numbers.Float(1.0), *syms) == [0, 0, 1.0]", "line": null, "original_line"...
5a3207ec2026bedcb491ab0f10547b77d132bec6
diff --git a/sympy/solvers/solveset.py b/sympy/solvers/solveset.py index 5ad6b3b248c7..7b307b1e45a6 100644 --- a/sympy/solvers/solveset.py +++ b/sympy/solvers/solveset.py @@ -2193,7 +2193,10 @@ def linear_coeffs(eq, *syms, **_kw): ValueError: nonlinear term encountered: x*(y + 1) """ d = defaultdict(list...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-17809@b887301
sympy/sympy
Python
17,809
Modified is_positive for cosh 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://github.com/blog/1506-closing-issues...
2019-10-27T18:14:04Z
abs(cosh(x)) should simplify to cosh(x) for real x Sympy 1.0 only simplifies in a limited set of cases: ``` py >>> x = sympy.var('x', real=True) >>> abs(sympy.cosh(x)).simplify() Abs(cosh(x)) # bad >>> (sympy.cosh(x) - abs(sympy.cosh(x))).simplify() 0 # good >>> (sympy.cosh(x) + abs(sympy.cosh(x))).simplify() cosh(x) ...
I think to make it work in general `cosh(x).is_positive` should be True. It's strange that simplify works. It must be attempting some rewrites that cause it to reduce (like `rewrite(exp)`). These examples all work fine now: ```julia In [169]: x = Symbol('x', real=True) ...
[ { "body": "Sympy 1.0 only simplifies in a limited set of cases:\n\n``` py\n>>> x = sympy.var('x', real=True)\n>>> abs(sympy.cosh(x)).simplify()\nAbs(cosh(x)) # bad\n>>> (sympy.cosh(x) - abs(sympy.cosh(x))).simplify()\n0 # good\n>>> (sympy.cosh(x) + abs(sympy.cosh(x))).simplify()\ncosh(x) + Abs(cosh(x)) # bad\n`...
21183076095704d7844a832d2e7f387555934f0c
{ "head_commit": "b887301835ce40075cfe8748bc796965ac88a23b", "head_commit_message": "increased coverage", "patch_to_review": "diff --git a/sympy/functions/elementary/hyperbolic.py b/sympy/functions/elementary/hyperbolic.py\nindex be58291b9b69..595750b8d244 100644\n--- a/sympy/functions/elementary/hyperbolic.py\n+...
[ { "diff_hunk": "@@ -273,6 +277,48 @@ class cosh(HyperbolicFunction):\n sinh, tanh, acosh\n \"\"\"\n \n+ def _eval_is_positive(self):\n+ arg = self.args[0]\n+\n+ if arg.is_real:\n+ return True\n+\n+ re, im = arg.as_real_imag()\n+ im_mod = im % (2*pi)\n+\n+ ...
0b941e82bbfbe901249dccd75560f710a13aca1e
diff --git a/sympy/functions/elementary/hyperbolic.py b/sympy/functions/elementary/hyperbolic.py index be58291b9b69..4621764fccd2 100644 --- a/sympy/functions/elementary/hyperbolic.py +++ b/sympy/functions/elementary/hyperbolic.py @@ -8,6 +8,11 @@ from sympy.functions.elementary.miscellaneous import sqrt from sympy.f...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-17707@cbd58d6
sympy/sympy
Python
17,707
Functions: Combinatorial-DP based implementation of Stirling Numbers
Fixes #11650 Recursive implementation was slower as it was getting executed in exponential time hence maximum recursion depth got reached, when both kinds of stirling numbers were called. **[stirling(200, i, kind=1) for i in range(201)] RuntimeError: maximum recursion depth exceeded while calling a Python object...
2019-10-06T21:10:51Z
Slow Recursive implementation of Stirling Numbers Hi folks, I noticed the other day that the current implementation for Stirling Numbers is recursive and thus it works very slowly. I was wondering if there is any idea behind it why it should be recursive. If there is no specific reason then I would like to work on th...
Same question here. May I also ask that what is the reason for the recursive implementation? I wrote a dynamic programming version but the tests only cover small n and k so the there's no big difference in running time... Why is this issue open? Is there anything which still needs to be addressed? Is Dynamic program...
[ { "body": "Hi folks,\n\nI noticed the other day that the current implementation for Stirling Numbers is recursive and thus it works very slowly. I was wondering if there is any idea behind it why it should be recursive.\n\nIf there is no specific reason then I would like to work on this to update the implementa...
4fc50841e38205561523e0a9d0e5da173988b04a
{ "head_commit": "cbd58d63d41565a88876dd9c95d67f07566c0941", "head_commit_message": "Add back some special formula", "patch_to_review": "diff --git a/sympy/functions/combinatorial/numbers.py b/sympy/functions/combinatorial/numbers.py\nindex 1693827d5e8a..bf2f8938379f 100644\n--- a/sympy/functions/combinatorial/nu...
[ { "diff_hunk": "@@ -1715,22 +1715,25 @@ def _stirling1(n, k):\n return S.One\n if 0 in (n, k):\n return S.Zero\n- n1 = n - 1\n \n # some special values\n if n == k:\n return S.One\n- elif k == 1:\n- return factorial(n1)\n- elif k == n1:\n+ elif k == n - 1:\...
0e3989f6301fe649ec39e6beb2be6ee24673b0f9
diff --git a/sympy/functions/combinatorial/numbers.py b/sympy/functions/combinatorial/numbers.py index 1693827d5e8a..518654f717af 100644 --- a/sympy/functions/combinatorial/numbers.py +++ b/sympy/functions/combinatorial/numbers.py @@ -1709,46 +1709,60 @@ def nC(n, k=None, replacement=False): return nC(_multise...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Performance Optimizations" }
sympy__sympy-17773@44a7ab8
sympy/sympy
Python
17,773
Updated docstrings of Reference Frames and Points to show multiple instances
<!-- 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://github.com/blog/1506-closing-issues...
2019-10-22T06:32:43Z
update docstrings to show how to create many reference frames (and points) It is common to do: ``` from sympy.physics.vector import ReferenceFrame A = ReferenceFrame('A') B = ReferenceFrame('B') C = ReferenceFrame('C') D = ReferenceFrame('D') ``` It would be nice to do: ``` A, B, C, D = reference_frames...
```python >>> from sympy.physics.vector import ReferenceFrame, Point >>> A,B = symbols('A B', cls=ReferenceFrame) >>> a,b = symbols('a b', cls=Point) ``` What options do you want to set? Oh, yes, I forgot about that! The `__init__` method of ReferenceFrame has several optional parameters. Point may also. ```p...
[ { "body": "It is common to do:\r\n\r\n```\r\nfrom sympy.physics.vector import ReferenceFrame\r\nA = ReferenceFrame('A')\r\nB = ReferenceFrame('B')\r\nC = ReferenceFrame('C')\r\nD = ReferenceFrame('D')\r\n```\r\n\r\nIt would be nice to do:\r\n\r\n```\r\nA, B, C, D = reference_frames('A, B, C, D')\r\n```\r\n\r\nl...
97efc4d6bbbfb138b9fb5ab6ecf1b939d947f4ad
{ "head_commit": "44a7ab88627c5eb4188d8bafa7875215198f19da", "head_commit_message": "Updates Point docstring with initialization examples", "patch_to_review": "diff --git a/sympy/physics/vector/frame.py b/sympy/physics/vector/frame.py\nindex 8bd6011e14df..00c2fceb24fe 100644\n--- a/sympy/physics/vector/frame.py\n...
[ { "diff_hunk": "@@ -127,6 +129,22 @@ def __init__(self, name, indices=None, latexs=None, variables=None):\n >>> vlatex(P.x)\n 'A1'\n \n+\n+ Example to create multiple ReferenceFrames:\n+\n+ >>> from sympy.physics.vector import ReferenceFrame, CoordinateSym", "line": null, "...
1784ec280c766b6dd916e76f03836e8349780566
diff --git a/sympy/physics/vector/frame.py b/sympy/physics/vector/frame.py index 8bd6011e14df..0788ca7ef4b8 100644 --- a/sympy/physics/vector/frame.py +++ b/sympy/physics/vector/frame.py @@ -127,6 +127,21 @@ def __init__(self, name, indices=None, latexs=None, variables=None): >>> vlatex(P.x) 'A1' + ...
{ "difficulty": "low", "estimated_review_effort": 1, "problem_domain": "Documentation Updates" }
sympy__sympy-17534@0248577
sympy/sympy
Python
17,534
allow And/Or.subs to short-circuit
<!-- 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://github.com/blog/1506-closing-issues...
2019-08-28T17:10:37Z
should And and Or short-circuit and avoid invalid args if possible For ` Or(x+y>0, x - y < 0).subs(x,oo).subs(y,oo)` return True or raise an Error? While `x + y` is defined and it is positive, the difference evaluates to nan and the comparison raises a TypeError. If short-circuiting is better than raising an error then...
Not sure about the answer to your question but this is potentially a reason for using `x < y` rather than `x - y < 0` since: ``` In [4]: Or(x+y>0, x < y).subs(x,oo).subs(y, oo) Out[4]: True ``` I don't know if True makes sense in th...
[ { "body": "For ` Or(x+y>0, x - y < 0).subs(x,oo).subs(y,oo)` return True or raise an Error? While `x + y` is defined and it is positive, the difference evaluates to nan and the comparison raises a TypeError. If short-circuiting is better than raising an error then this diff might be of use:\r\n\r\n```diff\r\ndi...
5c643041e29fab8f5ad47e9a0ce57cd621a12dce
{ "head_commit": "024857754c797b84414f5d34b872a9cd5eedb11e", "head_commit_message": "17530: allow And/Or.subs to short-circuit", "patch_to_review": "diff --git a/sympy/logic/boolalg.py b/sympy/logic/boolalg.py\nindex bc1da809e4ce..72c83c4f830c 100644\n--- a/sympy/logic/boolalg.py\n+++ b/sympy/logic/boolalg.py\n@@...
[ { "diff_hunk": "@@ -679,6 +679,25 @@ def _new_args_filter(cls, args):\n newargs.append(x)\n return LatticeOp._new_args_filter(newargs, And)\n \n+ def _eval_subs(self, old, new):\n+ args = []\n+ bad = None\n+ for i in self.args:\n+ try:\n+ i =...
dc80e71a60df91f10c107688ceeecf73c7baad09
diff --git a/sympy/logic/boolalg.py b/sympy/logic/boolalg.py index bc1da809e4ce..c9b3b81d727b 100644 --- a/sympy/logic/boolalg.py +++ b/sympy/logic/boolalg.py @@ -679,6 +679,26 @@ def _new_args_filter(cls, args): newargs.append(x) return LatticeOp._new_args_filter(newargs, And) + def _eval_su...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
sympy__sympy-17767@6484733
sympy/sympy
Python
17,767
Solvers: NotImplementedError for an equation containing absolute value in Python 3
Fixes #17650 ||x² - 1| - x| = x When did: from sympy import * x = Symbol('x', real=True) solve(abs((abs(x**2-1)-x))-x) The following error was encountered: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python36-32\lib\site-packages\sympy\solvers\solvers.py", lin...
2019-10-20T20:05:47Z
Solving an equation containing absolute value, with python 3 I'm trying to solve the following equation, with python 3.6.3 on Windows 7: ||x² - 1| - x| = x I did from sympy import * x = Symbol('x', real=True) solve(abs((abs(x**2-1)-x))-x) but I get the following error: Traceback (most r...
The SymPy codebase could be changed with the following diff to correct the problem: ```diff diff --git a/sympy/solvers/solvers.py b/sympy/solvers/solvers.py index 172d504..96bfa94 100644 --- a/sympy/solvers/solvers.py +++ b/sympy/solvers/solvers.py @@ -1020,8 +1020,13 @@ def _sympified_list(w): # Abs ...
[ { "body": "I'm trying to solve the following equation, with python 3.6.3 on Windows 7:\r\n\r\n||x² - 1| - x| = x\r\n\r\nI did\r\n\r\n from sympy import *\r\n x = Symbol('x', real=True)\r\n solve(abs((abs(x**2-1)-x))-x)\r\n\r\nbut I get the following error:\r\n\r\n Traceback (most recent call last):\...
78d5a35e58c574fe76ee48f604147c09612ffc0f
{ "head_commit": "6484733dc5edbb11f0e8055d43c762a9dbc0622d", "head_commit_message": "Added a test case", "patch_to_review": "diff --git a/sympy/solvers/solvers.py b/sympy/solvers/solvers.py\nindex f5a9d80009e8..0f2f0e7a1037 100644\n--- a/sympy/solvers/solvers.py\n+++ b/sympy/solvers/solvers.py\n@@ -1020,8 +1020,1...
[ { "diff_hunk": "@@ -2113,3 +2113,8 @@ def test_issue_17452():\n assert solve((7**x)**x + pi, x) == [-sqrt(log(pi) + I*pi)/sqrt(log(7)),\n sqrt(log(pi) + I*pi)/sqrt(log(7))]\n assert solve(x**(x/11) + pi/11, x) == [exp(LambertW(-11*log(11) + 11*log(pi) + 11*I*pi))]...
1a54bb9777c2b834c0fa2072456959940b792712
diff --git a/sympy/solvers/solvers.py b/sympy/solvers/solvers.py index f5a9d80009e8..9eb462670e93 100644 --- a/sympy/solvers/solvers.py +++ b/sympy/solvers/solvers.py @@ -1018,10 +1018,13 @@ def _sympified_list(w): for i, fi in enumerate(f): # Abs - fi = fi.replace(Abs, lambda arg: - s...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
sympy__sympy-17839@07955a5
sympy/sympy
Python
17,839
Make EmptySet the instance rather than the class
<!-- 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://github.com/blog/1506-closing-issues...
2019-11-01T23:00:05Z
EmptySet and UniversalSet without S I had thought we cleaned up all the S objects, but I guess not. Right now we have ```py >>> from sympy import * >>> EmptySet <class 'sympy.sets.sets.EmptySet'> >>> UniversalSet UniversalSet() ``` There are two issues: - `EmptySet` should be the instance, not the cl...
I am taking up the issue. Should I make a new instance that will be called from the class ``EmptySet`` ? or instead return ``EmptySet`` as the instance not the class? Specifically `from sympy import EmptySet` should import the instance, not the class. Look at how it works for things like `UniversalSet` in `sympy/sets/...
[ { "body": "I had thought we cleaned up all the S objects, but I guess not. \r\n\r\nRight now we have\r\n\r\n```py\r\n>>> from sympy import *\r\n>>> EmptySet\r\n<class 'sympy.sets.sets.EmptySet'>\r\n>>> UniversalSet\r\nUniversalSet()\r\n```\r\n\r\nThere are two issues:\r\n\r\n- `EmptySet` should be the instance,...
d5251be94ab53806719f9912f0053d39a67ff2cc
{ "head_commit": "07955a518dd5c316d26ddcda3342bbab7af04666", "head_commit_message": "Use EmptySet not EmptySet.__class__()", "patch_to_review": "diff --git a/sympy/categories/baseclasses.py b/sympy/categories/baseclasses.py\nindex 3b80fae1ba9c..464b8168eaae 100644\n--- a/sympy/categories/baseclasses.py\n+++ b/sym...
[ { "diff_hunk": "@@ -466,15 +466,16 @@ def powerset(self):\n \n A power set of an empty set:\n \n- >>> A = EmptySet()\n+ >>> from sympy import FiniteSet, EmptySet\n+ >>> A = EmptySet\n >>> A.powerset()\n {EmptySet()}", "line": null, "original_line": 472, "...
8917403228c5c91f9692c1f1c947eab944afa69a
diff --git a/.travis.yml b/.travis.yml index 5f81ede9e137..a3d3e1b1c84e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -63,7 +63,7 @@ matrix: env: - TEST_ASCII="true" # space separated list of optional dependencies(conda packages) to install and test - - TEST_OPT_DEPENDENCY="numpy scipy g...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Code Refactoring / Architectural Improvement" }
sympy__sympy-17429@efa294d
sympy/sympy
Python
17,429
Add automatic evaluation for compositions of inverse hyperbolic functions
#### References to other Issues or PRs Closes #17421. The more difficult issue with evaluation near branch cuts is not addressed, but there is another issue that covers that (#6137). #### Brief description of what is fixed or changed Add automatic evaluation of `atanh(tanh(x)), acosh(cosh(x)), asinh(sinh(x))` for ...
2019-08-15T22:02:13Z
Incorrect evaluation of acos(-I + acosh(cosh(cosh(1) + I))) `-I + acosh(cosh(cosh(1) + I))` should be equivalent to `cosh(1)`, and this can be confirmed: ``` >>> N(-I + acosh(cosh(cosh(1) + I))) 1.54308063481524 + 0.e-20*I >>> N(cosh(1)) 1.54308063481524 ``` Taking `acos`, the sign gets flipped: ``` >>> ...
Actually, I think this is more of a mpmath issue- will close unless anyone feels otherwise. What makes you think it is an issue with mpmath rather than sympy? Never mind. I guess the issue is that any positive imaginary part no matter how small is going to cause the sign to flip from `I` to `-I`. perhaps related to #61...
[ { "body": "`-I + acosh(cosh(cosh(1) + I))` should be equivalent to `cosh(1)`, and this can be confirmed:\r\n\r\n```\r\n>>> N(-I + acosh(cosh(cosh(1) + I)))\r\n1.54308063481524 + 0.e-20*I\r\n>>> N(cosh(1))\r\n1.54308063481524\r\n```\r\n\r\nTaking `acos`, the sign gets flipped:\r\n\r\n```\r\n>>> a = -I + acosh(co...
40da07b3a8ca3b315aaf25ec4ac21dfe4364a097
{ "head_commit": "efa294ddba7149851b3d2018631a26419e0c3942", "head_commit_message": "fix merge problem", "patch_to_review": "diff --git a/sympy/core/tests/test_evalf.py b/sympy/core/tests/test_evalf.py\nindex 52aa0a56eb35..63a034768552 100644\n--- a/sympy/core/tests/test_evalf.py\n+++ b/sympy/core/tests/test_eval...
[ { "diff_hunk": "@@ -926,6 +927,21 @@ def eval(cls, arg):\n if _coeff_isneg(arg):\n return -cls(-arg)\n \n+ if isinstance(arg, sinh):\n+ x = arg.args[0]\n+ if x.is_number:", "line": null, "original_line": 932, "original_start_line": nul...
e010002b66a0377406bf6c4d13a5c53e930b1455
diff --git a/sympy/core/tests/test_evalf.py b/sympy/core/tests/test_evalf.py index 52aa0a56eb35..63a034768552 100644 --- a/sympy/core/tests/test_evalf.py +++ b/sympy/core/tests/test_evalf.py @@ -1,7 +1,7 @@ from sympy import (Abs, Add, atan, ceiling, cos, E, Eq, exp, factor, factorial, fibonacci, floor, Function,...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
sympy__sympy-17215@0905ad4
sympy/sympy
Python
17,215
KroneckerDelta simplification and rewrite(Piecewise)
#### References to other Issues or PRs Closes #17214. #### Brief description of what is fixed or changed Add `_eval_rewrite_as_Piecewise` to `KroneckerDelta`. Add `simplify` recognition of expressions containing `KroneckerDelta` and attempt to simplify via `Piecewise`. #### Release Notes <!-- BEGIN RELEASE N...
2019-07-17T16:58:33Z
Simplify Mul of KroneckerDelta There should be a way to simplify this to zero: ```julia In [56]: n = Symbol('n', integer=True) In [57]: expr = KroneckerDelta(0, n) * KroneckerDelta(1, n) ...
[ { "body": "There should be a way to simplify this to zero:\r\n```julia\r\nIn [56]: n = Symbol('n', integer=True) \r\n\r\nIn [57]: expr = KroneckerDelta(0, n) * KroneckerDelta(1, n) ...
a2d65f2a9c6c774404d602a941c09008e100025a
{ "head_commit": "0905ad40dfc3a7003512a9db52afcaf98e8cf566", "head_commit_message": "add case for simplifying KroneckerDelta", "patch_to_review": "diff --git a/sympy/functions/special/tensor_functions.py b/sympy/functions/special/tensor_functions.py\nindex 66efe8c85762..18a056d47dbd 100644\n--- a/sympy/functions/...
[ { "diff_hunk": "@@ -614,6 +615,10 @@ def shorter(*choices):\n if expr.has(Product):\n expr = product_simplify(expr)\n \n+ if expr.has(KroneckerDelta):\n+ from sympy.functions.elementary.piecewise import Piecewise\n+ expr = simplify(expr.rewrite(Piecewise))", "line": null, "o...
ca94a5f9a95b11b022a1a0d498523e7a275b00b8
diff --git a/doc/src/modules/simplify/simplify.rst b/doc/src/modules/simplify/simplify.rst index 7f7db1136374..5b15a65b338e 100644 --- a/doc/src/modules/simplify/simplify.rst +++ b/doc/src/modules/simplify/simplify.rst @@ -15,6 +15,10 @@ nthroot ------- .. autofunction:: nthroot +kroneckersimp +------------- +.. au...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Code Refactoring / Architectural Improvement" }
sympy__sympy-17239@1bcffd9
sympy/sympy
Python
17,239
Added relational operator printer for various languages
<!-- 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://github.com/blog/1506-closing-issues...
2019-07-21T14:32:26Z
Relational printing ```python3 from sympy import * from sympy.printing.ccode import ccode from sympy.printing.cxxcode import cxxcode from sympy.printing.fcode import fcode from sympy.printing.glsl import glsl_code from sympy.printing.jscode import jscode from sympy.printing.julia import julia_code from sympy....
[ { "body": "```python3\r\nfrom sympy import *\r\n\r\nfrom sympy.printing.ccode import ccode\r\nfrom sympy.printing.cxxcode import cxxcode\r\nfrom sympy.printing.fcode import fcode\r\nfrom sympy.printing.glsl import glsl_code\r\nfrom sympy.printing.jscode import jscode\r\nfrom sympy.printing.julia import julia_co...
8a375578647590e16aff119a2363a12ff171306c
{ "head_commit": "1bcffd9714b01151c1d3081e761cccd5efc9c0df", "head_commit_message": "Added relational operator printer for languages", "patch_to_review": "diff --git a/sympy/printing/glsl.py b/sympy/printing/glsl.py\nindex db8e6694cdd7..a8272e3490d9 100644\n--- a/sympy/printing/glsl.py\n+++ b/sympy/printing/glsl....
[ { "diff_hunk": "@@ -281,6 +281,12 @@ def _print_int(self, expr):\n def _print_Rational(self, expr):\n return \"%s.0/%s.0\" % (expr.p, expr.q)\n \n+ def _print_Relational(self, expr):\n+ lhs_code = self._print(expr.lhs)\n+ rhs_code = self._print(expr.rhs)\n+ op = expr.rel_op\n...
d26e5a6f582f8b838dbc5463135b709ae4a785b8
diff --git a/sympy/printing/ccode.py b/sympy/printing/ccode.py index 0aa125278d02..8ee46a3bfd19 100644 --- a/sympy/printing/ccode.py +++ b/sympy/printing/ccode.py @@ -390,7 +390,7 @@ def _print_Relational(self, expr): lhs_code = self._print(expr.lhs) rhs_code = self._print(expr.rhs) op = expr...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-17251@5bad418
sympy/sympy
Python
17,251
Reduce exp() argument modulo 2*I*pi
#### References to other Issues or PRs Fixes #17216 #### Brief description of what is fixed or changed `exp()` arguments with an imaginary part that is a rational multiple of pi will now be reduced mod `2*pi*I`. (In fact the principal value will be retained.) Before: ``` In [8]: exp(9*I*pi/4) - exp(I*pi/4) ...
2019-07-24T14:49:45Z
exp doesn't simplify based on its periodicity In current master, `exp` doesn't use its periodicity to automatically reduce its argument, not even for purely imaginary arguments: ``` >>> exp(9*I*pi/4) 9⋅ⅈ⋅π ───── 4 ℯ >>> simplify(exp(9*I*pi/4)) 9⋅ⅈ⋅π ───── 4 ℯ >>> a = exp(9*I*pi/4) - exp(I*pi/4); a...
[ { "body": "In current master, `exp` doesn't use its periodicity to automatically reduce its argument, not even for purely imaginary arguments:\r\n```\r\n>>> exp(9*I*pi/4)\r\n 9⋅ⅈ⋅π\r\n ─────\r\n 4\r\nℯ\r\n>>> simplify(exp(9*I*pi/4))\r\n 9⋅ⅈ⋅π\r\n ─────\r\n 4\r\nℯ\r\n>>> a = exp(9*I*pi/4) - exp(I*pi/4); a\r\...
8ca4a683d58ac1f61cfd2e4dacf7f58b9c0fefab
{ "head_commit": "5bad41867b7e6be198888b92ccac49c4b84933e4", "head_commit_message": "Add tests for exp() periodicity handling", "patch_to_review": "diff --git a/sympy/functions/elementary/exponential.py b/sympy/functions/elementary/exponential.py\nindex 047e2d52ea08..3eb7567764c9 100644\n--- a/sympy/functions/ele...
[ { "diff_hunk": "@@ -262,6 +262,12 @@ def eval(cls, arg):\n return -S.ImaginaryUnit\n elif ask(Q.odd(coeff + S.Half)):\n return S.ImaginaryUnit\n+ elif coeff.is_Rational:", "line": null, "original_line": 26...
3a9a5f24e1a2370121599028b1fad59126188a49
diff --git a/sympy/functions/elementary/exponential.py b/sympy/functions/elementary/exponential.py index 047e2d52ea08..94928bba16bd 100644 --- a/sympy/functions/elementary/exponential.py +++ b/sympy/functions/elementary/exponential.py @@ -250,18 +250,23 @@ def eval(cls, arg): elif isinstance(arg, SetExpr): ...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-17284@8b3e88d
sympy/sympy
Python
17,284
Src improve
<!-- BEGIN RELEASE NOTES --> NO ENTRY <!-- END RELEASE NOTES --> <!-- 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...
2019-07-28T00:39:21Z
Some confusing (Potential error) on source code (master branch) of sympy Here is some code in sympy master branch which make me feel it is error. But I am not sure. # 1 sympy/sets/handlers/add.py ```python3 @dispatch(Interval, Infinity) def _set_sub(x, y): if self.start is S.NegativeInfinity: r...
1. Not sure how the dispatch magic works, but I understand you concern. Worth looking more into. 2. Agreed. This line is not covered in the tests, so it may very well fail in Python 3. 3. The `_sage_` methods are only (supposed to be) called by Sage, so it should be OK. But clearly, it would be safer to use try and...
[ { "body": "Here is some code in sympy master branch which make me feel it is error. But I am not sure.\r\n\r\n# 1\r\n\r\nsympy/sets/handlers/add.py\r\n\r\n```python3\r\n@dispatch(Interval, Infinity)\r\ndef _set_sub(x, y):\r\n if self.start is S.NegativeInfinity:\r\n return Interval(-oo, oo)\r\n ret...
cebe3719ca3d7f1e3b311f2c86c18cc30d7f7484
{ "head_commit": "8b3e88dd7fc20e8ac706a3c89bcbad06603bfebc", "head_commit_message": "remove extra space near * and /", "patch_to_review": "diff --git a/sympy/core/cache.py b/sympy/core/cache.py\nindex a762272792d3..573f0cf17204 100644\n--- a/sympy/core/cache.py\n+++ b/sympy/core/cache.py\n@@ -3,6 +3,7 @@\n \n fro...
[ { "diff_hunk": "@@ -345,7 +345,7 @@ class IntQubit(IntQubitState, Qubit):\n \n The differences between this class and ``Qubit`` are:\n \n- * The form of the constructor.\n+ *The form of the constructor.", "line": null, "original_line": 348, "original_start_line": null, "path": "sympy/ph...
62dc2ebd7fc8af5e36cf6af30dd3a7493743b47d
diff --git a/sympy/core/cache.py b/sympy/core/cache.py index a762272792d3..573f0cf17204 100644 --- a/sympy/core/cache.py +++ b/sympy/core/cache.py @@ -3,6 +3,7 @@ from distutils.version import LooseVersion as V + class _cache(list): """ List of cached functions """ @@ -34,6 +35,7 @@ def clear_cache(self): ...
{ "difficulty": "low", "estimated_review_effort": 2, "problem_domain": "Bug Fixes" }
sympy__sympy-17410@c485c62
sympy/sympy
Python
17,410
Set cwd as the local sympy root in subprocess call to make tests run from different directory.
Set cwd as the local sympy root in subprocess call to make tests run from different directory. <!-- 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#17369 closes #17401 as an alternative #### Br...
2019-08-13T20:39:43Z
test and doctest scripts do not work from other directories The `path_hack` in the `test` and `doctest` scripts is supposed to make it so that something like ``` cd bin ./doctest ``` still tests the git SymPy. But the problem is that the tests and doctests run in a subprocess by default, which does not inh...
Thinking about it, it should be run_tests_in_subprocess's responsibility to make sure the subprocess test runner tests the same sympy that it is called from. I would like to work on this. I was not able to find where ` run_tests_in_subprocess` was defined. Can you help me out? I remembered the name wrong. It's `run_in...
[ { "body": "The `path_hack` in the `test` and `doctest` scripts is supposed to make it so that something like\r\n\r\n```\r\ncd bin\r\n./doctest\r\n```\r\n\r\nstill tests the git SymPy. \r\n\r\nBut the problem is that the tests and doctests run in a subprocess by default, which does not inherit the sys.path. So t...
e0f45aea9f283b1781a75e79ba47c93e46fc8bf6
{ "head_commit": "c485c62ffd2ecbc9531937d6fd3012355131b94a", "head_commit_message": "Discarded PYTHONPATH and used cwd to provide path to subrocess.Popen", "patch_to_review": "diff --git a/sympy/utilities/runtests.py b/sympy/utilities/runtests.py\nindex c5494f4b5c8e..b49ade623790 100644\n--- a/sympy/utilities/run...
[ { "diff_hunk": "@@ -24,6 +25,7 @@\n import linecache\n import time\n from fnmatch import fnmatch\n+from os.path import dirname", "line": null, "original_line": 28, "original_start_line": null, "path": "sympy/utilities/runtests.py", "start_line": null, "text": "@user1:\nYou seem to have i...
69983786be145a989035bde0e97f2e066b5478ea
diff --git a/sympy/utilities/runtests.py b/sympy/utilities/runtests.py index c5494f4b5c8e..b1cb098d17c1 100644 --- a/sympy/utilities/runtests.py +++ b/sympy/utilities/runtests.py @@ -32,6 +32,7 @@ import signal import stat import tempfile +import sympy from sympy.core.cache import clear_cache from sympy.core.com...
{ "difficulty": "low", "estimated_review_effort": 2, "problem_domain": "Test Suite / CI Enhancements" }
sympy__sympy-17173@4b960cb
sympy/sympy
Python
17,173
Update RisingFactorial eval for k noninteger, x negative integer
#### References to other Issues or PRs Closes #17166. #### Brief description of what is fixed or changed `RisingFactorial(x, k)` where `k` is noninteger, `x` is negative integer returns `0`. #### Release Notes <!-- BEGIN RELEASE NOTES --> * functions * RisingFactorial(x, k) where k is a noninteger, x is ...
2019-07-10T22:02:56Z
Automatic evaluation of RisingFactorial(n, k) with n negative integer, k non-integer ``` >>> RisingFactorial(-1,pi) RisingFactorial(-1, pi) >>> N(RisingFactorial(-1,pi)) 0 ``` This could be evaluated automatically. Note that this causes problems when used in larger expressions, for example: ``` >>> N(asech(...
[ { "body": "```\r\n>>> RisingFactorial(-1,pi)\r\nRisingFactorial(-1, pi)\r\n>>> N(RisingFactorial(-1,pi))\r\n0\r\n```\r\n\r\nThis could be evaluated automatically. Note that this causes problems when used in larger expressions, for example:\r\n\r\n```\r\n>>> N(asech(RisingFactorial(-1,pi)))\r\nTraceback (most re...
0ed1ecb4d4b5f078643fc6265f41c4d04ad3c9ce
{ "head_commit": "4b960cba421e4f9bcc40aaa44fa194682dc92540", "head_commit_message": "assert unchanged(rf, -3, x)", "patch_to_review": "diff --git a/sympy/functions/combinatorial/factorials.py b/sympy/functions/combinatorial/factorials.py\nindex bafc91a06925..297cec63f127 100644\n--- a/sympy/functions/combinatoria...
[ { "diff_hunk": "@@ -577,6 +577,10 @@ def eval(cls, x, k):\n return 1/reduce(lambda r, i:\n r*(x - i),\n range(1, abs(int(k)) + 1), 1)\n+ else:\n+ if k.is_number:\n+ ...
75c44449f1a17e1a0974651f2e4a7ac0ccf527c4
diff --git a/sympy/functions/combinatorial/factorials.py b/sympy/functions/combinatorial/factorials.py index bafc91a06925..6577704998fd 100644 --- a/sympy/functions/combinatorial/factorials.py +++ b/sympy/functions/combinatorial/factorials.py @@ -578,6 +578,10 @@ def eval(cls, x, k): ...
{ "difficulty": "medium", "estimated_review_effort": 2, "problem_domain": "Bug Fixes" }
sympy__sympy-17375@b245676
sympy/sympy
Python
17,375
polygamma improvements (evaluation, real and positivity determination)
Closes #17350. Fixes #12569. #### Brief description of what is fixed or changed - Add `_eval_evalf` to prevent evaluation when the first argument is not a nonnegative integer. - Remove `_eval_is_real` since the logic was wrong. - Update `_eval_is_positive` and `_eval_is_negative` to avoid doing comparisons with...
2019-08-09T17:42:32Z
problem with polygamma or im N(polygamma(0,I)) yields a correct result 0.094650320622477 + 2.07667404746858*I but im(polygamma(0,I)) yields zero. Should polygamma(a, b) raise NotImplementedError for noninteger (numeric) a? mpmath's implementation of polygamma is valid only for integer first arguments. SymPy's im...
`polygamma` is real for real arguments. Hence the imaginary part is zero. ``` >>> N(polygamma(0, 1)) -0.577215664901533 >>> im(polygamma(0, 1)) 0 ``` Please note that the second argument is I (imaginary unit) not 1 (one). I see, now that you point that out. (My eyesight is not what it used to be..) It seems tha...
[ { "body": "N(polygamma(0,I))\r\nyields a correct result \r\n0.094650320622477 + 2.07667404746858*I\r\nbut\r\nim(polygamma(0,I))\r\nyields zero.", "number": 12569, "title": "problem with polygamma or im" }, { "body": "mpmath's implementation of polygamma is valid only for integer first arguments....
fc6f766ab588fecbb69ad85eb01ca28b44715e5c
{ "head_commit": "b245676e34d32f6697ef0b766737933417fb6a64", "head_commit_message": "polygamma improvements: prevent bad evaluation, update sign, real determination", "patch_to_review": "diff --git a/sympy/functions/special/gamma_functions.py b/sympy/functions/special/gamma_functions.py\nindex ee79a3597770..57d1c...
[ { "diff_hunk": "@@ -583,6 +583,12 @@ class polygamma(Function):\n .. [4] http://functions.wolfram.com/GammaBetaErf/PolyGamma2/\n \"\"\"\n \n+ def _eval_evalf(self, prec):\n+ n = self.args[0]\n+ # the mpmath polygamma implementation valid only for nonnegative integers\n+ if n.is_r...
928625c76ff0620b918ab7e18a84b0fbbb9899ae
diff --git a/sympy/functions/special/gamma_functions.py b/sympy/functions/special/gamma_functions.py index 40b8873cdf54..1a75256c789b 100644 --- a/sympy/functions/special/gamma_functions.py +++ b/sympy/functions/special/gamma_functions.py @@ -586,6 +586,12 @@ class polygamma(Function): .. [4] http://functions.wolf...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-17414@6888f72
sympy/sympy
Python
17,414
Added assumption methods to Sum and Product
<!-- 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://github.com/blog/1506-closing-issues...
2019-08-14T14:06:02Z
Inconsistency with summation order and empty sequence ``` In [9]: Sum(1, (x, 6, 5), (y, -oo, oo)).doit() Out[9]: 0 In [10]: Sum(1, (y, -oo, oo), (x, 6, 5)).doit() Out[10]: NaN ``` The reason is that summing over `(x, 6, 5)` leads to 0 as it represents an empty summation range. But summing NaN over an empty su...
[ { "body": "```\r\nIn [9]: Sum(1, (x, 6, 5), (y, -oo, oo)).doit()\r\nOut[9]: 0\r\n\r\nIn [10]: Sum(1, (y, -oo, oo), (x, 6, 5)).doit()\r\nOut[10]: NaN\r\n```\r\n\r\nThe reason is that summing over `(x, 6, 5)` leads to 0 as it represents an empty summation range. But summing NaN over an empty summation range is ap...
a94bd27833479d8e8f32b6e626f12b03face0fba
{ "head_commit": "6888f72042d35d65f5ef14bee389d93c3ba9636f", "head_commit_message": "Added assumption methods to Sum and Product", "patch_to_review": "diff --git a/sympy/concrete/products.py b/sympy/concrete/products.py\nindex aebd2b71a204..6e2f1cfb5b67 100644\n--- a/sympy/concrete/products.py\n+++ b/sympy/concre...
[ { "diff_hunk": "@@ -204,6 +204,17 @@ def _eval_is_zero(self):\n # a Product is zero only if its term is zero.\n return self.term.is_zero\n \n+ def _eval_is_extended_real(self):\n+ return self.function.is_extended_real\n+\n+ def _eval_is_positive(self):\n+ if self.function.is_...
fe2ff6ac2391618385879b957b354ff408e3d6ed
diff --git a/sympy/concrete/expr_with_intlimits.py b/sympy/concrete/expr_with_intlimits.py index ec04c6eeb00e..77277110f3ef 100644 --- a/sympy/concrete/expr_with_intlimits.py +++ b/sympy/concrete/expr_with_intlimits.py @@ -2,6 +2,7 @@ from sympy.concrete.expr_with_limits import ExprWithLimits from sympy.core.single...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-17022@1de08b2
sympy/sympy
Python
17,022
NumPy print support for identity matrices
<!-- 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://github.com/blog/1506-closing-issues...
2019-06-12T21:54:57Z
Lambdify misinterprets some matrix expressions Using lambdify on an expression containing an identity matrix gives us an unexpected result: ```python >>> import numpy as np >>> n = symbols('n', integer=True) >>> A = MatrixSymbol("A", n, n) >>> a = np.array([[1, 2], [3, 4]]) >>> f = lambdify(A, A + Identity(n)) ...
If the shape is an explicit number, we can just print `eye(n)`. For unknown shape, it's harder. We can raise an exception for now. It's better to raise an exception than give a wrong answer.
[ { "body": "Using lambdify on an expression containing an identity matrix gives us an unexpected result:\r\n\r\n```python\r\n>>> import numpy as np\r\n>>> n = symbols('n', integer=True)\r\n>>> A = MatrixSymbol(\"A\", n, n)\r\n>>> a = np.array([[1, 2], [3, 4]])\r\n>>> f = lambdify(A, A + Identity(n))\r\n>>> f(a)\...
f91de695585c1fbc7d4f49ee061f64fcb1c2c4d8
{ "head_commit": "1de08b2f396efc1f65e9c107b78279dfd3b0e70a", "head_commit_message": "Add string matching test", "patch_to_review": "diff --git a/sympy/printing/pycode.py b/sympy/printing/pycode.py\nindex 6ec7bd891c23..0916d935688a 100644\n--- a/sympy/printing/pycode.py\n+++ b/sympy/printing/pycode.py\n@@ -608,6 +...
[ { "diff_hunk": "@@ -608,6 +608,13 @@ def _print_MatrixBase(self, expr):\n func = self._module_format('numpy.array')\n return \"%s(%s)\" % (func, self._print(expr.tolist()))\n \n+ def _print_Identity(self, expr):\n+ shape = expr.shape\n+ if all([dim.is_Integer for dim in shap...
cc2d72886696d6fa8c5c6e530403fbd23d132f82
diff --git a/sympy/printing/pycode.py b/sympy/printing/pycode.py index 6ec7bd891c23..662fa6c819cf 100644 --- a/sympy/printing/pycode.py +++ b/sympy/printing/pycode.py @@ -608,6 +608,13 @@ def _print_MatrixBase(self, expr): func = self._module_format('numpy.array') return "%s(%s)" % (func, self._pr...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-17154@8a02dd2
sympy/sympy
Python
17,154
Rewrite imaginary argument to acos as asin
<!-- 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://github.com/blog/1506-closing-issues...
2019-07-05T13:46:09Z
simplify(x**(1 / acos(I))) recursion error ``` >>> from sympy import * >>> x = Symbol('x') >>> e = x**(1 / acos(I)) >>> print(simplify(e)) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/e/se/sympy/simplify/simplify.py", line 559, in simplify expr = bottom_up(expr, lam...
The recursion error is manifested when we try to call `as_real_imag()` on `log(acos(-I)*acos(I)/sqrt(acos(-I)**2*acos(I)**2))/2`. Or for a simpler example, `acos(-I)**2*acos(I)**2`. Even simpler example: `simplify(2**acos(I)**2)` It seems like `asin(I)` evaluates to `I*log(1 + sqrt(2))` but `acos(I)` is kept unev...
[ { "body": "```\r\n>>> from sympy import *\r\n>>> x = Symbol('x')\r\n>>> e = x**(1 / acos(I))\r\n>>> print(simplify(e))\r\nTraceback (most recent call last):\r\n File \"<stdin>\", line 1, in <module>\r\n File \"/home/e/se/sympy/simplify/simplify.py\", line 559, in simplify\r\n expr = bottom_up(expr, lambda ...
d2308e8eb55ed6acb24bcd8dbb8c410c9e5e9d5c
{ "head_commit": "8a02dd2f9210bd18faa62ecca78ad0242b9a54e2", "head_commit_message": "Corrected LaTeX", "patch_to_review": "diff --git a/sympy/functions/elementary/tests/test_trigonometric.py b/sympy/functions/elementary/tests/test_trigonometric.py\nindex 1edb173848e4..51f08d52f433 100644\n--- a/sympy/functions/el...
[ { "diff_hunk": "@@ -2616,10 +2616,10 @@ class asec(InverseTrigonometricFunction):\n negative branch cut, the limit\n \n .. math::\n- \\lim_{z \\to 0}-i\\frac{\\log\\left(-\\sqrt{1 - z^2} + 1}{z}\n+ \\lim_{z \\to 0}-i\\frac{\\log\\left(-\\sqrt{1 - z^2} + 1\\right)}{z}\n \n- simplifies to...
ddc1a2245e50a9e8f162641f51fed8c639b5c938
diff --git a/sympy/functions/elementary/tests/test_trigonometric.py b/sympy/functions/elementary/tests/test_trigonometric.py index 1edb173848e4..51f08d52f433 100644 --- a/sympy/functions/elementary/tests/test_trigonometric.py +++ b/sympy/functions/elementary/tests/test_trigonometric.py @@ -855,6 +855,8 @@ def test_acos...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-16792@cc93f9c
sympy/sympy
Python
16,792
Fix incorrect codegen with unused array arguments
#### References to other Issues or PRs Fixes #16791. #### Brief description of what is fixed or changed Changed `routine` generation so that all array-like `InputArgument` s to generated code have dimension information attached...even if the corresponding argument in `argument_sequence` does not appear in the `exp...
2019-05-09T03:40:54Z
autowrap with cython backend fails when array arguments do not appear in wrapped expr When using the cython backend for autowrap, it appears that the code is not correctly generated when the function in question has array arguments that do not appear in the final expression. A minimal counterexample is: ```python f...
[ { "body": "When using the cython backend for autowrap, it appears that the code is not correctly generated when the function in question has array arguments that do not appear in the final expression. A minimal counterexample is:\r\n\r\n```python\r\nfrom sympy.utilities.autowrap import autowrap\r\nfrom sympy im...
09786a173e7a0a488f46dd6000177c23e5d24eed
{ "head_commit": "cc93f9c6545299a609ffccd4622196588f71a1a4", "head_commit_message": "Fix indentation", "patch_to_review": "diff --git a/sympy/utilities/codegen.py b/sympy/utilities/codegen.py\nindex f0befb2bd739..346ec1277b2f 100644\n--- a/sympy/utilities/codegen.py\n+++ b/sympy/utilities/codegen.py\n@@ -695,6 +6...
[ { "diff_hunk": "@@ -739,7 +745,11 @@ def routine(self, name, expr, argument_sequence=None, global_vars=None):\n try:\n new_args.append(name_arg_dict[symbol])\n except KeyError:\n- new_args.append(InputArgument(symbol))\n+ ...
4d3afb29edc7c50386b77484a187624c152ebf65
diff --git a/sympy/utilities/codegen.py b/sympy/utilities/codegen.py index f0befb2bd739..194aafc37642 100644 --- a/sympy/utilities/codegen.py +++ b/sympy/utilities/codegen.py @@ -695,6 +695,11 @@ def routine(self, name, expr, argument_sequence=None, global_vars=None): arg_list = [] # setup input arg...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-16897@30d9c05
sympy/sympy
Python
16,897
Float.is_integer updated for removing disparity in gamma
<!-- 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://github.com/blog/1506-closing-issues...
2019-05-26T13:36:39Z
Disparity in gamma function result for non-positive float numbers As nonpositive integers are poles for gamma function, we have the following: ``` >>> gamma(-1) zoo >>> gamma(0) zoo ``` But for nonpositive integers represented as floats, we get the following error ``` >>> gamma(-1.0) Traceback (most recent ca...
As said in [this document](http://mhtlab.uwaterloo.ca/courses/me755/web_chap1.pdf) and [this stackexchange thread](https://math.stackexchange.com/questions/705103/what-is-the-domain-of-gamma-function), I think we should not allow computations of gamma function for negative integers and zero. The following should happe...
[ { "body": "As nonpositive integers are poles for gamma function, we have the following:\r\n```\r\n>>> gamma(-1)\r\nzoo\r\n>>> gamma(0)\r\nzoo\r\n```\r\nBut for nonpositive integers represented as floats, we get the following error\r\n```\r\n>>> gamma(-1.0)\r\nTraceback (most recent call last):\r\n File \"/home...
5158ecf2cb5b926f0f6421aab7b0279280305554
{ "head_commit": "30d9c051ec10363230e59745021e59ae9b87fa99", "head_commit_message": "Float.is_integer updated", "patch_to_review": "diff --git a/sympy/core/numbers.py b/sympy/core/numbers.py\nindex c2bd28d796ea..6ea6f6fecd04 100644\n--- a/sympy/core/numbers.py\n+++ b/sympy/core/numbers.py\n@@ -1254,7 +1254,7 @@ d...
[ { "diff_hunk": "@@ -1254,7 +1254,7 @@ def _eval_is_infinite(self):\n return False\n \n def _eval_is_integer(self):\n- return self._mpf_ == fzero\n+ return self._mpf_[2] == fzero[2]", "line": null, "original_line": 1257, "original_start_line": null, "path": "sympy/core/n...
c12aa88d60e5333d4e725e00a3686c244fbf54e0
diff --git a/sympy/core/tests/test_numbers.py b/sympy/core/tests/test_numbers.py index b1a604949a61..d81baab52819 100644 --- a/sympy/core/tests/test_numbers.py +++ b/sympy/core/tests/test_numbers.py @@ -468,6 +468,9 @@ def eq(a, b): assert Float('0.0').is_zero is True # rationality properties + # if the ...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-16711@3d98270
sympy/sympy
Python
16,711
added a decimal separator option for floats and lists, sets, and tupl…
…e for latex printing <!-- 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://github.com...
2019-04-23T00:02:30Z
[feature request] LatexPrinter: comma as decimal separator Hi, Normally I don't mind the use of a period as decimal separator (not at all in fact), but when using Sympy in LaTeX documents via PythonTeX, this is becoming quite problematic, since the generated documents have to be in French and decimal numbers are usu...
That seems like a reasonable feature request. Can you give an example of the output that you currently see and what you would like it to be? Also can you show what you mean about the list item separator? I think he means lists will be like: ``A = [1; 2; 3]`` instead of ``A = [1, 2, 3]`` when decimal_separatio...
[ { "body": "Hi,\r\n\r\nNormally I don't mind the use of a period as decimal separator (not at all in fact), but when using Sympy in LaTeX documents via PythonTeX, this is becoming quite problematic, since the generated documents have to be in French and decimal numbers are usually written with a comma as decimal...
2ba36ff081043b1206e103b9b6306af713bf99a8
{ "head_commit": "3d98270411bff541855be8089ce50ed1efc4acf0", "head_commit_message": "added the decimal separator tests to test_latex.py. Latex.py and printer.py pass all tests", "patch_to_review": "diff --git a/sympy/printing/latex.py b/sympy/printing/latex.py\nindex e5cd6a446a68..6bb4803ef614 100644\n--- a/sympy...
[ { "diff_hunk": "@@ -2452,6 +2477,12 @@ def latex(expr, fold_frac_powers=False, fold_func_brackets=False,\n gothic_re_im : boolean, optional\n If set to ``True``, `\\Re` and `\\Im` is used for ``re`` and ``im``, respectively.\n The default is ``False`` leading to `\\operatorname{re}` and `\\o...
365677fe2fc13cf35e52824a6ae861106d854b7b
diff --git a/sympy/printing/latex.py b/sympy/printing/latex.py index e5cd6a446a68..a00aa2f60804 100644 --- a/sympy/printing/latex.py +++ b/sympy/printing/latex.py @@ -140,6 +140,7 @@ class LatexPrinter(Printer): "mat_symbol_style": "plain", "imaginary_unit": "i", "gothic_re_im": False, + ...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "New Feature Additions" }
sympy__sympy-16601@3d5dc38
sympy/sympy
Python
16,601
Vertex and p_parameter for Parabolas declared symbolically
<!-- 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://github.com/blog/1506-closing-issues...
2019-04-08T15:16:39Z
Parabola vertex can not be determined if Parabola is declared symbolically. ``` >>> from sympy import * >>> a = symbols('a') >>> l = Line((-a, 0), slope=oo) >>> p = Parabola((a, 0), l) >>> p.vertex Traceback (most recent call last): File "<stdin>", line 1, in <module> File "sympy/geometry/parabola.py", line...
[ { "body": "```\r\n>>> from sympy import *\r\n>>> a = symbols('a')\r\n>>> l = Line((-a, 0), slope=oo)\r\n>>> p = Parabola((a, 0), l)\r\n>>> p.vertex\r\nTraceback (most recent call last):\r\n File \"<stdin>\", line 1, in <module>\r\n File \"sympy/geometry/parabola.py\", line 412, in vertex\r\n vertex = Point...
d474418cf4475139d66da7d474012f366d74b628
{ "head_commit": "3d5dc382db5bce713e51ee8db71cbb5594c60e94", "head_commit_message": "include test and parentesis", "patch_to_review": "diff --git a/sympy/geometry/parabola.py b/sympy/geometry/parabola.py\nindex ac669102bcf0..8f4c08ed502e 100644\n--- a/sympy/geometry/parabola.py\n+++ b/sympy/geometry/parabola.py\n...
[ { "diff_hunk": "@@ -62,6 +68,9 @@ def test_parabola_geom():\n assert pa8.p_parameter == pa9.p_parameter\n assert pa8.vertex == pa9.vertex\n assert pa8.equation() == pa9.equation()\n+ assert pa10.focal_length == sqrt((a - b) ** 2) / 2 # if a, b real == abs(a - b)/2\n+ assert pa10.focal_length =...
e085d64831ccf0601320b7e2f60facc19dbfd9ce
diff --git a/sympy/geometry/parabola.py b/sympy/geometry/parabola.py index ac669102bcf0..8f4c08ed502e 100644 --- a/sympy/geometry/parabola.py +++ b/sympy/geometry/parabola.py @@ -14,7 +14,7 @@ from sympy.geometry.point import Point, Point2D from sympy.geometry.line import Line, Line2D, Ray2D, Segment2D, LinearEntity3...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-16452@41694d0
sympy/sympy
Python
16,452
banded matrix construction
<!-- 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://github.com/blog/1506-closing-issues...
2019-03-26T19:55:39Z
easier creation of banded matrices currently we have the `Matrix.diag` method which allows for easy creation of a single diagonal. To create a banded matrix is a little more difficult. This is the current docstring extract: ``` A given band off the diagonal can be made by padding with a vertical or h...
I'm working on this.
[ { "body": "currently we have the `Matrix.diag` method which allows for easy creation of a single diagonal. To create a banded matrix is a little more difficult. This is the current docstring extract:\r\n```\r\n A given band off the diagonal can be made by padding with a\r\n vertical or horizontal ...
4cdcbd914d66733eee1de77d592bbad3d693b049
{ "head_commit": "41694d06de63217e07148ef7b64a6c9f025e6114", "head_commit_message": "added `banded` for creation of banded matrices", "patch_to_review": "diff --git a/sympy/geometry/point.py b/sympy/geometry/point.py\nindex 7630b517cef6..6a061ec78c5b 100644\n--- a/sympy/geometry/point.py\n+++ b/sympy/geometry/poi...
[ { "diff_hunk": "@@ -790,35 +791,33 @@ def diag(kls, *args, **kwargs):\n diag_entries = defaultdict(int)\n R = C = 0 # keep track of the biggest index seen\n for m in args:\n- if hasattr(m, 'rows') or isinstance(m, list):\n- # in this case, we're a matrix or lis...
5ae62ff67eaf6bfe33e151094b3a88bb9831e692
diff --git a/sympy/geometry/point.py b/sympy/geometry/point.py index 7630b517cef6..6a061ec78c5b 100644 --- a/sympy/geometry/point.py +++ b/sympy/geometry/point.py @@ -152,7 +152,7 @@ def __new__(cls, *args, **kwargs): raise ValueError(filldedent(''' on_morph value should be 'er...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "New Feature Additions" }
sympy__sympy-16334@42502b4
sympy/sympy
Python
16,334
Improved code of sympy.core.power.Pow
<!-- 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://github.com/blog/1506-closing-issues...
2019-03-19T10:40:10Z
S(0)**real(!=0) should be (0 or zoo) and hence non-positive. Consider the following code from master: ```py >>> from sympy import symbols, ask, Q >>> from sympy.abc import x,y,z >>> p = symbols('p', real=True, zero=False) >>> q = symbols('q', zero=True) >>> (q**p).is_positive >>> ``` Since `0**a`(where a is r...
Also in the master, the following code segment works: ```py In [7]: from sympy import symbols In [8]: p = symbols('p', zero=True) In [9]: q = symbols('q', odd=True) In [10]: (p**q).is_positive Out[10]: False ```
[ { "body": "Consider the following code from master:\r\n```py\r\n>>> from sympy import symbols, ask, Q\r\n>>> from sympy.abc import x,y,z\r\n>>> p = symbols('p', real=True, zero=False)\r\n>>> q = symbols('q', zero=True)\r\n>>> (q**p).is_positive\r\n>>>\r\n```\r\nSince `0**a`(where a is real and non-zero) should ...
356a73cd676e0c3f1a1c3057a6895db0d82a1be7
{ "head_commit": "42502b4d9a3239009d5f9d766548bb06ba5fe12e", "head_commit_message": "remove extra whitespace", "patch_to_review": "diff --git a/sympy/core/power.py b/sympy/core/power.py\nindex 13b4b560f7a9..f15f67a3c7ca 100644\n--- a/sympy/core/power.py\n+++ b/sympy/core/power.py\n@@ -437,6 +437,9 @@ def _eval_is...
[ { "diff_hunk": "@@ -459,6 +462,9 @@ def _eval_is_negative(self):\n elif self.base.is_positive:\n if self.exp.is_real:\n return False\n+ elif self.base.is_zero:\n+ if self.exp.is_real:\n+ return self.exp.is_zero and False", "line": null, ...
3c266b8982b71a74fad98ed967f395fc4b97efa7
diff --git a/sympy/core/power.py b/sympy/core/power.py index 13b4b560f7a9..e7816829dd60 100644 --- a/sympy/core/power.py +++ b/sympy/core/power.py @@ -437,6 +437,9 @@ def _eval_is_positive(self): return True if self.exp.is_odd: return False + elif self.base.is_zero:...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-16302@965caab
sympy/sympy
Python
16,302
added `fraction` flag in `factor()`
<!-- 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: #16263 <!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact format, e.g. "Fixes #1234". See https://github.com/blog/150...
2019-03-17T20:39:59Z
`solve_lambert()` unable to solve in `1.4.dev` ```python In [3]: import sympy In [4]: sympy.__version__ Out[4]: '1.4.dev' In [5]: x = symbols('x', real=True) In [6]: f = 5*x - 1 + 3*exp(2 - 7*x) In [7]: poly = f.as_poly() ...
The issue seems with `factor()` ```python # in 1.3 In [7]: f = 5*x + 3*exp(-7*x + 2) In [8]: factor(f, deep=True) ...
[ { "body": "```python\r\nIn [3]: import sympy\r\nIn [4]: sympy.__version__\r\nOut[4]: '1.4.dev' \r\nIn [5]: x = symbols('x', real=True) \r\nIn [6]: f = 5*x - 1 + 3*exp(2 - 7*x) \r\nIn [7]: poly = f.as_poly() ...
6979792bd194c385a851a8e44925b522630d04de
{ "head_commit": "965caab27723da640c9e0389c4a63aa916706ee7", "head_commit_message": "removed `class Fraction` as an option for polynomial, instead used `fraction`\nflag directly in `factor`;", "patch_to_review": "diff --git a/sympy/polys/polytools.py b/sympy/polys/polytools.py\nindex 886627692851..ac432add443a 10...
[ { "diff_hunk": "@@ -2476,6 +2476,11 @@ def test_factor():\n assert factor(eq, x, deep=True) == (x + 3)*(x + 4)*(y**2 + 11*y + 30)\n assert factor(eq, y, deep=True) == (y + 5)*(y + 6)*(x**2 + 7*x + 12)\n \n+ # fraction option\n+ f = 5*x + 3*exp(2 - 7*x)\n+ assert factor(f, deep=True) == factor(f...
04fc8da1ef7e4a513da51c2e5de3c9a53d735d21
diff --git a/sympy/polys/polytools.py b/sympy/polys/polytools.py index 886627692851..f4ef829b03eb 100644 --- a/sympy/polys/polytools.py +++ b/sympy/polys/polytools.py @@ -5961,7 +5961,7 @@ def _symbolic_factor(expr, opt, method): if isinstance(expr, Expr) and not expr.is_Relational: if hasattr(expr,'_eval...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-16385@1c9b127
sympy/sympy
Python
16,385
Fixed issue #16327 (atan2 rewrite atan ignores 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 Fixes #16327 <!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact format, e.g. "Fixes #1234". See https://github.com/blog/1506...
2019-03-22T14:26:01Z
atan2 rewrite atan ignores sign If `x` is real then `arg(x)` is either 0 or pi but this assumes 0: ```julia In [14]: x = Symbol('x', real=True) In [15]: arg(x) ...
I would like to work on this issue Okay this code seems to do the trick: ``` x = re(a) y = im(a) return Piecewise( (2*atan(y / (sqrt(x**2 + y**2) + x)), Or(x>0, Ne(y, 0))), (pi, And(x<0, Eq(y, 0))), (nan, True), ...
[ { "body": "If `x` is real then `arg(x)` is either 0 or pi but this assumes 0:\r\n```julia\r\nIn [14]: x = Symbol('x', real=True) \r\n\r\nIn [15]: arg(x) ...
5e1bb40a5a929000e2dc0e3e3321a1a93de88ac8
{ "head_commit": "1c9b127fde81c993262ca21b21cd02b9b210062f", "head_commit_message": "Simplified Piecewise", "patch_to_review": "diff --git a/sympy/functions/elementary/tests/test_trigonometric.py b/sympy/functions/elementary/tests/test_trigonometric.py\nindex e16f8f8b48cc..edb349d62106 100644\n--- a/sympy/functio...
[ { "diff_hunk": "@@ -2924,7 +2924,9 @@ def _eval_rewrite_as_log(self, y, x, **kwargs):\n return -S.ImaginaryUnit*log((x + S.ImaginaryUnit*y) / sqrt(x**2 + y**2))\n \n def _eval_rewrite_as_atan(self, y, x, **kwargs):\n- return 2*atan(y / (sqrt(x**2 + y**2) + x))\n+ from sympy.logic.boola...
79bd8bb866e72464285fdf05be81332750c7a448
diff --git a/sympy/functions/elementary/tests/test_trigonometric.py b/sympy/functions/elementary/tests/test_trigonometric.py index e16f8f8b48cc..2fb44bc02861 100644 --- a/sympy/functions/elementary/tests/test_trigonometric.py +++ b/sympy/functions/elementary/tests/test_trigonometric.py @@ -904,7 +904,9 @@ def test_atan...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-16344@a43d70c
sympy/sympy
Python
16,344
Clean up the Union and Intersection constructors
<!-- Your title above should be a short description of what was changed. Do not include the issue number in the title. --> Note, this is a backwards incompatible change. In particular, Union and Intersection no longer automatically denest their arguments. You must pass the arguments like `Union(*args)`. There is al...
2019-03-20T01:09:31Z
Union does not work with Python set objects ```pytb >>> Union({1}, {2}) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "./sympy/sets/sets.py", line 1028, in __new__ args = flatten(args) File "./sympy/sets/sets.py", line 1026, in flatten return sum(map(flatten, arg), [])...
I will take up this issue. I have just started contributing to sympy, so it might take a while. @deepakkavoor are you still working on this one @FrackeR011 Yes, I am @FrackeR011 Are you still working on it ? No i am not . You should ask @deepakkavoor if he is . @deepakkavoor I want to work on this issue . Are you ...
[ { "body": "```pytb\r\n>>> Union({1}, {2})\r\nTraceback (most recent call last):\r\n File \"<stdin>\", line 1, in <module>\r\n File \"./sympy/sets/sets.py\", line 1028, in __new__\r\n args = flatten(args)\r\n File \"./sympy/sets/sets.py\", line 1026, in flatten\r\n return sum(map(flatten, arg), [])\r\n ...
f06edf42b003540cd119371440f6c226a63e5c8d
{ "head_commit": "a43d70ca2b49ccca4e6555e4f7d358b9c1426296", "head_commit_message": "Add a test that Union and Intersection don't accept iterable single arguments\n\nAlso that they do accept Python set arguments, and convert them into\nFiniteSets.", "patch_to_review": "diff --git a/sympy/series/sequences.py b/sym...
[ { "diff_hunk": "@@ -1009,34 +1010,36 @@ class Union(Set, EvalfMixin):\n \"\"\"\n is_Union = True\n \n- def __new__(cls, *args, **kwargs):\n- evaluate = kwargs.get('evaluate', global_evaluate[0])\n+ @property\n+ def identity(self):\n+ return S.EmptySet\n \n- # flatten inputs...
652203482f7f2bec900f45e419312be64444c5ae
diff --git a/sympy/series/sequences.py b/sympy/series/sequences.py index f6b971786fc4..5c2f930e8cef 100644 --- a/sympy/series/sequences.py +++ b/sympy/series/sequences.py @@ -953,7 +953,7 @@ def interval(self): """Sequence is defined on the intersection of all the intervals of respective sequences ...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "New Feature Additions" }
sympy__sympy-16190@d719081
sympy/sympy
Python
16,190
Boolean objects ignores set flags in solve
<!-- Your title above should be a short description of what was changed. Do not include the issue number in the title. --> Fixes #16138 #### 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://github.com/blog/1506-c...
2019-03-07T11:50:38Z
Solve ignores dict=True when bools are in the input equations The docstring for solve says: ``` 'dict'=True (default is False) return list (perhaps empty) of solution mappings ``` However when given a list of Eqs where one of the Eqs has auto-evaluated to `True` it doesn't return a list of di...
https://github.com/sympy/sympy/blob/0d93891268729373339dddc759f7320c85dc4851/sympy/solvers/solvers.py#L981 I have gone through the code and I find that when bool is present it returns directly without checking other flags so in such case all flag is useless. I wonder why it does that. That line was add in #13204. I...
[ { "body": "The docstring for solve says:\r\n```\r\n 'dict'=True (default is False)\r\n return list (perhaps empty) of solution mappings\r\n```\r\n\r\nHowever when given a list of Eqs where one of the Eqs has auto-evaluated to `True` it doesn't return a list of dicts:\r\n```julia\r\nIn [1]: sol...
6ad7e8d132e6f0067371847d810b4bee1ed3066f
{ "head_commit": "d71908167582c004b2ad093e663477b4b699ebe4", "head_commit_message": "Added test cases and added check for flags in reduce_inequalities", "patch_to_review": "diff --git a/sympy/solvers/inequalities.py b/sympy/solvers/inequalities.py\nindex 5e5d9fb6008c..f1a3fafa8e86 100644\n--- a/sympy/solvers/ineq...
[ { "diff_hunk": "@@ -985,6 +985,18 @@ def reduce_inequalities(inequalities, symbols=[]):\n \n # solve system\n rv = _reduce_inequalities(inequalities, symbols)\n+ as_dict = flags.get('dict', False)\n \n- # restore original symbols and return\n- return rv.xreplace({v: k for k, v in recast.items()...
792a28865c2a7eba581b9bf20b42f680a7515429
diff --git a/sympy/solvers/solvers.py b/sympy/solvers/solvers.py index 97b2e3c7075e..658eea4048bb 100644 --- a/sympy/solvers/solvers.py +++ b/sympy/solvers/solvers.py @@ -466,7 +466,8 @@ def solve(f, *symbols, **flags): * f - a single Expr or Poly that must be zero, - an Equality - - a Rel...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-16170@64b4d81
sympy/sympy
Python
16,170
dsolve gave NotImplemented error while solving with ics
<!-- Your title above should be a short description of what was changed. Do not include the issue number in the title. --> Fixes #15724 #### 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://github.com/blog/1506-cl...
2019-03-05T16:15:24Z
dsolve fails to solve for initial condition which does not seem complicated Trying to solve `y' = 1/y` with initial condition `y(1) = 2`. Expected solution: `y = sqrt(2*x + 2)`. Works fine without ICS, fails with it. ``` >>> from sympy import * >>> x, y = Symbol('x'), Function('y') >>> dsolve(y(x).diff(x) - 1/y(x)...
There could be a try / catch block on line 723 in `ode.py`. `solve_ics` can raise 4 different errors (either ValueError or NotImplementedError) that one might like to do different things with- or just ignore all of them and `pass`. Right now if any general solution cannot be solved (for initial conditions) it won't ret...
[ { "body": "Trying to solve `y' = 1/y` with initial condition `y(1) = 2`. Expected solution: `y = sqrt(2*x + 2)`. Works fine without ICS, fails with it. \r\n```\r\n>>> from sympy import *\r\n>>> x, y = Symbol('x'), Function('y')\r\n>>> dsolve(y(x).diff(x) - 1/y(x), y(x))\r\n[Eq(y(x), -sqrt(C1 + 2*x)), Eq(y(x), s...
023284e673ff91bf6a9faf1700c180fd7457c127
{ "head_commit": "64b4d81cb42d65e1456900c1b5eb307b4186ed0c", "head_commit_message": "Corrected assertion error", "patch_to_review": "diff --git a/sympy/solvers/ode.py b/sympy/solvers/ode.py\nindex 2b66aa1baee5..5998ca5bfc08 100644\n--- a/sympy/solvers/ode.py\n+++ b/sympy/solvers/ode.py\n@@ -714,8 +714,13 @@ def _...
[ { "diff_hunk": "@@ -1103,11 +1105,29 @@ def test_solve_ics():\n assert solve_ics([Eq(f(x), C1*sin(x) + C2*cos(x))], [f(x)], [C1, C2],\n {f(0): 1, f(x).diff(x).subs(x, 0): 1}) == {C1: 1, C2: 1}\n \n- # XXX: Ought to be ValueError\n- raises(NotImplementedError, lambda: solve_ics([Eq(f(x), C1*sin...
f170c87bf90017c1f348b4d3cfa4d59b62b5e1ff
diff --git a/sympy/solvers/ode.py b/sympy/solvers/ode.py index 2b66aa1baee5..0e0dc2715f46 100644 --- a/sympy/solvers/ode.py +++ b/sympy/solvers/ode.py @@ -714,8 +714,13 @@ def _helper_simplify(eq, hint, match, simplify=True, ics=None, **kwargs): else: rv1 = [] for s in rv: - ...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-16136@468a5bd
sympy/sympy
Python
16,136
Function for rotation in iterables
<!-- 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 #16127 <!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact format, e.g. "Fixes #1234". See https://github.com/blog/1506-...
2019-03-02T13:00:06Z
iterables could use rotations Would a simple routine to return the rotations of a sequence be something useful in iterables? ```python def rotations(s, dir=1): """Return a generator giving the items in s as list where each subsequent list has the items rotated to the left (default) or right (dir=-1) re...
I would like to take this.
[ { "body": "Would a simple routine to return the rotations of a sequence be something useful in iterables?\r\n```python\r\ndef rotations(s, dir=1):\r\n \"\"\"Return a generator giving the items in s as list where\r\n each subsequent list has the items rotated to the left (default)\r\n or right (dir=-1) ...
b786c995a59a7bb0e673e80ccb4ccece4dfbcaad
{ "head_commit": "468a5bde546d336f3ecc2b8ab6c968a48db22744", "head_commit_message": "trailing-whitespaces", "patch_to_review": "diff --git a/sympy/utilities/__init__.py b/sympy/utilities/__init__.py\nindex 4a5f8d59608f..96bb668185b6 100644\n--- a/sympy/utilities/__init__.py\n+++ b/sympy/utilities/__init__.py\n@@ ...
[ { "diff_hunk": "@@ -732,3 +732,14 @@ def test_ordered_partitions():\n sum(1 for p in f(i, j, 1)) ==\n sum(1 for p in f(i, j, 0)) ==\n nT(i, j))\n+\n+\n+def test_rotations():\n+ assert list(rotations([10,-20,20])) == [[10, -20, 20], [-20, 20, 10], [20, 10, -20]]...
02d8a3c1c5f0e0d798912f0236f5555f7aeb9d1e
diff --git a/sympy/utilities/__init__.py b/sympy/utilities/__init__.py index 4a5f8d59608f..96bb668185b6 100644 --- a/sympy/utilities/__init__.py +++ b/sympy/utilities/__init__.py @@ -5,7 +5,8 @@ variations, numbered_symbols, cartes, capture, dict_merge, postorder_traversal, interactive_traversal, prefixe...
{ "difficulty": "low", "estimated_review_effort": 3, "problem_domain": "New Feature Additions" }
sympy__sympy-16581@1f6e82e
sympy/sympy
Python
16,581
Add solvers for Bessel and Airy differential equations
#### References to other Issues or PRs closes #10870 fixes #9819 #### Brief description of what is fixed or changed Currently, sympy does not support the ODEs solution in term of Bessel function. So for this, I have taken help from pr #10870 and Implemented ODEs in term of Bessel and Airy's function. ``` ...
2019-04-07T11:20:40Z
ODE solver cannot solve Bessel equation I tried to solve the Bessel equation with Sympy (version 0.7.6), but got a weird result (the Bessel function is expected): ``` >>> x = symbols('x') >>> f = Function('f') >>> eq=Derivative(f(x),x,2)*x*x+x*Derivative(f(x),x,1)+(x*x)*f(x) >>> dsolve(eq) f(x) == C1*(x**4/64 - x**2/4...
Yes, we need somebody to implement a routine in ode.py that will recognize and solve the classical 2nd-order variable-coefficient linear ordinary differential equations like the Bessel equation and the Airy equation. The solution sympy is currently giving is the series for Bessel's J function of order 0: ``` In [51]...
[ { "body": "I tried to solve the Bessel equation with Sympy (version 0.7.6), but got a weird result (the Bessel function is expected):\n\n```\n>>> x = symbols('x')\n>>> f = Function('f')\n>>> eq=Derivative(f(x),x,2)*x*x+x*Derivative(f(x),x,1)+(x*x)*f(x)\n>>> dsolve(eq)\nf(x) == C1*(x**4/64 - x**2/4 + 1) + O(x**6...
1459b63f08274addc8722fa0b9c729f9f64943ac
{ "head_commit": "1f6e82edb4b9cc1f940417a9752f8264d6364e42", "head_commit_message": "add checkodesol in test case and some code cleaning", "patch_to_review": "diff --git a/sympy/solvers/ode.py b/sympy/solvers/ode.py\nindex d00b13ad520f..f526b93ff3cb 100644\n--- a/sympy/solvers/ode.py\n+++ b/sympy/solvers/ode.py\n...
[ { "diff_hunk": "@@ -307,6 +307,9 @@\n \"nth_linear_constant_coeff_variation_of_parameters\",\n \"nth_linear_euler_eq_nonhomogeneous_variation_of_parameters\",\n \"Liouville\",\n+ \"order_reducible\",", "line": null, "original_line": 310, "original_start_line": null, "path": "sympy...
0199be7788cc9d7ade23d4fdbbd07e904132f964
diff --git a/doc/src/modules/solvers/ode.rst b/doc/src/modules/solvers/ode.rst index a3e1caa3a312..0bd4040928b2 100644 --- a/doc/src/modules/solvers/ode.rst +++ b/doc/src/modules/solvers/ode.rst @@ -88,6 +88,14 @@ the various ODE solving methods. For this reason, they are documented here. ^^^^^^^^^^^^^^^^^ .. autofun...
{ "difficulty": "high", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
sympy__sympy-16439@2279e6e
sympy/sympy
Python
16,439
Function to calculate Polar moment of inertia of a 3D Beam
<!-- 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://github.com/blog/1506-closing-issues...
2019-03-25T17:57:37Z
No function for calculating polar moment of inertia and section modulus in continuum_mechanics in beam.py There is currently no function to calculate polar moment of inertia and section modulus of the beam . Both of these quantities are important in further future works in this module.
Can I work on this? Sure, feel free. Here the Beam is 2D, so along what axis should the polar moment be? Usually it is along the beam, right? @arooshiverma There is a separate class for 3D beams. Checkout from line no 1493. I think you'll have to calculate it in all 3 directions. Yeah got it. Will do it.
[ { "body": "There is currently no function to calculate polar moment of inertia and section modulus of the beam . Both of these quantities are important in further future works in this module.", "number": 16392, "title": "No function for calculating polar moment of inertia and section modulus in continuu...
3729e1ba5a2afcfc3ceee7b98b07d5b57303f919
{ "head_commit": "2279e6e2e5f25626bbbf8b7827d2a703c31151ec", "head_commit_message": "Removed the axis parameter from polar_moment() function", "patch_to_review": "diff --git a/sympy/physics/continuum_mechanics/beam.py b/sympy/physics/continuum_mechanics/beam.py\nindex 35db899e9bcd..49932c37df7f 100644\n--- a/symp...
[ { "diff_hunk": "@@ -1664,6 +1664,30 @@ def boundary_conditions(self):\n \"\"\"\n return self._boundary_conditions\n \n+\n+ def polar_moment(self):\n+ \"\"\"\n+ This function calculates the Polar moment of Inertia of the beam about the x axis.", "line": null, "original_li...
e0dea0390db388aa6bfb6acab41f2e91c2c85d6b
diff --git a/sympy/physics/continuum_mechanics/beam.py b/sympy/physics/continuum_mechanics/beam.py index f4bca0cd9411..80c7b9adcc9b 100644 --- a/sympy/physics/continuum_mechanics/beam.py +++ b/sympy/physics/continuum_mechanics/beam.py @@ -13,6 +13,16 @@ from sympy.integrals import integrate from sympy.series import l...
{ "difficulty": "low", "estimated_review_effort": 3, "problem_domain": "New Feature Additions" }
volcengine__verl-213@90d194c
volcengine/verl
Python
213
[rollout]: fix incorrect response_attention_mask in vLLM rollout
This PR addresses issue https://github.com/volcengine/verl/issues/212. close #212 The changes include: - read eos_token_id from generation_config to ensure alignment with vLLM - modified the get_eos_mask function to accept both int and list types for the eos_token parameter.
2025-02-06T07:56:25Z
Incorrect response_attention_mask observed When running instruct serial model, like `examples/ppo_trainer/run_qwen2-7b.sh`, I observed that certain requests would stop with `<|endoftext|>`. This occurs because vLLM retrieves the eos_token_id from `generation_config.json`, where the eos_token_id is specified as `[151645...
[ { "body": "When running instruct serial model, like `examples/ppo_trainer/run_qwen2-7b.sh`, I observed that certain requests would stop with `<|endoftext|>`. This occurs because vLLM retrieves the eos_token_id from `generation_config.json`, where the eos_token_id is specified as `[151645, 151643]`.\n\nAs a resu...
ced8ecbf39fae9c3192629c1c618a13896366758
{ "head_commit": "90d194c4d4c0dcf12511dcb42996729bf67be827", "head_commit_message": "fix incase no generation_config", "patch_to_review": "diff --git a/verl/utils/model.py b/verl/utils/model.py\nindex 9002451a1d..f319e400a6 100644\n--- a/verl/utils/model.py\n+++ b/verl/utils/model.py\n@@ -16,12 +16,12 @@\n \"\"\"...
[ { "diff_hunk": "@@ -445,7 +447,14 @@ def generate_sequences(self, prompts: DataProto):\n load_grad=self._is_offload_grad)\n \n prompts.batch = prompts.batch.cuda()\n- meta_info = {'eos_token_id': self.tokenizer.eos_token_id, 'pad_token_id': self.tokenizer.pad_...
dabd400d69327eac7a84598ba05657bbf14cc956
diff --git a/verl/utils/model.py b/verl/utils/model.py index 9002451a1d..f319e400a6 100644 --- a/verl/utils/model.py +++ b/verl/utils/model.py @@ -16,12 +16,12 @@ """ import os import warnings -from typing import Dict, Type +from typing import Dict, Type, Optional import numpy as np import torch from torch impo...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-16109@0ab484d
sympy/sympy
Python
16,109
Added is_abundant and is_deficient with test cases
<!-- 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://github.com/blog/1506-closing-issues...
2019-02-28T20:05:57Z
Function for perfect, deficient, abundant numbers There should be a separate function for checking whether a number is perfect, deficient or abundant. If you liked this idea then I can add a pull request. - [x] perfect - [x] deficient - [x] abundant
I think it would be good to have. For perfect numbers, there are only [51 known ones](https://en.wikipedia.org/wiki/Mersenne_prime), so we could just check against a list. I don't know if there is an efficient way to test if a number is abundant. I think ntheory/factor_.py would be the appropriate place @asmeurer ...
[ { "body": "There should be a separate function for checking whether a number is perfect, deficient or abundant. If you liked this idea then I can add a pull request.\r\n\r\n- [x] perfect\r\n- [x] deficient\r\n- [x] abundant", "number": 15926, "title": "Function for perfect, deficient, abundant numbers" ...
a302bbeb5fa4418be4ad82b6b5b3607de3f2d65d
{ "head_commit": "0ab484d488af1d4457ea9148d402c8e88734232f", "head_commit_message": "Slight change", "patch_to_review": "diff --git a/sympy/ntheory/__init__.py b/sympy/ntheory/__init__.py\nindex bf0065221703..1cd470b3f305 100644\n--- a/sympy/ntheory/__init__.py\n+++ b/sympy/ntheory/__init__.py\n@@ -8,7 +8,8 @@\n ...
[ { "diff_hunk": "@@ -2129,3 +2129,55 @@ def is_mersenne_prime(n):\n \n r, b = integer_log(n + 1, 2)\n return b and r in MERSENNE_PRIME_EXPONENTS\n+\n+\n+def is_abundant(n):\n+ \"\"\"Returns True if ``n`` is a abundant number, else False.\n+\n+ A perfect number is smaller to the sum of its positive,...
8329a7ebbec24751477bb9c5a3380743a99ef7a9
diff --git a/sympy/ntheory/__init__.py b/sympy/ntheory/__init__.py index bf0065221703..6d7ca7de9a2a 100644 --- a/sympy/ntheory/__init__.py +++ b/sympy/ntheory/__init__.py @@ -8,7 +8,8 @@ from .factor_ import divisors, factorint, multiplicity, perfect_power, \ pollard_pm1, pollard_rho, primefactors, totient, trail...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "New Feature Additions" }
sympy__sympy-16131@fca0b5a
sympy/sympy
Python
16,131
Created class for finite fourier series
<!-- 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 #15701 follows #15979 <!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact format, e.g. "Fixes #1234". See https://githu...
2019-03-02T07:37:13Z
Fourier Series of sin(x) Obviously the Fourier series of sin(x) is sin(x) but Try the following: ``` from sympy import Function, sin, fourier_series, pi from sympy.abc import x f = Function('f')(x) f = sin(x) s = fourier_series(f) # or e.g: fourier_series(f, (x,-pi, pi)) s.truncate(2) # it works for n = 1 b...
The problem seems to be [this](https://github.com/sympy/sympy/blob/master/sympy/series/fourier.py#L189-L194) in `FourierSeries.truncate`: ``` terms = [] for t in self: if len(terms) == n: break if t is not S.Zero: terms.append(t) ``` Because the Fourier series it...
[ { "body": "Obviously the Fourier series of sin(x) is sin(x) but\r\nTry the following:\r\n```\r\nfrom sympy import Function, sin, fourier_series, pi\r\nfrom sympy.abc import x\r\n\r\nf = Function('f')(x)\r\nf = sin(x)\r\n\r\ns = fourier_series(f) # or e.g: fourier_series(f, (x,-pi, pi))\r\ns.truncate(2) # it wor...
2dd1275d6050605f517b030c92e9ef30c75eab45
{ "head_commit": "fca0b5a4e1e3b997ddfaa97dad1246b25f582b7e", "head_commit_message": "added docstrings for clarity", "patch_to_review": "diff --git a/sympy/series/fourier.py b/sympy/series/fourier.py\nindex 04dacd3b8771..72fe639f3c71 100644\n--- a/sympy/series/fourier.py\n+++ b/sympy/series/fourier.py\n@@ -96,19 +...
[ { "diff_hunk": "@@ -440,16 +438,213 @@ def __sub__(self, other):\n return self.__add__(-other)\n \n \n-class FiniteFourierSeries(Basic):\n- def __new__(cls, *args):\n- obj = Basic.__new__(cls, *args)\n- return obj\n+class FiniteFourierSeries(FourierSeries):\n+ r\"\"\"Represents Finit...
2a5010000c426c34f67ddbef27316664a0d1c9e5
diff --git a/sympy/series/fourier.py b/sympy/series/fourier.py index 04dacd3b8771..fb62b23bfa19 100644 --- a/sympy/series/fourier.py +++ b/sympy/series/fourier.py @@ -96,30 +96,28 @@ def finite_check(f, x, L): def check_fx(exprs, x): return x not in exprs.free_symbols - def check_sincos(expr, x, L): ...
{ "difficulty": "high", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
sympy__sympy-16133@82bdbae
sympy/sympy
Python
16,133
SOPform and POSform accepts terms as integers
<!-- 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://github.com/blog/1506-closing-issues...
2019-03-02T11:46:28Z
boolalg.SOPform() does not give the simplest form. Hi, developers of Sympy. @mpraiser and I were using `boolalg.SOPform()` to get the smallest sum of products. But it does not seem to give the *smallest* sum of products. ```python In [136]: v Out[136]: [A, B, C, D, E, F, G, H] In [137]: q Out[137]: (B ∧ D...
Can you show the code you used to generate the above outputs? It's difficult to investigate this seeing only the output.
[ { "body": "Hi, developers of Sympy.\r\n\r\n@mpraiser and I were using `boolalg.SOPform()` to get the smallest sum of products. But it does not seem to give the *smallest* sum of products.\r\n\r\n```python\r\nIn [136]: v\r\nOut[136]: [A, B, C, D, E, F, G, H]\r\n\r\nIn [137]: q\r\nOut[137]: \r\n(B ∧ D ∧ H ∧ ¬F) ∨...
d4c64e2b68e2873d32492afdf2942fe8e805de1a
{ "head_commit": "82bdbae50992ad59c6d2cb37af2650e352baaac9", "head_commit_message": "Incorporated function into standard SOPform and POSform", "patch_to_review": "diff --git a/sympy/logic/boolalg.py b/sympy/logic/boolalg.py\nindex 8bbea2125c94..2633a5644c25 100644\n--- a/sympy/logic/boolalg.py\n+++ b/sympy/logic/...
[ { "diff_hunk": "@@ -1869,6 +1869,12 @@ def _rem_redundancy(l1, terms):\n \n return essential\n \n+def _binary_from_list_or_number(lon, bits):\n+ def tobin(n, bits):", "line": null, "original_line": 1873, "original_start_line": null, "path": "sympy/logic/boolalg.py", "start_line": ...
99aa1c960a9b6cba3b08118dca35e351569f6e99
diff --git a/sympy/logic/boolalg.py b/sympy/logic/boolalg.py index ffd7c55158cd..e5cc6f680ba4 100644 --- a/sympy/logic/boolalg.py +++ b/sympy/logic/boolalg.py @@ -5,7 +5,6 @@ from collections import defaultdict from itertools import combinations, product - from sympy.core.add import Add from sympy.core.basic impo...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
sympy__sympy-16052@b230f4c
sympy/sympy
Python
16,052
Fix Matrix Equality and MatrixExpr
<!-- 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 #7842 Fixes #16042 <!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact format, e.g. "Fixes #1234". See https://github....
2019-02-23T10:06:57Z
`Equality` and `MatrixExpr` There are a couple issues here, just not sure about the best way to fix them. A couple things to setup the examples: ``` >>> A = MatrixSymbol('A', 3, 1) >>> B = MatrixSymbol('B', 2, 1) ``` 1.) A and B cannot be equal, but Symbol doesn't care: ``` >>> Eq(A, B) A == B ``` I think this cou...
Ping @mrocklin : Matrix Expressions seem to be your thing. What are your thoughts on this? Regarding 1. `Eq` subclasses `Expr` and so will be assumed by much of sympy to be a scalar, not a Matrix. Historically we've had to reinvent all of the Expr terms, e.g. `Add -> MatAdd`. One might have to do the same with `Eq ...
[ { "body": "There are a couple issues here, just not sure about the best way to fix them.\n\nA couple things to setup the examples:\n\n```\n>>> A = MatrixSymbol('A', 3, 1)\n>>> B = MatrixSymbol('B', 2, 1)\n```\n\n1.) A and B cannot be equal, but Symbol doesn't care:\n\n```\n>>> Eq(A, B)\nA == B\n```\n\nI think t...
a4f40d79dda2630c9cda32debf64a8e04258f752
{ "head_commit": "b230f4c780b5477afda450c3dda4d6543a1d5ee8", "head_commit_message": "fix-matexpr", "patch_to_review": "diff --git a/sympy/matrices/expressions/matexpr.py b/sympy/matrices/expressions/matexpr.py\nindex 124e9994e25e..18457d9a19c5 100644\n--- a/sympy/matrices/expressions/matexpr.py\n+++ b/sympy/matri...
[ { "diff_hunk": "@@ -360,3 +360,14 @@ def test_issue_2749():\n def test_issue_2750():\n x = MatrixSymbol('x', 1, 1)\n assert (x.T*x).as_explicit()**-1 == Matrix([[x[0, 0]**(-2)]])\n+\n+\n+def test_matrix_equality():\n+ from sympy import Eq", "line": null, "original_line": 366, "original_st...
c67199dd2e735f9f2f7a43cb7921e83cf15942a0
diff --git a/sympy/matrices/expressions/matexpr.py b/sympy/matrices/expressions/matexpr.py index 69124d89fe7a..4eed7af61ee5 100644 --- a/sympy/matrices/expressions/matexpr.py +++ b/sympy/matrices/expressions/matexpr.py @@ -549,6 +549,15 @@ def applyfunc(self, func): from .applyfunc import ElementwiseApplyFunct...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
volcengine__verl-91@081c1cc
volcengine/verl
Python
91
[misc] feat: spport rmpad/data-packing in FSDP with transformers
- Use `actor_rollout_ref.model.use_rmpad=True` + `critic.model.use_rmpad=True \` + `reward_model.model.use_rmpad=True ` to enable rmpad for different models. Default set to False - Using `AutoModelForTokenClassification` for Value and Reward Model. Instead of using SeqenceClassification - Compute logprob convert to `...
2025-01-10T05:06:33Z
Do we have plans for data packing? Thank you for creating this excellent project. The design is elegant and the implementation is very efficient. I'm wondering if there are plans to support sequence packing? OpenRLHF has demonstrated significant speedup after supporting sequence packing. Given VERL's already impre...
Hi @YixinSong-e, thanks for your positive feedback about veRL! Do you mean data packing in the FSDP backend? We already implemented data packing (i.e. remove padding?) in the Megatron-LM backend. For the FSDP backend, we do have some monkey-patch to implement it upon transformers but it's not general for all models ...
[ { "body": "Thank you for creating this excellent project. The design is elegant and the implementation is very efficient.\r\n\r\nI'm wondering if there are plans to support sequence packing? \r\nOpenRLHF has demonstrated significant speedup after supporting sequence packing. Given VERL's already impressive perf...
e88cf81ae84e34f30d8503524605b66c336f67c8
{ "head_commit": "081c1cc70315096fdf3598618e6e4bb4a8057780", "head_commit_message": "fix util issue", "patch_to_review": "diff --git a/examples/ppo_trainer/run_deepseek7b_llm.sh b/examples/ppo_trainer/run_deepseek7b_llm.sh\nindex 108fba14d2..b54ecea803 100644\n--- a/examples/ppo_trainer/run_deepseek7b_llm.sh\n+++...
[ { "diff_hunk": "@@ -41,17 +43,44 @@ def __init__(\n super().__init__(config)\n self.actor_module = actor_module\n self.actor_optimizer = actor_optimizer\n+ self.use_rmpad = self.config.get('use_rmpad', False)\n+ print(f'Actor use_rmpad={self.use_rmpad}')\n \n- def _forwa...
e8fec7598beb15474b689ec21efe1720c33972cf
diff --git a/.github/workflows/e2e_gpu.yml b/.github/workflows/e2e_gpu.yml index d8760a8323..5311a41b3c 100644 --- a/.github/workflows/e2e_gpu.yml +++ b/.github/workflows/e2e_gpu.yml @@ -23,6 +23,7 @@ jobs: HTTP_PROXY: ${{ secrets.PROXY_HTTP }} HTTPS_PROXY: ${{ secrets.PROXY_HTTPS }} NO_PROXY: "loc...
{ "difficulty": "high", "estimated_review_effort": 4, "problem_domain": "New Feature Additions" }
sympy__sympy-15954@7a2d359
sympy/sympy
Python
15,954
solve exp and difference of logs with irrational coefficients
<!-- 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://github.com/blog/1506-closing-issues...
2019-02-09T13:26:01Z
exp and difference of logs doesn't simplify with irrational coefficients These expressions auto-simplify ```julia In [36]: x, y = symbols('x y') In [37]: exp(log(x)) ...
I think` exp(log(x)-log(y))` should not combine until we define x as positive integer. ``` In [6]: x,y=symbols('x y') In [7]: exp(log(x)...
[ { "body": "These expressions auto-simplify\r\n```julia\r\nIn [36]: x, y = symbols('x y') \r\n\r\nIn [37]: exp(log(x)) ...
7d899577a672c2c9505e7aa7b894362eca5b4f6c
{ "head_commit": "7a2d3596da2cf27cc932f64d34f1de3ed5bae12f", "head_commit_message": "solve exp and difference of logs with irrational coefficients", "patch_to_review": "diff --git a/sympy/functions/elementary/exponential.py b/sympy/functions/elementary/exponential.py\nindex 2827ad648385..01021b064346 100644\n---...
[ { "diff_hunk": "@@ -277,9 +278,9 @@ def eval(cls, arg):\n \n coeffs, log_term = [coeff], None\n for term in Mul.make_args(terms):\n- if isinstance(term, log):\n+ if isinstance(logcombine(term), log):\n if log_term is None:\n- ...
edcc4529c5c0c57803d47866c3dcc09bcbaff6b6
diff --git a/sympy/functions/elementary/exponential.py b/sympy/functions/elementary/exponential.py index 2827ad648385..35d4a0344a43 100644 --- a/sympy/functions/elementary/exponential.py +++ b/sympy/functions/elementary/exponential.py @@ -231,6 +231,7 @@ def eval(cls, arg): from sympy.calculus import AccumBoun...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-16056@e40f491
sympy/sympy
Python
16,056
Some minor fixes for LaTeX printer
<!-- 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://github.com/blog/1506-closing-issues...
2019-02-23T19:47:42Z
LaTeX priniting: \mathrm vs. \text It turns out that both `\mathrm` and `\text` is used for printing "text" in the LaTeX printing routines. It seems like there should be one that is standard and that it should be possible to change that by configuration. ### \text * **Pro** adapts the font to the used math-font, n...
I should probably add that many of these instances are probably from documentation, so the effort to implement it will not be to manually change 169 instances. I think that \text and \mathrm are intended for different kinds of use. \mathrm is used for symbols like 'sin' that contain typically only a few letters. \text ...
[ { "body": "It turns out that both `\\mathrm` and `\\text` is used for printing \"text\" in the LaTeX printing routines. It seems like there should be one that is standard and that it should be possible to change that by configuration.\r\n\r\n### \\text\r\n * **Pro** adapts the font to the used math-font, not ne...
93a65b9bb8a615906e73d5885ff03076bcabc555
{ "head_commit": "e40f491c9e043c4abd39052301affd775c3e2a1a", "head_commit_message": "Changed mathrm to text and added tests", "patch_to_review": "diff --git a/sympy/core/numbers.py b/sympy/core/numbers.py\nindex 60ec5d36bec6..dec24a51b10d 100644\n--- a/sympy/core/numbers.py\n+++ b/sympy/core/numbers.py\n@@ -3200,...
[ { "diff_hunk": "@@ -1958,3 +1958,16 @@ def test_imaginary_unit():\n assert latex(1 + I, imaginary_unit='foo') == '1 + foo'\n assert latex(I, imaginary_unit=\"ti\") == '\\\\text{i}'\n assert latex(I, imaginary_unit=\"tj\") == '\\\\text{j}'\n+\n+\n+def test_DiffGeomMethods():\n+ from sympy.diffgeom...
c815cca1c346cbe680618992763a83e62f657401
diff --git a/sympy/core/numbers.py b/sympy/core/numbers.py index 08fa959ed12c..b7c01bdb2752 100644 --- a/sympy/core/numbers.py +++ b/sympy/core/numbers.py @@ -3141,7 +3141,7 @@ def __new__(cls): return AtomicExpr.__new__(cls) def _latex(self, printer): - return r"\mathrm{NaN}" + return r"\...
{ "difficulty": "low", "estimated_review_effort": 3, "problem_domain": "Code Refactoring / Architectural Improvement" }
sympy__sympy-15953@5b3665a
sympy/sympy
Python
15,953
solved Incorrect lambdify of constant times matrix symbol
<!-- 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://github.com/blog/1506-closing-issues...
2019-02-09T12:47:24Z
Incorrect lambdify of constant times matrix symbol ``` >>> A = MatrixSymbol("A", 3, 3) >>> f = lambdify(A, 2*A) >>> import numpy as np >>> f(np.array([[1, 2, 3], [1, 2, 3], [1, 2, 3]])) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<lambdifygenerated-4>", line 2, in _lambdifyge...
As far as lambdifying matrix expressions, some of the code that I wrote here may be useful https://github.com/ergs/transmutagen/blob/master/transmutagen/codegen.py. I am working on this. The fix for this was incorrect.
[ { "body": "```\r\n>>> A = MatrixSymbol(\"A\", 3, 3)\r\n>>> f = lambdify(A, 2*A)\r\n>>> import numpy as np\r\n>>> f(np.array([[1, 2, 3], [1, 2, 3], [1, 2, 3]]))\r\nTraceback (most recent call last):\r\n File \"<stdin>\", line 1, in <module>\r\n File \"<lambdifygenerated-4>\", line 2, in _lambdifygenerated\r\n ...
7d899577a672c2c9505e7aa7b894362eca5b4f6c
{ "head_commit": "5b3665a8cff66cba2b0d2e346e2f99ee5356692f", "head_commit_message": "added more test case", "patch_to_review": "diff --git a/sympy/printing/pycode.py b/sympy/printing/pycode.py\nindex fd70c73ab2e5..b22b709f571b 100644\n--- a/sympy/printing/pycode.py\n+++ b/sympy/printing/pycode.py\n@@ -7,7 +7,7 @@...
[ { "diff_hunk": "@@ -1130,6 +1130,22 @@ def test_issue_15827():\n if not numpy:\n skip(\"numpy not installed\")\n A = MatrixSymbol(\"A\", 3, 3)\n- f = lambdify(A, 2*A)\n+ B = MatrixSymbol(\"B\", 3, 2)\n+ C = MatrixSymbol(\"C\", 2, 3)", "line": null, "original_line": 1134, "or...
71a664e007dfcbff60449e0aac08cf32c06e475c
diff --git a/sympy/printing/pycode.py b/sympy/printing/pycode.py index fd70c73ab2e5..30b8679153e9 100644 --- a/sympy/printing/pycode.py +++ b/sympy/printing/pycode.py @@ -7,7 +7,7 @@ from collections import defaultdict from itertools import chain -from sympy.core import S, Number, Symbol +from sympy.core import S, ...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-15933@a16317f
sympy/sympy
Python
15,933
Add "nqubits" parameter to IntQubit
#### References to other Issues or PRs Fixes #9136 Fixes #12585 #### Brief description of what is fixed or changed This PR fixes the ambiguity of `IntQubit` constructor. ``` IntQubit(3).args == Qubit('11').args # bit pattern '11' (3) of implicit width 2 IntQubit(5, 4).args == Qubit('0101').args # bit patte...
2019-02-06T09:04:41Z
IntQubit doesn't work if the number of qubits to use is 1 Using Python 3.4 and SymPy 0.7.6, I came through this strange output : ``` >>> from sympy.physics.quantum.qubit import Qubit, IntQubit >>> IntQubit(0,1) |1> >>> IntQubit(1,1) |3> >>> Qubit(IntQubit(0,1)) |01> >>> Qubit(IntQubit(1,1)) |11> ``` Shouldn't it ret...
I believe this really a bug. I think it happened because `IntQubit` inherit `Qubit`, and `Qubit` accept two representation for qubit. For example, consider `v = |10101>` , you can use `Qubit("10101")`, or `Qubit(1,0,1,0,1)`. I like this library, but it looks like a forest for me when I was trying to debug the code th...
[ { "body": "Using Python 3.4 and SymPy 0.7.6, I came through this strange output : \n\n```\n>>> from sympy.physics.quantum.qubit import Qubit, IntQubit\n>>> IntQubit(0,1)\n|1>\n>>> IntQubit(1,1)\n|3>\n>>> Qubit(IntQubit(0,1))\n|01>\n>>> Qubit(IntQubit(1,1))\n|11>\n```\n\nShouldn't it return the same as `IntQubit...
e8cf4260af7461a42db9ed4edb2ab3fe442507c7
{ "head_commit": "a16317f5fb81c5a03724afb195c764fc45772894", "head_commit_message": "removed the trailing space missed in the previous commit", "patch_to_review": "diff --git a/examples/advanced/grover_example.py b/examples/advanced/grover_example.py\nindex 15b7f441a348..5d52c28408e3 100755\n--- a/examples/advanc...
[ { "diff_hunk": "@@ -282,10 +282,22 @@ class IntQubitState(QubitState):\n \"\"\"A base class for qubits that work with binary representations.\"\"\"\n \n @classmethod\n- def _eval_args(cls, args):\n+ def _eval_args(cls, args, **extra_args):", "line": null, "original_line": 285, "origina...
e8909b744a7fb2f48adcfe346cb61a2858ac2e41
diff --git a/examples/advanced/grover_example.py b/examples/advanced/grover_example.py index 15b7f441a348..5d52c28408e3 100755 --- a/examples/advanced/grover_example.py +++ b/examples/advanced/grover_example.py @@ -12,12 +12,12 @@ def demo_vgate_app(v): for i in range(2**v.nqubits): print('qapply(v*IntQu...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-15923@b33e6da
sympy/sympy
Python
15,923
raise value error for Eq(RootOf(), Symbol)
<!-- 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://github.com/blog/1506-closing-issues...
2019-02-04T15:14:55Z
Eq(RootOf(), y) evaluates as False Creating an Eq with a `RootOf` evaluates as False. ```julia In [20]: x = Symbol('x') In [21]: y = Symbol('y') ...
This is where it becomes false: https://github.com/sympy/sympy/blob/27f2f10b965f912ea38bb189e6b498ec00efdb08/sympy/polys/rootoftools.py#L964-L965 ``` In [10]: y.has(AppliedUndef) Out[10]: False In [11]: y.is_number Out[11]: False ``` As I teach digital design at the moment, I cannot help thinking that t...
[ { "body": "Creating an Eq with a `RootOf` evaluates as False.\r\n```julia\r\nIn [20]: x = Symbol('x') \r\n\r\nIn [21]: y = Symbol('y') ...
a7aed50f600c79c9b977b5e8059346312e625716
{ "head_commit": "b33e6da971528fd9b713a02dfadf8357569c2ec4", "head_commit_message": "modified code and add test", "patch_to_review": "diff --git a/sympy/polys/rootoftools.py b/sympy/polys/rootoftools.py\nindex 4a65b15822ae..749572848bec 100644\n--- a/sympy/polys/rootoftools.py\n+++ b/sympy/polys/rootoftools.py\n@...
[ { "diff_hunk": "@@ -12,7 +12,7 @@\n \n from sympy import (\n S, sqrt, I, Rational, Float, Lambda, log, exp, tan, Function, Eq,\n- solve, legendre_poly\n+ solve, legendre_poly, Symbol, Integral", "line": null, "original_line": 15, "original_start_line": null, "path": "sympy/polys/tests/...
2568b6cbb46bd6da6076412c1b50d573b665404a
diff --git a/sympy/polys/rootoftools.py b/sympy/polys/rootoftools.py index 4a65b15822ae..9be7920f80aa 100644 --- a/sympy/polys/rootoftools.py +++ b/sympy/polys/rootoftools.py @@ -970,8 +970,8 @@ def _eval_Eq(self, other): # is_real value of the CRootOf instance. if type(self) == type(other): ...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-15895@dfa991c
sympy/sympy
Python
15,895
NotImplementedError if nonlinsolve can't solve equations in real domain
<!-- 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://github.com/blog/1506-closing-issues...
2019-01-31T21:43:27Z
SolveSet: nonlinsolve return EmptySet() - Wrong Result I was trying to solve two non-linear equations ``` eq1 = (x+y)**2 - 9 eq2 = x**2 - y**2 -3/4 nonlinsolve((eq1, eq2), (c1, c2)) ``` But it returns ``` EmptySet() ``` I tried figuring it out and found that ``` is_zero_dimensional(polys, symbols...
That function is expected to return True if the solution set is finite, as it is in this example. There must be a bug in the implementation. You mean it just checks if the solution set is finite without actually finding the solutions. Note that this works as expected if you use a rational value for `3/4` instead of a f...
[ { "body": "I was trying to solve two non-linear equations\r\n\r\n```\r\neq1 = (x+y)**2 - 9\r\neq2 = x**2 - y**2 -3/4\r\nnonlinsolve((eq1, eq2), (c1, c2))\r\n```\r\n\r\nBut it returns\r\n\r\n```\r\nEmptySet()\r\n```\r\n\r\nI tried figuring it out and found that \r\n\r\n```\r\nis_zero_dimensional(polys, symbols):...
084b39efe9fec1683c4958d37ff5b8ee16428b1d
{ "head_commit": "dfa991c38934c16ae259397f311039f0be01fe1f", "head_commit_message": "NotImplementedError if nonlinsolve can't solve", "patch_to_review": "diff --git a/sympy/solvers/solveset.py b/sympy/solvers/solveset.py\nindex 5da01c2e6261..e50fb6003421 100644\n--- a/sympy/solvers/solveset.py\n+++ b/sympy/solver...
[ { "diff_hunk": "@@ -3051,7 +3053,11 @@ def nonlinsolve(system, *symbols):\n return result\n \n # positive dimensional system\n- return _handle_positive_dimensional(polys, symbols, denominators)\n+ res = _handle_positive_dimensional(polys, symbols, denominators)\n+ if...
495f19027cf447cd4b770ffa33775bae424f41de
diff --git a/sympy/solvers/solveset.py b/sympy/solvers/solveset.py index 5da01c2e6261..ee7d298cad19 100644 --- a/sympy/solvers/solveset.py +++ b/sympy/solvers/solveset.py @@ -2803,6 +2803,7 @@ def _handle_positive_dimensional(polys, symbols, denominators): new_system, symbols, result, [], denominators...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-15957@e75b4f3
sympy/sympy
Python
15,957
Fixed checkodesol 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://github.com/blog/1506-closing-issues...
2019-02-10T09:47:01Z
checkodesol doesn't recognise solution with unevaluatable integral checkodesol should report True/False to say whether an expression is a solution of an ODE e.g.: ```julia In [89]: eq = f(x).diff(x) - f(x) ...
I would like to work on this issue. @oscarbenjamin I had solved it in #15957 Please review.
[ { "body": "checkodesol should report True/False to say whether an expression is a solution of an ODE e.g.:\r\n```julia\r\nIn [89]: eq = f(x).diff(x) - f(x) \r\n\r\nIn [90]: eq ...
946be880abad6186c74eb3a10d608bebbcaf0851
{ "head_commit": "e75b4f30388f1d432dddd01bbff465d8fe77da20", "head_commit_message": "Update ode.py", "patch_to_review": "diff --git a/sympy/solvers/ode.py b/sympy/solvers/ode.py\nindex 8fc6f514a02b..bae3cb0eb974 100644\n--- a/sympy/solvers/ode.py\n+++ b/sympy/solvers/ode.py\n@@ -338,14 +338,13 @@\n )\n \n \n-...
[ { "diff_hunk": "@@ -363,25 +362,15 @@ def sub_func_doit(eq, func, new):\n x*(-1/(x**2*(z + 1/x)) + 1/(x**3*(z + 1/x)**2)) + 1/(x*(z + 1/x))\n ...- 1/(x**2*(z + 1/x)**2)\n \"\"\"\n- reps = {}\n- repu = {}\n- for d in eq.atoms(Derivative):\n- u = Dummy('u')\n- repu[u] = d.subs(f...
3dadce1e5ada0b09e55610f54ec36f3bd5e47f8e
diff --git a/sympy/solvers/ode.py b/sympy/solvers/ode.py index ad30197248dd..cff449b675d0 100644 --- a/sympy/solvers/ode.py +++ b/sympy/solvers/ode.py @@ -343,10 +343,6 @@ def sub_func_doit(eq, func, new): When replacing the func with something else, we usually want the derivative evaluated, so this function ...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-15846@36b0677
sympy/sympy
Python
15,846
Integration of Polygon gives no len() error solved
<!-- Your title above should be a short description of what was changed. Do not include the issue number in the title. --> Fixes #15843 #### 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://github.com/blog/1506-c...
2019-01-25T21:49:05Z
`polytope_integrate`: Polygon vertex order assumption The `Polygon` class has a positive area if the vertices are in ccw order. In contrast the default behaviour of `polytope_integrate` is given the same polygon that the integral of, for example, the one function is negative. This inconsistent behaviour is especiall...
I will be looking up on the issue. @jgersti Can you please share the code of what were you trying to do. Especially the arguments passed. Here is the condensed source file which shows the second issue. The expected output is three times `1`. [issue15843.py.txt](https://github.com/sympy/sympy/files/2796186/issue15843.p...
[ { "body": "The `Polygon` class has a positive area if the vertices are in ccw order. In contrast the default behaviour of `polytope_integrate` is given the same polygon that the integral of, for example, the one function is negative.\r\n\r\nThis inconsistent behaviour is especially noticeable because the `polyt...
da9fdef5e00f40dfd500bfa356c61ce6bad1b559
{ "head_commit": "36b06774bed6eb74902c9b97da1f4ebb3899422a", "head_commit_message": "Added test cases and added functionality to pass both list and Polygon object", "patch_to_review": "diff --git a/sympy/integrals/intpoly.py b/sympy/integrals/intpoly.py\nindex 7aa41207acba..0cc60649f60e 100644\n--- a/sympy/integr...
[ { "diff_hunk": "@@ -1009,19 +1009,26 @@ def point_sort(poly, normal=None, clockwise=True):\n >>> point_sort([Point(0, 0), Point(1, 0), Point(1, 1)])\n [Point2D(1, 1), Point2D(1, 0), Point2D(0, 0)]\n \"\"\"\n- n = len(poly)\n+ flag = 0", "line": null, "original_line": 1012, "origina...
79fe1eea987ab6b8e746afa3baee5bf7c8652c49
diff --git a/sympy/integrals/intpoly.py b/sympy/integrals/intpoly.py index 7aa41207acba..776d2d87f8bb 100644 --- a/sympy/integrals/intpoly.py +++ b/sympy/integrals/intpoly.py @@ -62,9 +62,9 @@ def polytope_integrate(poly, expr=None, **kwargs): clockwise = kwargs.get('clockwise', False) max_degree = kwargs.get...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-15686@2f0f34f
sympy/sympy
Python
15,686
update pretty printer for physics vector
<!-- 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://github.com/blog/1506-closing-issues...
2018-12-23T18:26:13Z
Tuple of Physics Unit Vectors Errors on Rendering in Jupyter Notebook ```python import sympy as sm sm.init_printing() import sympy.physics.mechanics as me N = me.ReferenceFrame('N') N.x, N.y, N.z ``` ``` --------------------------------------------------------------------------- AttributeError ...
@moorepants i would like to work on this issue can you tell me more about this. The pretty printer seems to fail for the physics vectors.
[ { "body": "```python\r\nimport sympy as sm\r\nsm.init_printing()\r\nimport sympy.physics.mechanics as me\r\nN = me.ReferenceFrame('N')\r\nN.x, N.y, N.z\r\n```\r\n\r\n```\r\n---------------------------------------------------------------------------\r\nAttributeError Traceback (most re...
a627ef1d3b8d89be3349d6d59d8642d64afb02e5
{ "head_commit": "2f0f34f721689c3eb22d3ea9f78f51214096763e", "head_commit_message": "update pretty printer for physics vector", "patch_to_review": "diff --git a/sympy/printing/pretty/pretty.py b/sympy/printing/pretty/pretty.py\nindex a696db126202..26c93f8751e5 100644\n--- a/sympy/printing/pretty/pretty.py\n+++ b/...
[ { "diff_hunk": "@@ -6483,3 +6483,11 @@ def test_issue_15560():\n e = pretty(a*(KroneckerProduct(a, a)))\n result = 'a*(a x a)'\n assert e == result\n+\n+def test_issue_15583():\n+ from sympy.physics import mechanics", "line": null, "original_line": 6488, "original_start_line": null, ...
d3d1dd2c8cdd29bf42143233fd3c863af79715d0
diff --git a/sympy/printing/pretty/pretty.py b/sympy/printing/pretty/pretty.py index a696db126202..26c93f8751e5 100644 --- a/sympy/printing/pretty/pretty.py +++ b/sympy/printing/pretty/pretty.py @@ -1977,21 +1977,37 @@ def _print_SeqFormula(self, s): def _print_seq(self, seq, left=None, right=None, delimiter=', ',...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-15719@ef0144b
sympy/sympy
Python
15,719
printing unevaluated Integrals
<!-- 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. See https://github.com/blog/1506-closing-issues-via-pull-requ...
2019-01-01T20:21:26Z
Definite integral of -3**x*exp(-3)*log(3**x*exp(-3)/factorial(x))/factorial(x) returns an object that cannot be printed ``` >>> from sympy import * >>> x = Symbol('x') >>> e = -3**x*exp(-3)*log(3**x*exp(-3)/factorial(x))/factorial(x) >>> i = integrate(e, [x, -oo, oo]) >>> i Traceback (most recent call last): F...
I am working on this and i think that problem is with limits. I think problem is with limits because of factorial it can't be negative. It seems that ValueError should be handled [here](https://github.com/sympy/sympy/blob/master/sympy/core/expr.py#L1061) in addition to TypeError. @jksuom I think it is working ,there ...
[ { "body": "```\r\n>>> from sympy import *\r\n>>> x = Symbol('x')\r\n>>> e = -3**x*exp(-3)*log(3**x*exp(-3)/factorial(x))/factorial(x)\r\n>>> i = integrate(e, [x, -oo, oo])\r\n>>> i\r\nTraceback (most recent call last):\r\n File \"/home/e/se/sympy/core/evalf.py\", line 1306, in evalf\r\n rf = evalf_table[x.f...
afb923c44b958af0d62d965cf6891300c3e9cfe9
{ "head_commit": "ef0144b78ae6785680e2657f4d0b5976a3658772", "head_commit_message": "test case added", "patch_to_review": "diff --git a/sympy/core/expr.py b/sympy/core/expr.py\nindex 0e0b59d392d9..5ff2a69402ab 100644\n--- a/sympy/core/expr.py\n+++ b/sympy/core/expr.py\n@@ -1058,7 +1058,7 @@ def as_terms(self):\n ...
[ { "diff_hunk": "@@ -809,3 +810,9 @@ def test_MatrixSymbol_printing():\n def test_Subs_printing():\n assert str(Subs(x, (x,), (1,))) == 'Subs(x, x, 1)'\n assert str(Subs(x + y, (x, y), (1, 2))) == 'Subs(x + y, (x, y), (1, 2))'\n+\n+def test_issue_15716():\n+ x = Symbol('x')\n+ e = -3**x*exp(-3)*log...
237139d53e9e05992201532cff16a52df51eaaf6
diff --git a/sympy/core/expr.py b/sympy/core/expr.py index 0e0b59d392d9..5ff2a69402ab 100644 --- a/sympy/core/expr.py +++ b/sympy/core/expr.py @@ -1058,7 +1058,7 @@ def as_terms(self): if factor.is_number: try: coeff *= complex(factor) - ...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-15678@35dcb42
sympy/sympy
Python
15,678
geometry/util: fixed idiff() for Function support
<!-- 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://github.com/blog/1506-closing-issu...
2018-12-20T18:11:56Z
Some issues with idiff idiff doesn't support Eq, and it also doesn't support f(x) instead of y. Both should be easy to correct. ``` >>> idiff(Eq(y*exp(y), x*exp(x)), y, x) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "./sympy/geometry/util.py", line 582, in idiff yp = solv...
Hi i am a beginner and i would like to work on this issue. @krishna-akula are you still working on this?... I'd like to work on it too See comments on #15678. I can see adding `f(x)` support but not Eq for reasons given there. See #5030 But `idiff` is in the class of functions that assumes the expression = 0 (see the d...
[ { "body": "idiff doesn't support Eq, and it also doesn't support f(x) instead of y. Both should be easy to correct.\r\n\r\n```\r\n>>> idiff(Eq(y*exp(y), x*exp(x)), y, x)\r\nTraceback (most recent call last):\r\n File \"<stdin>\", line 1, in <module>\r\n File \"./sympy/geometry/util.py\", line 582, in idiff\r\...
31c68eef3ffef39e2e792b0ec92cd92b7010eb2a
{ "head_commit": "35dcb42b53f0317313c95f14b7af5ba9025d36e7", "head_commit_message": "Added tests for idiff()\n\nAdded 5 tests in test_idiff() in geometry/tests/test_util.py", "patch_to_review": "diff --git a/sympy/geometry/tests/test_util.py b/sympy/geometry/tests/test_util.py\nindex a6ded4406202..1ea72584cd39 10...
[ { "diff_hunk": "@@ -570,12 +571,22 @@ def idiff(eq, y, x, n=1):\n y = y[0]\n elif isinstance(y, Symbol):\n dep = {y}\n+ elif isinstance(y, Function):\n+ pass\n else:\n- raise ValueError(\"expecting x-dependent symbol(s) but got: %s\" % y)\n+ raise ValueError(\"exp...
15c835a8542590a0f47c1f19780bbaba51777cf8
diff --git a/sympy/geometry/tests/test_util.py b/sympy/geometry/tests/test_util.py index a6ded4406202..367ee7f0c209 100644 --- a/sympy/geometry/tests/test_util.py +++ b/sympy/geometry/tests/test_util.py @@ -1,5 +1,5 @@ -from sympy import Symbol, sqrt, Derivative, S -from sympy.geometry import Point, Point2D, Line, Circ...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-15835@60f710c
sympy/sympy
Python
15,835
correct dot product of numpy matrix
<!-- 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://github.com/blog/1506-closing-issues...
2019-01-24T11:51:03Z
Incorrect lambdify of constant times matrix symbol ``` >>> A = MatrixSymbol("A", 3, 3) >>> f = lambdify(A, 2*A) >>> import numpy as np >>> f(np.array([[1, 2, 3], [1, 2, 3], [1, 2, 3]])) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<lambdifygenerated-4>", line 2, in _lambdifyge...
As far as lambdifying matrix expressions, some of the code that I wrote here may be useful https://github.com/ergs/transmutagen/blob/master/transmutagen/codegen.py. I am working on this.
[ { "body": "```\r\n>>> A = MatrixSymbol(\"A\", 3, 3)\r\n>>> f = lambdify(A, 2*A)\r\n>>> import numpy as np\r\n>>> f(np.array([[1, 2, 3], [1, 2, 3], [1, 2, 3]]))\r\nTraceback (most recent call last):\r\n File \"<stdin>\", line 1, in <module>\r\n File \"<lambdifygenerated-4>\", line 2, in _lambdifygenerated\r\n ...
27f2f10b965f912ea38bb189e6b498ec00efdb08
{ "head_commit": "60f710c050d4f9b8b9032e9f251d10e5083017ec", "head_commit_message": "correct dot product of numpy matrix", "patch_to_review": "diff --git a/sympy/printing/pycode.py b/sympy/printing/pycode.py\nindex 9e8d5e7eff3d..15376099d7d8 100644\n--- a/sympy/printing/pycode.py\n+++ b/sympy/printing/pycode.py\n...
[ { "diff_hunk": "@@ -497,7 +497,7 @@ def _print_seq(self, seq):\n \n def _print_MatMul(self, expr):\n \"Matrix multiplication printer\"\n- return '({0})'.format(').dot('.join(self._print(i) for i in expr.args))\n+ return '({0})'.format(').dot('.join([self._print(expr.args[1]), self._pri...
60758b991e1dfe3f941efa3dded3aef4e7b49433
diff --git a/sympy/printing/pycode.py b/sympy/printing/pycode.py index 98d9e1ab87f8..fd70c73ab2e5 100644 --- a/sympy/printing/pycode.py +++ b/sympy/printing/pycode.py @@ -7,9 +7,9 @@ from collections import defaultdict from itertools import chain -from sympy.core import S -from .codeprinter import CodePrinter +from...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-15576@a689a84
sympy/sympy
Python
15,576
Avoid infinite integration by parts in manualintegrate
#### References to other Issues or PRs Fixes #9858 #### Brief description of what is fixed or changed With an integral like `exp(x) * cos(exp(x))`, manualintegrate attempts integration by parts with `u = cos(exp(x))`, which "succeeds", but leads to an infinite chain of different integrals such as `exp(n*x) * ...
2018-12-01T23:11:14Z
manualintegrate(exp(x)*cos(exp(x)), x) infinite loop `manualintegrate(exp(x)*cos(exp(x)), x)` goes into an infinite loop when it tries to do integration by parts. It picks `cos(exp(x))` as u and `exp(x)` as dv by the LIATE rule, and then tries to evaluate the integral v*du. This causes it to try integration by parts ...
[ { "body": "`manualintegrate(exp(x)*cos(exp(x)), x)` goes into an infinite loop when it tries to do integration by parts. \n\nIt picks `cos(exp(x))` as u and `exp(x)` as dv by the LIATE rule, and then tries to evaluate the integral v*du. This causes it to try integration by parts again and causes the infinite re...
bdb001b09fdcfeb1be51f7e41206169bb89e66a0
{ "head_commit": "a689a84a7628567646ab8e40bd4bc6dc280a914d", "head_commit_message": "Avoid infinite integration by parts in manualintegrate\n\nWith an integral like `exp(x) * cos(exp(x))`, manualintegrate attempts\nintegration by parts with `u = cos(exp(x))`, which \"succeeds\", but\nleads to an infinite chain of d...
[ { "diff_hunk": "@@ -496,6 +496,12 @@ def parts_rule(integral):\n if isinstance(v, sympy.Integral):\n return\n \n+ # Set a limit on the number of times u can be used\n+ cachekey = u.xreplace({symbol: _cache_dummy})\n+ if _parts_u_cache[cachekey] > 5:", "line": null, ...
17c1930e4dc1623a9a9d986a8ec134a78e78acda
diff --git a/sympy/integrals/manualintegrate.py b/sympy/integrals/manualintegrate.py index 4938ebc88fe1..b4bf0ece98f0 100644 --- a/sympy/integrals/manualintegrate.py +++ b/sympy/integrals/manualintegrate.py @@ -18,7 +18,7 @@ """ from __future__ import print_function, division -from collections import namedtuple +fr...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
sympy__sympy-15542@8af0665
sympy/sympy
Python
15,542
Point: redefine distance() in Point to work for Line and other GeometryEntity
point : modified `distance` to work for any Linear Entity . <!-- 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....
2018-11-24T07:31:00Z
Should Point.distance(Line) return distance? In Geometry module, `Line.distance(Point)` can be used to compute distance, but `Point.distance(Line)` cannot. Should this be made symmetric? ``` >>> L = Line((1, 1), (2, 2)) >>> P = Point(1, 0) >>> L.distance(P) sqrt(2)/2 >>> P.distance(L) Traceback (most recent cal...
It would be natural that `distance` be symmetric. That is not even hard to implement. I think it is right for `distance` to be symmetric . I would like to give this a try .
[ { "body": "In Geometry module, `Line.distance(Point)` can be used to compute distance, but `Point.distance(Line)` cannot. Should this be made symmetric? \r\n```\r\n>>> L = Line((1, 1), (2, 2))\r\n>>> P = Point(1, 0)\r\n>>> L.distance(P)\r\nsqrt(2)/2\r\n>>> P.distance(L)\r\nTraceback (most recent call last):\r\n...
495e749818bbcd55dc0d9ee7101cb36646e4277a
{ "head_commit": "8af0665bb67cbdc7905c8652211b5941055367fc", "head_commit_message": " Point : made distance symmetric\n\n distance function first checks whether argument passed( other) is a Geomety entity.\n If other is not a GeometryEntity , it is converted into a Point if it is a tuple or a list\n oth...
[ { "diff_hunk": "@@ -402,19 +406,28 @@ def distance(self, p):\n Examples\n ========\n \n- >>> from sympy.geometry import Point\n+ >>> from sympy.geometry import Point, Line\n >>> p1, p2 = Point(1, 1), Point(4, 5)\n+ >>> l = Line((3, 1), (2, 2))\n >>> p1.distan...
677b646622daf0299ee3f25122e55f7d6cc33ad8
diff --git a/sympy/geometry/point.py b/sympy/geometry/point.py index 5c8636e688b1..69afbd1d9c66 100644 --- a/sympy/geometry/point.py +++ b/sympy/geometry/point.py @@ -380,19 +380,20 @@ def are_coplanar(cls, *points): points = list(uniq(points)) return Point.affine_rank(*points) <= 2 - def distanc...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-15434@8be0927
sympy/sympy
Python
15,434
Rescale ODEs to match Euler solver
<!-- 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://github.com/blog/1506-closing-issues...
2018-10-28T10:44:27Z
Euler ODE solver should recognize when there is a missing factor of x ``` >>> classify_ode(eqn.doit().expand()) () >>> classify_ode((x**2*eqn.doit()).expand()) ('nth_linear_euler_eq_nonhomogeneous_variation_of_parameters', 'nth_linear_euler_eq_nonhomogeneous_variation_of_parameters_Integral') ``` Probably the s...
What is `eqn` defined as? Oh derp. It's from the [mailing list](https://groups.google.com/forum/#!topic/sympy/VBRmeCCAN0U). ``` >>> eqn.doit() -exp(x) + (x*Derivative(f(x), (x, 2)) + Derivative(f(x), x))/x ``` The original `eqn` is in factored form, but that's a separate issue from this (although I do think c...
[ { "body": "```\r\n>>> classify_ode(eqn.doit().expand())\r\n()\r\n>>> classify_ode((x**2*eqn.doit()).expand())\r\n('nth_linear_euler_eq_nonhomogeneous_variation_of_parameters', 'nth_linear_euler_eq_nonhomogeneous_variation_of_parameters_Integral')\r\n```\r\n\r\nProbably the simplest way to fix this would be to m...
60347e07600dfe0eeb279da3f6207343adc8f78b
{ "head_commit": "8be0927428a669e4eea3ac189e1c92b0960356bc", "head_commit_message": "Update classify_ode doctest after nth_euler fixes", "patch_to_review": "diff --git a/sympy/solvers/ode.py b/sympy/solvers/ode.py\nindex d95efe24498a..6f0a5e06bfdc 100644\n--- a/sympy/solvers/ode.py\n+++ b/sympy/solvers/ode.py\n@@...
[ { "diff_hunk": "@@ -2420,6 +2428,16 @@ def test_nth_order_linear_euler_eq_nonhomogeneous_variation_of_parameters():\n assert dsolve(eq, f(x), hint=our_hint).rhs in (sol, sols)\n assert checkodesol(eq, sol, order=2, solve_for_func=False)[0]\n \n+ eq = -exp(x) + (x*Derivative(f(x), (x, 2)) + Derivative...
385c443e011dcc6dae41fc0febd8fb1832ee02f7
diff --git a/sympy/solvers/ode.py b/sympy/solvers/ode.py index d95efe24498a..1ac4f6557e84 100644 --- a/sympy/solvers/ode.py +++ b/sympy/solvers/ode.py @@ -934,7 +934,8 @@ class in it. Note that a hint may do this anyway if '1st_homogeneous_coeff_subs_indep_div_dep', '1st_homogeneous_coeff_subs_dep_div_indep'...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
sympy__sympy-15816@a5e02c3
sympy/sympy
Python
15,816
change float value of radius to Rational in circle
<!-- 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://github.com/blog/1506-closing-issues...
2019-01-20T21:58:23Z
Tangent line to Circle does not work Running the code: ``` from sympy.geometry import Point, Line, Circle Ri = 0.024127189424130748 Ci = Point(0.0864931002830291, 0.0819863295239654) A = Point(0, 0.0578591400998346) c = Circle(Ci, Ri) Lax = Line(A, slope=0) print(c.is_tangent(Lax)) # Gives False I = c.tangent_...
I think this is due to many points after the decimal as you can see Lax.distance(Ci) and Ri has a very small difference (should be zero but not), I think due to this it is showing "false" for the tangent. although `c.is_tangent(c.tangent_lines(A)[1])` and `c.is_tangent(c.tangent_lines(A)[0)` are also giving false . I ...
[ { "body": "Running the code:\r\n```\r\nfrom sympy.geometry import Point, Line, Circle\r\nRi = 0.024127189424130748\r\nCi = Point(0.0864931002830291, 0.0819863295239654)\r\nA = Point(0, 0.0578591400998346)\r\nc = Circle(Ci, Ri)\r\nLax = Line(A, slope=0)\r\nprint(c.is_tangent(Lax)) # Gives False\r\nI = c.tangent_...
2d4eb2fd9f8333bb1992c31069f256db542b589b
{ "head_commit": "a5e02c3215628bef2ada3538def7a60694e9af53", "head_commit_message": "added method for changing fractional value to Rational value for radius", "patch_to_review": "diff --git a/sympy/geometry/ellipse.py b/sympy/geometry/ellipse.py\nindex b817740506d2..905e16f21161 100644\n--- a/sympy/geometry/ellip...
[ { "diff_hunk": "@@ -1436,7 +1437,11 @@ def __new__(cls, *args, **kwargs):\n elif len(args) == 2:\n # Assume (center, radius) pair\n c = Point(args[0], dim=2)\n- r = sympify(args[1])\n+ r = Tuple(args[1], )\n+ r = r.xreplace...
200826c83d3dc1e39177a19d0abb88e97f4f1bc2
diff --git a/sympy/geometry/ellipse.py b/sympy/geometry/ellipse.py index 88c0cccb478c..d0bd20a05995 100644 --- a/sympy/geometry/ellipse.py +++ b/sympy/geometry/ellipse.py @@ -10,11 +10,12 @@ from sympy import Expr, Eq from sympy.core import S, pi, sympify +from sympy.core.evaluate import global_evaluate from sympy...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
streamlit__streamlit-10264@6ce95a2
streamlit/streamlit
Python
10,264
Allow hiding dataframe columns from UI
## Describe your changes Allow users to show & hide dataframe columns from UI via the column menu: <img width="307" alt="image" src="https://github.com/user-attachments/assets/20acf147-9742-4df4-8905-b2dd7c16b55d" /> This also adds a new toolbar action that allows showing & hiding all columns of the dataframe:...
2025-01-27T21:31:24Z
Show and hide dataframe columns in UI I think it will be nice to have where we can show or hide dataframe columns. For example if we have too many columns and we just want some for comparison we can hide them and later as necessary we can show too --- Community voting on feature requests enables the Streamlit ...
I assume you mean by clicking on them in the UI, not programmatically? programmatically you can do this now via the new `column_order` parameter. Talking about via UI🙂 +1
[ { "body": "I think it will be nice to have where we can show or hide dataframe columns.\r\n\r\nFor example if we have too many columns and we just want some for comparison we can hide them and later as necessary we can show too\r\n\r\n---\r\n\r\nCommunity voting on feature requests enables the Streamlit team to...
4b6501addf8fdd7ba216be792398b602ce5a9463
{ "head_commit": "6ce95a28aa02825a48241e576d551e0406b1cef5", "head_commit_message": "Update menu state", "patch_to_review": "diff --git a/frontend/lib/src/components/widgets/DataFrame/ColumnMenu.tsx b/frontend/lib/src/components/widgets/DataFrame/ColumnMenu.tsx\nindex ed33cab8acc1..e03e2c88317c 100644\n--- a/fron...
[ { "diff_hunk": "@@ -0,0 +1,218 @@\n+/**\n+ * Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2025)\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ ...
597aec0f3cb55f8849fc97cb5186f9103825d1d2
diff --git a/e2e_playwright/__snapshots__/linux/st_dataframe_interactions_test/st_data_editor-row_deletion_toolbar[dark_theme-chromium].png b/e2e_playwright/__snapshots__/linux/st_dataframe_interactions_test/st_data_editor-row_deletion_toolbar[dark_theme-chromium].png index 6c627d82b3a8..687c139d534e 100644 Binary file...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "New Feature Additions" }
sympy__sympy-15379@5f83494
sympy/sympy
Python
15,379
Reverted changes to code printer due to performance issues.
<!-- 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://github.com/blog/1506-closing-issues...
2018-10-11T19:54:24Z
ccode excessively slow when using user_functions The following code takes 28 seconds to run: ``` import sympy as sy x = sy.Symbol('x') foo = sy.Function('foo') sy.ccode(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(x))))))))))))), user_functions={'foo':'foo'}) ``` This seems excessively slow. It seems ...
I found a workaround for this issue, in case this affects someone else. Instead of using `Function('foo')`, make foo a subclass of sympy.Function that defines the following method: ``` def _ccode(self, printer): return f"{type(self).__name__}({', '.join(printer._print(arg) for arg in self.args)})" ``` Then ...
[ { "body": "The following code takes 28 seconds to run:\r\n\r\n```\r\nimport sympy as sy\r\nx = sy.Symbol('x')\r\nfoo = sy.Function('foo')\r\nsy.ccode(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(x))))))))))))), user_functions={'foo':'foo'})\r\n```\r\n\r\nThis seems excessively slow. It seems to scale exp...
813328e6a9daa2655c03828ed3709af2675f3b29
{ "head_commit": "5f834941ff3b9dd73e8cd3cfb118f8b8bd21c88e", "head_commit_message": "Reverted changes to code printer due to performance issues.\n\nFixes #15377\n\nThe C code printer was changed in #13692 to support the Mod function by\nincluding a set of lambda statements in known_function. This required\nmany mor...
[ { "diff_hunk": "@@ -299,6 +288,14 @@ def _print_Pow(self, expr):\n return '%spow%s(%s, %s)' % (self._ns, suffix, self._print(expr.base),\n self._print(expr.exp))\n \n+ def _print_Mod(self, expr):\n+ num, den = expr.args\n+ if num.is_integer and den...
5c0d090d208758b8838711ba57da655665113c71
diff --git a/sympy/printing/ccode.py b/sympy/printing/ccode.py index a983b140202d..35eaa76d1ac7 100644 --- a/sympy/printing/ccode.py +++ b/sympy/printing/ccode.py @@ -33,17 +33,6 @@ # Used in C89CodePrinter._print_Function(self) known_functions_C89 = { "Abs": [(lambda x: not x.is_integer, "fabs"), (lambda x: x.i...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Performance Optimizations" }
sympy__sympy-15346@99fe375
sympy/sympy
Python
15,346
trigsimp: changes order of TRmorrie and TR10i in trigsimp.py
simplify : Fix order of TR10i and TRmorrie in trgsimp.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. "F...
2018-10-05T17:25:21Z
can't simplify sin/cos with Rational? latest cloned sympy, python 3 on windows firstly, cos, sin with symbols can be simplified; rational number can be simplified ```python from sympy import * x, y = symbols('x, y', real=True) r = sin(x)*sin(y) + cos(x)*cos(y) print(r) print(r.simplify()) print() r = Ratio...
some can be simplified ```python from sympy import * t1 = Matrix([sin(Rational(1, 50)), cos(Rational(1, 50)), 0]) t2 = Matrix([sin(Rational(2, 50)), cos(Rational(2, 50)), 0]) t3 = Matrix([sin(Rational(3, 50)), cos(Rational(3, 50)), 0]) r1 = t1.dot(t2) print(r1) print(r1.simplify()) print() r2 = t2.dot(t...
[ { "body": "latest cloned sympy, python 3 on windows\r\nfirstly, cos, sin with symbols can be simplified; rational number can be simplified\r\n```python\r\nfrom sympy import *\r\n\r\nx, y = symbols('x, y', real=True)\r\nr = sin(x)*sin(y) + cos(x)*cos(y)\r\nprint(r)\r\nprint(r.simplify())\r\nprint()\r\n\r\nr = Ra...
9ef28fba5b4d6d0168237c9c005a550e6dc27d81
{ "head_commit": "99fe375f997fe5405453905c23b8a65a20870d25", "head_commit_message": "trigsimp: Added test cases", "patch_to_review": "diff --git a/sympy/simplify/tests/test_trigsimp.py b/sympy/simplify/tests/test_trigsimp.py\nindex 644b06d464df..90e0584b0d0d 100644\n--- a/sympy/simplify/tests/test_trigsimp.py\n++...
[ { "diff_hunk": "@@ -357,6 +358,14 @@ def test_issue_2827_trigsimp_methods():\n eq = 1/sqrt(E) + E\n assert exptrigsimp(eq) == eq\n \n+def test_issue_15129_trigsimp_methods():\n+ t1 = Matrix([sin(Rational(1, 50)), cos(Rational(1, 50)), 0])\n+ t2 = Matrix([sin(Rational(1, 25)), cos(Rational(1, 25)),...
83e1ba0b6514287d3da4a8f7c3c971c409d44b94
diff --git a/sympy/simplify/tests/test_trigsimp.py b/sympy/simplify/tests/test_trigsimp.py index 644b06d464df..546d9d3bdec5 100644 --- a/sympy/simplify/tests/test_trigsimp.py +++ b/sympy/simplify/tests/test_trigsimp.py @@ -1,7 +1,8 @@ from sympy import ( symbols, sin, simplify, cos, trigsimp, rad, tan, exptrigsim...
{ "difficulty": "low", "estimated_review_effort": 2, "problem_domain": "Bug Fixes" }
sympy__sympy-15338@1e938d6
sympy/sympy
Python
15,338
Fix wrong result in create_expand_pow_optimization(). Partially fixes #15335
<!-- 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://github.com/blog/1506-closing-issues...
2018-10-04T12:53:09Z
create_expand_pow_optimization() is not robust Using SymPy 1.3: ``` import sympy as sp from sympy.codegen.rewriting import create_expand_pow_optimization expand_opt = create_expand_pow_optimization(7) a = sp.symbols("a") expr = a**(5) - a**2 print("should be a**5 - a**2:",expr) print("should be a*a*a*a*a - a*...
CC @bjodah Replacing ``` return ReplaceOptim( lambda e: e.is_Pow and e.base.is_symbol and e.exp.is_integer and e.exp <= limit, lambda p: Mul(*([p.base]*p.exp), evaluate=False) ) ``` with ``` return ReplaceOptim( lambda e: e.is_Pow and e.base.is_symbol and e.exp.is_integer and ...
[ { "body": "Using SymPy 1.3:\r\n\r\n```\r\nimport sympy as sp\r\nfrom sympy.codegen.rewriting import create_expand_pow_optimization\r\nexpand_opt = create_expand_pow_optimization(7)\r\na = sp.symbols(\"a\")\r\nexpr = a**(5) - a**2\r\nprint(\"should be a**5 - a**2:\",expr)\r\nprint(\"should be a*a*a*a*a - a*a:\",...
9ef28fba5b4d6d0168237c9c005a550e6dc27d81
{ "head_commit": "1e938d64a1947006cbdcc0ab6facb0b2439edcf1", "head_commit_message": "Add new test of create_expand_pow_optimization() to validate against issue #15335", "patch_to_review": "diff --git a/sympy/codegen/rewriting.py b/sympy/codegen/rewriting.py\nindex c005717c56bf..f5742d2fb62d 100644\n--- a/sympy/co...
[ { "diff_hunk": "@@ -169,3 +169,5 @@ def test_create_expand_pow_optimization():\n \n sin4x = sin(x)**4\n assert ccode(optimize(sin4x, [my_opt])) == 'pow(sin(x), 4)'\n+\n+ assert ccode(optimize((x**(-4)), [my_opt])) == 'x**(-4)'", "line": null, "original_line": 173, "original_start_line": n...
169d2b919ec874642dfa33172a92a3bd63fe7d57
diff --git a/sympy/codegen/rewriting.py b/sympy/codegen/rewriting.py index c005717c56bf..f5742d2fb62d 100644 --- a/sympy/codegen/rewriting.py +++ b/sympy/codegen/rewriting.py @@ -221,7 +221,7 @@ def create_expand_pow_optimization(limit): """ return ReplaceOptim( - lambda e: e.is_Pow and e.base.is_sym...
{ "difficulty": "low", "estimated_review_effort": 2, "problem_domain": "Bug Fixes" }
sympy__sympy-15345@8779f99
sympy/sympy
Python
15,345
Mathematica code printing of Max and Min
<!-- 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://github.com/blog/1506-closing-issues...
2018-10-05T06:00:31Z
mathematica_code gives wrong output with Max If I run the code ``` x = symbols('x') mathematica_code(Max(x,2)) ``` then I would expect the output `'Max[x,2]'` which is valid Mathematica code but instead I get `'Max(2, x)'` which is not valid Mathematica code.
Hi, I'm new (to the project and development in general, but I'm a long time Mathematica user) and have been looking into this problem. The `mathematica.py` file goes thru a table of known functions (of which neither Mathematica `Max` or `Min` functions are in) that are specified with lowercase capitalization, so it ...
[ { "body": "If I run the code\r\n\r\n```\r\nx = symbols('x')\r\nmathematica_code(Max(x,2))\r\n```\r\n\r\nthen I would expect the output `'Max[x,2]'` which is valid Mathematica code but instead I get `'Max(2, x)'` which is not valid Mathematica code.", "number": 15344, "title": "mathematica_code gives wro...
9ef28fba5b4d6d0168237c9c005a550e6dc27d81
{ "head_commit": "8779f99166eae65e124330b66fc4086700fd5334", "head_commit_message": "Mathematica code printing of Max and Min", "patch_to_review": "diff --git a/sympy/printing/mathematica.py b/sympy/printing/mathematica.py\nindex ea7e3a2d9478..eaf90d7512f8 100644\n--- a/sympy/printing/mathematica.py\n+++ b/sympy/...
[ { "diff_hunk": "@@ -101,6 +102,8 @@ def _print_Function(self, expr):\n return \"%s[%s]\" % (mfunc, self.stringify(expr.args, \", \"))\n return expr.func.__name__ + \"[%s]\" % self.stringify(expr.args, \", \")\n \n+ _print_Expr = _print_Function", "line": null, "original_li...
311b75f48fcea27bb4f97f64523fd595dcd4706b
diff --git a/sympy/printing/mathematica.py b/sympy/printing/mathematica.py index ea7e3a2d9478..9505e008dc31 100644 --- a/sympy/printing/mathematica.py +++ b/sympy/printing/mathematica.py @@ -31,7 +31,8 @@ "asech": [(lambda x: True, "ArcSech")], "acsch": [(lambda x: True, "ArcCsch")], "conjugate": [(lambd...
{ "difficulty": "low", "estimated_review_effort": 2, "problem_domain": "Bug Fixes" }
sympy__sympy-15269@d6962ac
sympy/sympy
Python
15,269
Modified Ellipse to return segment when h or v radius is zero
<!-- 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://github.com/blog/1506-closing-issues...
2018-09-19T14:51:58Z
Ellipse with 0 h or v radius is Segment ``` >>> Ellipse((a, b),3,0) Ellipse(Point2D(0, 0), 3, 0) >>> _.equation() x**2/9 + zoo*y**2 - 1 ``` This could be ``` Segment((a-3,b),(a+3,b)) ``` and similar for the case when hradius is 0. When both are zero, a Point should be obtained.
[ { "body": "```\r\n>>> Ellipse((a, b),3,0)\r\nEllipse(Point2D(0, 0), 3, 0)\r\n>>> _.equation()\r\nx**2/9 + zoo*y**2 - 1\r\n```\r\nThis could be\r\n```\r\nSegment((a-3,b),(a+3,b))\r\n```\r\nand similar for the case when hradius is 0. When both are zero, a Point should be obtained.", "number": 15268, "titl...
8011678f370ee24665aed21413231de476d669ae
{ "head_commit": "d6962ac4d8954dc62f9ec8fd99ff586e1a0cb55b", "head_commit_message": "Remove trailing whitespace in geometry/test_ellipse.py", "patch_to_review": "diff --git a/sympy/geometry/ellipse.py b/sympy/geometry/ellipse.py\nindex 93766e25d358..93d9a2217051 100644\n--- a/sympy/geometry/ellipse.py\n+++ b/symp...
[ { "diff_hunk": "@@ -147,6 +147,15 @@ def __new__(\n if hradius == vradius:\n return Circle(center, hradius, **kwargs)\n \n+ if hradius == 0 and vradius == 0:\n+ return center\n+\n+ if hradius == 0:\n+ return Segment(Point(center[0], center[1]-vradius), Poi...
7db22ce406463430ac50b9cb068685af07283489
diff --git a/sympy/geometry/ellipse.py b/sympy/geometry/ellipse.py index 93766e25d358..0c02cc480f05 100644 --- a/sympy/geometry/ellipse.py +++ b/sympy/geometry/ellipse.py @@ -26,7 +26,7 @@ from .entity import GeometryEntity, GeometrySet from .point import Point, Point2D, Point3D -from .line import Line, LinearEntit...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-15241@a8ef8ab
sympy/sympy
Python
15,241
Derivative._sort_variable_count correction
AppliedUndef and Symbols commute; derivatives don't commute with symbols or functions that are contained in the derivative. Anything else is assumed to behave like derivatives in terms of sorting. Here is an example where order of differentiation matters: ```python >>> f = f(x) >>> df = f.diff(x) >>> (f+x*df)...
2018-09-15T11:33:38Z
better canonicalization of variables of Derivative Better canonicalization of `Derivative._sort_variable_count` will be had if any symbols, appearing after functions, that are not in the free symbols of the function, appear before the functions: `Derivative(f(x, y), x, f(y), x)` should equal `Derivative(f(x, y), x, x, ...
This sorting ```python >>> Derivative._sort_variable_count([(f(x).diff(x),1),(x,1),(f(x),1),(x,1)]) [(Derivative(f(x), x), 1), (x, 1), (f(x), 1), (x, 1)] ``` could be this ``` [(f(x), 1), (Derivative(f(x), x), 1), (x, 2)] ``` but the only harm here is that it is not canonical. The following ordering is wrong, ...
[ { "body": "Better canonicalization of `Derivative._sort_variable_count` will be had if any symbols, appearing after functions, that are not in the free symbols of the function, appear before the functions: `Derivative(f(x, y), x, f(y), x)` should equal `Derivative(f(x, y), x, x, f(y))`.", "number": 15028, ...
5997e30a33f92e6b4b4d351e835feb7379a0e31d
{ "head_commit": "a8ef8ab3246140deda58956313d72e08eb2cc5a1", "head_commit_message": "_sort_variable_count: watch for noncommuting wrt\n\nAppliedUndef and Symbols commute; derivatives don't commute\nwith symbols or functions that are contained in the derivative.\nAnything else is assumed not to behave like derivativ...
[ { "diff_hunk": "@@ -1298,72 +1298,101 @@ def _remove_derived_once(cls, v):\n return [i[0] if i[1] == 1 else i for i in v]\n \n @classmethod\n- def _sort_variable_count(cls, varcounts):\n+ def _sort_variable_count(cls, vc):\n \"\"\"\n- Sort (variable, count) pairs by variable, bu...
21004ebe3df88bc4541b15f9240f952428b184a3
diff --git a/sympy/core/function.py b/sympy/core/function.py index 97099ce6d9ca..25e379fc4880 100644 --- a/sympy/core/function.py +++ b/sympy/core/function.py @@ -1298,72 +1298,101 @@ def _remove_derived_once(cls, v): return [i[0] if i[1] == 1 else i for i in v] @classmethod - def _sort_variable_coun...
{ "difficulty": "high", "estimated_review_effort": 4, "problem_domain": "Code Refactoring / Architectural Improvement" }
sympy__sympy-15212@6052b38
sympy/sympy
Python
15,212
linear_coeffs function added to solveset
<!-- 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://github.com/blog/1506-closing-issues...
2018-09-10T19:01:39Z
linear_eq_to_matrix proceeds without exception even if equations are nonlinear Hi, I would expect the following code to throw an exception (or give me a warning telling me I'm silly), but it does not. `x**2=0` is not a linear equation. ``` from sympy import symbols, linear_eq_to_matrix, linsolve x = symbols("x"...
I would like to work on this issue. Can I proceed working on this? Sure, anyone can work on any issue. Some thoughts: 1. Technically, there is no bug here because the docs say: > Here `equations` must be a linear system of equations in `symbols`. 2. But IMHO its still important to have sanity checks in pl...
[ { "body": "Hi,\r\n\r\nI would expect the following code to throw an exception (or give me a warning telling me I'm silly), but it does not. `x**2=0` is not a linear equation.\r\n\r\n```\r\nfrom sympy import symbols, linear_eq_to_matrix, linsolve\r\nx = symbols(\"x\")\r\nlinear_eq_to_matrix([x**2], [x])\r\n```",...
fa40a0cd87628819c289087370e1e783d712e3e8
{ "head_commit": "6052b384d71b216808f542545db2ca0e45f0a49d", "head_commit_message": "make sure Eq simplification happens in linsolve", "patch_to_review": "diff --git a/sympy/physics/continuum_mechanics/beam.py b/sympy/physics/continuum_mechanics/beam.py\nindex 8d11dbe8594f..387c105d1fda 100644\n--- a/sympy/physic...
[ { "diff_hunk": "@@ -1829,84 +1890,104 @@ def linear_eq_to_matrix(equations, *symbols):\n A = [ 3 1 1 ] b = [-6 ]\n [ 2 4 9 ] [ 2 ]\n \n+ The only simplification performed is to convert\n+ `Eq(a, b) -> a - b`.\n+\n+ Raises\n+ ======\n+\n+ ValueError\n+ The eq...
3b8a465fb2dbbfee0265d28ff477d4c36966d5bb
diff --git a/sympy/physics/continuum_mechanics/beam.py b/sympy/physics/continuum_mechanics/beam.py index 8d11dbe8594f..387c105d1fda 100644 --- a/sympy/physics/continuum_mechanics/beam.py +++ b/sympy/physics/continuum_mechanics/beam.py @@ -1490,13 +1490,13 @@ class Beam3D(Beam): >>> b.bc_deflection = [(0, [0, 0, 0]...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
sympy__sympy-15308@58e5fe1
sympy/sympy
Python
15,308
Add LaTeX printing for matrix symbol trace
Fixes #15303. Adds a _print_Trace method and test. Also adds a _print_Basic method to handle unimplemented types. <!-- BEGIN RELEASE NOTES --> * printing * added a method to correctly LaTeX print the trace of a MatrixSymbol * fixed a bug in LaTeX.py where subexpressions of an unimplemented basic expression we...
2018-09-28T16:42:11Z
LaTeX printing for Matrix Expression ```py >>> A = MatrixSymbol("A", n, n) >>> latex(trace(A**2)) 'Trace(A**2)' ``` The bad part is not only is Trace not recognized, but whatever printer is being used doesn't fallback to the LaTeX printer for the inner expression (it should be `A^2`).
What is the correct way to print the trace? AFAIK there isn't one built in to Latex. One option is ```\mathrm{Tr}```. Or ```\operatorname{Tr}```. What's the difference between the two. It looks like we use both in different parts of the latex printer. \operatorname puts a thin space after the operator.
[ { "body": "```py\r\n>>> A = MatrixSymbol(\"A\", n, n)\r\n>>> latex(trace(A**2))\r\n'Trace(A**2)'\r\n```\r\n\r\nThe bad part is not only is Trace not recognized, but whatever printer is being used doesn't fallback to the LaTeX printer for the inner expression (it should be `A^2`). ", "number": 15303, "ti...
fb59d703e6863ed803c98177b59197b5513332e9
{ "head_commit": "58e5fe1e1686b389babf95a61893633b86556a69", "head_commit_message": "add test for printing trace", "patch_to_review": "diff --git a/sympy/printing/latex.py b/sympy/printing/latex.py\nindex 00f844d9cb26..85ecb07999a4 100644\n--- a/sympy/printing/latex.py\n+++ b/sympy/printing/latex.py\n@@ -1462,6 +...
[ { "diff_hunk": "@@ -1462,6 +1462,10 @@ def _print_Transpose(self, expr):\n else:\n return \"%s^T\" % self._print(mat)\n \n+ def _print_Trace(self, expr):\n+ mat = expr.arg\n+ return r\"\\operatorname{Tr} %s\" % self._print(mat)", "line": null, "original_line": 1467, ...
c7699c46dd76fdd46f658636b61666fede653489
diff --git a/sympy/printing/latex.py b/sympy/printing/latex.py index a0eb97792e17..3de6929ba42d 100644 --- a/sympy/printing/latex.py +++ b/sympy/printing/latex.py @@ -289,6 +289,10 @@ def _do_exponent(self, expr, exp): else: return expr + def _print_Basic(self, expr): + l = [self._prin...
{ "difficulty": "low", "estimated_review_effort": 2, "problem_domain": "Bug Fixes" }
sympy__sympy-15174@2bd5d0f
sympy/sympy
Python
15,174
Move the super() call to the end of FunctionClass.__init__
The `super()` call calls `BasicMeta.__init__`, which adds the class to a set of classes (`sympy.core.core.all_classes`). This computes the hash of the class. However, the hash of a Function depends on its `nargs` (`class_key()`), meaning if it is set dynamically, the hash will change and the class won't be found in ...
2018-08-30T20:57:36Z
UndefinedFunction.__hash__()'s use of class_key() broke existing code Hi, I just learned that commit e210a762d (_"Allow Function('f', is_real=True) != Function('f')"_) broke my code, and I'm not sure if this is a bug in SymPy or not. The problem appears to have been caused by this change: class UndefinedFunction(Fu...
I don't know why it worked before. The issue is this: ```py >>> expr = temp(t) >>> expr.fdiff <bound method <lambda> of temp(t)> >>> expr = sympify(expr) >>> expr.fdiff <bound method Function.fdiff of temp(t)> ``` The reason is that sympify doesn't recognize `temp(t)` as a SymPy object, and so eventually f...
[ { "body": "Hi, I just learned that commit e210a762d (_\"Allow Function('f', is_real=True) != Function('f')\"_) broke my code, and I'm not sure if this is a bug in SymPy or not. The problem appears to have been caused by this change:\r\n\r\n\tclass UndefinedFunction(FunctionClass):\r\n\t+ def __hash__(self):\...
f4984def9f735823411bc5d5b0d9bcb322738303
{ "head_commit": "2bd5d0f1ccc65223448ad6068ddc761c2c31cc81", "head_commit_message": "Fix a test so it works in Python 2", "patch_to_review": "diff --git a/sympy/core/function.py b/sympy/core/function.py\nindex 9c4453ab5055..479b352f8cb6 100644\n--- a/sympy/core/function.py\n+++ b/sympy/core/function.py\n@@ -145,7...
[ { "diff_hunk": "@@ -162,6 +161,8 @@ def __init__(cls, *args, **kwargs):\n nargs = (as_int(nargs),)\n cls._nargs = nargs\n \n+ super(FunctionClass, cls).__init__(args, kwargs)", "line": null, "original_line": 164, "original_start_line": null, "path": "sympy/core/functio...
93ae4d601078eb9953b0b1286fda9e9e14190416
diff --git a/sympy/core/function.py b/sympy/core/function.py index 9c4453ab5055..bb488ead968f 100644 --- a/sympy/core/function.py +++ b/sympy/core/function.py @@ -145,7 +145,6 @@ def __init__(cls, *args, **kwargs): # honor kwarg value or class-defined value before using # the number of arguments in th...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-15010@719af6f
sympy/sympy
Python
15,010
Fixed pretty printing and codegen error messages for empty piecewise
<!-- Your title above should be a short description of what was changed. Do not include the issue number in the title. --> New behavior: - Manually constructing Piecewise() now raises a type error - Piecewise evaluated with no matching condition gives nan #### References to other Issues or PRs <!-- If this pu...
2018-08-02T02:09:32Z
empty Piecewise fails to pretty print Consider: ``` >>> f = Piecewise() >>> print(f) Piecewise() ``` Ok, but: ``` >>> pprint(f) --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-5-dd6b50590f87...
[ { "body": "Consider:\r\n```\r\n>>> f = Piecewise()\r\n>>> print(f)\r\nPiecewise()\r\n```\r\nOk, but:\r\n```\r\n>>> pprint(f)\r\n---------------------------------------------------------------------------\r\nValueError Traceback (most recent call last)\r\n<ipython-input-5-dd6b50590...
a78cf1d3efe853f1c360f962c5582b1d3d29ded3
{ "head_commit": "719af6f116e459fc6e32bf4643ddeedc270f04e9", "head_commit_message": "Fixed pretty printing and codegen error messages for empty piecewise\n\n1. pprint called on an empty Piecewise function now prints \"undefined\"\n2. codegen print functions raise the relevant \"No otherwise statement error\"\nwhen ...
[ { "diff_hunk": "@@ -418,7 +418,7 @@ def _print_yn(self, expr):\n \n \n def _print_Piecewise(self, expr):\n- if expr.args[-1].cond != True:\n+ if len(expr.args) == 0 or expr.args[-1].cond != True:", "line": null, "original_line": 421, "original_start_line": null, "path": "sympy/...
5273e8ba75b57655906769aff57bcca113a62a73
diff --git a/sympy/functions/elementary/piecewise.py b/sympy/functions/elementary/piecewise.py index 6c9230c6d50e..d46ab050dae9 100644 --- a/sympy/functions/elementary/piecewise.py +++ b/sympy/functions/elementary/piecewise.py @@ -71,7 +71,7 @@ class Piecewise(Function): If any of the evaluated conds are not...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-14991@be53939
sympy/sympy
Python
14,991
Integrate gives a wrong result
<!-- 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://github.com/blog/1506-closing-issues...
2018-07-29T17:23:28Z
integrate(sqrt(-x**2 + 1)*(-x**2 + x), [x, -1, 1]) is incorrect ``` >>> from sympy import * >>> x = Symbol('x') >>> integrate(sqrt(-x**2 + 1)*(-x**2 + x), [x, -1, 1]) 0 >>> ``` The answer should be `-pi/8`. The integral from `0` to `1` is also incorrect and returns a weird empty `Piecewise` object: ``` >...
[ { "body": "```\r\n>>> from sympy import *\r\n>>> x = Symbol('x')\r\n>>> integrate(sqrt(-x**2 + 1)*(-x**2 + x), [x, -1, 1])\r\n0\r\n>>> \r\n```\r\nThe answer should be `-pi/8`.\r\n\r\nThe integral from `0` to `1` is also incorrect and returns a weird empty `Piecewise` object:\r\n\r\n```\r\n>>> integrate(sqrt(-x*...
2b4afb6cd0a7cd5791d512b80fce493cda9b57e0
{ "head_commit": "be5393958b994c85af4fe86b201e4d4ab23892e5", "head_commit_message": "Added piecewise_fold after Add(*piecewises)", "patch_to_review": "diff --git a/sympy/integrals/integrals.py b/sympy/integrals/integrals.py\nindex 3119d84522ba..f380b5473851 100644\n--- a/sympy/integrals/integrals.py\n+++ b/sympy/...
[ { "diff_hunk": "@@ -1584,7 +1584,7 @@ def test_1st_homogeneous_coeff_ode3():\n sol = Eq(log(f(x)), C1 - Piecewise(\n (-acosh(f(x)/x), abs(f(x)**2)/x**2 > 1),\n (I*asin(f(x)/x), True)))\n- assert dsolve(eq, hint='1st_homogeneous_coeff_subs_indep_div_dep') == sol\n+ assert simpli...
be8ec180e0adc2177f1a9afe8f66ffa8d50ff0b0
diff --git a/sympy/integrals/integrals.py b/sympy/integrals/integrals.py index 3119d84522ba..f380b5473851 100644 --- a/sympy/integrals/integrals.py +++ b/sympy/integrals/integrals.py @@ -616,18 +616,22 @@ def eval_factored(f, x, a, b): args.append(g) ret...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
sympy__sympy-15004@8ad600e
sympy/sympy
Python
15,004
Added support for naming of Indexed types and avoid passing unnecessary kw_args
#### References to other Issues or PRs Fixes #14960 #### Brief description of what is fixed or changed * IndexedBase and Indexed types have been given a name attribute. * kw_args are not unnecessarily passed to Expr when creating an IndexedBase object #### Release Notes <!-- BEGIN RELEASE NOTES --> * tensor ...
2018-08-01T13:38:27Z
`integrate` raised issue with variable of integration of type `Indexed` This error was raised with the particular expression given below. ``` from sympy import * >>> x = Symbol('x') >>> x1, x2 = Indexed('x', 1), Indexed('x', 2) >>> pdf = exp(-x1**2/2 + x1 - x2**2/2 - S(1)/2)/(2*pi) >>> integrate(pdf, (x1, -oo, o...
It seems that plain `Indexed` is not the proper type for these variables. It should probably be a subclass of both `Symbol` and `Indexed`. @jksuom Do you mean to use `x, y = symbols('x y', cls=Idx)` and then rest of the statements ? Similar error results on doing so. No, that is not what I mean. I mean that the type ...
[ { "body": "This error was raised with the particular expression given below. \r\n```\r\nfrom sympy import *\r\n>>> x = Symbol('x')\r\n>>> x1, x2 = Indexed('x', 1), Indexed('x', 2)\r\n>>> pdf = exp(-x1**2/2 + x1 - x2**2/2 - S(1)/2)/(2*pi)\r\n>>> integrate(pdf, (x1, -oo, oo))\r\n...\r\nAttributeError: 'Indexed' o...
45e7cea6c1653a1e1d343b620c80f1f5b00af0b8
{ "head_commit": "8ad600ece843bf66417e08c77c021d215a8667ee", "head_commit_message": "Add support for name of IndexedBase and Indexed types", "patch_to_review": "diff --git a/sympy/tensor/indexed.py b/sympy/tensor/indexed.py\nindex 241d16402193..ccb6492172b4 100644\n--- a/sympy/tensor/indexed.py\n+++ b/sympy/tenso...
[ { "diff_hunk": "@@ -159,6 +159,14 @@ def __new__(cls, base, *args, **kw_args):\n \n return Expr.__new__(cls, base, *args, **kw_args)\n \n+ @property\n+ def name(self):\n+ indices_str = \"[\"\n+ for index in self.args[1:-1]:\n+ indices_str += str(index) + \",\"\n+ in...
d07554ce8a33669fc853bb89743c6313560be4cb
diff --git a/sympy/tensor/indexed.py b/sympy/tensor/indexed.py index 241d16402193..f4d1f2453595 100644 --- a/sympy/tensor/indexed.py +++ b/sympy/tensor/indexed.py @@ -159,6 +159,10 @@ def __new__(cls, base, *args, **kw_args): return Expr.__new__(cls, base, *args, **kw_args) + @property + def name(sel...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-15085@1b3ee51
sympy/sympy
Python
15,085
Allow CodePrinter to generate code for any Function
<!-- Your title above should be a short description of what was changed. Do not include the issue number in the title. --> ~~Not really a fix, but rather a test case showing the new syntax.~~ ~~Perhaps a proper fix is needed, providing this to start with for discussion.~~ #### References to other Issues or PRs <...
2018-08-13T21:06:14Z
[regression] lambdify with Matrix: `NameError: name 'Matrix' is not defined` I'm trying to create a lambda function from a sympy expression that involves a dot product with a `sympy.Matrix`. Since at least sympy 1.2, this fails. MWE: ```python from sympy import Matrix import sympy import numpy class dot(sym...
Bisected to 998946c03c0934b2bb638f182d728a31120488e7 CC @bjodah Mmmm yes, I remember you and I discussing that this could happen. `lambdify` was (and still is) quite under-tested. I opened gh-15085 with a test case that does pass. Is that viable?
[ { "body": "I'm trying to create a lambda function from a sympy expression that involves a dot product with a `sympy.Matrix`. Since at least sympy 1.2, this fails.\r\n\r\nMWE:\r\n```python\r\nfrom sympy import Matrix\r\nimport sympy\r\nimport numpy\r\n\r\n\r\nclass dot(sympy.Function):\r\n pass\r\n\r\n\r\n# d...
694baf9686c9a092e280283d6d58d2e17867f040
{ "head_commit": "1b3ee519b1417c312821f84726f3fdd37890bdcd", "head_commit_message": "Make PythonCodePrinter print unkown Functions", "patch_to_review": "diff --git a/sympy/printing/pycode.py b/sympy/printing/pycode.py\nindex 85e88cc660b9..5116ef8c2005 100644\n--- a/sympy/printing/pycode.py\n+++ b/sympy/printing/p...
[ { "diff_hunk": "@@ -106,6 +106,12 @@ def __init__(self, settings=None):\n self.known_constants = dict(self._kc, **(settings or {}).get(\n 'user_constants', {}))\n \n+ def _print_not_supported(self, expr):", "line": null, "original_line": 109, "original_start_line": null, "...
d92e394c3b11ad57aaac0d5f44ff8fff9e344ccb
diff --git a/doc/src/modules/printing.rst b/doc/src/modules/printing.rst index 7318f6f04294..4aad903cb31b 100644 --- a/doc/src/modules/printing.rst +++ b/doc/src/modules/printing.rst @@ -259,10 +259,17 @@ to introduce the names of user-defined functions in the Fortran expression. >>> print(fcode(1 - gamma(x)**2, u...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
zulip__zulip-33480@5538026
zulip/zulip
Python
33,480
search: Add is-muted search operator.
1st commit fixes the issues existing with `-in:home` search operator. Previously, mentions from muted channels were incorrectly excluded when narrowed down to `-in:home`. Additionally, messages from all muted topics were missing in the results. This commit solves the above listed issues. 2nd commit adds `-is:muted...
2025-02-14T09:45:47Z
Add -is:muted as alias for in:home. This is a relatively simple fix for somebody who's worked with our message filtering logic. It's probably a couple hours to get stuff working and a day or two to polish. We want to make -is:muted the new alias for in:home. We probably want to deprecate this somewhat slowly. I...
Hello @zulip/server-search members, this issue was labeled with the "area: search" label, so you may want to check it out! <!-- areaLabelAddition --> @zulipbot claim Hello @tushar912, it looks like you've currently claimed 1 issue in this repository. We encourage new contributors to focus their efforts on at most 1 is...
[ { "body": "This is a relatively simple fix for somebody who's worked with our message filtering logic. It's probably a couple hours to get stuff working and a day or two to polish.\r\n\r\nWe want to make -is:muted the new alias for in:home.\r\n\r\nWe probably want to deprecate this somewhat slowly. I think we...
0f5246400bf971983c49fc67adcfb693b8540f8d
{ "head_commit": "5538026f5813bdf988163114311acea80bb1baca", "head_commit_message": "search: Fix `-in:home` muting logic.\n\nPreviously, mentions from muted channels were incorrectly excluded when\nnarrowing down to `-in:home`. Additionally, messages from all muted\ntopics were missing in the results.\nThis commit ...
[ { "diff_hunk": "@@ -432,6 +432,14 @@ def by_is(self, query: Select, operand: str, maybe_negate: ConditionTransform) -\n elif operand == \"followed\":\n cond = get_followed_topic_condition_sa(self.user_profile.id)\n return query.where(maybe_negate(cond))\n+ elif operand == ...
a46bcacd513054cb3b06ea5658f63b2cdec6409e
diff --git a/api_docs/changelog.md b/api_docs/changelog.md index e728e50764f8c..1e1151e535bcc 100644 --- a/api_docs/changelog.md +++ b/api_docs/changelog.md @@ -20,6 +20,16 @@ format used by the Zulip server that they are interacting with. ## Changes in Zulip 10.0 +**Feature level 366** + +* [`GET /messages`](/api...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "New Feature Additions" }
sympy__sympy-14923@dce76cb
sympy/sympy
Python
14,923
14547: avoid evaluation of (Dimension|Quantity - 1)
Issue #14547 has, at its root, a dimensional quantity being subtracted from 1 to see how it compares to 1. This raises an error for dimensional mismatch of addends. Addition of numbers (and expressions containing free symbols) to quantities or dimensions is now ignored but can be tested with the added `check_dimens...
2018-07-14T22:43:39Z
false error message with Eq() and quantities in log() I believe the below is a bug: ```python from sympy import Eq, log from sympy.physics.units import Quantity, mass, gram, kilogram, length, meter m1 = Quantity('m_1', mass, kilogram) m2 = Quantity('m_2', mass, kilogram) m3 = Quantity('m_3', mass, kilogram) prin...
I am working on this issue. I found out that the problem begins from `fin = L, R = [i.is_finite for i in (lhs, rhs)]`. Now I am unable to figure how it propagates to `File "/home/gagandeep/anaconda3/lib/python3.6/site-packages/sympy/physics/units/quantities.py", line 173, in _Quantity_constructor_postprocessor_Add ...
[ { "body": "I believe the below is a bug:\r\n```python\r\nfrom sympy import Eq, log\r\nfrom sympy.physics.units import Quantity, mass, gram, kilogram, length, meter\r\nm1 = Quantity('m_1', mass, kilogram)\r\nm2 = Quantity('m_2', mass, kilogram)\r\nm3 = Quantity('m_3', mass, kilogram)\r\nprint log(m1 + m2) - log(...
fccf0444c1d0b67ddf4a48c28d4f4dd5ce0510a7
{ "head_commit": "dce76cbf1177967c711da0d94e0810d7753baec5", "head_commit_message": "remove Dimension postprocessing for Add", "patch_to_review": "diff --git a/sympy/physics/units/dimensions.py b/sympy/physics/units/dimensions.py\nindex 2aabd5923875..ec3b165c11a1 100644\n--- a/sympy/physics/units/dimensions.py\n+...
[ { "diff_hunk": "@@ -65,17 +66,33 @@ def test_Dimension_properties():\n \n \n def test_Dimension_add_sub():\n- assert length + length == length\n+ assert length + length == length + foot == foot + length == length\n assert length - length == length\n assert -length == length\n \n- raises(TypeErr...
cdda9e6b2d52de7f18e3ef14137d91c5e78bfe30
diff --git a/sympy/physics/units/dimensions.py b/sympy/physics/units/dimensions.py index 2aabd5923875..f4d544912244 100644 --- a/sympy/physics/units/dimensions.py +++ b/sympy/physics/units/dimensions.py @@ -18,7 +18,9 @@ from sympy import Integer, Matrix, S, Symbol, sympify, Basic, Tuple, Dict, default_sort_key fro...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
sympy__sympy-14564@e38f403
sympy/sympy
Python
14,564
increase safety of ConditionSet
<!-- 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://github.com/blog/1506-closing-issues...
2018-03-26T20:09:34Z
guard dummy symbol of ConditionSet Don't target the first argument unless the replacement is of symbol -> symbol type: ``` >>> ConditionSet(x, Eq(y, 0), S.Integers).subs(x,1) ConditionSet(1, Eq(y, 0), S.Integers) # should be unchanged ``` ambiguous behavior of ConditionSet ``` Help on class ConditionSet in m...
The base set should not be targeted if the old matches the sym of the condition set. Or wait...perhaps only the base set should be targetted in this case. It should mean "set of all x in S for which condition(x) is True". The role of `x` is comparable to the role of an integration variable in a definite integral: I...
[ { "body": "Don't target the first argument unless the replacement is of symbol -> symbol type:\r\n```\r\n>>> ConditionSet(x, Eq(y, 0), S.Integers).subs(x,1)\r\nConditionSet(1, Eq(y, 0), S.Integers) # should be unchanged\r\n```\r\n\r\n", "number": 14495, "title": "guard dummy symbol of ConditionSet" }...
57379b832b25bf22ef5e5ab6c8ee3fa0e863f48d
{ "head_commit": "e38f40340a63d336f615d0dc90d781d8072cf5d4", "head_commit_message": "increase safety of ConditionSet", "patch_to_review": "diff --git a/sympy/sets/conditionset.py b/sympy/sets/conditionset.py\nindex bb0e21dc79a0..d45d78163b58 100644\n--- a/sympy/sets/conditionset.py\n+++ b/sympy/sets/conditionset....
[ { "diff_hunk": "@@ -33,6 +37,53 @@ class ConditionSet(Set):\n False\n >>> 5 in ConditionSet(x, x**2 > 4, S.Reals)\n True\n+\n+ If the value is not in the base set, the result is false:\n+\n+ >>> 5 in ConditionSet(x, x**2 > 4, Interval(2, 4))\n+ False\n+\n+ Notes\n+ =====\n+\n+ Symb...
2b913a99596d52acf15a7125414d6d3b2e43898b
diff --git a/sympy/printing/latex.py b/sympy/printing/latex.py index 8e526dcfcb69..a3ead157c1ae 100644 --- a/sympy/printing/latex.py +++ b/sympy/printing/latex.py @@ -1798,7 +1798,12 @@ def _print_ImageSet(self, s): def _print_ConditionSet(self, s): vars_print = ', '.join([self._print(var) for var in Tu...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
sympy__sympy-14401@f4fba9b
sympy/sympy
Python
14,401
Limit comparison test introduced
Fixes #14111 Fixes #14484 This PR introduces a new way of finding whether a `Sum` series is `convergent` or not. The `Limit Comparison Test` has been added in the `is_convergent` method. See [here](https://math.oregonstate.edu/home/programs/undergrad/CalculusQuestStudyGuides/SandS/SeriesTests/limit_comparison.ht...
2018-03-06T06:52:08Z
Sum(1/log(log(n)), (n, 22, oo)).is_convergent() not implemented `>>> Sum(1/log(log(n)), (n, 22, oo)).is_convergent()` Traceback (most recent call last): File "<ipython-input-19-50f193f491f8>", line 1, in <module> Sum(1/log(log(n)), (n, 22, oo)).is_convergent() File ".\sympy\concrete\summations.py", line...
You can post a code block by surrounding it with triple backticks ``` (so-called code walls). For example ``` >>> Sum(1/log(log(n)), (n, 22, oo)).is_convergent() NotImplementedError: The algorithm to find the Sum convergence of 1/log(log(n)) is not yet implemented ``` > whenever it encounters a sum whose convergen...
[ { "body": "`>>> Sum(1/log(log(n)), (n, 22, oo)).is_convergent()`\r\nTraceback (most recent call last):\r\n\r\n File \"<ipython-input-19-50f193f491f8>\", line 1, in <module>\r\n Sum(1/log(log(n)), (n, 22, oo)).is_convergent()\r\n\r\n File \".\\sympy\\concrete\\summations.py\", line 528, in is_convergent\r\n...
f35ad6411f86a15dd78db39c29d1e5291f66f9b5
{ "head_commit": "f4fba9b92990b832bd23a6e9e39fd35eaeb0c931", "head_commit_message": "Added limit comparison test for n", "patch_to_review": "diff --git a/sympy/concrete/summations.py b/sympy/concrete/summations.py\nindex 79e1e51ff430..47a5ec5cd611 100644\n--- a/sympy/concrete/summations.py\n+++ b/sympy/concrete/s...
[ { "diff_hunk": "@@ -518,6 +519,12 @@ def is_convergent(self):\n except NotImplementedError:\n pass\n \n+ ### ------------- Limit comparison test -----------###\n+ # (n) comparison\n+ lim_comp = limit((sequence_term/sym), sym, oo)\n+ if lim_comp is ...
82cb999190ea4b463f8574eacf1e51dd66fea858
diff --git a/sympy/concrete/summations.py b/sympy/concrete/summations.py index 79e1e51ff430..8ce0cc33d178 100644 --- a/sympy/concrete/summations.py +++ b/sympy/concrete/summations.py @@ -439,10 +439,11 @@ def is_convergent(self): next_sequence_term = sequence_term.xreplace({sym: sym + 1}) ratio = comb...
{ "difficulty": "high", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
streamlit__streamlit-9670@b5522b9
streamlit/streamlit
Python
9,670
Allow adding the Streamlit logo in markdown
## Describe your changes Adds a new remark extension that converts `:streamlit:` in Markdown into a small image of the Streamlit logo. ![CleanShot 2024-10-15 at 12 57 24@2x](https://github.com/user-attachments/assets/0ba6810e-3f84-4f08-b349-e8af0c945376) To enable this remark extension in widget labels, this ...
2024-10-15T19:58:43Z
Make :streamlit: become a streamlit logo Via @tvst : Make this work: `st.write("Made in :streamlit: with :heart:")` --- Community voting on feature requests enables the Streamlit team to understand which features are most important to our users. **If you'd like the Streamlit team to prioritize this featu...
[ { "body": "Via @tvst :\r\n\r\nMake this work:\r\n\r\n`st.write(\"Made in :streamlit: with :heart:\")`\r\n\r\n---\r\n\r\nCommunity voting on feature requests enables the Streamlit team to understand which features are most important to our users.\r\n\r\n**If you'd like the Streamlit team to prioritize this featu...
9e3d73fe7e86dfe694c0bf68ff29ebef6ac22743
{ "head_commit": "b5522b93b717a05f3badaf9f03ae65a92189e111", "head_commit_message": "Update snapshots", "patch_to_review": "diff --git a/e2e_playwright/__snapshots__/linux/label_markdown_test/st_button-invalid_image[chromium].png b/e2e_playwright/__snapshots__/linux/label_markdown_test/st_button-invalid_image[chr...
[ { "diff_hunk": "@@ -68,6 +68,8 @@ export const StyledStreamlitMarkdown =\n // Images in markdown should never be wider\n // than the content area.\n maxWidth: \"100%\",\n+ // In labels, widgets should never be taller than the text.\n+ maxHeight: isLabel ? \"1em\" ...
8d69eefd7e2da487bf1e11f7483f426ba89a82e5
diff --git a/e2e_playwright/__snapshots__/linux/label_markdown_test/st_button-invalid_image[chromium].png b/e2e_playwright/__snapshots__/linux/label_markdown_test/st_button-invalid_image[chromium].png deleted file mode 100644 index bf28cc614221..000000000000 Binary files a/e2e_playwright/__snapshots__/linux/label_markd...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "New Feature Additions" }
sympy__sympy-14372@08a66b4
sympy/sympy
Python
14,372
Moved arithematic operators to sympy/sets/sets.py
All the functions related to generic use for all sets are moved from sympy/sets/setexpr.py to sympy/sets/sets.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 i...
2018-03-03T07:47:15Z
Move set arithmetic operators to sympy/sets/sets.py Set arithmetic operators such as `set_add` and the function application on sets (`set_function`) have been defined in `sympy/sets/setexpr.py` to support `SetExpr`. They are actually of generic use for all sets, so they should rather stay in `sympy/sets/sets.py`.
Let's do it before version 1.2, so no API break. Do we have to move all the set arithmetic operators? I am beginner, can I work on this? I am going to make a pull request for this issue. Please give your review on that. Beginner here. Can I look into this issue?
[ { "body": "Set arithmetic operators such as `set_add` and the function application on sets (`set_function`) have been defined in `sympy/sets/setexpr.py` to support `SetExpr`.\r\n\r\nThey are actually of generic use for all sets, so they should rather stay in `sympy/sets/sets.py`.", "number": 14366, "tit...
eea43ed1983d224b4977abc08fe9e378487411dc
{ "head_commit": "08a66b453c675eb9408087719192517424335f28", "head_commit_message": "Moved arithematic operators to sympy/sets/sets.py\n\nAll the functions related to generic use for all sets are moved from\nsympy/sets/setexpr.py to sympy/sets/sets.py", "patch_to_review": "diff --git a/sympy/sets/setexpr.py b/sym...
[ { "diff_hunk": "@@ -1959,3 +1957,33 @@ def simplify_intersection(args):\n return args.pop()\n else:\n return Intersection(args, evaluate=False)\n+\n+def set_add(x, y):\n+ from sympy.sets.handlers.add import _set_add\n+ from sympy.sets.setexpr import _apply_operation\n+ return _apply...
6ffebb8c712a893a625e64c40df1e21d4c5cfde6
diff --git a/sympy/sets/setexpr.py b/sympy/sets/setexpr.py index 5ea277ec3559..31caa9e89b1a 100644 --- a/sympy/sets/setexpr.py +++ b/sympy/sets/setexpr.py @@ -5,10 +5,7 @@ from sympy.core.decorators import call_highest_priority, _sympifyit from sympy.utilities.iterables import sift from sympy.multipledispatch import...
{ "difficulty": "low", "estimated_review_effort": 2, "problem_domain": "Code Refactoring / Architectural Improvement" }
sympy__sympy-14348@6c0de69
sympy/sympy
Python
14,348
improve identification of imaginary roots for CRootOf instances
<!-- 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://github.com/blog/1506-closing-issues...
2018-02-27T14:23:57Z
poly(((x - 1)**2 + 1)*((x - 1)**2 + 2)*(x - 1)).all_roots() hangs bisected to 73fafba wrong simplification of sum of fractions The result should be zero: ``` In [14]: e1 = (2*b*x+a)/(2*sqrt(c*x**2)*c*x) In [15]: e2 = (b*x+a)**2/(2*sqrt(c*x**2)*c*x*a) In [16]: e1.diff(x)-e2.diff(x) Out[16]: ...
I found that the infinite loop occurs [here](https://github.com/sympy/sympy/blob/master/sympy/polys/rootoftools.py#L323). I am having some difficulty in understanding the code/work of this function. @skirpichev @jksuom can you show me some examples that what `_refine_complexes` do ? > what _refine_complexes do Isn'...
[ { "body": "bisected to 73fafba\r\n", "number": 14291, "title": "poly(((x - 1)**2 + 1)*((x - 1)**2 + 2)*(x - 1)).all_roots() hangs" }, { "body": "The result should be zero:\r\n```\r\nIn [14]: e1 = (2*b*x+a)/(2*sqrt(c*x**2)*c*x)\r\n\r\nIn [15]: e2 = (b*x+a)**2/(2*sqrt(c*x**2)*c*x*a)\r\n\r\nIn [16]...
c619f373c2b34c227174fa90db78e54192f71067
{ "head_commit": "6c0de6938f455c99fc3291358eb7bbb323bfbf86", "head_commit_message": "allow is_disjoint to compare re and cmplx intervals", "patch_to_review": "diff --git a/sympy/core/numbers.py b/sympy/core/numbers.py\nindex df22c68955fa..ad7177365ecd 100644\n--- a/sympy/core/numbers.py\n+++ b/sympy/core/numbers....
[ { "diff_hunk": "@@ -244,7 +250,23 @@ def test_CRootOf_evalf():\n \n # watch out for UnboundLocalError\n c = CRootOf(90720*x**6 - 4032*x**4 + 84*x**2 - 1, 0)\n- assert str(c._eval_evalf(2)) == '-0.e-1'\n+ assert c._eval_evalf(2) # doesn't fail\n+\n+ # watch out for imaginary parts that don't wa...
78abe04f31247ebfbbc4337918eca0c275e1a9a0
diff --git a/sympy/core/numbers.py b/sympy/core/numbers.py index df22c68955fa..ad7177365ecd 100644 --- a/sympy/core/numbers.py +++ b/sympy/core/numbers.py @@ -17,6 +17,7 @@ from sympy.core.compatibility import ( as_int, integer_types, long, string_types, with_metaclass, HAS_GMPY, SYMPY_INTS, int_info) + imp...
{ "difficulty": "medium", "estimated_review_effort": 4, "problem_domain": "Bug Fixes" }
sympy__sympy-14321@682e2a3
sympy/sympy
Python
14,321
Inverse trigonometric evaluation for compatible arguments
#### References to other Issues or PRs Fixes #14320 #### Brief description of what is fixed or changed Added support for evaluation of inverse trigonometric non-symbolic expressions with real arguments, taking into account the range of inverse trigonometric functions. This has the advantage of directly evaluatin...
2018-02-24T19:05:46Z
Improper results with inverse trigonometric functions ```python >>> pprint(asin(sin(2))) asin(sin(2)) >>> pprint(asin(sin(2)).simplify()) 2 >>> pprint(asin(sin(2)).trigsimp()) asin(sin(2)) ``` Using simplify, does not give the correct value as range of `asin` is `[-pi/2,pi/2]`. The other statements are no...
This was recently discussed on gitter. The attribute `inverse` does not differentiate between right inverse and left inverse. Therefore [this line](https://github.com/sympy/sympy/blob/master/sympy/simplify/simplify.py#L531) may lead to a wrong result. > The attribute inverse does not differentiate between right inverse...
[ { "body": "```python\r\n>>> pprint(asin(sin(2)))\r\nasin(sin(2))\r\n\r\n>>> pprint(asin(sin(2)).simplify())\r\n2\r\n\r\n>>> pprint(asin(sin(2)).trigsimp())\r\nasin(sin(2))\r\n```\r\nUsing simplify, does not give the correct value as range of `asin` is `[-pi/2,pi/2]`. \r\nThe other statements are not able to sol...
fb536869fb7aa28b2695ad7a3b70949926b291c4
{ "head_commit": "682e2a3d22e935dad1a06383a8b3a16d422ddc06", "head_commit_message": "Added is_comparable check", "patch_to_review": "diff --git a/sympy/functions/elementary/tests/test_trigonometric.py b/sympy/functions/elementary/tests/test_trigonometric.py\nindex c2eaf6668062..895fd5e92061 100644\n--- a/sympy/fu...
[ { "diff_hunk": "@@ -2405,6 +2453,16 @@ def eval(cls, arg):\n if i_coeff is not None:\n return -S.ImaginaryUnit * acoth(i_coeff)\n \n+ if isinstance(arg, cot):\n+ ang = arg.args[0]\n+ if ang.is_comparable:\n+ return ang % pi # restrict to [0,pi)", ...
fad45b1c8951d40a28624145470a7cce36769745
diff --git a/sympy/functions/elementary/tests/test_trigonometric.py b/sympy/functions/elementary/tests/test_trigonometric.py index c2eaf6668062..eb49f0f5444c 100644 --- a/sympy/functions/elementary/tests/test_trigonometric.py +++ b/sympy/functions/elementary/tests/test_trigonometric.py @@ -1562,3 +1562,21 @@ def test_r...
{ "difficulty": "high", "estimated_review_effort": 4, "problem_domain": "New Feature Additions" }
sympy__sympy-14343@5589e9e
sympy/sympy
Python
14,343
Latex: Fixed long_frac_ratio
Correct output for fractions involving terms in numerator more than twice the terms in denominator. Fixes https://github.com/sympy/sympy/issues/14309 <!-- 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 ...
2018-02-26T23:40:48Z
Wrong latex output for fraction with a sqrt Latex output for some fractions, which involve a square root is wrong: ``` In [2]: x = sympy.symbols('x') In [4]: sympy.latex((2*sympy.sqrt(2)*x)/3) Out[4]: '\\frac{2 x}{3} \\sqrt{2}' ``` The square root is incorrectly taken out of the fraction. Without the variable...
setting `long_frac_ratio = 3` (ratio of number of terms in num to that in denom) should do the trick. ``` >>>latex((2*sqrt(2)*x)/3, long_frac_ratio=3) '\\frac{2 \\sqrt{2} x}{3}' ``` Even so, it would be nice for the LaTeX printer and the pretty printer to be consistent here. ``` >>> pprint((2*sympy.sqrt(2)*x)...
[ { "body": "Latex output for some fractions, which involve a square root is wrong:\r\n```\r\nIn [2]: x = sympy.symbols('x') \r\n\r\nIn [4]: sympy.latex((2*sympy.sqrt(2)*x)/3)\r\nOut[4]: '\\\\frac{2 x}{3} \\\\sqrt{2}'\r\n```\r\nThe square root is incorrectly taken out of the fraction.\r\nWithout the variable x, t...
f012a040c1373dd960513ec990d9d2ed77d587c0
{ "head_commit": "5589e9ec240a009c8b421722c8d90d6d7b25b263", "head_commit_message": "Added test cases", "patch_to_review": "diff --git a/sympy/printing/latex.py b/sympy/printing/latex.py\nindex 28e3f1ba530d..65d3e3dd1c2d 100644\n--- a/sympy/printing/latex.py\n+++ b/sympy/printing/latex.py\n@@ -128,7 +128,7 @@ cla...
[ { "diff_hunk": "@@ -446,9 +446,17 @@ def convert(expr):\n snumer = convert(numer)\n sdenom = convert(denom)\n ldenom = len(sdenom.split())\n- ratio = self._settings['long_frac_ratio']\n+ if self._settings['long_frac_ratio'] == None:\n+ exp...
895c2e7e62a36aad4e13c64e018b637e1f79e2a8
diff --git a/sympy/printing/latex.py b/sympy/printing/latex.py index 28e3f1ba530d..8154d733a6e5 100644 --- a/sympy/printing/latex.py +++ b/sympy/printing/latex.py @@ -128,7 +128,7 @@ class LatexPrinter(Printer): "fold_frac_powers": False, "fold_func_brackets": False, "fold_short_frac": None, ...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }
sympy__sympy-14317@2e00d13
sympy/sympy
Python
14,317
latex : order wise printing of monomials
Fixes #14316 #### Brief description of what is fixed or changed The issue arose because `Poly` was being printed as an Expr instance (`poly.as_expr()`) rather than a Poly. ``` >>> Poly([a, 1, b, 2, c, 3], x).as_expr() a*x**5 + b*x**3 + c*x + x**4 + 2*x**2 + 3 ``` This branch rather prints `Poly` term by term ...
2018-02-24T10:05:10Z
LaTeX printer does not use the same order of monomials as pretty and str When printing a Poly, the str and pretty printers use the logical order of monomials, from highest to lowest degrees. But latex printer does not. ``` >>> var('a b c x') >>> p = Poly([a, 1, b, 2, c, 3], x) >>> p Poly(a*x**5 + x**4 + b*x**3 +...
[ { "body": "When printing a Poly, the str and pretty printers use the logical order of monomials, from highest to lowest degrees. But latex printer does not. \r\n```\r\n>>> var('a b c x')\r\n>>> p = Poly([a, 1, b, 2, c, 3], x)\r\n>>> p\r\nPoly(a*x**5 + x**4 + b*x**3 + 2*x**2 + c*x + 3, x, domain='ZZ[a,b,c]')\r\n...
fb536869fb7aa28b2695ad7a3b70949926b291c4
{ "head_commit": "2e00d13c2132cd2ffb4b56a21188dd24bb5c5858", "head_commit_message": "changes in _print_Poly", "patch_to_review": "diff --git a/sympy/printing/latex.py b/sympy/printing/latex.py\nindex fa55bfc3d09e..2facf3027561 100644\n--- a/sympy/printing/latex.py\n+++ b/sympy/printing/latex.py\n@@ -1813,7 +1813,...
[ { "diff_hunk": "@@ -1813,7 +1813,50 @@ def _print_PolynomialRingBase(self, expr):\n \n def _print_Poly(self, poly):\n cls = poly.__class__.__name__\n- expr = self._print(poly.as_expr())\n+ terms, gens = [], [s for s in poly.gens]\n+ for monom, coeff in poly.terms():\n+ ...
b04c26af3f094ae50c11fcb8da34f335b2baac08
diff --git a/sympy/printing/latex.py b/sympy/printing/latex.py index fa55bfc3d09e..6f8ad7b70fb2 100644 --- a/sympy/printing/latex.py +++ b/sympy/printing/latex.py @@ -1813,7 +1813,50 @@ def _print_PolynomialRingBase(self, expr): def _print_Poly(self, poly): cls = poly.__class__.__name__ - expr = ...
{ "difficulty": "medium", "estimated_review_effort": 3, "problem_domain": "Bug Fixes" }