instance_id
stringlengths
14
33
version
stringclasses
1 value
gold_patches
dict
test_patch
null
pre_patches
dict
pre_scripts
null
repo
stringclasses
11 values
base_commit
stringclasses
11 values
base_commit_timestamp
stringdate
2024-07-22 07:32:48-0400
2024-10-09 00:56:33-0400
hints_text
null
created_at
null
problem_statement
dict
environment_setup_commit
stringclasses
11 values
evaluation
dict
sympy__sympy-17
1.0
{ "code": "diff --git b/sympy/integrals/integrals.py a/sympy/integrals/integrals.py\nindex 950e5c9356..3017c9ba31 100644\n--- b/sympy/integrals/integrals.py\n+++ a/sympy/integrals/integrals.py\n@@ -1303,6 +1303,42 @@ def as_sum(self, n=None, method=\"midpoint\", evaluate=True):\n .. [1] https://en.wikipedia.org/wiki/Riemann_sum#Riemann_summation_methods\n \"\"\"\n \n+ from sympy.concrete.summations import Sum\n+ limits = self.limits\n+ if len(limits) > 1:\n+ raise NotImplementedError(\n+ \"Multidimensional midpoint rule not implemented yet\")\n+ else:\n+ limit = limits[0]\n+ if (len(limit) != 3 or limit[1].is_finite is False or\n+ limit[2].is_finite is False):\n+ raise ValueError(\"Expecting a definite integral over \"\n+ \"a finite interval.\")\n+ if n is None:\n+ n = Dummy('n', integer=True, positive=True)\n+ else:\n+ n = sympify(n)\n+ if (n.is_positive is False or n.is_integer is False or\n+ n.is_finite is False):\n+ raise ValueError(\"n must be a positive integer, got %s\" % n)\n+ x, a, b = limit\n+ dx = (b - a)/n\n+ k = Dummy('k', integer=True, positive=True)\n+ f = self.function\n+\n+ if method == \"left\":\n+ result = dx*Sum(f.subs(x, a + (k-1)*dx), (k, 1, n))\n+ elif method == \"right\":\n+ result = dx*Sum(f.subs(x, a + k*dx), (k, 1, n))\n+ elif method == \"midpoint\":\n+ result = dx*Sum(f.subs(x, a + k*dx - dx/2), (k, 1, n))\n+ elif method == \"trapezoid\":\n+ result = dx*((f.subs(x, a) + f.subs(x, b))/2 +\n+ Sum(f.subs(x, a + k*dx), (k, 1, n - 1)))\n+ else:\n+ raise ValueError(\"Unknown method %s\" % method)\n+ return result.doit() if evaluate else result\n+\n def principal_value(self, **kwargs):\n \"\"\"\n Compute the Cauchy Principal Value of the definite integral of a real function in the given interval\n", "test": null }
null
{ "code": "diff --git a/sympy/integrals/integrals.py b/sympy/integrals/integrals.py\nindex 3017c9ba31..950e5c9356 100644\n--- a/sympy/integrals/integrals.py\n+++ b/sympy/integrals/integrals.py\n@@ -1303,42 +1303,6 @@ def as_sum(self, n=None, method=\"midpoint\", evaluate=True):\n .. [1] https://en.wikipedia.org/wiki/Riemann_sum#Riemann_summation_methods\n \"\"\"\n \n- from sympy.concrete.summations import Sum\n- limits = self.limits\n- if len(limits) > 1:\n- raise NotImplementedError(\n- \"Multidimensional midpoint rule not implemented yet\")\n- else:\n- limit = limits[0]\n- if (len(limit) != 3 or limit[1].is_finite is False or\n- limit[2].is_finite is False):\n- raise ValueError(\"Expecting a definite integral over \"\n- \"a finite interval.\")\n- if n is None:\n- n = Dummy('n', integer=True, positive=True)\n- else:\n- n = sympify(n)\n- if (n.is_positive is False or n.is_integer is False or\n- n.is_finite is False):\n- raise ValueError(\"n must be a positive integer, got %s\" % n)\n- x, a, b = limit\n- dx = (b - a)/n\n- k = Dummy('k', integer=True, positive=True)\n- f = self.function\n-\n- if method == \"left\":\n- result = dx*Sum(f.subs(x, a + (k-1)*dx), (k, 1, n))\n- elif method == \"right\":\n- result = dx*Sum(f.subs(x, a + k*dx), (k, 1, n))\n- elif method == \"midpoint\":\n- result = dx*Sum(f.subs(x, a + k*dx - dx/2), (k, 1, n))\n- elif method == \"trapezoid\":\n- result = dx*((f.subs(x, a) + f.subs(x, b))/2 +\n- Sum(f.subs(x, a + k*dx), (k, 1, n - 1)))\n- else:\n- raise ValueError(\"Unknown method %s\" % method)\n- return result.doit() if evaluate else result\n-\n def principal_value(self, **kwargs):\n \"\"\"\n Compute the Cauchy Principal Value of the definite integral of a real function in the given interval\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/integrals/integrals.py.\nHere is the description for the function:\n def as_sum(self, n=None, method=\"midpoint\", evaluate=True):\n \"\"\"\n Approximates a definite integral by a sum.\n\n Parameters\n ==========\n\n n :\n The number of subintervals to use, optional.\n method :\n One of: 'left', 'right', 'midpoint', 'trapezoid'.\n evaluate : bool\n If False, returns an unevaluated Sum expression. The default\n is True, evaluate the sum.\n\n Notes\n =====\n\n These methods of approximate integration are described in [1].\n\n Examples\n ========\n\n >>> from sympy import Integral, sin, sqrt\n >>> from sympy.abc import x, n\n >>> e = Integral(sin(x), (x, 3, 7))\n >>> e\n Integral(sin(x), (x, 3, 7))\n\n For demonstration purposes, this interval will only be split into 2\n regions, bounded by [3, 5] and [5, 7].\n\n The left-hand rule uses function evaluations at the left of each\n interval:\n\n >>> e.as_sum(2, 'left')\n 2*sin(5) + 2*sin(3)\n\n The midpoint rule uses evaluations at the center of each interval:\n\n >>> e.as_sum(2, 'midpoint')\n 2*sin(4) + 2*sin(6)\n\n The right-hand rule uses function evaluations at the right of each\n interval:\n\n >>> e.as_sum(2, 'right')\n 2*sin(5) + 2*sin(7)\n\n The trapezoid rule uses function evaluations on both sides of the\n intervals. This is equivalent to taking the average of the left and\n right hand rule results:\n\n >>> s = e.as_sum(2, 'trapezoid')\n >>> s\n 2*sin(5) + sin(3) + sin(7)\n >>> (e.as_sum(2, 'left') + e.as_sum(2, 'right'))/2 == s\n True\n\n Here, the discontinuity at x = 0 can be avoided by using the\n midpoint or right-hand method:\n\n >>> e = Integral(1/sqrt(x), (x, 0, 1))\n >>> e.as_sum(5).n(4)\n 1.730\n >>> e.as_sum(10).n(4)\n 1.809\n >>> e.doit().n(4) # the actual value is 2\n 2.000\n\n The left- or trapezoid method will encounter the discontinuity and\n return infinity:\n\n >>> e.as_sum(5, 'left')\n zoo\n\n The number of intervals can be symbolic. If omitted, a dummy symbol\n will be used for it.\n\n >>> e = Integral(x**2, (x, 0, 2))\n >>> e.as_sum(n, 'right').expand()\n 8/3 + 4/n + 4/(3*n**2)\n\n This shows that the midpoint rule is more accurate, as its error\n term decays as the square of n:\n\n >>> e.as_sum(method='midpoint').expand()\n 8/3 - 2/(3*_n**2)\n\n A symbolic sum is returned with evaluate=False:\n\n >>> e.as_sum(n, 'midpoint', evaluate=False)\n 2*Sum((2*_k/n - 1/n)**2, (_k, 1, n))/n\n\n See Also\n ========\n\n Integral.doit : Perform the integration using any hints\n\n References\n ==========\n\n .. [1] https://en.wikipedia.org/wiki/Riemann_sum#Riemann_summation_methods\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/integrals/tests/test_integrals.py::test_as_sum_midpoint1", "sympy/integrals/tests/test_integrals.py::test_as_sum_midpoint2", "sympy/integrals/tests/test_integrals.py::test_as_sum_left", "sympy/integrals/tests/test_integrals.py::test_as_sum_right", "sympy/integrals/tests/test_integrals.py::test_as_sum_trapezoid", "sympy/integrals/tests/test_integrals.py::test_as_sum_raises" ], "PASS_TO_PASS": null }
sympy__sympy-18
1.0
{ "code": "diff --git b/sympy/physics/mechanics/pathway.py a/sympy/physics/mechanics/pathway.py\nindex 48d17580a1..3823750b0a 100644\n--- b/sympy/physics/mechanics/pathway.py\n+++ a/sympy/physics/mechanics/pathway.py\n@@ -454,6 +454,16 @@ def to_loads(self, force):\n that this ``Expr`` represents an expansile force.\n \n \"\"\"\n+ loads = []\n+ attachment_pairs = zip(self.attachments[:-1], self.attachments[1:])\n+ for attachment_pair in attachment_pairs:\n+ relative_position = _point_pair_relative_position(*attachment_pair)\n+ length = _point_pair_length(*attachment_pair)\n+ loads.extend([\n+ Force(attachment_pair[0], -force*relative_position/length),\n+ Force(attachment_pair[1], force*relative_position/length),\n+ ])\n+ return loads\n \n \n class WrappingPathway(PathwayBase):\n", "test": null }
null
{ "code": "diff --git a/sympy/physics/mechanics/pathway.py b/sympy/physics/mechanics/pathway.py\nindex 3823750b0a..48d17580a1 100644\n--- a/sympy/physics/mechanics/pathway.py\n+++ b/sympy/physics/mechanics/pathway.py\n@@ -454,16 +454,6 @@ def to_loads(self, force):\n that this ``Expr`` represents an expansile force.\n \n \"\"\"\n- loads = []\n- attachment_pairs = zip(self.attachments[:-1], self.attachments[1:])\n- for attachment_pair in attachment_pairs:\n- relative_position = _point_pair_relative_position(*attachment_pair)\n- length = _point_pair_length(*attachment_pair)\n- loads.extend([\n- Force(attachment_pair[0], -force*relative_position/length),\n- Force(attachment_pair[1], force*relative_position/length),\n- ])\n- return loads\n \n \n class WrappingPathway(PathwayBase):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/physics/mechanics/pathway.py.\nHere is the description for the function:\n def to_loads(self, force):\n \"\"\"Loads required by the equations of motion method classes.\n\n Explanation\n ===========\n\n ``KanesMethod`` requires a list of ``Point``-``Vector`` tuples to be\n passed to the ``loads`` parameters of its ``kanes_equations`` method\n when constructing the equations of motion. This method acts as a\n utility to produce the correctly-structred pairs of points and vectors\n required so that these can be easily concatenated with other items in\n the list of loads and passed to ``KanesMethod.kanes_equations``. These\n loads are also in the correct form to also be passed to the other\n equations of motion method classes, e.g. ``LagrangesMethod``.\n\n Examples\n ========\n\n The below example shows how to generate the loads produced in an\n actuator that follows an obstacle-set pathway between four points and\n produces an expansile force ``F``. First, create a pair of reference\n frames, ``A`` and ``B``, in which the four points ``pA``, ``pB``,\n ``pC``, and ``pD`` will be located. The first two points in frame ``A``\n and the second two in frame ``B``. Frame ``B`` will also be oriented\n such that it relates to ``A`` via a rotation of ``q`` about an axis\n ``N.z`` in a global frame (``N.z``, ``A.z``, and ``B.z`` are parallel).\n\n >>> from sympy.physics.mechanics import (ObstacleSetPathway, Point,\n ... ReferenceFrame)\n >>> from sympy.physics.vector import dynamicsymbols\n >>> q = dynamicsymbols('q')\n >>> N = ReferenceFrame('N')\n >>> N = ReferenceFrame('N')\n >>> A = N.orientnew('A', 'axis', (0, N.x))\n >>> B = A.orientnew('B', 'axis', (q, N.z))\n >>> pO = Point('pO')\n >>> pA, pB, pC, pD = Point('pA'), Point('pB'), Point('pC'), Point('pD')\n >>> pA.set_pos(pO, A.x)\n >>> pB.set_pos(pO, -A.y)\n >>> pC.set_pos(pO, B.y)\n >>> pD.set_pos(pO, B.x)\n >>> obstacle_set_pathway = ObstacleSetPathway(pA, pB, pC, pD)\n\n Now create a symbol ``F`` to describe the magnitude of the (expansile)\n force that will be produced along the pathway. The list of loads that\n ``KanesMethod`` requires can be produced by calling the pathway's\n ``to_loads`` method with ``F`` passed as the only argument.\n\n >>> from sympy import Symbol\n >>> F = Symbol('F')\n >>> obstacle_set_pathway.to_loads(F)\n [(pA, sqrt(2)*F/2*A.x + sqrt(2)*F/2*A.y),\n (pB, - sqrt(2)*F/2*A.x - sqrt(2)*F/2*A.y),\n (pB, - F/sqrt(2*cos(q(t)) + 2)*A.y - F/sqrt(2*cos(q(t)) + 2)*B.y),\n (pC, F/sqrt(2*cos(q(t)) + 2)*A.y + F/sqrt(2*cos(q(t)) + 2)*B.y),\n (pC, - sqrt(2)*F/2*B.x + sqrt(2)*F/2*B.y),\n (pD, sqrt(2)*F/2*B.x - sqrt(2)*F/2*B.y)]\n\n Parameters\n ==========\n\n force : Expr\n The force acting along the length of the pathway. It is assumed\n that this ``Expr`` represents an expansile force.\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/physics/mechanics/tests/test_pathway.py::TestObstacleSetPathway::test_static_pathway_to_loads", "sympy/physics/mechanics/tests/test_pathway.py::TestObstacleSetPathway::test_2D_pathway_to_loads" ], "PASS_TO_PASS": null }
sympy__sympy-19
1.0
{ "code": "diff --git b/sympy/logic/boolalg.py a/sympy/logic/boolalg.py\nindex 9519825227..6be561c94b 100644\n--- b/sympy/logic/boolalg.py\n+++ a/sympy/logic/boolalg.py\n@@ -2464,6 +2464,25 @@ def POSform(variables, minterms, dontcares=None):\n .. [2] https://en.wikipedia.org/wiki/Don%27t-care_term\n \n \"\"\"\n+ if not minterms:\n+ return false\n+\n+ variables = tuple(map(sympify, variables))\n+ minterms = _input_to_binlist(minterms, variables)\n+ dontcares = _input_to_binlist((dontcares or []), variables)\n+ for d in dontcares:\n+ if d in minterms:\n+ raise ValueError('%s in minterms is also in dontcares' % d)\n+\n+ maxterms = []\n+ for t in product((0, 1), repeat=len(variables)):\n+ t = list(t)\n+ if (t not in minterms) and (t not in dontcares):\n+ maxterms.append(t)\n+\n+ new = _simplified_pairs(maxterms + dontcares)\n+ essential = _rem_redundancy(new, maxterms)\n+ return And(*[_convert_to_varsPOS(x, variables) for x in essential])\n \n \n def ANFform(variables, truthvalues):\n", "test": null }
null
{ "code": "diff --git a/sympy/logic/boolalg.py b/sympy/logic/boolalg.py\nindex 6be561c94b..9519825227 100644\n--- a/sympy/logic/boolalg.py\n+++ b/sympy/logic/boolalg.py\n@@ -2464,25 +2464,6 @@ def POSform(variables, minterms, dontcares=None):\n .. [2] https://en.wikipedia.org/wiki/Don%27t-care_term\n \n \"\"\"\n- if not minterms:\n- return false\n-\n- variables = tuple(map(sympify, variables))\n- minterms = _input_to_binlist(minterms, variables)\n- dontcares = _input_to_binlist((dontcares or []), variables)\n- for d in dontcares:\n- if d in minterms:\n- raise ValueError('%s in minterms is also in dontcares' % d)\n-\n- maxterms = []\n- for t in product((0, 1), repeat=len(variables)):\n- t = list(t)\n- if (t not in minterms) and (t not in dontcares):\n- maxterms.append(t)\n-\n- new = _simplified_pairs(maxterms + dontcares)\n- essential = _rem_redundancy(new, maxterms)\n- return And(*[_convert_to_varsPOS(x, variables) for x in essential])\n \n \n def ANFform(variables, truthvalues):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/logic/boolalg.py.\nHere is the description for the function:\ndef POSform(variables, minterms, dontcares=None):\n \"\"\"\n The POSform function uses simplified_pairs and a redundant-group\n eliminating algorithm to convert the list of all input combinations\n that generate '1' (the minterms) into the smallest product-of-sums form.\n\n The variables must be given as the first argument.\n\n Return a logical :py:class:`~.And` function (i.e., the \"product of sums\"\n or \"POS\" form) that gives the desired outcome. If there are inputs that can\n be ignored, pass them as a list, too.\n\n The result will be one of the (perhaps many) functions that satisfy\n the conditions.\n\n Examples\n ========\n\n >>> from sympy.logic import POSform\n >>> from sympy import symbols\n >>> w, x, y, z = symbols('w x y z')\n >>> minterms = [[0, 0, 0, 1], [0, 0, 1, 1], [0, 1, 1, 1],\n ... [1, 0, 1, 1], [1, 1, 1, 1]]\n >>> dontcares = [[0, 0, 0, 0], [0, 0, 1, 0], [0, 1, 0, 1]]\n >>> POSform([w, x, y, z], minterms, dontcares)\n z & (y | ~w)\n\n The terms can also be represented as integers:\n\n >>> minterms = [1, 3, 7, 11, 15]\n >>> dontcares = [0, 2, 5]\n >>> POSform([w, x, y, z], minterms, dontcares)\n z & (y | ~w)\n\n They can also be specified using dicts, which does not have to be fully\n specified:\n\n >>> minterms = [{w: 0, x: 1}, {y: 1, z: 1, x: 0}]\n >>> POSform([w, x, y, z], minterms)\n (x | y) & (x | z) & (~w | ~x)\n\n Or a combination:\n\n >>> minterms = [4, 7, 11, [1, 1, 1, 1]]\n >>> dontcares = [{w : 0, x : 0, y: 0}, 5]\n >>> POSform([w, x, y, z], minterms, dontcares)\n (w | x) & (y | ~w) & (z | ~y)\n\n See also\n ========\n\n SOPform\n\n References\n ==========\n\n .. [1] https://en.wikipedia.org/wiki/Quine-McCluskey_algorithm\n .. [2] https://en.wikipedia.org/wiki/Don%27t-care_term\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/logic/tests/test_boolalg.py::test_simplification_boolalg", "sympy/logic/tests/test_boolalg.py::test_bool_map", "sympy/logic/tests/test_boolalg.py::test_to_cnf", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_22917", "sympy/logic/tests/test_boolalg.py::test_issue_14700", "sympy/logic/tests/test_boolalg.py::test_relational_simplification", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_simplify", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_fold", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_fold_piecewise_in_cond", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_fold_piecewise_in_cond_2", "sympy/logic/tests/test_boolalg.py::test_issue_7950", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_exclusive", "sympy/logic/tests/test_boolalg.py::test_issue_16803", "sympy/geometry/tests/test_line.py::test_basic_properties_2d", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_21481", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_8458", "sympy/simplify/tests/test_simplify.py::test_issue_21869", "sympy/simplify/tests/test_simplify.py::test_issue_18645", "sympy/simplify/tests/test_simplify.py::test_issue_7950", "sympy/physics/control/tests/test_lti.py::test_StateSpace_dsolve", "sympy/concrete/tests/test_sums_products.py::test_issue_2787", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_point_cflexure", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_shear_force", "sympy/integrals/tests/test_integrals.py::test_issue_4527", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_bmoment", "sympy/integrals/tests/test_manual.py::test_manualintegrate_sqrt_quadratic", "sympy/solvers/tests/test_solvers.py::test_issue_17650", "sympy/integrals/tests/test_integrals.py::test_sqrt_quadratic" ], "PASS_TO_PASS": null }
sympy__sympy-20
1.0
{ "code": "diff --git b/sympy/combinatorics/perm_groups.py a/sympy/combinatorics/perm_groups.py\nindex 4d560c2075..041e0f0719 100644\n--- b/sympy/combinatorics/perm_groups.py\n+++ a/sympy/combinatorics/perm_groups.py\n@@ -3608,6 +3608,130 @@ def schreier_sims_incremental(self, base=None, gens=None, slp_dict=False):\n schreier_sims, schreier_sims_random\n \n \"\"\"\n+ if base is None:\n+ base = []\n+ if gens is None:\n+ gens = self.generators[:]\n+ degree = self.degree\n+ id_af = list(range(degree))\n+ # handle the trivial group\n+ if len(gens) == 1 and gens[0].is_Identity:\n+ if slp_dict:\n+ return base, gens, {gens[0]: [gens[0]]}\n+ return base, gens\n+ # prevent side effects\n+ _base, _gens = base[:], gens[:]\n+ # remove the identity as a generator\n+ _gens = [x for x in _gens if not x.is_Identity]\n+ # make sure no generator fixes all base points\n+ for gen in _gens:\n+ if all(x == gen._array_form[x] for x in _base):\n+ for new in id_af:\n+ if gen._array_form[new] != new:\n+ break\n+ else:\n+ assert None # can this ever happen?\n+ _base.append(new)\n+ # distribute generators according to basic stabilizers\n+ strong_gens_distr = _distribute_gens_by_base(_base, _gens)\n+ strong_gens_slp = []\n+ # initialize the basic stabilizers, basic orbits and basic transversals\n+ orbs = {}\n+ transversals = {}\n+ slps = {}\n+ base_len = len(_base)\n+ for i in range(base_len):\n+ transversals[i], slps[i] = _orbit_transversal(degree, strong_gens_distr[i],\n+ _base[i], pairs=True, af=True, slp=True)\n+ transversals[i] = dict(transversals[i])\n+ orbs[i] = list(transversals[i].keys())\n+ # main loop: amend the stabilizer chain until we have generators\n+ # for all stabilizers\n+ i = base_len - 1\n+ while i >= 0:\n+ # this flag is used to continue with the main loop from inside\n+ # a nested loop\n+ continue_i = False\n+ # test the generators for being a strong generating set\n+ db = {}\n+ for beta, u_beta in list(transversals[i].items()):\n+ for j, gen in enumerate(strong_gens_distr[i]):\n+ gb = gen._array_form[beta]\n+ u1 = transversals[i][gb]\n+ g1 = _af_rmul(gen._array_form, u_beta)\n+ slp = [(i, g) for g in slps[i][beta]]\n+ slp = [(i, j)] + slp\n+ if g1 != u1:\n+ # test if the schreier generator is in the i+1-th\n+ # would-be basic stabilizer\n+ y = True\n+ try:\n+ u1_inv = db[gb]\n+ except KeyError:\n+ u1_inv = db[gb] = _af_invert(u1)\n+ schreier_gen = _af_rmul(u1_inv, g1)\n+ u1_inv_slp = slps[i][gb][:]\n+ u1_inv_slp.reverse()\n+ u1_inv_slp = [(i, (g,)) for g in u1_inv_slp]\n+ slp = u1_inv_slp + slp\n+ h, j, slp = _strip_af(schreier_gen, _base, orbs, transversals, i, slp=slp, slps=slps)\n+ if j <= base_len:\n+ # new strong generator h at level j\n+ y = False\n+ elif h:\n+ # h fixes all base points\n+ y = False\n+ moved = 0\n+ while h[moved] == moved:\n+ moved += 1\n+ _base.append(moved)\n+ base_len += 1\n+ strong_gens_distr.append([])\n+ if y is False:\n+ # if a new strong generator is found, update the\n+ # data structures and start over\n+ h = _af_new(h)\n+ strong_gens_slp.append((h, slp))\n+ for l in range(i + 1, j):\n+ strong_gens_distr[l].append(h)\n+ transversals[l], slps[l] =\\\n+ _orbit_transversal(degree, strong_gens_distr[l],\n+ _base[l], pairs=True, af=True, slp=True)\n+ transversals[l] = dict(transversals[l])\n+ orbs[l] = list(transversals[l].keys())\n+ i = j - 1\n+ # continue main loop using the flag\n+ continue_i = True\n+ if continue_i is True:\n+ break\n+ if continue_i is True:\n+ break\n+ if continue_i is True:\n+ continue\n+ i -= 1\n+\n+ strong_gens = _gens[:]\n+\n+ if slp_dict:\n+ # create the list of the strong generators strong_gens and\n+ # rewrite the indices of strong_gens_slp in terms of the\n+ # elements of strong_gens\n+ for k, slp in strong_gens_slp:\n+ strong_gens.append(k)\n+ for i in range(len(slp)):\n+ s = slp[i]\n+ if isinstance(s[1], tuple):\n+ slp[i] = strong_gens_distr[s[0]][s[1][0]]**-1\n+ else:\n+ slp[i] = strong_gens_distr[s[0]][s[1]]\n+ strong_gens_slp = dict(strong_gens_slp)\n+ # add the original generators\n+ for g in _gens:\n+ strong_gens_slp[g] = [g]\n+ return (_base, strong_gens, strong_gens_slp)\n+\n+ strong_gens.extend([k for k, _ in strong_gens_slp])\n+ return _base, strong_gens\n \n def schreier_sims_random(self, base=None, gens=None, consec_succ=10,\n _random_prec=None):\n", "test": null }
null
{ "code": "diff --git a/sympy/combinatorics/perm_groups.py b/sympy/combinatorics/perm_groups.py\nindex 041e0f0719..4d560c2075 100644\n--- a/sympy/combinatorics/perm_groups.py\n+++ b/sympy/combinatorics/perm_groups.py\n@@ -3608,130 +3608,6 @@ def schreier_sims_incremental(self, base=None, gens=None, slp_dict=False):\n schreier_sims, schreier_sims_random\n \n \"\"\"\n- if base is None:\n- base = []\n- if gens is None:\n- gens = self.generators[:]\n- degree = self.degree\n- id_af = list(range(degree))\n- # handle the trivial group\n- if len(gens) == 1 and gens[0].is_Identity:\n- if slp_dict:\n- return base, gens, {gens[0]: [gens[0]]}\n- return base, gens\n- # prevent side effects\n- _base, _gens = base[:], gens[:]\n- # remove the identity as a generator\n- _gens = [x for x in _gens if not x.is_Identity]\n- # make sure no generator fixes all base points\n- for gen in _gens:\n- if all(x == gen._array_form[x] for x in _base):\n- for new in id_af:\n- if gen._array_form[new] != new:\n- break\n- else:\n- assert None # can this ever happen?\n- _base.append(new)\n- # distribute generators according to basic stabilizers\n- strong_gens_distr = _distribute_gens_by_base(_base, _gens)\n- strong_gens_slp = []\n- # initialize the basic stabilizers, basic orbits and basic transversals\n- orbs = {}\n- transversals = {}\n- slps = {}\n- base_len = len(_base)\n- for i in range(base_len):\n- transversals[i], slps[i] = _orbit_transversal(degree, strong_gens_distr[i],\n- _base[i], pairs=True, af=True, slp=True)\n- transversals[i] = dict(transversals[i])\n- orbs[i] = list(transversals[i].keys())\n- # main loop: amend the stabilizer chain until we have generators\n- # for all stabilizers\n- i = base_len - 1\n- while i >= 0:\n- # this flag is used to continue with the main loop from inside\n- # a nested loop\n- continue_i = False\n- # test the generators for being a strong generating set\n- db = {}\n- for beta, u_beta in list(transversals[i].items()):\n- for j, gen in enumerate(strong_gens_distr[i]):\n- gb = gen._array_form[beta]\n- u1 = transversals[i][gb]\n- g1 = _af_rmul(gen._array_form, u_beta)\n- slp = [(i, g) for g in slps[i][beta]]\n- slp = [(i, j)] + slp\n- if g1 != u1:\n- # test if the schreier generator is in the i+1-th\n- # would-be basic stabilizer\n- y = True\n- try:\n- u1_inv = db[gb]\n- except KeyError:\n- u1_inv = db[gb] = _af_invert(u1)\n- schreier_gen = _af_rmul(u1_inv, g1)\n- u1_inv_slp = slps[i][gb][:]\n- u1_inv_slp.reverse()\n- u1_inv_slp = [(i, (g,)) for g in u1_inv_slp]\n- slp = u1_inv_slp + slp\n- h, j, slp = _strip_af(schreier_gen, _base, orbs, transversals, i, slp=slp, slps=slps)\n- if j <= base_len:\n- # new strong generator h at level j\n- y = False\n- elif h:\n- # h fixes all base points\n- y = False\n- moved = 0\n- while h[moved] == moved:\n- moved += 1\n- _base.append(moved)\n- base_len += 1\n- strong_gens_distr.append([])\n- if y is False:\n- # if a new strong generator is found, update the\n- # data structures and start over\n- h = _af_new(h)\n- strong_gens_slp.append((h, slp))\n- for l in range(i + 1, j):\n- strong_gens_distr[l].append(h)\n- transversals[l], slps[l] =\\\n- _orbit_transversal(degree, strong_gens_distr[l],\n- _base[l], pairs=True, af=True, slp=True)\n- transversals[l] = dict(transversals[l])\n- orbs[l] = list(transversals[l].keys())\n- i = j - 1\n- # continue main loop using the flag\n- continue_i = True\n- if continue_i is True:\n- break\n- if continue_i is True:\n- break\n- if continue_i is True:\n- continue\n- i -= 1\n-\n- strong_gens = _gens[:]\n-\n- if slp_dict:\n- # create the list of the strong generators strong_gens and\n- # rewrite the indices of strong_gens_slp in terms of the\n- # elements of strong_gens\n- for k, slp in strong_gens_slp:\n- strong_gens.append(k)\n- for i in range(len(slp)):\n- s = slp[i]\n- if isinstance(s[1], tuple):\n- slp[i] = strong_gens_distr[s[0]][s[1][0]]**-1\n- else:\n- slp[i] = strong_gens_distr[s[0]][s[1]]\n- strong_gens_slp = dict(strong_gens_slp)\n- # add the original generators\n- for g in _gens:\n- strong_gens_slp[g] = [g]\n- return (_base, strong_gens, strong_gens_slp)\n-\n- strong_gens.extend([k for k, _ in strong_gens_slp])\n- return _base, strong_gens\n \n def schreier_sims_random(self, base=None, gens=None, consec_succ=10,\n _random_prec=None):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/combinatorics/perm_groups.py.\nHere is the description for the function:\n def schreier_sims_incremental(self, base=None, gens=None, slp_dict=False):\n \"\"\"Extend a sequence of points and generating set to a base and strong\n generating set.\n\n Parameters\n ==========\n\n base\n The sequence of points to be extended to a base. Optional\n parameter with default value ``[]``.\n gens\n The generating set to be extended to a strong generating set\n relative to the base obtained. Optional parameter with default\n value ``self.generators``.\n\n slp_dict\n If `True`, return a dictionary `{g: gens}` for each strong\n generator `g` where `gens` is a list of strong generators\n coming before `g` in `strong_gens`, such that the product\n of the elements of `gens` is equal to `g`.\n\n Returns\n =======\n\n (base, strong_gens)\n ``base`` is the base obtained, and ``strong_gens`` is the strong\n generating set relative to it. The original parameters ``base``,\n ``gens`` remain unchanged.\n\n Examples\n ========\n\n >>> from sympy.combinatorics.named_groups import AlternatingGroup\n >>> from sympy.combinatorics.testutil import _verify_bsgs\n >>> A = AlternatingGroup(7)\n >>> base = [2, 3]\n >>> seq = [2, 3]\n >>> base, strong_gens = A.schreier_sims_incremental(base=seq)\n >>> _verify_bsgs(A, base, strong_gens)\n True\n >>> base[:2]\n [2, 3]\n\n Notes\n =====\n\n This version of the Schreier-Sims algorithm runs in polynomial time.\n There are certain assumptions in the implementation - if the trivial\n group is provided, ``base`` and ``gens`` are returned immediately,\n as any sequence of points is a base for the trivial group. If the\n identity is present in the generators ``gens``, it is removed as\n it is a redundant generator.\n The implementation is described in [1], pp. 90-93.\n\n See Also\n ========\n\n schreier_sims, schreier_sims_random\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/tensor/tests/test_tensor.py::test_canonicalize_no_slot_sym", "sympy/combinatorics/tests/test_perm_groups.py::test_generate", "sympy/combinatorics/tests/test_perm_groups.py::test_order", "sympy/tensor/tests/test_tensor.py::test_canonicalize_no_dummies", "sympy/combinatorics/tests/test_perm_groups.py::test_equality", "sympy/tensor/tests/test_tensor.py::test_no_metric_symmetry", "sympy/combinatorics/tests/test_perm_groups.py::test_stabilizer", "sympy/tensor/tests/test_tensor.py::test_canonicalize1", "sympy/combinatorics/tests/test_perm_groups.py::test_center", "sympy/combinatorics/tests/test_perm_groups.py::test_centralizer", "sympy/tensor/tests/test_tensor.py::test_riemann_invariants", "sympy/tensor/tests/test_tensor.py::test_riemann_products", "sympy/combinatorics/tests/test_perm_groups.py::test_coset_rank", "sympy/combinatorics/tests/test_perm_groups.py::test_coset_factor", "sympy/tensor/tests/test_tensor.py::test_canonicalize2", "sympy/tensor/tests/test_tensor.py::test_canonicalize3", "sympy/combinatorics/tests/test_perm_groups.py::test_is_normal", "sympy/tensor/tests/test_tensor.py::test_canonicalize4", "sympy/combinatorics/tests/test_perm_groups.py::test_eq", "sympy/combinatorics/tests/test_perm_groups.py::test_derived_subgroup", "sympy/tensor/tests/test_tensor.py::test_TensorIndexType", "sympy/combinatorics/tests/test_perm_groups.py::test_is_solvable", "sympy/tensor/tests/test_tensor.py::test_add1", "sympy/combinatorics/tests/test_perm_groups.py::test_rubik1", "sympy/tensor/tests/test_tensor.py::test_special_eq_ne", "sympy/combinatorics/tests/test_perm_groups.py::test_direct_product", "sympy/tensor/tests/test_tensor.py::test_add2", "sympy/combinatorics/tests/test_perm_groups.py::test_schreier_sims_random", "sympy/combinatorics/tests/test_perm_groups.py::test_baseswap", "sympy/combinatorics/tests/test_perm_groups.py::test_schreier_sims_incremental", "sympy/tensor/tests/test_tensor.py::test_riemann_cyclic", "sympy/combinatorics/tests/test_perm_groups.py::test_subgroup_search", "sympy/combinatorics/tests/test_perm_groups.py::test_normal_closure", "sympy/combinatorics/tests/test_perm_groups.py::test_derived_series", "sympy/combinatorics/tests/test_perm_groups.py::test_lower_central_series", "sympy/core/tests/test_assumptions.py::test_ask_shuffle", "sympy/combinatorics/tests/test_perm_groups.py::test_commutator", "sympy/tensor/tests/test_tensor.py::test_contract_metric1", "sympy/combinatorics/tests/test_perm_groups.py::test_is_nilpotent", "sympy/tensor/tests/test_tensor.py::test_contract_metric2", "sympy/combinatorics/tests/test_perm_groups.py::test_pointwise_stabilizer", "sympy/tensor/tests/test_tensor.py::test_metric_contract3", "sympy/combinatorics/tests/test_perm_groups.py::test_elements", "sympy/tensor/tests/test_tensor.py::test_contract_metric4", "sympy/combinatorics/tests/test_perm_groups.py::test_coset_transvesal", "sympy/combinatorics/tests/test_perm_groups.py::test_coset_table", "sympy/combinatorics/tests/test_perm_groups.py::test_subgroup", "sympy/tensor/tests/test_tensor.py::test_epsilon", "sympy/combinatorics/tests/test_perm_groups.py::test_generator_product", "sympy/tensor/tests/test_tensor.py::test_contract_delta1", "sympy/combinatorics/tests/test_perm_groups.py::test_sylow_subgroup", "sympy/combinatorics/tests/test_perm_groups.py::test_polycyclic", "sympy/tensor/tests/test_tensor.py::test_fun", "sympy/combinatorics/tests/test_perm_groups.py::test_perfect", "sympy/combinatorics/tests/test_perm_groups.py::test_index", "sympy/tensor/tests/test_tensor.py::test_TensorManager", "sympy/combinatorics/tests/test_perm_groups.py::test_cyclic", "sympy/combinatorics/tests/test_perm_groups.py::test_dihedral", "sympy/combinatorics/tests/test_perm_groups.py::test_abelian_invariants", "sympy/combinatorics/tests/test_perm_groups.py::test_composition_series", "sympy/combinatorics/tests/test_perm_groups.py::test_is_symmetric", "sympy/combinatorics/tests/test_perm_groups.py::test_conjugacy_classes", "sympy/combinatorics/tests/test_perm_groups.py::test_coset_class", "sympy/tensor/tests/test_tensor.py::test_valued_canon_bp_swapaxes", "sympy/tensor/tests/test_tensor.py::test_TensMul_data", "sympy/tensor/tests/test_tensor.py::test_tensor_expand", "sympy/tensor/tests/test_tensor.py::test_TensAdd_matching", "sympy/tensor/tests/test_tensor.py::test_TensMul_matching", "sympy/tensor/tests/test_tensor_operators.py::test_eval_partial_derivative_expr1", "sympy/combinatorics/tests/test_tensor_can.py::test_canonicalize_no_slot_sym", "sympy/combinatorics/tests/test_tensor_can.py::test_canonicalize1", "sympy/combinatorics/tests/test_tensor_can.py::test_riemann_invariants", "sympy/combinatorics/tests/test_tensor_can.py::test_riemann_products", "sympy/combinatorics/tests/test_util.py::test_strip", "sympy/combinatorics/tests/test_util.py::test_orbits_transversals_from_bsgs", "sympy/combinatorics/tests/test_util.py::test_handle_precomputed_bsgs", "sympy/combinatorics/tests/test_util.py::test_remove_gens", "sympy/physics/hep/tests/test_gamma_matrices.py::test_kahane_algorithm", "sympy/physics/hep/tests/test_gamma_matrices.py::test_kahane_simplify1", "sympy/combinatorics/tests/test_testutil.py::test_naive_list_centralizer", "sympy/combinatorics/tests/test_testutil.py::test_verify_bsgs", "sympy/physics/hep/tests/test_gamma_matrices.py::test_gamma_matrix_class", "sympy/combinatorics/tests/test_testutil.py::test_verify_normal_closure", "sympy/physics/hep/tests/test_gamma_matrices.py::test_gamma_matrix_trace", "sympy/combinatorics/tests/test_named_groups.py::test_SymmetricGroup", "sympy/combinatorics/tests/test_named_groups.py::test_CyclicGroup", "sympy/physics/hep/tests/test_gamma_matrices.py::test_bug_13636", "sympy/polys/numberfields/tests/test_galoisgroups.py::test__galois_group_degree_5_hybrid", "sympy/combinatorics/tests/test_named_groups.py::test_DihedralGroup", "sympy/combinatorics/tests/test_named_groups.py::test_AlternatingGroup", "sympy/combinatorics/tests/test_galois.py::test_four_group", "sympy/combinatorics/tests/test_homomorphisms.py::test_homomorphism", "sympy/combinatorics/tests/test_galois.py::test_M20", "sympy/combinatorics/tests/test_pc_groups.py::test_pc_presentation", "sympy/combinatorics/tests/test_homomorphisms.py::test_isomorphisms", "sympy/combinatorics/tests/test_galois.py::test_S6_transitive_subgroups", "sympy/combinatorics/tests/test_pc_groups.py::test_exponent_vector", "sympy/combinatorics/tests/test_pc_groups.py::test_induced_pcgs", "sympy/combinatorics/tests/test_homomorphisms.py::test_check_homomorphism", "sympy/combinatorics/tests/test_fp_groups.py::test_permutation_methods", "sympy/combinatorics/tests/test_group_constructs.py::test_direct_product_n", "sympy/combinatorics/tests/test_fp_groups.py::test_cyclic", "sympy/combinatorics/tests/test_fp_groups.py::test_abelian_invariants" ], "PASS_TO_PASS": null }
sympy__sympy-21
1.0
{ "code": "diff --git b/sympy/polys/polytools.py a/sympy/polys/polytools.py\nindex b52c4a24d5..0546cd1674 100644\n--- b/sympy/polys/polytools.py\n+++ a/sympy/polys/polytools.py\n@@ -3939,6 +3939,11 @@ def which_all_roots(f, candidates):\n same_root\n which_real_roots\n \"\"\"\n+ if f.is_multivariate:\n+ raise MultivariatePolynomialError(\n+ \"Must be a univariate polynomial\")\n+\n+ return f._which_roots(candidates, f.degree())\n \n def _which_roots(f, candidates, num_roots):\n prec = 10\n", "test": null }
null
{ "code": "diff --git a/sympy/polys/polytools.py b/sympy/polys/polytools.py\nindex 0546cd1674..b52c4a24d5 100644\n--- a/sympy/polys/polytools.py\n+++ b/sympy/polys/polytools.py\n@@ -3939,11 +3939,6 @@ def which_all_roots(f, candidates):\n same_root\n which_real_roots\n \"\"\"\n- if f.is_multivariate:\n- raise MultivariatePolynomialError(\n- \"Must be a univariate polynomial\")\n-\n- return f._which_roots(candidates, f.degree())\n \n def _which_roots(f, candidates, num_roots):\n prec = 10\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/polys/polytools.py.\nHere is the description for the function:\n def which_all_roots(f, candidates):\n \"\"\"\n Find roots of a square-free polynomial ``f`` from ``candidates``.\n\n Explanation\n ===========\n\n If ``f`` is a square-free polynomial and ``candidates`` is a superset\n of the roots of ``f``, then ``f.which_all_roots(candidates)`` returns a\n list containing exactly the set of roots of ``f``. The polynomial``f``\n must be univariate and square-free.\n\n The list ``candidates`` must be a superset of the complex roots of\n ``f`` and ``f.which_all_roots(candidates)`` returns exactly the\n set of all complex roots of ``f``. The output preserves the order of\n the order of ``candidates``.\n\n Examples\n ========\n\n >>> from sympy import Poly, I\n >>> from sympy.abc import x\n\n >>> f = Poly(x**4 - 1)\n >>> f.which_all_roots([-1, 1, -I, I, 0])\n [-1, 1, -I, I]\n >>> f.which_all_roots([-1, 1, -I, I, I, I])\n [-1, 1, -I, I]\n\n This method is useful as lifting to rational coefficients\n produced extraneous roots, which we can filter out with\n this method.\n\n >>> f = Poly(x**2 + I*x - 1, x, extension=True)\n >>> f.lift()\n Poly(x**4 - x**2 + 1, x, domain='ZZ')\n >>> f.lift().all_roots()\n [CRootOf(x**4 - x**2 + 1, 0),\n CRootOf(x**4 - x**2 + 1, 1),\n CRootOf(x**4 - x**2 + 1, 2),\n CRootOf(x**4 - x**2 + 1, 3)]\n >>> f.which_all_roots(f.lift().all_roots())\n [CRootOf(x**4 - x**2 + 1, 0), CRootOf(x**4 - x**2 + 1, 2)]\n\n This procedure is already done internally when calling\n `.all_roots()` on a polynomial with algebraic coefficients,\n or polynomials with Gaussian domains.\n\n >>> f.all_roots()\n [CRootOf(x**4 - x**2 + 1, 0), CRootOf(x**4 - x**2 + 1, 2)]\n\n See Also\n ========\n\n same_root\n which_real_roots\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/solvers/tests/test_solveset.py::test_solve_polynomial", "sympy/polys/tests/test_rootoftools.py::test_CRootOf_all_roots", "sympy/polys/tests/test_polytools.py::test_all_roots", "sympy/polys/tests/test_polytools.py::test_which_all_roots" ], "PASS_TO_PASS": null }
sympy__sympy-22
1.0
{ "code": "diff --git b/sympy/combinatorics/polyhedron.py a/sympy/combinatorics/polyhedron.py\nindex c30e8b438b..2bc05d7d97 100644\n--- b/sympy/combinatorics/polyhedron.py\n+++ a/sympy/combinatorics/polyhedron.py\n@@ -567,6 +567,15 @@ def rotate(self, perm):\n >>> h5.corners == copy.corners\n False\n \"\"\"\n+ if not isinstance(perm, Perm):\n+ perm = self.pgroup[perm]\n+ # and we know it's valid\n+ else:\n+ if perm.size != self.size:\n+ raise ValueError('Polyhedron and Permutation sizes differ.')\n+ a = perm.array_form\n+ corners = [self.corners[a[i]] for i in range(len(self.corners))]\n+ self._corners = tuple(corners)\n \n def reset(self):\n \"\"\"Return corners to their original positions.\n", "test": null }
null
{ "code": "diff --git a/sympy/combinatorics/polyhedron.py b/sympy/combinatorics/polyhedron.py\nindex 2bc05d7d97..c30e8b438b 100644\n--- a/sympy/combinatorics/polyhedron.py\n+++ b/sympy/combinatorics/polyhedron.py\n@@ -567,15 +567,6 @@ def rotate(self, perm):\n >>> h5.corners == copy.corners\n False\n \"\"\"\n- if not isinstance(perm, Perm):\n- perm = self.pgroup[perm]\n- # and we know it's valid\n- else:\n- if perm.size != self.size:\n- raise ValueError('Polyhedron and Permutation sizes differ.')\n- a = perm.array_form\n- corners = [self.corners[a[i]] for i in range(len(self.corners))]\n- self._corners = tuple(corners)\n \n def reset(self):\n \"\"\"Return corners to their original positions.\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/combinatorics/polyhedron.py.\nHere is the description for the function:\n def rotate(self, perm):\n \"\"\"\n Apply a permutation to the polyhedron *in place*. The permutation\n may be given as a Permutation instance or an integer indicating\n which permutation from pgroup of the Polyhedron should be\n applied.\n\n This is an operation that is analogous to rotation about\n an axis by a fixed increment.\n\n Notes\n =====\n\n When a Permutation is applied, no check is done to see if that\n is a valid permutation for the Polyhedron. For example, a cube\n could be given a permutation which effectively swaps only 2\n vertices. A valid permutation (that rotates the object in a\n physical way) will be obtained if one only uses\n permutations from the ``pgroup`` of the Polyhedron. On the other\n hand, allowing arbitrary rotations (applications of permutations)\n gives a way to follow named elements rather than indices since\n Polyhedron allows vertices to be named while Permutation works\n only with indices.\n\n Examples\n ========\n\n >>> from sympy.combinatorics import Polyhedron, Permutation\n >>> from sympy.combinatorics.polyhedron import cube\n >>> cube = cube.copy()\n >>> cube.corners\n (0, 1, 2, 3, 4, 5, 6, 7)\n >>> cube.rotate(0)\n >>> cube.corners\n (1, 2, 3, 0, 5, 6, 7, 4)\n\n A non-physical \"rotation\" that is not prohibited by this method:\n\n >>> cube.reset()\n >>> cube.rotate(Permutation([[1, 2]], size=8))\n >>> cube.corners\n (0, 2, 1, 3, 4, 5, 6, 7)\n\n Polyhedron can be used to follow elements of set that are\n identified by letters instead of integers:\n\n >>> shadow = h5 = Polyhedron(list('abcde'))\n >>> p = Permutation([3, 0, 1, 2, 4])\n >>> h5.rotate(p)\n >>> h5.corners\n (d, a, b, c, e)\n >>> _ == shadow.corners\n True\n >>> copy = h5.copy()\n >>> h5.rotate(p)\n >>> h5.corners == copy.corners\n False\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/combinatorics/tests/test_polyhedron.py::test_polyhedron", "sympy/combinatorics/tests/test_polyhedron.py::test_pgroups" ], "PASS_TO_PASS": null }
sympy__sympy-23
1.0
{ "code": "diff --git b/sympy/physics/hydrogen.py a/sympy/physics/hydrogen.py\nindex 0ac9b92560..a3bac274c6 100644\n--- b/sympy/physics/hydrogen.py\n+++ a/sympy/physics/hydrogen.py\n@@ -147,6 +147,18 @@ def Psi_nlm(n, l, m, r, phi, theta, Z=1):\n 1\n \"\"\"\n \n+ # sympify arguments\n+ n, l, m, r, phi, theta, Z = map(S, [n, l, m, r, phi, theta, Z])\n+ # check if values for n,l,m make physically sense\n+ if n.is_integer and n < 1:\n+ raise ValueError(\"'n' must be positive integer\")\n+ if l.is_integer and not (n > l):\n+ raise ValueError(\"'n' must be greater than 'l'\")\n+ if m.is_integer and not (abs(m) <= l):\n+ raise ValueError(\"|'m'| must be less or equal 'l'\")\n+ # return the hydrogen wave function\n+ return R_nl(n, l, r, Z)*Ynm(l, m, theta, phi).expand(func=True)\n+\n \n def E_nl(n, Z=1):\n \"\"\"\n", "test": null }
null
{ "code": "diff --git a/sympy/physics/hydrogen.py b/sympy/physics/hydrogen.py\nindex a3bac274c6..0ac9b92560 100644\n--- a/sympy/physics/hydrogen.py\n+++ b/sympy/physics/hydrogen.py\n@@ -147,18 +147,6 @@ def Psi_nlm(n, l, m, r, phi, theta, Z=1):\n 1\n \"\"\"\n \n- # sympify arguments\n- n, l, m, r, phi, theta, Z = map(S, [n, l, m, r, phi, theta, Z])\n- # check if values for n,l,m make physically sense\n- if n.is_integer and n < 1:\n- raise ValueError(\"'n' must be positive integer\")\n- if l.is_integer and not (n > l):\n- raise ValueError(\"'n' must be greater than 'l'\")\n- if m.is_integer and not (abs(m) <= l):\n- raise ValueError(\"|'m'| must be less or equal 'l'\")\n- # return the hydrogen wave function\n- return R_nl(n, l, r, Z)*Ynm(l, m, theta, phi).expand(func=True)\n-\n \n def E_nl(n, Z=1):\n \"\"\"\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/physics/hydrogen.py.\nHere is the description for the function:\ndef Psi_nlm(n, l, m, r, phi, theta, Z=1):\n \"\"\"\n Returns the Hydrogen wave function psi_{nlm}. It's the product of\n the radial wavefunction R_{nl} and the spherical harmonic Y_{l}^{m}.\n\n Parameters\n ==========\n\n n : integer\n Principal Quantum Number which is\n an integer with possible values as 1, 2, 3, 4,...\n l : integer\n ``l`` is the Angular Momentum Quantum Number with\n values ranging from 0 to ``n-1``.\n m : integer\n ``m`` is the Magnetic Quantum Number with values\n ranging from ``-l`` to ``l``.\n r :\n radial coordinate\n phi :\n azimuthal angle\n theta :\n polar angle\n Z :\n atomic number (1 for Hydrogen, 2 for Helium, ...)\n\n Everything is in Hartree atomic units.\n\n Examples\n ========\n\n >>> from sympy.physics.hydrogen import Psi_nlm\n >>> from sympy import Symbol\n >>> r=Symbol(\"r\", positive=True)\n >>> phi=Symbol(\"phi\", real=True)\n >>> theta=Symbol(\"theta\", real=True)\n >>> Z=Symbol(\"Z\", positive=True, integer=True, nonzero=True)\n >>> Psi_nlm(1,0,0,r,phi,theta,Z)\n Z**(3/2)*exp(-Z*r)/sqrt(pi)\n >>> Psi_nlm(2,1,1,r,phi,theta,Z)\n -Z**(5/2)*r*exp(I*phi)*exp(-Z*r/2)*sin(theta)/(8*sqrt(pi))\n\n Integrating the absolute square of a hydrogen wavefunction psi_{nlm}\n over the whole space leads 1.\n\n The normalization of the hydrogen wavefunctions Psi_nlm is:\n\n >>> from sympy import integrate, conjugate, pi, oo, sin\n >>> wf=Psi_nlm(2,1,1,r,phi,theta,Z)\n >>> abs_sqrd=wf*conjugate(wf)\n >>> jacobi=r**2*sin(theta)\n >>> integrate(abs_sqrd*jacobi, (r,0,oo), (phi,0,2*pi), (theta,0,pi))\n 1\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/physics/tests/test_hydrogen.py::test_psi_nlm" ], "PASS_TO_PASS": null }
sympy__sympy-24
1.0
{ "code": "diff --git b/sympy/physics/vector/frame.py a/sympy/physics/vector/frame.py\nindex 7159c61443..dd0945fbf3 100644\n--- b/sympy/physics/vector/frame.py\n+++ a/sympy/physics/vector/frame.py\n@@ -989,6 +989,23 @@ def orient_body_fixed(self, parent, angles, rotation_order):\n >>> B.orient_body_fixed(N, (q1, q2, q3), 123)\n \n \"\"\"\n+ from sympy.physics.vector.functions import dynamicsymbols\n+\n+ _check_frame(parent)\n+\n+ amounts, rot_order, rot_matrices = self._parse_consecutive_rotations(\n+ angles, rotation_order)\n+ self._dcm(parent, rot_matrices[0] * rot_matrices[1] * rot_matrices[2])\n+\n+ rot_vecs = [zeros(3, 1) for _ in range(3)]\n+ for i, order in enumerate(rot_order):\n+ rot_vecs[i][order - 1] = amounts[i].diff(dynamicsymbols._t)\n+ u1, u2, u3 = rot_vecs[2] + rot_matrices[2].T * (\n+ rot_vecs[1] + rot_matrices[1].T * rot_vecs[0])\n+ wvec = u1 * self.x + u2 * self.y + u3 * self.z # There is a double -\n+ self._ang_vel_dict.update({parent: wvec})\n+ parent._ang_vel_dict.update({self: -wvec})\n+ self._var_dict = {}\n \n def orient_space_fixed(self, parent, angles, rotation_order):\n \"\"\"Rotates this reference frame relative to the parent reference frame\n", "test": null }
null
{ "code": "diff --git a/sympy/physics/vector/frame.py b/sympy/physics/vector/frame.py\nindex dd0945fbf3..7159c61443 100644\n--- a/sympy/physics/vector/frame.py\n+++ b/sympy/physics/vector/frame.py\n@@ -989,23 +989,6 @@ def orient_body_fixed(self, parent, angles, rotation_order):\n >>> B.orient_body_fixed(N, (q1, q2, q3), 123)\n \n \"\"\"\n- from sympy.physics.vector.functions import dynamicsymbols\n-\n- _check_frame(parent)\n-\n- amounts, rot_order, rot_matrices = self._parse_consecutive_rotations(\n- angles, rotation_order)\n- self._dcm(parent, rot_matrices[0] * rot_matrices[1] * rot_matrices[2])\n-\n- rot_vecs = [zeros(3, 1) for _ in range(3)]\n- for i, order in enumerate(rot_order):\n- rot_vecs[i][order - 1] = amounts[i].diff(dynamicsymbols._t)\n- u1, u2, u3 = rot_vecs[2] + rot_matrices[2].T * (\n- rot_vecs[1] + rot_matrices[1].T * rot_vecs[0])\n- wvec = u1 * self.x + u2 * self.y + u3 * self.z # There is a double -\n- self._ang_vel_dict.update({parent: wvec})\n- parent._ang_vel_dict.update({self: -wvec})\n- self._var_dict = {}\n \n def orient_space_fixed(self, parent, angles, rotation_order):\n \"\"\"Rotates this reference frame relative to the parent reference frame\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/physics/vector/frame.py.\nHere is the description for the function:\n def orient_body_fixed(self, parent, angles, rotation_order):\n \"\"\"Rotates this reference frame relative to the parent reference frame\n by right hand rotating through three successive body fixed simple axis\n rotations. Each subsequent axis of rotation is about the \"body fixed\"\n unit vectors of a new intermediate reference frame. This type of\n rotation is also referred to rotating through the `Euler and Tait-Bryan\n Angles`_.\n\n .. _Euler and Tait-Bryan Angles: https://en.wikipedia.org/wiki/Euler_angles\n\n The computed angular velocity in this method is by default expressed in\n the child's frame, so it is most preferable to use ``u1 * child.x + u2 *\n child.y + u3 * child.z`` as generalized speeds.\n\n Parameters\n ==========\n\n parent : ReferenceFrame\n Reference frame that this reference frame will be rotated relative\n to.\n angles : 3-tuple of sympifiable\n Three angles in radians used for the successive rotations.\n rotation_order : 3 character string or 3 digit integer\n Order of the rotations about each intermediate reference frames'\n unit vectors. The Euler rotation about the X, Z', X'' axes can be\n specified by the strings ``'XZX'``, ``'131'``, or the integer\n ``131``. There are 12 unique valid rotation orders (6 Euler and 6\n Tait-Bryan): zxz, xyx, yzy, zyz, xzx, yxy, xyz, yzx, zxy, xzy, zyx,\n and yxz.\n\n Warns\n ======\n\n UserWarning\n If the orientation creates a kinematic loop.\n\n Examples\n ========\n\n Setup variables for the examples:\n\n >>> from sympy import symbols\n >>> from sympy.physics.vector import ReferenceFrame\n >>> q1, q2, q3 = symbols('q1, q2, q3')\n >>> N = ReferenceFrame('N')\n >>> B = ReferenceFrame('B')\n >>> B1 = ReferenceFrame('B1')\n >>> B2 = ReferenceFrame('B2')\n >>> B3 = ReferenceFrame('B3')\n\n For example, a classic Euler Angle rotation can be done by:\n\n >>> B.orient_body_fixed(N, (q1, q2, q3), 'XYX')\n >>> B.dcm(N)\n Matrix([\n [ cos(q2), sin(q1)*sin(q2), -sin(q2)*cos(q1)],\n [sin(q2)*sin(q3), -sin(q1)*sin(q3)*cos(q2) + cos(q1)*cos(q3), sin(q1)*cos(q3) + sin(q3)*cos(q1)*cos(q2)],\n [sin(q2)*cos(q3), -sin(q1)*cos(q2)*cos(q3) - sin(q3)*cos(q1), -sin(q1)*sin(q3) + cos(q1)*cos(q2)*cos(q3)]])\n\n This rotates reference frame B relative to reference frame N through\n ``q1`` about ``N.x``, then rotates B again through ``q2`` about\n ``B.y``, and finally through ``q3`` about ``B.x``. It is equivalent to\n three successive ``orient_axis()`` calls:\n\n >>> B1.orient_axis(N, N.x, q1)\n >>> B2.orient_axis(B1, B1.y, q2)\n >>> B3.orient_axis(B2, B2.x, q3)\n >>> B3.dcm(N)\n Matrix([\n [ cos(q2), sin(q1)*sin(q2), -sin(q2)*cos(q1)],\n [sin(q2)*sin(q3), -sin(q1)*sin(q3)*cos(q2) + cos(q1)*cos(q3), sin(q1)*cos(q3) + sin(q3)*cos(q1)*cos(q2)],\n [sin(q2)*cos(q3), -sin(q1)*cos(q2)*cos(q3) - sin(q3)*cos(q1), -sin(q1)*sin(q3) + cos(q1)*cos(q2)*cos(q3)]])\n\n Acceptable rotation orders are of length 3, expressed in as a string\n ``'XYZ'`` or ``'123'`` or integer ``123``. Rotations about an axis\n twice in a row are prohibited.\n\n >>> B.orient_body_fixed(N, (q1, q2, 0), 'ZXZ')\n >>> B.orient_body_fixed(N, (q1, q2, 0), '121')\n >>> B.orient_body_fixed(N, (q1, q2, q3), 123)\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/physics/vector/tests/test_frame.py::test_ang_vel", "sympy/physics/vector/tests/test_frame.py::test_reference_frame", "sympy/physics/mechanics/tests/test_joint.py::test_pin_joint_interframe", "sympy/physics/vector/tests/test_frame.py::test_orient_body", "sympy/physics/vector/tests/test_frame.py::test_orient_body_advanced", "sympy/physics/vector/tests/test_frame.py::test_orient_body_simple_ang_vel", "sympy/physics/mechanics/tests/test_joint.py::test_spherical_joint", "sympy/physics/mechanics/tests/test_joint.py::test_spherical_joint_speeds_as_derivative_terms", "sympy/physics/mechanics/tests/test_joint.py::test_spherical_joint_coords", "sympy/physics/mechanics/tests/test_joint.py::test_spherical_joint_orient_body", "sympy/physics/mechanics/tests/test_kane.py::test_issue_24887", "sympy/physics/mechanics/tests/test_kane5.py::test_kane_rolling_disc_lu", "sympy/physics/mechanics/tests/test_kane5.py::test_kane_rolling_disc_kdes_callable" ], "PASS_TO_PASS": null }
sympy__sympy-25
1.0
{ "code": "diff --git b/sympy/physics/vector/frame.py a/sympy/physics/vector/frame.py\nindex 4e0dd3896e..dd0945fbf3 100644\n--- b/sympy/physics/vector/frame.py\n+++ a/sympy/physics/vector/frame.py\n@@ -773,6 +773,13 @@ def orient_explicit(self, parent, dcm):\n [0, -sin(q1), cos(q1)]])\n \n \"\"\"\n+ _check_frame(parent)\n+ # amounts must be a Matrix type object\n+ # (e.g. sympy.matrices.dense.MutableDenseMatrix).\n+ if not isinstance(dcm, MatrixBase):\n+ raise TypeError(\"Amounts must be a SymPy Matrix type object.\")\n+\n+ self.orient_dcm(parent, dcm.T)\n \n def orient_dcm(self, parent, dcm):\n \"\"\"Sets the orientation of this reference frame relative to another (parent) reference frame\n", "test": null }
null
{ "code": "diff --git a/sympy/physics/vector/frame.py b/sympy/physics/vector/frame.py\nindex dd0945fbf3..4e0dd3896e 100644\n--- a/sympy/physics/vector/frame.py\n+++ b/sympy/physics/vector/frame.py\n@@ -773,13 +773,6 @@ def orient_explicit(self, parent, dcm):\n [0, -sin(q1), cos(q1)]])\n \n \"\"\"\n- _check_frame(parent)\n- # amounts must be a Matrix type object\n- # (e.g. sympy.matrices.dense.MutableDenseMatrix).\n- if not isinstance(dcm, MatrixBase):\n- raise TypeError(\"Amounts must be a SymPy Matrix type object.\")\n-\n- self.orient_dcm(parent, dcm.T)\n \n def orient_dcm(self, parent, dcm):\n \"\"\"Sets the orientation of this reference frame relative to another (parent) reference frame\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/physics/vector/frame.py.\nHere is the description for the function:\n def orient_explicit(self, parent, dcm):\n \"\"\"Sets the orientation of this reference frame relative to another (parent) reference frame\n using a direction cosine matrix that describes the rotation from the parent to the child.\n\n Parameters\n ==========\n\n parent : ReferenceFrame\n Reference frame that this reference frame will be rotated relative\n to.\n dcm : Matrix, shape(3, 3)\n Direction cosine matrix that specifies the relative rotation\n between the two reference frames.\n\n Warns\n ======\n\n UserWarning\n If the orientation creates a kinematic loop.\n\n Examples\n ========\n\n Setup variables for the examples:\n\n >>> from sympy import symbols, Matrix, sin, cos\n >>> from sympy.physics.vector import ReferenceFrame\n >>> q1 = symbols('q1')\n >>> A = ReferenceFrame('A')\n >>> B = ReferenceFrame('B')\n >>> N = ReferenceFrame('N')\n\n A simple rotation of ``A`` relative to ``N`` about ``N.x`` is defined\n by the following direction cosine matrix:\n\n >>> dcm = Matrix([[1, 0, 0],\n ... [0, cos(q1), -sin(q1)],\n ... [0, sin(q1), cos(q1)]])\n >>> A.orient_explicit(N, dcm)\n >>> A.dcm(N)\n Matrix([\n [1, 0, 0],\n [0, cos(q1), sin(q1)],\n [0, -sin(q1), cos(q1)]])\n\n This is equivalent to using ``orient_axis()``:\n\n >>> B.orient_axis(N, N.x, q1)\n >>> B.dcm(N)\n Matrix([\n [1, 0, 0],\n [0, cos(q1), sin(q1)],\n [0, -sin(q1), cos(q1)]])\n\n **Note carefully that** ``N.dcm(B)`` **(the transpose) would be passed\n into** ``orient_explicit()`` **for** ``A.dcm(N)`` **to match**\n ``B.dcm(N)``:\n\n >>> A.orient_explicit(N, N.dcm(B))\n >>> A.dcm(N)\n Matrix([\n [1, 0, 0],\n [0, cos(q1), sin(q1)],\n [0, -sin(q1), cos(q1)]])\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/physics/vector/tests/test_frame.py::test_w_diff_dcm1", "sympy/physics/vector/tests/test_frame.py::test_w_diff_dcm2", "sympy/physics/vector/tests/test_frame.py::test_issue_11498", "sympy/physics/vector/tests/test_frame.py::test_reference_frame", "sympy/physics/vector/tests/test_frame.py::test_dcm_diff_16824", "sympy/physics/vector/tests/test_frame.py::test_orient_explicit" ], "PASS_TO_PASS": null }
sympy__sympy-26
1.0
{ "code": "diff --git b/sympy/physics/vector/frame.py a/sympy/physics/vector/frame.py\nindex 34fd9eec13..dd0945fbf3 100644\n--- b/sympy/physics/vector/frame.py\n+++ a/sympy/physics/vector/frame.py\n@@ -1087,6 +1087,23 @@ def orient_space_fixed(self, parent, angles, rotation_order):\n [sin(q1)*cos(q2), sin(q1)*sin(q2)*cos(q3) - sin(q3)*cos(q1), sin(q1)*sin(q2)*sin(q3) + cos(q1)*cos(q3)]])\n \n \"\"\"\n+ from sympy.physics.vector.functions import dynamicsymbols\n+\n+ _check_frame(parent)\n+\n+ amounts, rot_order, rot_matrices = self._parse_consecutive_rotations(\n+ angles, rotation_order)\n+ self._dcm(parent, rot_matrices[2] * rot_matrices[1] * rot_matrices[0])\n+\n+ rot_vecs = [zeros(3, 1) for _ in range(3)]\n+ for i, order in enumerate(rot_order):\n+ rot_vecs[i][order - 1] = amounts[i].diff(dynamicsymbols._t)\n+ u1, u2, u3 = rot_vecs[0] + rot_matrices[0].T * (\n+ rot_vecs[1] + rot_matrices[1].T * rot_vecs[2])\n+ wvec = u1 * self.x + u2 * self.y + u3 * self.z # There is a double -\n+ self._ang_vel_dict.update({parent: wvec})\n+ parent._ang_vel_dict.update({self: -wvec})\n+ self._var_dict = {}\n \n def orient_quaternion(self, parent, numbers):\n \"\"\"Sets the orientation of this reference frame relative to a parent\n", "test": null }
null
{ "code": "diff --git a/sympy/physics/vector/frame.py b/sympy/physics/vector/frame.py\nindex dd0945fbf3..34fd9eec13 100644\n--- a/sympy/physics/vector/frame.py\n+++ b/sympy/physics/vector/frame.py\n@@ -1087,23 +1087,6 @@ def orient_space_fixed(self, parent, angles, rotation_order):\n [sin(q1)*cos(q2), sin(q1)*sin(q2)*cos(q3) - sin(q3)*cos(q1), sin(q1)*sin(q2)*sin(q3) + cos(q1)*cos(q3)]])\n \n \"\"\"\n- from sympy.physics.vector.functions import dynamicsymbols\n-\n- _check_frame(parent)\n-\n- amounts, rot_order, rot_matrices = self._parse_consecutive_rotations(\n- angles, rotation_order)\n- self._dcm(parent, rot_matrices[2] * rot_matrices[1] * rot_matrices[0])\n-\n- rot_vecs = [zeros(3, 1) for _ in range(3)]\n- for i, order in enumerate(rot_order):\n- rot_vecs[i][order - 1] = amounts[i].diff(dynamicsymbols._t)\n- u1, u2, u3 = rot_vecs[0] + rot_matrices[0].T * (\n- rot_vecs[1] + rot_matrices[1].T * rot_vecs[2])\n- wvec = u1 * self.x + u2 * self.y + u3 * self.z # There is a double -\n- self._ang_vel_dict.update({parent: wvec})\n- parent._ang_vel_dict.update({self: -wvec})\n- self._var_dict = {}\n \n def orient_quaternion(self, parent, numbers):\n \"\"\"Sets the orientation of this reference frame relative to a parent\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/physics/vector/frame.py.\nHere is the description for the function:\n def orient_space_fixed(self, parent, angles, rotation_order):\n \"\"\"Rotates this reference frame relative to the parent reference frame\n by right hand rotating through three successive space fixed simple axis\n rotations. Each subsequent axis of rotation is about the \"space fixed\"\n unit vectors of the parent reference frame.\n\n The computed angular velocity in this method is by default expressed in\n the child's frame, so it is most preferable to use ``u1 * child.x + u2 *\n child.y + u3 * child.z`` as generalized speeds.\n\n Parameters\n ==========\n parent : ReferenceFrame\n Reference frame that this reference frame will be rotated relative\n to.\n angles : 3-tuple of sympifiable\n Three angles in radians used for the successive rotations.\n rotation_order : 3 character string or 3 digit integer\n Order of the rotations about the parent reference frame's unit\n vectors. The order can be specified by the strings ``'XZX'``,\n ``'131'``, or the integer ``131``. There are 12 unique valid\n rotation orders.\n\n Warns\n ======\n\n UserWarning\n If the orientation creates a kinematic loop.\n\n Examples\n ========\n\n Setup variables for the examples:\n\n >>> from sympy import symbols\n >>> from sympy.physics.vector import ReferenceFrame\n >>> q1, q2, q3 = symbols('q1, q2, q3')\n >>> N = ReferenceFrame('N')\n >>> B = ReferenceFrame('B')\n >>> B1 = ReferenceFrame('B1')\n >>> B2 = ReferenceFrame('B2')\n >>> B3 = ReferenceFrame('B3')\n\n >>> B.orient_space_fixed(N, (q1, q2, q3), '312')\n >>> B.dcm(N)\n Matrix([\n [ sin(q1)*sin(q2)*sin(q3) + cos(q1)*cos(q3), sin(q1)*cos(q2), sin(q1)*sin(q2)*cos(q3) - sin(q3)*cos(q1)],\n [-sin(q1)*cos(q3) + sin(q2)*sin(q3)*cos(q1), cos(q1)*cos(q2), sin(q1)*sin(q3) + sin(q2)*cos(q1)*cos(q3)],\n [ sin(q3)*cos(q2), -sin(q2), cos(q2)*cos(q3)]])\n\n is equivalent to:\n\n >>> B1.orient_axis(N, N.z, q1)\n >>> B2.orient_axis(B1, N.x, q2)\n >>> B3.orient_axis(B2, N.y, q3)\n >>> B3.dcm(N).simplify()\n Matrix([\n [ sin(q1)*sin(q2)*sin(q3) + cos(q1)*cos(q3), sin(q1)*cos(q2), sin(q1)*sin(q2)*cos(q3) - sin(q3)*cos(q1)],\n [-sin(q1)*cos(q3) + sin(q2)*sin(q3)*cos(q1), cos(q1)*cos(q2), sin(q1)*sin(q3) + sin(q2)*cos(q1)*cos(q3)],\n [ sin(q3)*cos(q2), -sin(q2), cos(q2)*cos(q3)]])\n\n It is worth noting that space-fixed and body-fixed rotations are\n related by the order of the rotations, i.e. the reverse order of body\n fixed will give space fixed and vice versa.\n\n >>> B.orient_space_fixed(N, (q1, q2, q3), '231')\n >>> B.dcm(N)\n Matrix([\n [cos(q1)*cos(q2), sin(q1)*sin(q3) + sin(q2)*cos(q1)*cos(q3), -sin(q1)*cos(q3) + sin(q2)*sin(q3)*cos(q1)],\n [ -sin(q2), cos(q2)*cos(q3), sin(q3)*cos(q2)],\n [sin(q1)*cos(q2), sin(q1)*sin(q2)*cos(q3) - sin(q3)*cos(q1), sin(q1)*sin(q2)*sin(q3) + cos(q1)*cos(q3)]])\n\n >>> B.orient_body_fixed(N, (q3, q2, q1), '132')\n >>> B.dcm(N)\n Matrix([\n [cos(q1)*cos(q2), sin(q1)*sin(q3) + sin(q2)*cos(q1)*cos(q3), -sin(q1)*cos(q3) + sin(q2)*sin(q3)*cos(q1)],\n [ -sin(q2), cos(q2)*cos(q3), sin(q3)*cos(q2)],\n [sin(q1)*cos(q2), sin(q1)*sin(q2)*cos(q3) - sin(q3)*cos(q1), sin(q1)*sin(q2)*sin(q3) + cos(q1)*cos(q3)]])\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/physics/vector/tests/test_frame.py::test_dcm", "sympy/physics/vector/tests/test_frame.py::test_issue_10348", "sympy/physics/vector/tests/test_frame.py::test_reference_frame", "sympy/physics/vector/tests/test_frame.py::test_orient_space_advanced", "sympy/physics/vector/tests/test_frame.py::test_orient_space", "sympy/physics/mechanics/tests/test_joint.py::test_spherical_joint_orient_space" ], "PASS_TO_PASS": null }
sympy__sympy-27
1.0
{ "code": "diff --git b/sympy/logic/boolalg.py a/sympy/logic/boolalg.py\nindex 9c5962ae62..6be561c94b 100644\n--- b/sympy/logic/boolalg.py\n+++ a/sympy/logic/boolalg.py\n@@ -2383,6 +2383,19 @@ def SOPform(variables, minterms, dontcares=None):\n .. [2] https://en.wikipedia.org/wiki/Don%27t-care_term\n \n \"\"\"\n+ if not minterms:\n+ return false\n+\n+ variables = tuple(map(sympify, variables))\n+\n+\n+ minterms = _input_to_binlist(minterms, variables)\n+ dontcares = _input_to_binlist((dontcares or []), variables)\n+ for d in dontcares:\n+ if d in minterms:\n+ raise ValueError('%s in minterms is also in dontcares' % d)\n+\n+ return _sop_form(variables, minterms, dontcares)\n \n \n def _sop_form(variables, minterms, dontcares):\n", "test": null }
null
{ "code": "diff --git a/sympy/logic/boolalg.py b/sympy/logic/boolalg.py\nindex 6be561c94b..9c5962ae62 100644\n--- a/sympy/logic/boolalg.py\n+++ b/sympy/logic/boolalg.py\n@@ -2383,19 +2383,6 @@ def SOPform(variables, minterms, dontcares=None):\n .. [2] https://en.wikipedia.org/wiki/Don%27t-care_term\n \n \"\"\"\n- if not minterms:\n- return false\n-\n- variables = tuple(map(sympify, variables))\n-\n-\n- minterms = _input_to_binlist(minterms, variables)\n- dontcares = _input_to_binlist((dontcares or []), variables)\n- for d in dontcares:\n- if d in minterms:\n- raise ValueError('%s in minterms is also in dontcares' % d)\n-\n- return _sop_form(variables, minterms, dontcares)\n \n \n def _sop_form(variables, minterms, dontcares):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/logic/boolalg.py.\nHere is the description for the function:\ndef SOPform(variables, minterms, dontcares=None):\n \"\"\"\n The SOPform function uses simplified_pairs and a redundant group-\n eliminating algorithm to convert the list of all input combos that\n generate '1' (the minterms) into the smallest sum-of-products form.\n\n The variables must be given as the first argument.\n\n Return a logical :py:class:`~.Or` function (i.e., the \"sum of products\" or\n \"SOP\" form) that gives the desired outcome. If there are inputs that can\n be ignored, pass them as a list, too.\n\n The result will be one of the (perhaps many) functions that satisfy\n the conditions.\n\n Examples\n ========\n\n >>> from sympy.logic import SOPform\n >>> from sympy import symbols\n >>> w, x, y, z = symbols('w x y z')\n >>> minterms = [[0, 0, 0, 1], [0, 0, 1, 1],\n ... [0, 1, 1, 1], [1, 0, 1, 1], [1, 1, 1, 1]]\n >>> dontcares = [[0, 0, 0, 0], [0, 0, 1, 0], [0, 1, 0, 1]]\n >>> SOPform([w, x, y, z], minterms, dontcares)\n (y & z) | (~w & ~x)\n\n The terms can also be represented as integers:\n\n >>> minterms = [1, 3, 7, 11, 15]\n >>> dontcares = [0, 2, 5]\n >>> SOPform([w, x, y, z], minterms, dontcares)\n (y & z) | (~w & ~x)\n\n They can also be specified using dicts, which does not have to be fully\n specified:\n\n >>> minterms = [{w: 0, x: 1}, {y: 1, z: 1, x: 0}]\n >>> SOPform([w, x, y, z], minterms)\n (x & ~w) | (y & z & ~x)\n\n Or a combination:\n\n >>> minterms = [4, 7, 11, [1, 1, 1, 1]]\n >>> dontcares = [{w : 0, x : 0, y: 0}, 5]\n >>> SOPform([w, x, y, z], minterms, dontcares)\n (w & y & z) | (~w & ~y) | (x & z & ~w)\n\n See also\n ========\n\n POSform\n\n References\n ==========\n\n .. [1] https://en.wikipedia.org/wiki/Quine-McCluskey_algorithm\n .. [2] https://en.wikipedia.org/wiki/Don%27t-care_term\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/logic/tests/test_boolalg.py::test_simplification_boolalg", "sympy/logic/tests/test_boolalg.py::test_bool_map", "sympy/logic/tests/test_boolalg.py::test_issue_14700", "sympy/logic/tests/test_boolalg.py::test_issue_20870" ], "PASS_TO_PASS": null }
sympy__sympy-28
1.0
{ "code": "diff --git b/sympy/physics/mechanics/wrapping_geometry.py a/sympy/physics/mechanics/wrapping_geometry.py\nindex 6192c248ce..47ed3c1c46 100644\n--- b/sympy/physics/mechanics/wrapping_geometry.py\n+++ a/sympy/physics/mechanics/wrapping_geometry.py\n@@ -488,6 +488,42 @@ def geodesic_length(self, point_1, point_2):\n Point to which the geodesic length should be calculated.\n \n \"\"\"\n+ for point in (point_1, point_2):\n+ if not self.point_on_surface(point):\n+ msg = (\n+ f'Geodesic length cannot be calculated as point {point} '\n+ f'with radius {point.pos_from(self.point).magnitude()} '\n+ f'from the cylinder\\'s center {self.point} does not lie on '\n+ f'the surface of {self} with radius {self.radius} and axis '\n+ f'{self.axis}.'\n+ )\n+ raise ValueError(msg)\n+\n+ relative_position = point_2.pos_from(point_1)\n+ parallel_length = relative_position.dot(self.axis)\n+\n+ point_1_relative_position = point_1.pos_from(self.point)\n+ point_1_perpendicular_vector = (\n+ point_1_relative_position\n+ - point_1_relative_position.dot(self.axis)*self.axis\n+ ).normalize()\n+\n+ point_2_relative_position = point_2.pos_from(self.point)\n+ point_2_perpendicular_vector = (\n+ point_2_relative_position\n+ - point_2_relative_position.dot(self.axis)*self.axis\n+ ).normalize()\n+\n+ central_angle = _directional_atan(\n+ cancel(point_1_perpendicular_vector\n+ .cross(point_2_perpendicular_vector)\n+ .dot(self.axis)),\n+ cancel(point_1_perpendicular_vector.dot(point_2_perpendicular_vector)),\n+ )\n+\n+ planar_arc_length = self.radius*central_angle\n+ geodesic_length = sqrt(parallel_length**2 + planar_arc_length**2)\n+ return geodesic_length\n \n def geodesic_end_vectors(self, point_1, point_2):\n \"\"\"The vectors parallel to the geodesic at the two end points.\n", "test": null }
null
{ "code": "diff --git a/sympy/physics/mechanics/wrapping_geometry.py b/sympy/physics/mechanics/wrapping_geometry.py\nindex 47ed3c1c46..6192c248ce 100644\n--- a/sympy/physics/mechanics/wrapping_geometry.py\n+++ b/sympy/physics/mechanics/wrapping_geometry.py\n@@ -488,42 +488,6 @@ def geodesic_length(self, point_1, point_2):\n Point to which the geodesic length should be calculated.\n \n \"\"\"\n- for point in (point_1, point_2):\n- if not self.point_on_surface(point):\n- msg = (\n- f'Geodesic length cannot be calculated as point {point} '\n- f'with radius {point.pos_from(self.point).magnitude()} '\n- f'from the cylinder\\'s center {self.point} does not lie on '\n- f'the surface of {self} with radius {self.radius} and axis '\n- f'{self.axis}.'\n- )\n- raise ValueError(msg)\n-\n- relative_position = point_2.pos_from(point_1)\n- parallel_length = relative_position.dot(self.axis)\n-\n- point_1_relative_position = point_1.pos_from(self.point)\n- point_1_perpendicular_vector = (\n- point_1_relative_position\n- - point_1_relative_position.dot(self.axis)*self.axis\n- ).normalize()\n-\n- point_2_relative_position = point_2.pos_from(self.point)\n- point_2_perpendicular_vector = (\n- point_2_relative_position\n- - point_2_relative_position.dot(self.axis)*self.axis\n- ).normalize()\n-\n- central_angle = _directional_atan(\n- cancel(point_1_perpendicular_vector\n- .cross(point_2_perpendicular_vector)\n- .dot(self.axis)),\n- cancel(point_1_perpendicular_vector.dot(point_2_perpendicular_vector)),\n- )\n-\n- planar_arc_length = self.radius*central_angle\n- geodesic_length = sqrt(parallel_length**2 + planar_arc_length**2)\n- return geodesic_length\n \n def geodesic_end_vectors(self, point_1, point_2):\n \"\"\"The vectors parallel to the geodesic at the two end points.\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/physics/mechanics/wrapping_geometry.py.\nHere is the description for the function:\n def geodesic_length(self, point_1, point_2):\n \"\"\"The shortest distance between two points on a geometry's surface.\n\n Explanation\n ===========\n\n The geodesic length, i.e. the shortest arc along the surface of a\n cylinder, connecting two points. It can be calculated using Pythagoras'\n theorem. The first short side is the distance between the two points on\n the cylinder's surface parallel to the cylinder's axis. The second\n short side is the arc of a circle between the two points of the\n cylinder's surface perpendicular to the cylinder's axis. The resulting\n hypotenuse is the geodesic length.\n\n Examples\n ========\n\n A geodesic length can only be calculated between two points on the\n cylinder's surface. Firstly, a ``WrappingCylinder`` instance must be\n created along with two points that will lie on its surface:\n\n >>> from sympy import symbols, cos, sin\n >>> from sympy.physics.mechanics import (Point, ReferenceFrame,\n ... WrappingCylinder, dynamicsymbols)\n >>> N = ReferenceFrame('N')\n >>> r = symbols('r')\n >>> pO = Point('pO')\n >>> pO.set_vel(N, 0)\n >>> cylinder = WrappingCylinder(r, pO, N.x)\n >>> p1 = Point('p1')\n >>> p2 = Point('p2')\n\n Let's assume that ``p1`` is located at ``N.x + r*N.y`` relative to\n ``pO`` and that ``p2`` is located at ``r*(cos(q)*N.y + sin(q)*N.z)``\n relative to ``pO``, where ``q(t)`` is a generalized coordinate\n specifying the angle rotated around the ``N.x`` axis according to the\n right-hand rule where ``N.y`` is zero. These positions can be set with:\n\n >>> q = dynamicsymbols('q')\n >>> p1.set_pos(pO, N.x + r*N.y)\n >>> p1.pos_from(pO)\n N.x + r*N.y\n >>> p2.set_pos(pO, r*(cos(q)*N.y + sin(q)*N.z).normalize())\n >>> p2.pos_from(pO).simplify()\n r*cos(q(t))*N.y + r*sin(q(t))*N.z\n\n The geodesic length, which is in this case a is the hypotenuse of a\n right triangle where the other two side lengths are ``1`` (parallel to\n the cylinder's axis) and ``r*q(t)`` (parallel to the cylinder's cross\n section), can be calculated using the ``geodesic_length`` method:\n\n >>> cylinder.geodesic_length(p1, p2).simplify()\n sqrt(r**2*q(t)**2 + 1)\n\n If the ``geodesic_length`` method is passed an argument ``Point`` that\n doesn't lie on the sphere's surface then a ``ValueError`` is raised\n because it's not possible to calculate a value in this case.\n\n Parameters\n ==========\n\n point_1 : Point\n Point from which the geodesic length should be calculated.\n point_2 : Point\n Point to which the geodesic length should be calculated.\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_length_point_not_on_surface_invalid[position0]", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_length_point_not_on_surface_invalid[position1]", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_length[axis0-position_10-position_20-expected0]", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_length[axis1-position_11-position_21-expected1]", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_length[axis2-position_12-position_22-expected2]", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_length[axis3-position_13-position_23-expected3]", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_length[axis4-position_14-position_24-expected4]", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_length[axis5-position_15-position_25-expected5]", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_length[axis6-position_16-position_26-expected6]", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_length[axis7-position_17-position_27-expected7]", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_length[axis8-position_18-position_28-expected8]", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_length[axis9-position_19-position_29-expected9]", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_end_vectors[axis0-position_10-position_20-vector_10-vector_20]", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_end_vectors[axis1-position_11-position_21-vector_11-vector_21]", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_end_vectors[axis2-position_12-position_22-vector_12-vector_22]", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_end_vectors[axis3-position_13-position_23-vector_13-vector_23]", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_end_vectors[axis4-position_14-position_24-vector_14-vector_24]", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_end_vectors[axis5-position_15-position_25-vector_15-vector_25]", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_end_vectors[axis6-position_16-position_26-vector_16-vector_26]", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_end_vectors[axis7-position_17-position_27-vector_17-vector_27]", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_end_vectors[axis8-position_18-position_28-vector_18-vector_28]", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_end_vectors[axis9-position_19-position_29-vector_19-vector_29]", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_end_vectors[axis10-position_110-position_210-vector_110-vector_210]", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_end_vectors[axis11-position_111-position_211-vector_111-vector_211]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_length[pA_vec0-pB_vec0-factor0]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_length[pA_vec1-pB_vec1-factor1]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_length[pA_vec2-pB_vec2-factor2]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_length[pA_vec3-pB_vec3-factor3]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_length[pA_vec4-pB_vec4-factor4]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_length[pA_vec5-pB_vec5-factor5]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_length[pA_vec6-pB_vec6-factor6]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_extension_velocity[pA_vec0-pB_vec0]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_extension_velocity[pA_vec1-pB_vec1]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_extension_velocity[pA_vec2-pB_vec2]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_extension_velocity[pA_vec3-pB_vec3]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_extension_velocity[pA_vec4-pB_vec4]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_extension_velocity[pA_vec5-pB_vec5]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_extension_velocity[pA_vec6-pB_vec6]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_to_loads[pA_vec0-pB_vec0-pA_vec_expected0-pB_vec_expected0-pO_vec_expected0]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_to_loads[pA_vec1-pB_vec1-pA_vec_expected1-pB_vec_expected1-pO_vec_expected1]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_to_loads[pA_vec2-pB_vec2-pA_vec_expected2-pB_vec_expected2-pO_vec_expected2]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_to_loads[pA_vec3-pB_vec3-pA_vec_expected3-pB_vec_expected3-pO_vec_expected3]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_to_loads[pA_vec4-pB_vec4-pA_vec_expected4-pB_vec_expected4-pO_vec_expected4]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_to_loads[pA_vec5-pB_vec5-pA_vec_expected5-pB_vec_expected5-pO_vec_expected5]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_to_loads[pA_vec6-pB_vec6-pA_vec_expected6-pB_vec_expected6-pO_vec_expected6]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_to_loads[pA_vec7-pB_vec7-pA_vec_expected7-pB_vec_expected7-pO_vec_expected7]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_2D_pathway_on_cylinder_length", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_2D_pathway_on_cylinder_extension_velocity", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_2D_pathway_on_cylinder_to_loads" ], "PASS_TO_PASS": null }
sympy__sympy-29
1.0
{ "code": "diff --git b/sympy/physics/mechanics/pathway.py a/sympy/physics/mechanics/pathway.py\nindex 11b37816c2..3823750b0a 100644\n--- b/sympy/physics/mechanics/pathway.py\n+++ a/sympy/physics/mechanics/pathway.py\n@@ -652,6 +652,17 @@ def to_loads(self, force):\n is assumed that this ``Expr`` represents an expansile force.\n \n \"\"\"\n+ pA, pB = self.attachments\n+ pO = self.geometry.point\n+ pA_force, pB_force = self.geometry.geodesic_end_vectors(pA, pB)\n+ pO_force = -(pA_force + pB_force)\n+\n+ loads = [\n+ Force(pA, force * pA_force),\n+ Force(pB, force * pB_force),\n+ Force(pO, force * pO_force),\n+ ]\n+ return loads\n \n def __repr__(self):\n \"\"\"Representation of a ``WrappingPathway``.\"\"\"\n", "test": null }
null
{ "code": "diff --git a/sympy/physics/mechanics/pathway.py b/sympy/physics/mechanics/pathway.py\nindex 3823750b0a..11b37816c2 100644\n--- a/sympy/physics/mechanics/pathway.py\n+++ b/sympy/physics/mechanics/pathway.py\n@@ -652,17 +652,6 @@ def to_loads(self, force):\n is assumed that this ``Expr`` represents an expansile force.\n \n \"\"\"\n- pA, pB = self.attachments\n- pO = self.geometry.point\n- pA_force, pB_force = self.geometry.geodesic_end_vectors(pA, pB)\n- pO_force = -(pA_force + pB_force)\n-\n- loads = [\n- Force(pA, force * pA_force),\n- Force(pB, force * pB_force),\n- Force(pO, force * pO_force),\n- ]\n- return loads\n \n def __repr__(self):\n \"\"\"Representation of a ``WrappingPathway``.\"\"\"\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/physics/mechanics/pathway.py.\nHere is the description for the function:\n def to_loads(self, force):\n \"\"\"Loads required by the equations of motion method classes.\n\n Explanation\n ===========\n\n ``KanesMethod`` requires a list of ``Point``-``Vector`` tuples to be\n passed to the ``loads`` parameters of its ``kanes_equations`` method\n when constructing the equations of motion. This method acts as a\n utility to produce the correctly-structred pairs of points and vectors\n required so that these can be easily concatenated with other items in\n the list of loads and passed to ``KanesMethod.kanes_equations``. These\n loads are also in the correct form to also be passed to the other\n equations of motion method classes, e.g. ``LagrangesMethod``.\n\n Examples\n ========\n\n The below example shows how to generate the loads produced in an\n actuator that produces an expansile force ``F`` while wrapping around a\n cylinder. First, create a cylinder with radius ``r`` and an axis\n parallel to the ``N.z`` direction of the global frame ``N`` that also\n passes through a point ``pO``.\n\n >>> from sympy import symbols\n >>> from sympy.physics.mechanics import (Point, ReferenceFrame,\n ... WrappingCylinder)\n >>> N = ReferenceFrame('N')\n >>> r = symbols('r', positive=True)\n >>> pO = Point('pO')\n >>> cylinder = WrappingCylinder(r, pO, N.z)\n\n Create the pathway of the actuator using the ``WrappingPathway`` class,\n defined to span between two points ``pA`` and ``pB``. Both points lie\n on the surface of the cylinder and the location of ``pB`` is defined\n relative to ``pA`` by the dynamics symbol ``q``.\n\n >>> from sympy import cos, sin\n >>> from sympy.physics.mechanics import WrappingPathway, dynamicsymbols\n >>> q = dynamicsymbols('q')\n >>> pA = Point('pA')\n >>> pB = Point('pB')\n >>> pA.set_pos(pO, r*N.x)\n >>> pB.set_pos(pO, r*(cos(q)*N.x + sin(q)*N.y))\n >>> pB.pos_from(pA)\n (r*cos(q(t)) - r)*N.x + r*sin(q(t))*N.y\n >>> pathway = WrappingPathway(pA, pB, cylinder)\n\n Now create a symbol ``F`` to describe the magnitude of the (expansile)\n force that will be produced along the pathway. The list of loads that\n ``KanesMethod`` requires can be produced by calling the pathway's\n ``to_loads`` method with ``F`` passed as the only argument.\n\n >>> F = symbols('F')\n >>> loads = pathway.to_loads(F)\n >>> [load.__class__(load.location, load.vector.simplify()) for load in loads]\n [(pA, F*N.y), (pB, F*sin(q(t))*N.x - F*cos(q(t))*N.y),\n (pO, - F*sin(q(t))*N.x + F*(cos(q(t)) - 1)*N.y)]\n\n Parameters\n ==========\n\n force : Expr\n Magnitude of the force acting along the length of the pathway. It\n is assumed that this ``Expr`` represents an expansile force.\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_sphere_to_loads[pA_vec0-pB_vec0-pA_vec_expected0-pB_vec_expected0-pO_vec_expected0]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_sphere_to_loads[pA_vec1-pB_vec1-pA_vec_expected1-pB_vec_expected1-pO_vec_expected1]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_sphere_to_loads[pA_vec2-pB_vec2-pA_vec_expected2-pB_vec_expected2-pO_vec_expected2]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_to_loads[pA_vec0-pB_vec0-pA_vec_expected0-pB_vec_expected0-pO_vec_expected0]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_to_loads[pA_vec1-pB_vec1-pA_vec_expected1-pB_vec_expected1-pO_vec_expected1]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_to_loads[pA_vec2-pB_vec2-pA_vec_expected2-pB_vec_expected2-pO_vec_expected2]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_to_loads[pA_vec3-pB_vec3-pA_vec_expected3-pB_vec_expected3-pO_vec_expected3]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_to_loads[pA_vec4-pB_vec4-pA_vec_expected4-pB_vec_expected4-pO_vec_expected4]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_to_loads[pA_vec5-pB_vec5-pA_vec_expected5-pB_vec_expected5-pO_vec_expected5]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_to_loads[pA_vec6-pB_vec6-pA_vec_expected6-pB_vec_expected6-pO_vec_expected6]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_to_loads[pA_vec7-pB_vec7-pA_vec_expected7-pB_vec_expected7-pO_vec_expected7]", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_2D_pathway_on_cylinder_to_loads" ], "PASS_TO_PASS": null }
sympy__sympy-30
1.0
{ "code": "diff --git b/sympy/calculus/finite_diff.py a/sympy/calculus/finite_diff.py\nindex 2c551cb66e..17eece149a 100644\n--- b/sympy/calculus/finite_diff.py\n+++ a/sympy/calculus/finite_diff.py\n@@ -356,6 +356,52 @@ def _as_finite_diff(derivative, points=1, x0=None, wrt=None):\n sympy.calculus.finite_diff.finite_diff_weights\n \n \"\"\"\n+ if derivative.is_Derivative:\n+ pass\n+ elif derivative.is_Atom:\n+ return derivative\n+ else:\n+ return derivative.fromiter(\n+ [_as_finite_diff(ar, points, x0, wrt) for ar\n+ in derivative.args], **derivative.assumptions0)\n+\n+ if wrt is None:\n+ old = None\n+ for v in derivative.variables:\n+ if old is v:\n+ continue\n+ derivative = _as_finite_diff(derivative, points, x0, v)\n+ old = v\n+ return derivative\n+\n+ order = derivative.variables.count(wrt)\n+\n+ if x0 is None:\n+ x0 = wrt\n+\n+ if not iterable(points):\n+ if getattr(points, 'is_Function', False) and wrt in points.args:\n+ points = points.subs(wrt, x0)\n+ # points is simply the step-size, let's make it a\n+ # equidistant sequence centered around x0\n+ if order % 2 == 0:\n+ # even order => odd number of points, grid point included\n+ points = [x0 + points*i for i\n+ in range(-order//2, order//2 + 1)]\n+ else:\n+ # odd order => even number of points, half-way wrt grid point\n+ points = [x0 + points*S(i)/2 for i\n+ in range(-order, order + 1, 2)]\n+ others = [wrt, 0]\n+ for v in set(derivative.variables):\n+ if v == wrt:\n+ continue\n+ others += [v, derivative.variables.count(v)]\n+ if len(points) < order+1:\n+ raise ValueError(\"Too few points for order %d\" % order)\n+ return apply_finite_diff(order, points, [\n+ Derivative(derivative.expr.subs({wrt: x}), *others) for\n+ x in points], x0)\n \n \n def differentiate_finite(expr, *symbols,\n", "test": null }
null
{ "code": "diff --git a/sympy/calculus/finite_diff.py b/sympy/calculus/finite_diff.py\nindex 17eece149a..2c551cb66e 100644\n--- a/sympy/calculus/finite_diff.py\n+++ b/sympy/calculus/finite_diff.py\n@@ -356,52 +356,6 @@ def _as_finite_diff(derivative, points=1, x0=None, wrt=None):\n sympy.calculus.finite_diff.finite_diff_weights\n \n \"\"\"\n- if derivative.is_Derivative:\n- pass\n- elif derivative.is_Atom:\n- return derivative\n- else:\n- return derivative.fromiter(\n- [_as_finite_diff(ar, points, x0, wrt) for ar\n- in derivative.args], **derivative.assumptions0)\n-\n- if wrt is None:\n- old = None\n- for v in derivative.variables:\n- if old is v:\n- continue\n- derivative = _as_finite_diff(derivative, points, x0, v)\n- old = v\n- return derivative\n-\n- order = derivative.variables.count(wrt)\n-\n- if x0 is None:\n- x0 = wrt\n-\n- if not iterable(points):\n- if getattr(points, 'is_Function', False) and wrt in points.args:\n- points = points.subs(wrt, x0)\n- # points is simply the step-size, let's make it a\n- # equidistant sequence centered around x0\n- if order % 2 == 0:\n- # even order => odd number of points, grid point included\n- points = [x0 + points*i for i\n- in range(-order//2, order//2 + 1)]\n- else:\n- # odd order => even number of points, half-way wrt grid point\n- points = [x0 + points*S(i)/2 for i\n- in range(-order, order + 1, 2)]\n- others = [wrt, 0]\n- for v in set(derivative.variables):\n- if v == wrt:\n- continue\n- others += [v, derivative.variables.count(v)]\n- if len(points) < order+1:\n- raise ValueError(\"Too few points for order %d\" % order)\n- return apply_finite_diff(order, points, [\n- Derivative(derivative.expr.subs({wrt: x}), *others) for\n- x in points], x0)\n \n \n def differentiate_finite(expr, *symbols,\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/calculus/finite_diff.py.\nHere is the description for the function:\ndef _as_finite_diff(derivative, points=1, x0=None, wrt=None):\n \"\"\"\n Returns an approximation of a derivative of a function in\n the form of a finite difference formula. The expression is a\n weighted sum of the function at a number of discrete values of\n (one of) the independent variable(s).\n\n Parameters\n ==========\n\n derivative: a Derivative instance\n\n points: sequence or coefficient, optional\n If sequence: discrete values (length >= order+1) of the\n independent variable used for generating the finite\n difference weights.\n If it is a coefficient, it will be used as the step-size\n for generating an equidistant sequence of length order+1\n centered around ``x0``. default: 1 (step-size 1)\n\n x0: number or Symbol, optional\n the value of the independent variable (``wrt``) at which the\n derivative is to be approximated. Default: same as ``wrt``.\n\n wrt: Symbol, optional\n \"with respect to\" the variable for which the (partial)\n derivative is to be approximated for. If not provided it\n is required that the Derivative is ordinary. Default: ``None``.\n\n Examples\n ========\n\n >>> from sympy import symbols, Function, exp, sqrt, Symbol\n >>> from sympy.calculus.finite_diff import _as_finite_diff\n >>> x, h = symbols('x h')\n >>> f = Function('f')\n >>> _as_finite_diff(f(x).diff(x))\n -f(x - 1/2) + f(x + 1/2)\n\n The default step size and number of points are 1 and ``order + 1``\n respectively. We can change the step size by passing a symbol\n as a parameter:\n\n >>> _as_finite_diff(f(x).diff(x), h)\n -f(-h/2 + x)/h + f(h/2 + x)/h\n\n We can also specify the discretized values to be used in a sequence:\n\n >>> _as_finite_diff(f(x).diff(x), [x, x+h, x+2*h])\n -3*f(x)/(2*h) + 2*f(h + x)/h - f(2*h + x)/(2*h)\n\n The algorithm is not restricted to use equidistant spacing, nor\n do we need to make the approximation around ``x0``, but we can get\n an expression estimating the derivative at an offset:\n\n >>> e, sq2 = exp(1), sqrt(2)\n >>> xl = [x-h, x+h, x+e*h]\n >>> _as_finite_diff(f(x).diff(x, 1), xl, x+h*sq2)\n 2*h*((h + sqrt(2)*h)/(2*h) - (-sqrt(2)*h + h)/(2*h))*f(E*h + x)/((-h + E*h)*(h + E*h)) +\n (-(-sqrt(2)*h + h)/(2*h) - (-sqrt(2)*h + E*h)/(2*h))*f(-h + x)/(h + E*h) +\n (-(h + sqrt(2)*h)/(2*h) + (-sqrt(2)*h + E*h)/(2*h))*f(h + x)/(-h + E*h)\n\n Partial derivatives are also supported:\n\n >>> y = Symbol('y')\n >>> d2fdxdy=f(x,y).diff(x,y)\n >>> _as_finite_diff(d2fdxdy, wrt=x)\n -Derivative(f(x - 1/2, y), y) + Derivative(f(x + 1/2, y), y)\n\n See also\n ========\n\n sympy.calculus.finite_diff.apply_finite_diff\n sympy.calculus.finite_diff.finite_diff_weights\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/core/tests/test_function.py::test_Derivative_as_finite_difference", "sympy/calculus/tests/test_finite_diff.py::test_as_finite_diff", "sympy/calculus/tests/test_finite_diff.py::test_differentiate_finite" ], "PASS_TO_PASS": null }
sympy__sympy-31
1.0
{ "code": "diff --git b/sympy/core/exprtools.py a/sympy/core/exprtools.py\nindex e1922f7505..869b9d569f 100644\n--- b/sympy/core/exprtools.py\n+++ a/sympy/core/exprtools.py\n@@ -1335,6 +1335,60 @@ def _mask_nc(eq, name=None):\n (A*_d0 + B*_d1, {_d0: Commutator(A, B), _d1: Commutator(A, C)}, [_d0, _d1, A, B])\n \n \"\"\"\n+ name = name or 'mask'\n+ # Make Dummy() append sequential numbers to the name\n+\n+ def numbered_names():\n+ i = 0\n+ while True:\n+ yield name + str(i)\n+ i += 1\n+\n+ names = numbered_names()\n+\n+ def Dummy(*args, **kwargs):\n+ from .symbol import Dummy\n+ return Dummy(next(names), *args, **kwargs)\n+\n+ expr = eq\n+ if expr.is_commutative:\n+ return eq, {}, []\n+\n+ # identify nc-objects; symbols and other\n+ rep = []\n+ nc_obj = set()\n+ nc_syms = set()\n+ pot = preorder_traversal(expr, keys=default_sort_key)\n+ for i, a in enumerate(pot):\n+ if any(a == r[0] for r in rep):\n+ pot.skip()\n+ elif not a.is_commutative:\n+ if a.is_symbol:\n+ nc_syms.add(a)\n+ pot.skip()\n+ elif not (a.is_Add or a.is_Mul or a.is_Pow):\n+ nc_obj.add(a)\n+ pot.skip()\n+\n+ # If there is only one nc symbol or object, it can be factored regularly\n+ # but polys is going to complain, so replace it with a Dummy.\n+ if len(nc_obj) == 1 and not nc_syms:\n+ rep.append((nc_obj.pop(), Dummy()))\n+ elif len(nc_syms) == 1 and not nc_obj:\n+ rep.append((nc_syms.pop(), Dummy()))\n+\n+ # Any remaining nc-objects will be replaced with an nc-Dummy and\n+ # identified as an nc-Symbol to watch out for\n+ nc_obj = sorted(nc_obj, key=default_sort_key)\n+ for n in nc_obj:\n+ nc = Dummy(commutative=False)\n+ rep.append((n, nc))\n+ nc_syms.add(nc)\n+ expr = expr.subs(rep)\n+\n+ nc_syms = list(nc_syms)\n+ nc_syms.sort(key=default_sort_key)\n+ return expr, {v: k for k, v in rep}, nc_syms\n \n \n def factor_nc(expr):\n", "test": null }
null
{ "code": "diff --git a/sympy/core/exprtools.py b/sympy/core/exprtools.py\nindex 869b9d569f..e1922f7505 100644\n--- a/sympy/core/exprtools.py\n+++ b/sympy/core/exprtools.py\n@@ -1335,60 +1335,6 @@ def _mask_nc(eq, name=None):\n (A*_d0 + B*_d1, {_d0: Commutator(A, B), _d1: Commutator(A, C)}, [_d0, _d1, A, B])\n \n \"\"\"\n- name = name or 'mask'\n- # Make Dummy() append sequential numbers to the name\n-\n- def numbered_names():\n- i = 0\n- while True:\n- yield name + str(i)\n- i += 1\n-\n- names = numbered_names()\n-\n- def Dummy(*args, **kwargs):\n- from .symbol import Dummy\n- return Dummy(next(names), *args, **kwargs)\n-\n- expr = eq\n- if expr.is_commutative:\n- return eq, {}, []\n-\n- # identify nc-objects; symbols and other\n- rep = []\n- nc_obj = set()\n- nc_syms = set()\n- pot = preorder_traversal(expr, keys=default_sort_key)\n- for i, a in enumerate(pot):\n- if any(a == r[0] for r in rep):\n- pot.skip()\n- elif not a.is_commutative:\n- if a.is_symbol:\n- nc_syms.add(a)\n- pot.skip()\n- elif not (a.is_Add or a.is_Mul or a.is_Pow):\n- nc_obj.add(a)\n- pot.skip()\n-\n- # If there is only one nc symbol or object, it can be factored regularly\n- # but polys is going to complain, so replace it with a Dummy.\n- if len(nc_obj) == 1 and not nc_syms:\n- rep.append((nc_obj.pop(), Dummy()))\n- elif len(nc_syms) == 1 and not nc_obj:\n- rep.append((nc_syms.pop(), Dummy()))\n-\n- # Any remaining nc-objects will be replaced with an nc-Dummy and\n- # identified as an nc-Symbol to watch out for\n- nc_obj = sorted(nc_obj, key=default_sort_key)\n- for n in nc_obj:\n- nc = Dummy(commutative=False)\n- rep.append((n, nc))\n- nc_syms.add(nc)\n- expr = expr.subs(rep)\n-\n- nc_syms = list(nc_syms)\n- nc_syms.sort(key=default_sort_key)\n- return expr, {v: k for k, v in rep}, nc_syms\n \n \n def factor_nc(expr):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/core/exprtools.py.\nHere is the description for the function:\ndef _mask_nc(eq, name=None):\n \"\"\"\n Return ``eq`` with non-commutative objects replaced with Dummy\n symbols. A dictionary that can be used to restore the original\n values is returned: if it is None, the expression is noncommutative\n and cannot be made commutative. The third value returned is a list\n of any non-commutative symbols that appear in the returned equation.\n\n Explanation\n ===========\n\n All non-commutative objects other than Symbols are replaced with\n a non-commutative Symbol. Identical objects will be identified\n by identical symbols.\n\n If there is only 1 non-commutative object in an expression it will\n be replaced with a commutative symbol. Otherwise, the non-commutative\n entities are retained and the calling routine should handle\n replacements in this case since some care must be taken to keep\n track of the ordering of symbols when they occur within Muls.\n\n Parameters\n ==========\n\n name : str\n ``name``, if given, is the name that will be used with numbered Dummy\n variables that will replace the non-commutative objects and is mainly\n used for doctesting purposes.\n\n Examples\n ========\n\n >>> from sympy.physics.secondquant import Commutator, NO, F, Fd\n >>> from sympy import symbols\n >>> from sympy.core.exprtools import _mask_nc\n >>> from sympy.abc import x, y\n >>> A, B, C = symbols('A,B,C', commutative=False)\n\n One nc-symbol:\n\n >>> _mask_nc(A**2 - x**2, 'd')\n (_d0**2 - x**2, {_d0: A}, [])\n\n Multiple nc-symbols:\n\n >>> _mask_nc(A**2 - B**2, 'd')\n (A**2 - B**2, {}, [A, B])\n\n An nc-object with nc-symbols but no others outside of it:\n\n >>> _mask_nc(1 + x*Commutator(A, B), 'd')\n (_d0*x + 1, {_d0: Commutator(A, B)}, [])\n >>> _mask_nc(NO(Fd(x)*F(y)), 'd')\n (_d0, {_d0: NO(CreateFermion(x)*AnnihilateFermion(y))}, [])\n\n Multiple nc-objects:\n\n >>> eq = x*Commutator(A, B) + x*Commutator(A, C)*Commutator(A, B)\n >>> _mask_nc(eq, 'd')\n (x*_d0 + x*_d1*_d0, {_d0: Commutator(A, B), _d1: Commutator(A, C)}, [_d0, _d1])\n\n Multiple nc-objects and nc-symbols:\n\n >>> eq = A*Commutator(A, B) + B*Commutator(A, C)\n >>> _mask_nc(eq, 'd')\n (A*_d0 + B*_d1, {_d0: Commutator(A, B), _d1: Commutator(A, C)}, [_d0, _d1, A, B])\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/simplify/tests/test_simplify.py::test_simplify_expr", "sympy/series/tests/test_order.py::test_order_noncommutative", "sympy/simplify/tests/test_simplify.py::test_separatevars", "sympy/concrete/tests/test_delta.py::test_deltaproduct_mul_x_add_kd_kd", "sympy/concrete/tests/test_delta.py::test_deltaproduct_mul_add_x_y_add_kd_kd", "sympy/concrete/tests/test_delta.py::test_deltaproduct_mul_x_add_y_kd", "sympy/concrete/tests/test_delta.py::test_deltaproduct_mul_x_add_y_twokd", "sympy/concrete/tests/test_delta.py::test_deltaproduct_mul_add_x_y_add_y_kd", "sympy/concrete/tests/test_delta.py::test_deltaproduct_mul_add_x_kd_add_y_kd", "sympy/simplify/tests/test_fu.py::test_issue_25590", "sympy/algebras/tests/test_quaternion.py::test_quaternion_construction", "sympy/simplify/tests/test_trigsimp.py::test_trigsimp_noncommutative", "sympy/simplify/tests/test_simplify.py::test_nc_simplify", "sympy/simplify/tests/test_simplify.py::test_issue_23543", "sympy/core/tests/test_noncommutative.py::test_combsimp", "sympy/core/tests/test_noncommutative.py::test_factor", "sympy/core/tests/test_exprtools.py::test_factor_nc", "sympy/core/tests/test_noncommutative.py::test_trigsimp", "sympy/core/tests/test_exprtools.py::test_issue_8263", "sympy/simplify/tests/test_gammasimp.py::test_gammasimp", "sympy/utilities/tests/test_wester.py::test_X6" ], "PASS_TO_PASS": null }
sympy__sympy-32
1.0
{ "code": "diff --git b/sympy/solvers/simplex.py a/sympy/solvers/simplex.py\nindex ced3afb1b2..c406a154a5 100644\n--- b/sympy/solvers/simplex.py\n+++ a/sympy/solvers/simplex.py\n@@ -550,6 +550,39 @@ def _primal_dual(M, factor=True):\n .. [1] David Galvin, Relations between Primal and Dual\n www3.nd.edu/~dgalvin1/30210/30210_F07/presentations/dual_opt.pdf\n \"\"\"\n+ if not M:\n+ return (None, []), (None, [])\n+ if not hasattr(M, \"shape\"):\n+ if len(M) not in (3, 4):\n+ raise ValueError(\"expecting Matrix or 3 or 4 lists\")\n+ M = _m(*M)\n+ m, n = [i - 1 for i in M.shape]\n+ A, b, c, d = _abcd(M)\n+ d = d[0]\n+ _ = lambda x: numbered_symbols(x, start=1)\n+ x = Matrix([i for i, j in zip(_(\"x\"), range(n))])\n+ yT = Matrix([i for i, j in zip(_(\"y\"), range(m))]).T\n+\n+ def ineq(L, r, op):\n+ rv = []\n+ for r in (op(i, j) for i, j in zip(L, r)):\n+ if r == True:\n+ continue\n+ elif r == False:\n+ return [False]\n+ if factor:\n+ f = factor_terms(r)\n+ if f.lhs.is_Mul and f.rhs % f.lhs.args[0] == 0:\n+ assert len(f.lhs.args) == 2, f.lhs\n+ k = f.lhs.args[0]\n+ r = r.func(sign(k) * f.lhs.args[1], f.rhs // abs(k))\n+ rv.append(r)\n+ return rv\n+\n+ eq = lambda x, d: x[0] - d if x else -d\n+ F = eq(c * x, d)\n+ f = eq(yT * b, d)\n+ return (F, ineq(A * x, b, Ge)), (f, ineq(yT * A, c, Le))\n \n \n def _rel_as_nonpos(constr, syms):\n", "test": null }
null
{ "code": "diff --git a/sympy/solvers/simplex.py b/sympy/solvers/simplex.py\nindex c406a154a5..ced3afb1b2 100644\n--- a/sympy/solvers/simplex.py\n+++ b/sympy/solvers/simplex.py\n@@ -550,39 +550,6 @@ def _primal_dual(M, factor=True):\n .. [1] David Galvin, Relations between Primal and Dual\n www3.nd.edu/~dgalvin1/30210/30210_F07/presentations/dual_opt.pdf\n \"\"\"\n- if not M:\n- return (None, []), (None, [])\n- if not hasattr(M, \"shape\"):\n- if len(M) not in (3, 4):\n- raise ValueError(\"expecting Matrix or 3 or 4 lists\")\n- M = _m(*M)\n- m, n = [i - 1 for i in M.shape]\n- A, b, c, d = _abcd(M)\n- d = d[0]\n- _ = lambda x: numbered_symbols(x, start=1)\n- x = Matrix([i for i, j in zip(_(\"x\"), range(n))])\n- yT = Matrix([i for i, j in zip(_(\"y\"), range(m))]).T\n-\n- def ineq(L, r, op):\n- rv = []\n- for r in (op(i, j) for i, j in zip(L, r)):\n- if r == True:\n- continue\n- elif r == False:\n- return [False]\n- if factor:\n- f = factor_terms(r)\n- if f.lhs.is_Mul and f.rhs % f.lhs.args[0] == 0:\n- assert len(f.lhs.args) == 2, f.lhs\n- k = f.lhs.args[0]\n- r = r.func(sign(k) * f.lhs.args[1], f.rhs // abs(k))\n- rv.append(r)\n- return rv\n-\n- eq = lambda x, d: x[0] - d if x else -d\n- F = eq(c * x, d)\n- f = eq(yT * b, d)\n- return (F, ineq(A * x, b, Ge)), (f, ineq(yT * A, c, Le))\n \n \n def _rel_as_nonpos(constr, syms):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/solvers/simplex.py.\nHere is the description for the function:\ndef _primal_dual(M, factor=True):\n \"\"\"return primal and dual function and constraints\n assuming that ``M = Matrix([[A, b], [c, d]])`` and the\n function ``c*x - d`` is being minimized with ``Ax >= b``\n for nonnegative values of ``x``. The dual and its\n constraints will be for maximizing `b.T*y - d` subject\n to ``A.T*y <= c.T``.\n\n Examples\n ========\n\n >>> from sympy.solvers.simplex import _primal_dual, lpmin, lpmax\n >>> from sympy import Matrix\n\n The following matrix represents the primal task of\n minimizing x + y + 7 for y >= x + 1 and y >= -2*x + 3.\n The dual task seeks to maximize x + 3*y + 7 with\n 2*y - x <= 1 and and x + y <= 1:\n\n >>> M = Matrix([\n ... [-1, 1, 1],\n ... [ 2, 1, 3],\n ... [ 1, 1, -7]])\n >>> p, d = _primal_dual(M)\n\n The minimum of the primal and maximum of the dual are the same\n (though they occur at different points):\n\n >>> lpmin(*p)\n (28/3, {x1: 2/3, x2: 5/3})\n >>> lpmax(*d)\n (28/3, {y1: 1/3, y2: 2/3})\n\n If the equivalent (but canonical) inequalities are\n desired, leave `factor=True`, otherwise the unmodified\n inequalities for M will be returned.\n\n >>> m = Matrix([\n ... [-3, -2, 4, -2],\n ... [ 2, 0, 0, -2],\n ... [ 0, 1, -3, 0]])\n\n >>> _primal_dual(m, False) # last condition is 2*x1 >= -2\n ((x2 - 3*x3,\n [-3*x1 - 2*x2 + 4*x3 >= -2, 2*x1 >= -2]),\n (-2*y1 - 2*y2,\n [-3*y1 + 2*y2 <= 0, -2*y1 <= 1, 4*y1 <= -3]))\n\n >>> _primal_dual(m) # condition now x1 >= -1\n ((x2 - 3*x3,\n [-3*x1 - 2*x2 + 4*x3 >= -2, x1 >= -1]),\n (-2*y1 - 2*y2,\n [-3*y1 + 2*y2 <= 0, -2*y1 <= 1, 4*y1 <= -3]))\n\n If you pass the transpose of the matrix, the primal will be\n identified as the standard minimization problem and the\n dual as the standard maximization:\n\n >>> _primal_dual(m.T)\n ((-2*x1 - 2*x2,\n [-3*x1 + 2*x2 >= 0, -2*x1 >= 1, 4*x1 >= -3]),\n (y2 - 3*y3,\n [-3*y1 - 2*y2 + 4*y3 <= -2, y1 <= -1]))\n\n A matrix must have some size or else None will be returned for\n the functions:\n\n >>> _primal_dual(Matrix([[1, 2]]))\n ((x1 - 2, []), (-2, []))\n\n >>> _primal_dual(Matrix([]))\n ((None, []), (None, []))\n\n References\n ==========\n\n .. [1] David Galvin, Relations between Primal and Dual\n www3.nd.edu/~dgalvin1/30210/30210_F07/presentations/dual_opt.pdf\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/solvers/tests/test_simplex.py::test_lpmin_lpmax" ], "PASS_TO_PASS": null }
sympy__sympy-33
1.0
{ "code": "diff --git b/sympy/solvers/simplex.py a/sympy/solvers/simplex.py\nindex 61bfbfd5a5..c406a154a5 100644\n--- b/sympy/solvers/simplex.py\n+++ a/sympy/solvers/simplex.py\n@@ -267,6 +267,135 @@ def _simplex(A, B, C, D=None, dual=False):\n web.tecnico.ulisboa.pt/mcasquilho/acad/or/ftp/FergusonUCLA_lp.pdf\n \n \"\"\"\n+ A, B, C, D = [Matrix(i) for i in (A, B, C, D or [0])]\n+ if dual:\n+ _o, d, p = _simplex(-A.T, C.T, B.T, -D)\n+ return -_o, d, p\n+\n+ if A and B:\n+ M = Matrix([[A, B], [C, D]])\n+ else:\n+ if A or B:\n+ raise ValueError(\"must give A and B\")\n+ # no constraints given\n+ M = Matrix([[C, D]])\n+ n = M.cols - 1\n+ m = M.rows - 1\n+\n+ if not all(i.is_Float or i.is_Rational for i in M):\n+ # with literal Float and Rational we are guaranteed the\n+ # ability of determining whether an expression is 0 or not\n+ raise TypeError(filldedent(\"\"\"\n+ Only rationals and floats are allowed.\n+ \"\"\"\n+ )\n+ )\n+\n+ # x variables have priority over y variables during Bland's rule\n+ # since False < True\n+ X = [(False, j) for j in range(n)]\n+ Y = [(True, i) for i in range(m)]\n+\n+ # Phase 1: find a feasible solution or determine none exist\n+\n+ ## keep track of last pivot row and column\n+ last = None\n+\n+ while True:\n+ B = M[:-1, -1]\n+ A = M[:-1, :-1]\n+ if all(B[i] >= 0 for i in range(B.rows)):\n+ # We have found a feasible solution\n+ break\n+\n+ # Find k: first row with a negative rightmost entry\n+ for k in range(B.rows):\n+ if B[k] < 0:\n+ break # use current value of k below\n+ else:\n+ pass # error will raise below\n+\n+ # Choose pivot column, c\n+ piv_cols = [_ for _ in range(A.cols) if A[k, _] < 0]\n+ if not piv_cols:\n+ raise InfeasibleLPError(filldedent(\"\"\"\n+ The constraint set is empty!\"\"\"))\n+ _, c = min((X[i], i) for i in piv_cols) # Bland's rule\n+\n+ # Choose pivot row, r\n+ piv_rows = [_ for _ in range(A.rows) if A[_, c] > 0 and B[_] > 0]\n+ piv_rows.append(k)\n+ r = _choose_pivot_row(A, B, piv_rows, c, Y)\n+\n+ # check for oscillation\n+ if (r, c) == last:\n+ # Not sure what to do here; it looks like there will be\n+ # oscillations; see o1 test added at this commit to\n+ # see a system with no solution and the o2 for one\n+ # with a solution. In the case of o2, the solution\n+ # from linprog is the same as the one from lpmin, but\n+ # the matrices created in the lpmin case are different\n+ # than those created without replacements in linprog and\n+ # the matrices in the linprog case lead to oscillations.\n+ # If the matrices could be re-written in linprog like\n+ # lpmin does, this behavior could be avoided and then\n+ # perhaps the oscillating case would only occur when\n+ # there is no solution. For now, the output is checked\n+ # before exit if oscillations were detected and an\n+ # error is raised there if the solution was invalid.\n+ #\n+ # cf section 6 of Ferguson for a non-cycling modification\n+ last = True\n+ break\n+ last = r, c\n+\n+ M = _pivot(M, r, c)\n+ X[c], Y[r] = Y[r], X[c]\n+\n+ # Phase 2: from a feasible solution, pivot to optimal\n+ while True:\n+ B = M[:-1, -1]\n+ A = M[:-1, :-1]\n+ C = M[-1, :-1]\n+\n+ # Choose a pivot column, c\n+ piv_cols = [_ for _ in range(n) if C[_] < 0]\n+ if not piv_cols:\n+ break\n+ _, c = min((X[i], i) for i in piv_cols) # Bland's rule\n+\n+ # Choose a pivot row, r\n+ piv_rows = [_ for _ in range(m) if A[_, c] > 0]\n+ if not piv_rows:\n+ raise UnboundedLPError(filldedent(\"\"\"\n+ Objective function can assume\n+ arbitrarily large values!\"\"\"))\n+ r = _choose_pivot_row(A, B, piv_rows, c, Y)\n+\n+ M = _pivot(M, r, c)\n+ X[c], Y[r] = Y[r], X[c]\n+\n+ argmax = [None] * n\n+ argmin_dual = [None] * m\n+\n+ for i, (v, n) in enumerate(X):\n+ if v == False:\n+ argmax[n] = 0\n+ else:\n+ argmin_dual[n] = M[-1, i]\n+\n+ for i, (v, n) in enumerate(Y):\n+ if v == True:\n+ argmin_dual[n] = 0\n+ else:\n+ argmax[n] = M[i, -1]\n+\n+ if last and not all(i >= 0 for i in argmax + argmin_dual):\n+ raise InfeasibleLPError(filldedent(\"\"\"\n+ Oscillating system led to invalid solution.\n+ If you believe there was a valid solution, please\n+ report this as a bug.\"\"\"))\n+ return -M[-1, -1], argmax, argmin_dual\n \n \n ## routines that use _simplex or support those that do\n", "test": null }
null
{ "code": "diff --git a/sympy/solvers/simplex.py b/sympy/solvers/simplex.py\nindex c406a154a5..61bfbfd5a5 100644\n--- a/sympy/solvers/simplex.py\n+++ b/sympy/solvers/simplex.py\n@@ -267,135 +267,6 @@ def _simplex(A, B, C, D=None, dual=False):\n web.tecnico.ulisboa.pt/mcasquilho/acad/or/ftp/FergusonUCLA_lp.pdf\n \n \"\"\"\n- A, B, C, D = [Matrix(i) for i in (A, B, C, D or [0])]\n- if dual:\n- _o, d, p = _simplex(-A.T, C.T, B.T, -D)\n- return -_o, d, p\n-\n- if A and B:\n- M = Matrix([[A, B], [C, D]])\n- else:\n- if A or B:\n- raise ValueError(\"must give A and B\")\n- # no constraints given\n- M = Matrix([[C, D]])\n- n = M.cols - 1\n- m = M.rows - 1\n-\n- if not all(i.is_Float or i.is_Rational for i in M):\n- # with literal Float and Rational we are guaranteed the\n- # ability of determining whether an expression is 0 or not\n- raise TypeError(filldedent(\"\"\"\n- Only rationals and floats are allowed.\n- \"\"\"\n- )\n- )\n-\n- # x variables have priority over y variables during Bland's rule\n- # since False < True\n- X = [(False, j) for j in range(n)]\n- Y = [(True, i) for i in range(m)]\n-\n- # Phase 1: find a feasible solution or determine none exist\n-\n- ## keep track of last pivot row and column\n- last = None\n-\n- while True:\n- B = M[:-1, -1]\n- A = M[:-1, :-1]\n- if all(B[i] >= 0 for i in range(B.rows)):\n- # We have found a feasible solution\n- break\n-\n- # Find k: first row with a negative rightmost entry\n- for k in range(B.rows):\n- if B[k] < 0:\n- break # use current value of k below\n- else:\n- pass # error will raise below\n-\n- # Choose pivot column, c\n- piv_cols = [_ for _ in range(A.cols) if A[k, _] < 0]\n- if not piv_cols:\n- raise InfeasibleLPError(filldedent(\"\"\"\n- The constraint set is empty!\"\"\"))\n- _, c = min((X[i], i) for i in piv_cols) # Bland's rule\n-\n- # Choose pivot row, r\n- piv_rows = [_ for _ in range(A.rows) if A[_, c] > 0 and B[_] > 0]\n- piv_rows.append(k)\n- r = _choose_pivot_row(A, B, piv_rows, c, Y)\n-\n- # check for oscillation\n- if (r, c) == last:\n- # Not sure what to do here; it looks like there will be\n- # oscillations; see o1 test added at this commit to\n- # see a system with no solution and the o2 for one\n- # with a solution. In the case of o2, the solution\n- # from linprog is the same as the one from lpmin, but\n- # the matrices created in the lpmin case are different\n- # than those created without replacements in linprog and\n- # the matrices in the linprog case lead to oscillations.\n- # If the matrices could be re-written in linprog like\n- # lpmin does, this behavior could be avoided and then\n- # perhaps the oscillating case would only occur when\n- # there is no solution. For now, the output is checked\n- # before exit if oscillations were detected and an\n- # error is raised there if the solution was invalid.\n- #\n- # cf section 6 of Ferguson for a non-cycling modification\n- last = True\n- break\n- last = r, c\n-\n- M = _pivot(M, r, c)\n- X[c], Y[r] = Y[r], X[c]\n-\n- # Phase 2: from a feasible solution, pivot to optimal\n- while True:\n- B = M[:-1, -1]\n- A = M[:-1, :-1]\n- C = M[-1, :-1]\n-\n- # Choose a pivot column, c\n- piv_cols = [_ for _ in range(n) if C[_] < 0]\n- if not piv_cols:\n- break\n- _, c = min((X[i], i) for i in piv_cols) # Bland's rule\n-\n- # Choose a pivot row, r\n- piv_rows = [_ for _ in range(m) if A[_, c] > 0]\n- if not piv_rows:\n- raise UnboundedLPError(filldedent(\"\"\"\n- Objective function can assume\n- arbitrarily large values!\"\"\"))\n- r = _choose_pivot_row(A, B, piv_rows, c, Y)\n-\n- M = _pivot(M, r, c)\n- X[c], Y[r] = Y[r], X[c]\n-\n- argmax = [None] * n\n- argmin_dual = [None] * m\n-\n- for i, (v, n) in enumerate(X):\n- if v == False:\n- argmax[n] = 0\n- else:\n- argmin_dual[n] = M[-1, i]\n-\n- for i, (v, n) in enumerate(Y):\n- if v == True:\n- argmin_dual[n] = 0\n- else:\n- argmax[n] = M[i, -1]\n-\n- if last and not all(i >= 0 for i in argmax + argmin_dual):\n- raise InfeasibleLPError(filldedent(\"\"\"\n- Oscillating system led to invalid solution.\n- If you believe there was a valid solution, please\n- report this as a bug.\"\"\"))\n- return -M[-1, -1], argmax, argmin_dual\n \n \n ## routines that use _simplex or support those that do\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/solvers/simplex.py.\nHere is the description for the function:\ndef _simplex(A, B, C, D=None, dual=False):\n \"\"\"Return ``(o, x, y)`` obtained from the two-phase simplex method\n using Bland's rule: ``o`` is the minimum value of primal,\n ``Cx - D``, under constraints ``Ax <= B`` (with ``x >= 0``) and\n the maximum of the dual, ``y^{T}B - D``, under constraints\n ``A^{T}*y >= C^{T}`` (with ``y >= 0``). To compute the dual of\n the system, pass `dual=True` and ``(o, y, x)`` will be returned.\n\n Note: the nonnegative constraints for ``x`` and ``y`` supercede\n any values of ``A`` and ``B`` that are inconsistent with that\n assumption, so if a constraint of ``x >= -1`` is represented\n in ``A`` and ``B``, no value will be obtained that is negative; if\n a constraint of ``x <= -1`` is represented, an error will be\n raised since no solution is possible.\n\n This routine relies on the ability of determining whether an\n expression is 0 or not. This is guaranteed if the input contains\n only Float or Rational entries. It will raise a TypeError if\n a relationship does not evaluate to True or False.\n\n Examples\n ========\n\n >>> from sympy.solvers.simplex import _simplex\n >>> from sympy import Matrix\n\n Consider the simple minimization of ``f = x + y + 1`` under the\n constraint that ``y + 2*x >= 4``. This is the \"standard form\" of\n a minimization.\n\n In the nonnegative quadrant, this inequality describes a area above\n a triangle with vertices at (0, 4), (0, 0) and (2, 0). The minimum\n of ``f`` occurs at (2, 0). Define A, B, C, D for the standard\n minimization:\n\n >>> A = Matrix([[2, 1]])\n >>> B = Matrix([4])\n >>> C = Matrix([[1, 1]])\n >>> D = Matrix([-1])\n\n Confirm that this is the system of interest:\n\n >>> from sympy.abc import x, y\n >>> X = Matrix([x, y])\n >>> (C*X - D)[0]\n x + y + 1\n >>> [i >= j for i, j in zip(A*X, B)]\n [2*x + y >= 4]\n\n Since `_simplex` will do a minimization for constraints given as\n ``A*x <= B``, the signs of ``A`` and ``B`` must be negated since\n the currently correspond to a greater-than inequality:\n\n >>> _simplex(-A, -B, C, D)\n (3, [2, 0], [1/2])\n\n The dual of minimizing ``f`` is maximizing ``F = c*y - d`` for\n ``a*y <= b`` where ``a``, ``b``, ``c``, ``d`` are derived from the\n transpose of the matrix representation of the standard minimization:\n\n >>> tr = lambda a, b, c, d: [i.T for i in (a, c, b, d)]\n >>> a, b, c, d = tr(A, B, C, D)\n\n This time ``a*x <= b`` is the expected inequality for the `_simplex`\n method, but to maximize ``F``, the sign of ``c`` and ``d`` must be\n changed (so that minimizing the negative will give the negative of\n the maximum of ``F``):\n\n >>> _simplex(a, b, -c, -d)\n (-3, [1/2], [2, 0])\n\n The negative of ``F`` and the min of ``f`` are the same. The dual\n point `[1/2]` is the value of ``y`` that minimized ``F = c*y - d``\n under constraints a*x <= b``:\n\n >>> y = Matrix(['y'])\n >>> (c*y - d)[0]\n 4*y + 1\n >>> [i <= j for i, j in zip(a*y,b)]\n [2*y <= 1, y <= 1]\n\n In this 1-dimensional dual system, the more restrictive contraint is\n the first which limits ``y`` between 0 and 1/2 and the maximum of\n ``F`` is attained at the nonzero value, hence is ``4*(1/2) + 1 = 3``.\n\n In this case the values for ``x`` and ``y`` were the same when the\n dual representation was solved. This is not always the case (though\n the value of the function will be the same).\n\n >>> l = [[1, 1], [-1, 1], [0, 1], [-1, 0]], [5, 1, 2, -1], [[1, 1]], [-1]\n >>> A, B, C, D = [Matrix(i) for i in l]\n >>> _simplex(A, B, -C, -D)\n (-6, [3, 2], [1, 0, 0, 0])\n >>> _simplex(A, B, -C, -D, dual=True) # [5, 0] != [3, 2]\n (-6, [1, 0, 0, 0], [5, 0])\n\n In both cases the function has the same value:\n\n >>> Matrix(C)*Matrix([3, 2]) == Matrix(C)*Matrix([5, 0])\n True\n\n See Also\n ========\n _lp - poses min/max problem in form compatible with _simplex\n lpmin - minimization which calls _lp\n lpmax - maximimzation which calls _lp\n\n References\n ==========\n\n .. [1] Thomas S. Ferguson, LINEAR PROGRAMMING: A Concise Introduction\n web.tecnico.ulisboa.pt/mcasquilho/acad/or/ftp/FergusonUCLA_lp.pdf\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/solvers/tests/test_simplex.py::test_lp", "sympy/solvers/tests/test_simplex.py::test_simplex", "sympy/solvers/tests/test_simplex.py::test_lpmin_lpmax", "sympy/solvers/tests/test_simplex.py::test_linprog" ], "PASS_TO_PASS": null }
sympy__sympy-34
1.0
{ "code": "diff --git b/sympy/solvers/inequalities.py a/sympy/solvers/inequalities.py\nindex ec4895865a..b090048807 100644\n--- b/sympy/solvers/inequalities.py\n+++ a/sympy/solvers/inequalities.py\n@@ -782,6 +782,103 @@ def _solve_inequality(ie, s, linear=False):\n >>> f(x < x*(2/x - 1), x)\n (x < 1) & Ne(x, 0)\n \"\"\"\n+ from sympy.solvers.solvers import denoms\n+ if s not in ie.free_symbols:\n+ return ie\n+ if ie.rhs == s:\n+ ie = ie.reversed\n+ if ie.lhs == s and s not in ie.rhs.free_symbols:\n+ return ie\n+\n+ def classify(ie, s, i):\n+ # return True or False if ie evaluates when substituting s with\n+ # i else None (if unevaluated) or NaN (when there is an error\n+ # in evaluating)\n+ try:\n+ v = ie.subs(s, i)\n+ if v is S.NaN:\n+ return v\n+ elif v not in (True, False):\n+ return\n+ return v\n+ except TypeError:\n+ return S.NaN\n+\n+ rv = None\n+ oo = S.Infinity\n+ expr = ie.lhs - ie.rhs\n+ try:\n+ p = Poly(expr, s)\n+ if p.degree() == 0:\n+ rv = ie.func(p.as_expr(), 0)\n+ elif not linear and p.degree() > 1:\n+ # handle in except clause\n+ raise NotImplementedError\n+ except (PolynomialError, NotImplementedError):\n+ if not linear:\n+ try:\n+ rv = reduce_rational_inequalities([[ie]], s)\n+ except PolynomialError:\n+ rv = solve_univariate_inequality(ie, s)\n+ # remove restrictions wrt +/-oo that may have been\n+ # applied when using sets to simplify the relationship\n+ okoo = classify(ie, s, oo)\n+ if okoo is S.true and classify(rv, s, oo) is S.false:\n+ rv = rv.subs(s < oo, True)\n+ oknoo = classify(ie, s, -oo)\n+ if (oknoo is S.true and\n+ classify(rv, s, -oo) is S.false):\n+ rv = rv.subs(-oo < s, True)\n+ rv = rv.subs(s > -oo, True)\n+ if rv is S.true:\n+ rv = (s <= oo) if okoo is S.true else (s < oo)\n+ if oknoo is not S.true:\n+ rv = And(-oo < s, rv)\n+ else:\n+ p = Poly(expr)\n+\n+ conds = []\n+ if rv is None:\n+ e = p.as_expr() # this is in expanded form\n+ # Do a safe inversion of e, moving non-s terms\n+ # to the rhs and dividing by a nonzero factor if\n+ # the relational is Eq/Ne; for other relationals\n+ # the sign must also be positive or negative\n+ rhs = 0\n+ b, ax = e.as_independent(s, as_Add=True)\n+ e -= b\n+ rhs -= b\n+ ef = factor_terms(e)\n+ a, e = ef.as_independent(s, as_Add=False)\n+ if (a.is_zero != False or # don't divide by potential 0\n+ a.is_negative ==\n+ a.is_positive is None and # if sign is not known then\n+ ie.rel_op not in ('!=', '==')): # reject if not Eq/Ne\n+ e = ef\n+ a = S.One\n+ rhs /= a\n+ if a.is_positive:\n+ rv = ie.func(e, rhs)\n+ else:\n+ rv = ie.reversed.func(e, rhs)\n+\n+ # return conditions under which the value is\n+ # valid, too.\n+ beginning_denoms = denoms(ie.lhs) | denoms(ie.rhs)\n+ current_denoms = denoms(rv)\n+ for d in beginning_denoms - current_denoms:\n+ c = _solve_inequality(Eq(d, 0), s, linear=linear)\n+ if isinstance(c, Eq) and c.lhs == s:\n+ if classify(rv, s, c.rhs) is S.true:\n+ # rv is permitting this value but it shouldn't\n+ conds.append(~c)\n+ for i in (-oo, oo):\n+ if (classify(rv, s, i) is S.true and\n+ classify(ie, s, i) is not S.true):\n+ conds.append(s < i if i is oo else i < s)\n+\n+ conds.append(rv)\n+ return And(*conds)\n \n \n def _reduce_inequalities(inequalities, symbols):\n", "test": null }
null
{ "code": "diff --git a/sympy/solvers/inequalities.py b/sympy/solvers/inequalities.py\nindex b090048807..ec4895865a 100644\n--- a/sympy/solvers/inequalities.py\n+++ b/sympy/solvers/inequalities.py\n@@ -782,103 +782,6 @@ def _solve_inequality(ie, s, linear=False):\n >>> f(x < x*(2/x - 1), x)\n (x < 1) & Ne(x, 0)\n \"\"\"\n- from sympy.solvers.solvers import denoms\n- if s not in ie.free_symbols:\n- return ie\n- if ie.rhs == s:\n- ie = ie.reversed\n- if ie.lhs == s and s not in ie.rhs.free_symbols:\n- return ie\n-\n- def classify(ie, s, i):\n- # return True or False if ie evaluates when substituting s with\n- # i else None (if unevaluated) or NaN (when there is an error\n- # in evaluating)\n- try:\n- v = ie.subs(s, i)\n- if v is S.NaN:\n- return v\n- elif v not in (True, False):\n- return\n- return v\n- except TypeError:\n- return S.NaN\n-\n- rv = None\n- oo = S.Infinity\n- expr = ie.lhs - ie.rhs\n- try:\n- p = Poly(expr, s)\n- if p.degree() == 0:\n- rv = ie.func(p.as_expr(), 0)\n- elif not linear and p.degree() > 1:\n- # handle in except clause\n- raise NotImplementedError\n- except (PolynomialError, NotImplementedError):\n- if not linear:\n- try:\n- rv = reduce_rational_inequalities([[ie]], s)\n- except PolynomialError:\n- rv = solve_univariate_inequality(ie, s)\n- # remove restrictions wrt +/-oo that may have been\n- # applied when using sets to simplify the relationship\n- okoo = classify(ie, s, oo)\n- if okoo is S.true and classify(rv, s, oo) is S.false:\n- rv = rv.subs(s < oo, True)\n- oknoo = classify(ie, s, -oo)\n- if (oknoo is S.true and\n- classify(rv, s, -oo) is S.false):\n- rv = rv.subs(-oo < s, True)\n- rv = rv.subs(s > -oo, True)\n- if rv is S.true:\n- rv = (s <= oo) if okoo is S.true else (s < oo)\n- if oknoo is not S.true:\n- rv = And(-oo < s, rv)\n- else:\n- p = Poly(expr)\n-\n- conds = []\n- if rv is None:\n- e = p.as_expr() # this is in expanded form\n- # Do a safe inversion of e, moving non-s terms\n- # to the rhs and dividing by a nonzero factor if\n- # the relational is Eq/Ne; for other relationals\n- # the sign must also be positive or negative\n- rhs = 0\n- b, ax = e.as_independent(s, as_Add=True)\n- e -= b\n- rhs -= b\n- ef = factor_terms(e)\n- a, e = ef.as_independent(s, as_Add=False)\n- if (a.is_zero != False or # don't divide by potential 0\n- a.is_negative ==\n- a.is_positive is None and # if sign is not known then\n- ie.rel_op not in ('!=', '==')): # reject if not Eq/Ne\n- e = ef\n- a = S.One\n- rhs /= a\n- if a.is_positive:\n- rv = ie.func(e, rhs)\n- else:\n- rv = ie.reversed.func(e, rhs)\n-\n- # return conditions under which the value is\n- # valid, too.\n- beginning_denoms = denoms(ie.lhs) | denoms(ie.rhs)\n- current_denoms = denoms(rv)\n- for d in beginning_denoms - current_denoms:\n- c = _solve_inequality(Eq(d, 0), s, linear=linear)\n- if isinstance(c, Eq) and c.lhs == s:\n- if classify(rv, s, c.rhs) is S.true:\n- # rv is permitting this value but it shouldn't\n- conds.append(~c)\n- for i in (-oo, oo):\n- if (classify(rv, s, i) is S.true and\n- classify(ie, s, i) is not S.true):\n- conds.append(s < i if i is oo else i < s)\n-\n- conds.append(rv)\n- return And(*conds)\n \n \n def _reduce_inequalities(inequalities, symbols):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/solvers/inequalities.py.\nHere is the description for the function:\ndef _solve_inequality(ie, s, linear=False):\n \"\"\"Return the inequality with s isolated on the left, if possible.\n If the relationship is non-linear, a solution involving And or Or\n may be returned. False or True are returned if the relationship\n is never True or always True, respectively.\n\n If `linear` is True (default is False) an `s`-dependent expression\n will be isolated on the left, if possible\n but it will not be solved for `s` unless the expression is linear\n in `s`. Furthermore, only \"safe\" operations which do not change the\n sense of the relationship are applied: no division by an unsigned\n value is attempted unless the relationship involves Eq or Ne and\n no division by a value not known to be nonzero is ever attempted.\n\n Examples\n ========\n\n >>> from sympy import Eq, Symbol\n >>> from sympy.solvers.inequalities import _solve_inequality as f\n >>> from sympy.abc import x, y\n\n For linear expressions, the symbol can be isolated:\n\n >>> f(x - 2 < 0, x)\n x < 2\n >>> f(-x - 6 < x, x)\n x > -3\n\n Sometimes nonlinear relationships will be False\n\n >>> f(x**2 + 4 < 0, x)\n False\n\n Or they may involve more than one region of values:\n\n >>> f(x**2 - 4 < 0, x)\n (-2 < x) & (x < 2)\n\n To restrict the solution to a relational, set linear=True\n and only the x-dependent portion will be isolated on the left:\n\n >>> f(x**2 - 4 < 0, x, linear=True)\n x**2 < 4\n\n Division of only nonzero quantities is allowed, so x cannot\n be isolated by dividing by y:\n\n >>> y.is_nonzero is None # it is unknown whether it is 0 or not\n True\n >>> f(x*y < 1, x)\n x*y < 1\n\n And while an equality (or inequality) still holds after dividing by a\n non-zero quantity\n\n >>> nz = Symbol('nz', nonzero=True)\n >>> f(Eq(x*nz, 1), x)\n Eq(x, 1/nz)\n\n the sign must be known for other inequalities involving > or <:\n\n >>> f(x*nz <= 1, x)\n nz*x <= 1\n >>> p = Symbol('p', positive=True)\n >>> f(x*p <= 1, x)\n x <= 1/p\n\n When there are denominators in the original expression that\n are removed by expansion, conditions for them will be returned\n as part of the result:\n\n >>> f(x < x*(2/x - 1), x)\n (x < 1) & Ne(x, 0)\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/stats/tests/test_continuous_rv.py::test_single_normal", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise1", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_integrate1", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_integrate1b", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_integrate2", "sympy/functions/elementary/tests/test_piecewise.py::test_meijer_bypass", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_integrate3_inequality_conditions", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_simplify", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_solve", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_fold", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_interval", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_exclusive", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_12587", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_11045", "sympy/functions/elementary/tests/test_piecewise.py::test_holes", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_11922", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_5227", "sympy/geometry/tests/test_line.py::test_basic_properties_2d", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_10137", "sympy/integrals/tests/test_heurisch.py::test_issue_21166", "sympy/functions/elementary/tests/test_piecewise.py::test_stackoverflow_43852159", "sympy/integrals/tests/test_meijerint.py::test_rewrite_single", "sympy/integrals/tests/test_integrals.py::test_issue_18133", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_12557", "sympy/logic/tests/test_boolalg.py::test_issue_8373", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_6900", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_4313", "sympy/solvers/tests/test_inequalities.py::test_reduce_inequalities_errors", "sympy/functions/elementary/tests/test_piecewise.py::test__intervals", "sympy/solvers/tests/test_inequalities.py::test__solve_inequalities", "sympy/functions/elementary/tests/test_piecewise.py::test_containment", "sympy/solvers/tests/test_inequalities.py::test_issue_5526", "sympy/simplify/tests/test_simplify.py::test_Piecewise", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_with_DiracDelta", "sympy/stats/tests/test_continuous_rv.py::test_ContinuousRV", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_8919", "sympy/functions/elementary/tests/test_piecewise.py::test_unevaluated_integrals", "sympy/logic/tests/test_boolalg.py::test_issue_16803", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_14052", "sympy/integrals/tests/test_meijerint.py::test_recursive", "sympy/simplify/tests/test_simplify.py::test_issue_19822", "sympy/integrals/tests/test_meijerint.py::test_bessel", "sympy/simplify/tests/test_simplify.py::test_issue_18645", "sympy/solvers/tests/test_inequalities.py::test_issue_10198", "sympy/solvers/tests/test_inequalities.py::test_issue_10047", "sympy/solvers/tests/test_inequalities.py::test_issue_10268", "sympy/holonomic/tests/test_holonomic.py::test_to_expr", "sympy/solvers/tests/test_inequalities.py::test__solve_inequality", "sympy/solvers/tests/test_inequalities.py::test_issue_25697", "sympy/integrals/tests/test_integrals.py::test_integrate_max_min", "sympy/integrals/tests/test_transforms.py::test_undefined_function", "sympy/integrals/tests/test_integrals.py::test_integrate_Abs_sign", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_point_cflexure", "sympy/integrals/tests/test_transforms.py::test_mellin_transform", "sympy/integrals/tests/test_meijerint.py::test_messy", "sympy/integrals/tests/test_transforms.py::test_mellin_transform2", "sympy/holonomic/tests/test_holonomic.py::test_integrate", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_7370", "sympy/stats/tests/test_continuous_rv.py::test_trapezoidal", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_22533", "sympy/stats/tests/test_continuous_rv.py::test_uniform", "sympy/integrals/tests/test_transforms.py::test_fourier_transform", "sympy/calculus/tests/test_util.py::test_periodicity", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_shear_force", "sympy/series/tests/test_fourier.py::test_FourierSeries", "sympy/series/tests/test_fourier.py::test_FourierSeries_2", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_bmoment", "sympy/integrals/tests/test_meijerint.py::test_issue_8368", "sympy/series/tests/test_fourier.py::test_square_wave", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_deflection", "sympy/stats/tests/test_continuous_rv.py::test_random_parameters", "sympy/integrals/tests/test_heurisch.py::test_issue_15498", "sympy/series/tests/test_fourier.py::test_FourierSeries__operations", "sympy/stats/tests/test_compound_rv.py::test_normal_CompoundDist", "sympy/stats/tests/test_continuous_rv.py::test_conjugate_priors", "sympy/series/tests/test_fourier.py::test_FourierSeries__neg", "sympy/integrals/tests/test_failing_integrals.py::test_issue_4212_real", "sympy/stats/tests/test_continuous_rv.py::test_precomputed_cdf", "sympy/series/tests/test_fourier.py::test_FourierSeries__add__sub", "sympy/stats/tests/test_symbolic_probability.py::test_literal_probability", "sympy/stats/tests/test_compound_rv.py::test_bernoulli_CompoundDist", "sympy/integrals/tests/test_failing_integrals.py::test_integrate_DiracDelta_no_meijerg", "sympy/integrals/tests/test_transforms.py::test_cosine_transform", "sympy/integrals/tests/test_failing_integrals.py::test_issue_15925b", "sympy/vector/tests/test_integrals.py::test_parametric_surfaceintegrals", "sympy/stats/tests/test_continuous_rv.py::test_issue_13324", "sympy/stats/tests/test_compound_rv.py::test_Compound_Distribution", "sympy/vector/tests/test_integrals.py::test_vector_integrate", "sympy/utilities/tests/test_wester.py::test_V1", "sympy/utilities/tests/test_wester.py::test_V2", "sympy/concrete/tests/test_sums_products.py::test_issue_17165", "sympy/stats/tests/test_continuous_rv.py::test_ContinuousDistributionHandmade", "sympy/solvers/tests/test_solvers.py::test_solve_inequalities", "sympy/utilities/tests/test_wester.py::test_W22", "sympy/utilities/tests/test_wester.py::test_W26", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_torsion_Beam3D", "sympy/integrals/tests/test_integrals.py::test_issue_4492", "sympy/integrals/tests/test_integrals.py::test_issue_14078", "sympy/integrals/tests/test_integrals.py::test_issue_14375", "sympy/integrals/tests/test_integrals.py::test_issue_15457", "sympy/integrals/tests/test_integrals.py::test_issue_15431", "sympy/integrals/tests/test_integrals.py::test_issue_4311_fast", "sympy/solvers/tests/test_solvers.py::test_issue_17638", "sympy/solvers/tests/test_solvers.py::test_issue_12024", "sympy/solvers/tests/test_solvers.py::test_issue_20902", "sympy/solvers/tests/test_solvers.py::test_solve_Piecewise", "sympy/integrals/tests/test_integrals.py::test_issue_4187", "sympy/integrals/tests/test_integrals.py::test_issue_5547", "sympy/integrals/tests/test_integrals.py::test_issue_20782", "sympy/integrals/tests/test_integrals.py::test_issue_20781", "sympy/integrals/tests/test_integrals.py::test_integral_issue_26566", "sympy/solvers/tests/test_solveset.py::test_solvify_piecewise" ], "PASS_TO_PASS": null }
sympy__sympy-35
1.0
{ "code": "diff --git b/sympy/combinatorics/util.py a/sympy/combinatorics/util.py\nindex 0baf66829a..fc73b02f94 100644\n--- b/sympy/combinatorics/util.py\n+++ a/sympy/combinatorics/util.py\n@@ -444,6 +444,17 @@ def _strip(g, base, orbits, transversals):\n sympy.combinatorics.perm_groups.PermutationGroup.schreier_sims_random\n \n \"\"\"\n+ h = g._array_form\n+ base_len = len(base)\n+ for i in range(base_len):\n+ beta = h[base[i]]\n+ if beta == base[i]:\n+ continue\n+ if beta not in orbits[i]:\n+ return _af_new(h), i + 1\n+ u = transversals[i][beta]._array_form\n+ h = _af_rmul(_af_invert(u), h)\n+ return _af_new(h), base_len + 1\n \n \n def _strip_af(h, base, orbits, transversals, j, slp=[], slps={}):\n", "test": null }
null
{ "code": "diff --git a/sympy/combinatorics/util.py b/sympy/combinatorics/util.py\nindex fc73b02f94..0baf66829a 100644\n--- a/sympy/combinatorics/util.py\n+++ b/sympy/combinatorics/util.py\n@@ -444,17 +444,6 @@ def _strip(g, base, orbits, transversals):\n sympy.combinatorics.perm_groups.PermutationGroup.schreier_sims_random\n \n \"\"\"\n- h = g._array_form\n- base_len = len(base)\n- for i in range(base_len):\n- beta = h[base[i]]\n- if beta == base[i]:\n- continue\n- if beta not in orbits[i]:\n- return _af_new(h), i + 1\n- u = transversals[i][beta]._array_form\n- h = _af_rmul(_af_invert(u), h)\n- return _af_new(h), base_len + 1\n \n \n def _strip_af(h, base, orbits, transversals, j, slp=[], slps={}):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/combinatorics/util.py.\nHere is the description for the function:\ndef _strip(g, base, orbits, transversals):\n \"\"\"\n Attempt to decompose a permutation using a (possibly partial) BSGS\n structure.\n\n Explanation\n ===========\n\n This is done by treating the sequence ``base`` as an actual base, and\n the orbits ``orbits`` and transversals ``transversals`` as basic orbits and\n transversals relative to it.\n\n This process is called \"sifting\". A sift is unsuccessful when a certain\n orbit element is not found or when after the sift the decomposition\n does not end with the identity element.\n\n The argument ``transversals`` is a list of dictionaries that provides\n transversal elements for the orbits ``orbits``.\n\n Parameters\n ==========\n\n g : permutation to be decomposed\n base : sequence of points\n orbits : list\n A list in which the ``i``-th entry is an orbit of ``base[i]``\n under some subgroup of the pointwise stabilizer of `\n `base[0], base[1], ..., base[i - 1]``. The groups themselves are implicit\n in this function since the only information we need is encoded in the orbits\n and transversals\n transversals : list\n A list of orbit transversals associated with the orbits *orbits*.\n\n Examples\n ========\n\n >>> from sympy.combinatorics import Permutation, SymmetricGroup\n >>> from sympy.combinatorics.util import _strip\n >>> S = SymmetricGroup(5)\n >>> S.schreier_sims()\n >>> g = Permutation([0, 2, 3, 1, 4])\n >>> _strip(g, S.base, S.basic_orbits, S.basic_transversals)\n ((4), 5)\n\n Notes\n =====\n\n The algorithm is described in [1],pp.89-90. The reason for returning\n both the current state of the element being decomposed and the level\n at which the sifting ends is that they provide important information for\n the randomized version of the Schreier-Sims algorithm.\n\n References\n ==========\n\n .. [1] Holt, D., Eick, B., O'Brien, E.\"Handbook of computational group theory\"\n\n See Also\n ========\n\n sympy.combinatorics.perm_groups.PermutationGroup.schreier_sims\n sympy.combinatorics.perm_groups.PermutationGroup.schreier_sims_random\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/combinatorics/tests/test_perm_groups.py::test_is_normal", "sympy/combinatorics/tests/test_perm_groups.py::test_derived_subgroup", "sympy/combinatorics/tests/test_perm_groups.py::test_is_solvable", "sympy/combinatorics/tests/test_perm_groups.py::test_rubik1", "sympy/combinatorics/tests/test_perm_groups.py::test_schreier_sims_random", "sympy/combinatorics/tests/test_perm_groups.py::test_normal_closure", "sympy/combinatorics/tests/test_perm_groups.py::test_derived_series", "sympy/combinatorics/tests/test_perm_groups.py::test_lower_central_series", "sympy/combinatorics/tests/test_perm_groups.py::test_commutator", "sympy/combinatorics/tests/test_perm_groups.py::test_sylow_subgroup", "sympy/combinatorics/tests/test_perm_groups.py::test_polycyclic", "sympy/combinatorics/tests/test_perm_groups.py::test_perfect", "sympy/combinatorics/tests/test_perm_groups.py::test_abelian_invariants", "sympy/combinatorics/tests/test_perm_groups.py::test_composition_series", "sympy/combinatorics/tests/test_util.py::test_strip", "sympy/combinatorics/tests/test_pc_groups.py::test_pc_presentation", "sympy/combinatorics/tests/test_pc_groups.py::test_exponent_vector", "sympy/combinatorics/tests/test_pc_groups.py::test_induced_pcgs", "sympy/combinatorics/tests/test_fp_groups.py::test_permutation_methods" ], "PASS_TO_PASS": null }
sympy__sympy-36
1.0
{ "code": "diff --git b/sympy/calculus/finite_diff.py a/sympy/calculus/finite_diff.py\nindex 431488e7b5..17eece149a 100644\n--- b/sympy/calculus/finite_diff.py\n+++ a/sympy/calculus/finite_diff.py\n@@ -264,6 +264,21 @@ def apply_finite_diff(order, x_list, y_list, x0=S.Zero):\n \n \"\"\"\n \n+ # In the original paper the following holds for the notation:\n+ # M = order\n+ # N = len(x_list) - 1\n+\n+ N = len(x_list) - 1\n+ if len(x_list) != len(y_list):\n+ raise ValueError(\"x_list and y_list not equal in length.\")\n+\n+ delta = finite_diff_weights(order, x_list, x0)\n+\n+ derivative = 0\n+ for nu in range(len(x_list)):\n+ derivative += delta[order][N][nu]*y_list[nu]\n+ return derivative\n+\n \n def _as_finite_diff(derivative, points=1, x0=None, wrt=None):\n \"\"\"\n", "test": null }
null
{ "code": "diff --git a/sympy/calculus/finite_diff.py b/sympy/calculus/finite_diff.py\nindex 17eece149a..431488e7b5 100644\n--- a/sympy/calculus/finite_diff.py\n+++ b/sympy/calculus/finite_diff.py\n@@ -264,21 +264,6 @@ def apply_finite_diff(order, x_list, y_list, x0=S.Zero):\n \n \"\"\"\n \n- # In the original paper the following holds for the notation:\n- # M = order\n- # N = len(x_list) - 1\n-\n- N = len(x_list) - 1\n- if len(x_list) != len(y_list):\n- raise ValueError(\"x_list and y_list not equal in length.\")\n-\n- delta = finite_diff_weights(order, x_list, x0)\n-\n- derivative = 0\n- for nu in range(len(x_list)):\n- derivative += delta[order][N][nu]*y_list[nu]\n- return derivative\n-\n \n def _as_finite_diff(derivative, points=1, x0=None, wrt=None):\n \"\"\"\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/calculus/finite_diff.py.\nHere is the description for the function:\ndef apply_finite_diff(order, x_list, y_list, x0=S.Zero):\n \"\"\"\n Calculates the finite difference approximation of\n the derivative of requested order at ``x0`` from points\n provided in ``x_list`` and ``y_list``.\n\n Parameters\n ==========\n\n order: int\n order of derivative to approximate. 0 corresponds to interpolation.\n x_list: sequence\n Sequence of (unique) values for the independent variable.\n y_list: sequence\n The function value at corresponding values for the independent\n variable in x_list.\n x0: Number or Symbol\n At what value of the independent variable the derivative should be\n evaluated. Defaults to 0.\n\n Returns\n =======\n\n sympy.core.add.Add or sympy.core.numbers.Number\n The finite difference expression approximating the requested\n derivative order at ``x0``.\n\n Examples\n ========\n\n >>> from sympy import apply_finite_diff\n >>> cube = lambda arg: (1.0*arg)**3\n >>> xlist = range(-3,3+1)\n >>> apply_finite_diff(2, xlist, map(cube, xlist), 2) - 12 # doctest: +SKIP\n -3.55271367880050e-15\n\n we see that the example above only contain rounding errors.\n apply_finite_diff can also be used on more abstract objects:\n\n >>> from sympy import IndexedBase, Idx\n >>> x, y = map(IndexedBase, 'xy')\n >>> i = Idx('i')\n >>> x_list, y_list = zip(*[(x[i+j], y[i+j]) for j in range(-1,2)])\n >>> apply_finite_diff(1, x_list, y_list, x[i])\n ((x[i + 1] - x[i])/(-x[i - 1] + x[i]) - 1)*y[i]/(x[i + 1] - x[i]) -\n (x[i + 1] - x[i])*y[i - 1]/((x[i + 1] - x[i - 1])*(-x[i - 1] + x[i])) +\n (-x[i - 1] + x[i])*y[i + 1]/((x[i + 1] - x[i - 1])*(x[i + 1] - x[i]))\n\n Notes\n =====\n\n Order = 0 corresponds to interpolation.\n Only supply so many points you think makes sense\n to around x0 when extracting the derivative (the function\n need to be well behaved within that region). Also beware\n of Runge's phenomenon.\n\n See also\n ========\n\n sympy.calculus.finite_diff.finite_diff_weights\n\n References\n ==========\n\n Fortran 90 implementation with Python interface for numerics: finitediff_\n\n .. _finitediff: https://github.com/bjodah/finitediff\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/core/tests/test_function.py::test_Derivative_as_finite_difference", "sympy/calculus/tests/test_finite_diff.py::test_apply_finite_diff", "sympy/calculus/tests/test_finite_diff.py::test_as_finite_diff", "sympy/calculus/tests/test_finite_diff.py::test_differentiate_finite" ], "PASS_TO_PASS": null }
sympy__sympy-37
1.0
{ "code": "diff --git b/sympy/assumptions/ask.py a/sympy/assumptions/ask.py\nindex 981ae48b39..ec81ec8ecc 100644\n--- b/sympy/assumptions/ask.py\n+++ a/sympy/assumptions/ask.py\n@@ -454,6 +454,65 @@ def ask(proposition, assumptions=True, context=global_assumptions):\n Proposition is not reduced to ``None`` if the truth value cannot\n be determined.\n \"\"\"\n+ from sympy.assumptions.satask import satask\n+ from sympy.assumptions.lra_satask import lra_satask\n+ from sympy.logic.algorithms.lra_theory import UnhandledInput\n+\n+ proposition = sympify(proposition)\n+ assumptions = sympify(assumptions)\n+\n+ if isinstance(proposition, Predicate) or proposition.kind is not BooleanKind:\n+ raise TypeError(\"proposition must be a valid logical expression\")\n+\n+ if isinstance(assumptions, Predicate) or assumptions.kind is not BooleanKind:\n+ raise TypeError(\"assumptions must be a valid logical expression\")\n+\n+ binrelpreds = {Eq: Q.eq, Ne: Q.ne, Gt: Q.gt, Lt: Q.lt, Ge: Q.ge, Le: Q.le}\n+ if isinstance(proposition, AppliedPredicate):\n+ key, args = proposition.function, proposition.arguments\n+ elif proposition.func in binrelpreds:\n+ key, args = binrelpreds[type(proposition)], proposition.args\n+ else:\n+ key, args = Q.is_true, (proposition,)\n+\n+ # convert local and global assumptions to CNF\n+ assump_cnf = CNF.from_prop(assumptions)\n+ assump_cnf.extend(context)\n+\n+ # extract the relevant facts from assumptions with respect to args\n+ local_facts = _extract_all_facts(assump_cnf, args)\n+\n+ # convert default facts and assumed facts to encoded CNF\n+ known_facts_cnf = get_all_known_facts()\n+ enc_cnf = EncodedCNF()\n+ enc_cnf.from_cnf(CNF(known_facts_cnf))\n+ enc_cnf.add_from_cnf(local_facts)\n+\n+ # check the satisfiability of given assumptions\n+ if local_facts.clauses and satisfiable(enc_cnf) is False:\n+ raise ValueError(\"inconsistent assumptions %s\" % assumptions)\n+\n+ # quick computation for single fact\n+ res = _ask_single_fact(key, local_facts)\n+ if res is not None:\n+ return res\n+\n+ # direct resolution method, no logic\n+ res = key(*args)._eval_ask(assumptions)\n+ if res is not None:\n+ return bool(res)\n+\n+ # using satask (still costly)\n+ res = satask(proposition, assumptions=assumptions, context=context)\n+ if res is not None:\n+ return res\n+\n+ try:\n+ res = lra_satask(proposition, assumptions=assumptions, context=context)\n+ except UnhandledInput:\n+ return None\n+\n+ return res\n \n \n def _ask_single_fact(key, local_facts):\n", "test": null }
null
{ "code": "diff --git a/sympy/assumptions/ask.py b/sympy/assumptions/ask.py\nindex ec81ec8ecc..981ae48b39 100644\n--- a/sympy/assumptions/ask.py\n+++ b/sympy/assumptions/ask.py\n@@ -454,65 +454,6 @@ def ask(proposition, assumptions=True, context=global_assumptions):\n Proposition is not reduced to ``None`` if the truth value cannot\n be determined.\n \"\"\"\n- from sympy.assumptions.satask import satask\n- from sympy.assumptions.lra_satask import lra_satask\n- from sympy.logic.algorithms.lra_theory import UnhandledInput\n-\n- proposition = sympify(proposition)\n- assumptions = sympify(assumptions)\n-\n- if isinstance(proposition, Predicate) or proposition.kind is not BooleanKind:\n- raise TypeError(\"proposition must be a valid logical expression\")\n-\n- if isinstance(assumptions, Predicate) or assumptions.kind is not BooleanKind:\n- raise TypeError(\"assumptions must be a valid logical expression\")\n-\n- binrelpreds = {Eq: Q.eq, Ne: Q.ne, Gt: Q.gt, Lt: Q.lt, Ge: Q.ge, Le: Q.le}\n- if isinstance(proposition, AppliedPredicate):\n- key, args = proposition.function, proposition.arguments\n- elif proposition.func in binrelpreds:\n- key, args = binrelpreds[type(proposition)], proposition.args\n- else:\n- key, args = Q.is_true, (proposition,)\n-\n- # convert local and global assumptions to CNF\n- assump_cnf = CNF.from_prop(assumptions)\n- assump_cnf.extend(context)\n-\n- # extract the relevant facts from assumptions with respect to args\n- local_facts = _extract_all_facts(assump_cnf, args)\n-\n- # convert default facts and assumed facts to encoded CNF\n- known_facts_cnf = get_all_known_facts()\n- enc_cnf = EncodedCNF()\n- enc_cnf.from_cnf(CNF(known_facts_cnf))\n- enc_cnf.add_from_cnf(local_facts)\n-\n- # check the satisfiability of given assumptions\n- if local_facts.clauses and satisfiable(enc_cnf) is False:\n- raise ValueError(\"inconsistent assumptions %s\" % assumptions)\n-\n- # quick computation for single fact\n- res = _ask_single_fact(key, local_facts)\n- if res is not None:\n- return res\n-\n- # direct resolution method, no logic\n- res = key(*args)._eval_ask(assumptions)\n- if res is not None:\n- return bool(res)\n-\n- # using satask (still costly)\n- res = satask(proposition, assumptions=assumptions, context=context)\n- if res is not None:\n- return res\n-\n- try:\n- res = lra_satask(proposition, assumptions=assumptions, context=context)\n- except UnhandledInput:\n- return None\n-\n- return res\n \n \n def _ask_single_fact(key, local_facts):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/assumptions/ask.py.\nHere is the description for the function:\ndef ask(proposition, assumptions=True, context=global_assumptions):\n \"\"\"\n Function to evaluate the proposition with assumptions.\n\n Explanation\n ===========\n\n This function evaluates the proposition to ``True`` or ``False`` if\n the truth value can be determined. If not, it returns ``None``.\n\n It should be discerned from :func:`~.refine` which, when applied to a\n proposition, simplifies the argument to symbolic ``Boolean`` instead of\n Python built-in ``True``, ``False`` or ``None``.\n\n **Syntax**\n\n * ask(proposition)\n Evaluate the *proposition* in global assumption context.\n\n * ask(proposition, assumptions)\n Evaluate the *proposition* with respect to *assumptions* in\n global assumption context.\n\n Parameters\n ==========\n\n proposition : Boolean\n Proposition which will be evaluated to boolean value. If this is\n not ``AppliedPredicate``, it will be wrapped by ``Q.is_true``.\n\n assumptions : Boolean, optional\n Local assumptions to evaluate the *proposition*.\n\n context : AssumptionsContext, optional\n Default assumptions to evaluate the *proposition*. By default,\n this is ``sympy.assumptions.global_assumptions`` variable.\n\n Returns\n =======\n\n ``True``, ``False``, or ``None``\n\n Raises\n ======\n\n TypeError : *proposition* or *assumptions* is not valid logical expression.\n\n ValueError : assumptions are inconsistent.\n\n Examples\n ========\n\n >>> from sympy import ask, Q, pi\n >>> from sympy.abc import x, y\n >>> ask(Q.rational(pi))\n False\n >>> ask(Q.even(x*y), Q.even(x) & Q.integer(y))\n True\n >>> ask(Q.prime(4*x), Q.integer(x))\n False\n\n If the truth value cannot be determined, ``None`` will be returned.\n\n >>> print(ask(Q.odd(3*x))) # cannot determine unless we know x\n None\n\n ``ValueError`` is raised if assumptions are inconsistent.\n\n >>> ask(Q.integer(x), Q.even(x) & Q.odd(x))\n Traceback (most recent call last):\n ...\n ValueError: inconsistent assumptions Q.even(x) & Q.odd(x)\n\n Notes\n =====\n\n Relations in assumptions are not implemented (yet), so the following\n will not give a meaningful result.\n\n >>> ask(Q.positive(x), x > 0)\n\n It is however a work in progress.\n\n See Also\n ========\n\n sympy.assumptions.refine.refine : Simplification using assumptions.\n Proposition is not reduced to ``None`` if the truth value cannot\n be determined.\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/assumptions/tests/test_query.py::test_int_1", "sympy/assumptions/tests/test_query.py::test_int_11", "sympy/assumptions/tests/test_query.py::test_int_12", "sympy/assumptions/tests/test_query.py::test_float_1", "sympy/assumptions/tests/test_query.py::test_zero_0", "sympy/assumptions/tests/test_query.py::test_negativeone", "sympy/assumptions/tests/test_query.py::test_infinity", "sympy/assumptions/tests/test_query.py::test_neg_infinity", "sympy/assumptions/tests/test_query.py::test_complex_infinity", "sympy/assumptions/tests/test_query.py::test_nan", "sympy/assumptions/tests/test_query.py::test_Rational_number", "sympy/assumptions/tests/test_query.py::test_sqrt_2", "sympy/core/tests/test_expr.py::test_action_verbs", "sympy/assumptions/tests/test_query.py::test_pi", "sympy/matrices/tests/test_commonmatrix.py::test_refine", "sympy/assumptions/tests/test_query.py::test_E", "sympy/assumptions/tests/test_query.py::test_GoldenRatio", "sympy/assumptions/tests/test_query.py::test_TribonacciConstant", "sympy/assumptions/tests/test_query.py::test_I", "sympy/assumptions/tests/test_query.py::test_bounded", "sympy/assumptions/tests/test_query.py::test_commutative", "sympy/assumptions/tests/test_query.py::test_complex", "sympy/assumptions/tests/test_query.py::test_even_query", "sympy/assumptions/tests/test_query.py::test_evenness_in_ternary_integer_product_with_even", "sympy/assumptions/tests/test_query.py::test_extended_real", "sympy/assumptions/tests/test_query.py::test_rational", "sympy/assumptions/tests/test_query.py::test_hermitian", "sympy/assumptions/tests/test_query.py::test_imaginary", "sympy/assumptions/tests/test_query.py::test_integer", "sympy/assumptions/tests/test_query.py::test_negative", "sympy/core/tests/test_relational.py::test_is_eq", "sympy/assumptions/tests/test_query.py::test_nonzero", "sympy/core/tests/test_relational.py::test_is_ge_le", "sympy/assumptions/tests/test_query.py::test_zero", "sympy/assumptions/tests/test_query.py::test_odd_query", "sympy/assumptions/tests/test_query.py::test_oddness_in_ternary_integer_product_with_even", "sympy/assumptions/tests/test_query.py::test_prime", "sympy/assumptions/tests/test_query.py::test_positive", "sympy/assumptions/tests/test_query.py::test_nonpositive", "sympy/assumptions/tests/test_query.py::test_nonnegative", "sympy/assumptions/tests/test_query.py::test_real_basic", "sympy/assumptions/tests/test_query.py::test_real_pow", "sympy/assumptions/tests/test_query.py::test_real_functions", "sympy/assumptions/tests/test_query.py::test_matrix", "sympy/assumptions/tests/test_query.py::test_algebraic", "sympy/matrices/tests/test_matrices.py::test_refine", "sympy/assumptions/tests/test_query.py::test_global", "sympy/assumptions/tests/test_query.py::test_custom_context", "sympy/matrices/tests/test_matrixbase.py::test_refine", "sympy/assumptions/tests/test_query.py::test_functions_in_assumptions", "sympy/assumptions/tests/test_query.py::test_composite_ask", "sympy/assumptions/tests/test_query.py::test_composite_proposition", "sympy/assumptions/tests/test_query.py::test_tautology", "sympy/matrices/expressions/tests/test_blockmatrix.py::test_BlockMatrix_Determinant", "sympy/matrices/expressions/tests/test_blockmatrix.py::test_BlockMatrix_2x2_inverse_symbolic", "sympy/assumptions/tests/test_query.py::test_composite_assumptions", "sympy/matrices/expressions/tests/test_blockmatrix.py::test_BlockMatrix_2x2_inverse_numeric", "sympy/assumptions/tests/test_query.py::test_key_extensibility", "sympy/matrices/expressions/tests/test_blockmatrix.py::test_reblock_2x2", "sympy/matrices/expressions/tests/test_blockmatrix.py::test_deblock", "sympy/assumptions/tests/test_query.py::test_type_extensibility", "sympy/matrices/expressions/tests/test_blockmatrix.py::test_issue_21866", "sympy/matrices/expressions/tests/test_matmul.py::test_refine", "sympy/matrices/expressions/tests/test_blockmatrix.py::test_transpose_inverse_commute", "sympy/assumptions/tests/test_query.py::test_Add_queries", "sympy/assumptions/tests/test_query.py::test_positive_assuming", "sympy/assumptions/tests/test_query.py::test_issue_5421", "sympy/tensor/array/expressions/tests/test_array_expressions.py::test_arrayexpr_split_multiple_contractions", "sympy/assumptions/tests/test_query.py::test_issue_3906", "sympy/utilities/tests/test_wester.py::test_I4", "sympy/assumptions/tests/test_query.py::test_issue_5833", "sympy/logic/tests/test_boolalg.py::test_refine", "sympy/assumptions/tests/test_query.py::test_issue_6732", "sympy/assumptions/tests/test_query.py::test_issue_7246", "sympy/assumptions/tests/test_query.py::test_check_old_assumption", "sympy/assumptions/tests/test_query.py::test_issue_9636", "sympy/assumptions/tests/test_query.py::test_autosimp_used_to_fail", "sympy/assumptions/tests/test_query.py::test_custom_AskHandler", "sympy/assumptions/tests/test_matrices.py::test_square", "sympy/assumptions/tests/test_matrices.py::test_invertible", "sympy/assumptions/tests/test_query.py::test_polyadic_predicate", "sympy/assumptions/tests/test_matrices.py::test_singular", "sympy/assumptions/tests/test_matrices.py::test_invertible_BlockMatrix", "sympy/assumptions/tests/test_matrices.py::test_invertible_BlockDiagMatrix", "sympy/assumptions/tests/test_matrices.py::test_symmetric", "sympy/assumptions/tests/test_matrices.py::test_orthogonal", "sympy/assumptions/tests/test_matrices.py::test_unitary", "sympy/assumptions/tests/test_query.py::test_relational", "sympy/assumptions/tests/test_matrices.py::test_fullrank", "sympy/assumptions/tests/test_matrices.py::test_positive_definite", "sympy/assumptions/tests/test_matrices.py::test_triangular", "sympy/assumptions/tests/test_query.py::test_issue_25221", "sympy/assumptions/tests/test_matrices.py::test_diagonal", "sympy/assumptions/tests/test_matrices.py::test_non_atoms", "sympy/assumptions/tests/test_matrices.py::test_MatrixSlice", "sympy/assumptions/tests/test_matrices.py::test_det_trace_positive", "sympy/assumptions/tests/test_matrices.py::test_field_assumptions", "sympy/assumptions/tests/test_matrices.py::test_matrix_element_sets", "sympy/assumptions/tests/test_matrices.py::test_matrix_element_sets_slices_blocks", "sympy/assumptions/tests/test_matrices.py::test_matrix_element_sets_determinant_trace", "sympy/codegen/tests/test_rewriting.py::test_matsolve", "sympy/assumptions/tests/test_refine.py::test_Abs", "sympy/assumptions/tests/test_refine.py::test_pow1", "sympy/assumptions/tests/test_refine.py::test_pow2", "sympy/assumptions/tests/test_refine.py::test_Piecewise", "sympy/assumptions/tests/test_refine.py::test_atan2", "sympy/assumptions/tests/test_refine.py::test_re", "sympy/assumptions/tests/test_refine.py::test_im", "sympy/assumptions/tests/test_refine.py::test_complex", "sympy/assumptions/tests/test_refine.py::test_sign", "sympy/assumptions/tests/test_refine.py::test_arg", "sympy/assumptions/tests/test_refine.py::test_issue_refine_9384", "sympy/assumptions/tests/test_refine.py::test_refine_issue_12724", "sympy/assumptions/tests/test_refine.py::test_matrixelement", "sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py::test_arrayexpr_convert_array_to_matrix", "sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py::test_arrayexpr_convert_array_to_matrix2", "sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py::test_arrayexpr_convert_array_to_diagonalized_vector", "sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py::test_arrayexpr_convert_array_contraction_tp_additions", "sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py::test_arrayexpr_convert_array_to_matrix_remove_trivial_dims", "sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py::test_arrayexpr_convert_array_to_matrix_diag2contraction_diagmatrix", "sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py::test_convert_array_to_hadamard_products", "sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py::test_identify_removable_identity_matrices", "sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py::test_array_contraction_to_diagonal_multiple_identities", "sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py::test_convert_array_element_to_matrix", "sympy/tensor/array/expressions/tests/test_convert_array_to_matrix.py::test_array2matrix", "sympy/matrices/expressions/tests/test_indexing.py::test_matrix_expression_to_indices", "sympy/matrices/expressions/tests/test_indexing.py::test_matrix_expression_from_index_summation", "sympy/utilities/tests/test_wester.py::test_N1", "sympy/matrices/expressions/tests/test_derivatives.py::test_one_matrix", "sympy/matrices/expressions/tests/test_matpow.py::test_OneMatrix_power", "sympy/matrices/expressions/tests/test_derivatives.py::test_matrix_derivative_with_inverse", "sympy/matrices/expressions/tests/test_derivatives.py::test_matrix_derivative_vectors_and_scalars", "sympy/matrices/expressions/tests/test_derivatives.py::test_matrix_derivatives_of_traces", "sympy/matrices/expressions/tests/test_derivatives.py::test_derivatives_of_complicated_matrix_expr", "sympy/utilities/tests/test_wester.py::test_P12", "sympy/matrices/expressions/tests/test_derivatives.py::test_mixed_deriv_mixed_expressions", "sympy/matrices/expressions/tests/test_derivatives.py::test_derivatives_matrix_norms", "sympy/matrices/expressions/tests/test_derivatives.py::test_derivatives_elementwise_applyfunc", "sympy/matrices/expressions/tests/test_derivatives.py::test_derivatives_of_hadamard_expressions", "sympy/unify/tests/test_rewrite.py::test_assumptions", "sympy/assumptions/tests/test_rel_queries.py::test_rel_queries", "sympy/assumptions/tests/test_rel_queries.py::test_unhandled_queries", "sympy/assumptions/tests/test_rel_queries.py::test_number_line_properties", "sympy/assumptions/tests/test_rel_queries.py::test_equality", "sympy/matrices/expressions/tests/test_inverse.py::test_refine", "sympy/tensor/array/expressions/tests/test_convert_indexed_to_array.py::test_arrayexpr_convert_indexed_to_array_and_back_to_matrix", "sympy/matrices/expressions/tests/test_determinant.py::test_refine", "sympy/matrices/expressions/tests/test_transpose.py::test_refine", "sympy/matrices/expressions/tests/test_transpose.py::test_transpose1x1", "sympy/assumptions/tests/test_context.py::test_assuming", "sympy/assumptions/tests/test_context.py::test_assuming_nested", "sympy/assumptions/tests/test_context.py::test_finally", "sympy/assumptions/tests/test_context.py::test_remove_safe", "sympy/assumptions/tests/test_wrapper.py::test_AssumptionsWrapper", "sympy/assumptions/tests/test_wrapper.py::test_is_infinite", "sympy/assumptions/tests/test_wrapper.py::test_is_extended_real", "sympy/matrices/expressions/tests/test_factorizations.py::test_LU", "sympy/matrices/expressions/tests/test_factorizations.py::test_QR", "sympy/matrices/expressions/tests/test_factorizations.py::test_svd", "sympy/matrices/expressions/tests/test_diagonal.py::test_DiagonalMatrix", "sympy/matrices/expressions/tests/test_diagonal.py::test_DiagMatrix", "sympy/matrices/expressions/tests/test_fourier.py::test_dft", "sympy/tensor/array/expressions/tests/test_convert_matrix_to_array.py::test_arrayexpr_convert_matrix_to_array", "sympy/tensor/array/expressions/tests/test_deprecated_conv_modules.py::test_deprecated_conv_module_results", "sympy/solvers/tests/test_solvers.py::test_issue_7110" ], "PASS_TO_PASS": null }
sympy__sympy-38
1.0
{ "code": "diff --git b/sympy/matrices/sparsetools.py a/sympy/matrices/sparsetools.py\nindex 53a36d25a3..50048f6dc7 100644\n--- b/sympy/matrices/sparsetools.py\n+++ a/sympy/matrices/sparsetools.py\n@@ -195,3 +195,106 @@ def banded(*args, **kwargs):\n [0, 0, 0, 0, 2, 1, 1],\n [0, 0, 0, 0, 0, 0, 1]])\n \"\"\"\n+ try:\n+ if len(args) not in (1, 2, 3):\n+ raise TypeError\n+ if not isinstance(args[-1], (dict, Dict)):\n+ raise TypeError\n+ if len(args) == 1:\n+ rows = kwargs.get('rows', None)\n+ cols = kwargs.get('cols', None)\n+ if rows is not None:\n+ rows = as_int(rows)\n+ if cols is not None:\n+ cols = as_int(cols)\n+ elif len(args) == 2:\n+ rows = cols = as_int(args[0])\n+ else:\n+ rows, cols = map(as_int, args[:2])\n+ # fails with ValueError if any keys are not ints\n+ _ = all(as_int(k) for k in args[-1])\n+ except (ValueError, TypeError):\n+ raise TypeError(filldedent(\n+ '''unrecognized input to banded:\n+ expecting [[row,] col,] {int: value}'''))\n+ def rc(d):\n+ # return row,col coord of diagonal start\n+ r = -d if d < 0 else 0\n+ c = 0 if r else d\n+ return r, c\n+ smat = {}\n+ undone = []\n+ tba = Dummy()\n+ # first handle objects with size\n+ for d, v in args[-1].items():\n+ r, c = rc(d)\n+ # note: only list and tuple are recognized since this\n+ # will allow other Basic objects like Tuple\n+ # into the matrix if so desired\n+ if isinstance(v, (list, tuple)):\n+ extra = 0\n+ for i, vi in enumerate(v):\n+ i += extra\n+ if is_sequence(vi):\n+ vi = SparseMatrix(vi)\n+ smat[r + i, c + i] = vi\n+ extra += min(vi.shape) - 1\n+ else:\n+ smat[r + i, c + i] = vi\n+ elif is_sequence(v):\n+ v = SparseMatrix(v)\n+ rv, cv = v.shape\n+ if rows and cols:\n+ nr, xr = divmod(rows - r, rv)\n+ nc, xc = divmod(cols - c, cv)\n+ x = xr or xc\n+ do = min(nr, nc)\n+ elif rows:\n+ do, x = divmod(rows - r, rv)\n+ elif cols:\n+ do, x = divmod(cols - c, cv)\n+ else:\n+ do = 1\n+ x = 0\n+ if x:\n+ raise ValueError(filldedent('''\n+ sequence does not fit an integral number of times\n+ in the matrix'''))\n+ j = min(v.shape)\n+ for i in range(do):\n+ smat[r, c] = v\n+ r += j\n+ c += j\n+ elif v:\n+ smat[r, c] = tba\n+ undone.append((d, v))\n+ s = SparseMatrix(None, smat) # to expand matrices\n+ smat = s.todok()\n+ # check for dim errors here\n+ if rows is not None and rows < s.rows:\n+ raise ValueError('Designated rows %s < needed %s' % (rows, s.rows))\n+ if cols is not None and cols < s.cols:\n+ raise ValueError('Designated cols %s < needed %s' % (cols, s.cols))\n+ if rows is cols is None:\n+ rows = s.rows\n+ cols = s.cols\n+ elif rows is not None and cols is None:\n+ cols = max(rows, s.cols)\n+ elif cols is not None and rows is None:\n+ rows = max(cols, s.rows)\n+ def update(i, j, v):\n+ # update smat and make sure there are\n+ # no collisions\n+ if v:\n+ if (i, j) in smat and smat[i, j] not in (tba, v):\n+ raise ValueError('collision at %s' % ((i, j),))\n+ smat[i, j] = v\n+ if undone:\n+ for d, vi in undone:\n+ r, c = rc(d)\n+ v = vi if callable(vi) else lambda _: vi\n+ i = 0\n+ while r + i < rows and c + i < cols:\n+ update(r + i, c + i, v(i))\n+ i += 1\n+ return SparseMatrix(rows, cols, smat)\n", "test": null }
null
{ "code": "diff --git a/sympy/matrices/sparsetools.py b/sympy/matrices/sparsetools.py\nindex 50048f6dc7..53a36d25a3 100644\n--- a/sympy/matrices/sparsetools.py\n+++ b/sympy/matrices/sparsetools.py\n@@ -195,106 +195,3 @@ def banded(*args, **kwargs):\n [0, 0, 0, 0, 2, 1, 1],\n [0, 0, 0, 0, 0, 0, 1]])\n \"\"\"\n- try:\n- if len(args) not in (1, 2, 3):\n- raise TypeError\n- if not isinstance(args[-1], (dict, Dict)):\n- raise TypeError\n- if len(args) == 1:\n- rows = kwargs.get('rows', None)\n- cols = kwargs.get('cols', None)\n- if rows is not None:\n- rows = as_int(rows)\n- if cols is not None:\n- cols = as_int(cols)\n- elif len(args) == 2:\n- rows = cols = as_int(args[0])\n- else:\n- rows, cols = map(as_int, args[:2])\n- # fails with ValueError if any keys are not ints\n- _ = all(as_int(k) for k in args[-1])\n- except (ValueError, TypeError):\n- raise TypeError(filldedent(\n- '''unrecognized input to banded:\n- expecting [[row,] col,] {int: value}'''))\n- def rc(d):\n- # return row,col coord of diagonal start\n- r = -d if d < 0 else 0\n- c = 0 if r else d\n- return r, c\n- smat = {}\n- undone = []\n- tba = Dummy()\n- # first handle objects with size\n- for d, v in args[-1].items():\n- r, c = rc(d)\n- # note: only list and tuple are recognized since this\n- # will allow other Basic objects like Tuple\n- # into the matrix if so desired\n- if isinstance(v, (list, tuple)):\n- extra = 0\n- for i, vi in enumerate(v):\n- i += extra\n- if is_sequence(vi):\n- vi = SparseMatrix(vi)\n- smat[r + i, c + i] = vi\n- extra += min(vi.shape) - 1\n- else:\n- smat[r + i, c + i] = vi\n- elif is_sequence(v):\n- v = SparseMatrix(v)\n- rv, cv = v.shape\n- if rows and cols:\n- nr, xr = divmod(rows - r, rv)\n- nc, xc = divmod(cols - c, cv)\n- x = xr or xc\n- do = min(nr, nc)\n- elif rows:\n- do, x = divmod(rows - r, rv)\n- elif cols:\n- do, x = divmod(cols - c, cv)\n- else:\n- do = 1\n- x = 0\n- if x:\n- raise ValueError(filldedent('''\n- sequence does not fit an integral number of times\n- in the matrix'''))\n- j = min(v.shape)\n- for i in range(do):\n- smat[r, c] = v\n- r += j\n- c += j\n- elif v:\n- smat[r, c] = tba\n- undone.append((d, v))\n- s = SparseMatrix(None, smat) # to expand matrices\n- smat = s.todok()\n- # check for dim errors here\n- if rows is not None and rows < s.rows:\n- raise ValueError('Designated rows %s < needed %s' % (rows, s.rows))\n- if cols is not None and cols < s.cols:\n- raise ValueError('Designated cols %s < needed %s' % (cols, s.cols))\n- if rows is cols is None:\n- rows = s.rows\n- cols = s.cols\n- elif rows is not None and cols is None:\n- cols = max(rows, s.cols)\n- elif cols is not None and rows is None:\n- rows = max(cols, s.rows)\n- def update(i, j, v):\n- # update smat and make sure there are\n- # no collisions\n- if v:\n- if (i, j) in smat and smat[i, j] not in (tba, v):\n- raise ValueError('collision at %s' % ((i, j),))\n- smat[i, j] = v\n- if undone:\n- for d, vi in undone:\n- r, c = rc(d)\n- v = vi if callable(vi) else lambda _: vi\n- i = 0\n- while r + i < rows and c + i < cols:\n- update(r + i, c + i, v(i))\n- i += 1\n- return SparseMatrix(rows, cols, smat)\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/matrices/sparsetools.py.\nHere is the description for the function:\ndef banded(*args, **kwargs):\n \"\"\"Returns a SparseMatrix from the given dictionary describing\n the diagonals of the matrix. The keys are positive for upper\n diagonals and negative for those below the main diagonal. The\n values may be:\n\n * expressions or single-argument functions,\n\n * lists or tuples of values,\n\n * matrices\n\n Unless dimensions are given, the size of the returned matrix will\n be large enough to contain the largest non-zero value provided.\n\n kwargs\n ======\n\n rows : rows of the resulting matrix; computed if\n not given.\n\n cols : columns of the resulting matrix; computed if\n not given.\n\n Examples\n ========\n\n >>> from sympy import banded, ones, Matrix\n >>> from sympy.abc import x\n\n If explicit values are given in tuples,\n the matrix will autosize to contain all values, otherwise\n a single value is filled onto the entire diagonal:\n\n >>> banded({1: (1, 2, 3), -1: (4, 5, 6), 0: x})\n Matrix([\n [x, 1, 0, 0],\n [4, x, 2, 0],\n [0, 5, x, 3],\n [0, 0, 6, x]])\n\n A function accepting a single argument can be used to fill the\n diagonal as a function of diagonal index (which starts at 0).\n The size (or shape) of the matrix must be given to obtain more\n than a 1x1 matrix:\n\n >>> s = lambda d: (1 + d)**2\n >>> banded(5, {0: s, 2: s, -2: 2})\n Matrix([\n [1, 0, 1, 0, 0],\n [0, 4, 0, 4, 0],\n [2, 0, 9, 0, 9],\n [0, 2, 0, 16, 0],\n [0, 0, 2, 0, 25]])\n\n The diagonal of matrices placed on a diagonal will coincide\n with the indicated diagonal:\n\n >>> vert = Matrix([1, 2, 3])\n >>> banded({0: vert}, cols=3)\n Matrix([\n [1, 0, 0],\n [2, 1, 0],\n [3, 2, 1],\n [0, 3, 2],\n [0, 0, 3]])\n\n >>> banded(4, {0: ones(2)})\n Matrix([\n [1, 1, 0, 0],\n [1, 1, 0, 0],\n [0, 0, 1, 1],\n [0, 0, 1, 1]])\n\n Errors are raised if the designated size will not hold\n all values an integral number of times. Here, the rows\n are designated as odd (but an even number is required to\n hold the off-diagonal 2x2 ones):\n\n >>> banded({0: 2, 1: ones(2)}, rows=5)\n Traceback (most recent call last):\n ...\n ValueError:\n sequence does not fit an integral number of times in the matrix\n\n And here, an even number of rows is given...but the square\n matrix has an even number of columns, too. As we saw\n in the previous example, an odd number is required:\n\n >>> banded(4, {0: 2, 1: ones(2)}) # trying to make 4x4 and cols must be odd\n Traceback (most recent call last):\n ...\n ValueError:\n sequence does not fit an integral number of times in the matrix\n\n A way around having to count rows is to enclosing matrix elements\n in a tuple and indicate the desired number of them to the right:\n\n >>> banded({0: 2, 2: (ones(2),)*3})\n Matrix([\n [2, 0, 1, 1, 0, 0, 0, 0],\n [0, 2, 1, 1, 0, 0, 0, 0],\n [0, 0, 2, 0, 1, 1, 0, 0],\n [0, 0, 0, 2, 1, 1, 0, 0],\n [0, 0, 0, 0, 2, 0, 1, 1],\n [0, 0, 0, 0, 0, 2, 1, 1]])\n\n An error will be raised if more than one value\n is written to a given entry. Here, the ones overlap\n with the main diagonal if they are placed on the\n first diagonal:\n\n >>> banded({0: (2,)*5, 1: (ones(2),)*3})\n Traceback (most recent call last):\n ...\n ValueError: collision at (1, 1)\n\n By placing a 0 at the bottom left of the 2x2 matrix of\n ones, the collision is avoided:\n\n >>> u2 = Matrix([\n ... [1, 1],\n ... [0, 1]])\n >>> banded({0: [2]*5, 1: [u2]*3})\n Matrix([\n [2, 1, 1, 0, 0, 0, 0],\n [0, 2, 1, 0, 0, 0, 0],\n [0, 0, 2, 1, 1, 0, 0],\n [0, 0, 0, 2, 1, 0, 0],\n [0, 0, 0, 0, 2, 1, 1],\n [0, 0, 0, 0, 0, 0, 1]])\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/matrices/tests/test_matrixbase.py::test_diagonal", "sympy/matrices/tests/test_matrices.py::test_issue_17247_expression_blowup_1", "sympy/matrices/tests/test_matrixbase.py::test_issue_17247_expression_blowup_1", "sympy/matrices/tests/test_commonmatrix.py::test_diagonal", "sympy/simplify/tests/test_simplify.py::test_simplify_complex", "sympy/matrices/tests/test_matrixbase.py::test_expand", "sympy/matrices/tests/test_matrices.py::test_expand", "sympy/matrices/tests/test_matrices.py::test_exp_jordan_block", "sympy/matrices/tests/test_matrices.py::test_exp", "sympy/matrices/tests/test_matrices.py::test_log", "sympy/matrices/tests/test_matrixbase.py::test_exp_jordan_block", "sympy/matrices/tests/test_matrixbase.py::test_exp", "sympy/matrices/tests/test_matrixbase.py::test_log", "sympy/stats/tests/test_joint_rv.py::test_Normal", "sympy/utilities/tests/test_wester.py::test_P32", "sympy/utilities/tests/test_wester.py::test_P33", "sympy/matrices/tests/test_matrices.py::test_func", "sympy/stats/tests/test_joint_rv.py::test_expectation", "sympy/stats/tests/test_stochastic_process.py::test_ContinuousMarkovChain", "sympy/matrices/tests/test_sparsetools.py::test_banded", "sympy/solvers/ode/tests/test_systems.py::test_sysode_linear_neq_order1_type3", "sympy/matrices/tests/test_matrixbase.py::test_func", "sympy/solvers/ode/tests/test_systems.py::test_higher_order_to_first_order", "sympy/solvers/ode/tests/test_systems.py::test_second_order_to_first_order_2", "sympy/solvers/ode/tests/test_systems.py::test_second_order_to_first_order_slow4", "sympy/solvers/ode/tests/test_systems.py::test_component_division", "sympy/solvers/ode/tests/test_systems.py::test_linodesolve", "sympy/solvers/ode/tests/test_systems.py::test_neq_order1_type4_slow3" ], "PASS_TO_PASS": null }
sympy__sympy-39
1.0
{ "code": "diff --git b/sympy/combinatorics/tensor_can.py a/sympy/combinatorics/tensor_can.py\nindex bcd183ae41..d43e96ed27 100644\n--- b/sympy/combinatorics/tensor_can.py\n+++ a/sympy/combinatorics/tensor_can.py\n@@ -755,6 +755,103 @@ def canonicalize(g, dummies, msym, *v):\n >>> canonicalize(g, dummies, [0, 0], t0, t1)\n [0, 2, 4, 1, 6, 8, 10, 3, 11, 7, 12, 5, 13, 9, 15, 14]\n \"\"\"\n+ from sympy.combinatorics.testutil import canonicalize_naive\n+ if not isinstance(msym, list):\n+ if msym not in (0, 1, None):\n+ raise ValueError('msym must be 0, 1 or None')\n+ num_types = 1\n+ else:\n+ num_types = len(msym)\n+ if not all(msymx in (0, 1, None) for msymx in msym):\n+ raise ValueError('msym entries must be 0, 1 or None')\n+ if len(dummies) != num_types:\n+ raise ValueError(\n+ 'dummies and msym must have the same number of elements')\n+ size = g.size\n+ num_tensors = 0\n+ v1 = []\n+ for base_i, gens_i, n_i, sym_i in v:\n+ # check that the BSGS is minimal;\n+ # this property is used in double_coset_can_rep;\n+ # if it is not minimal use canonicalize_naive\n+ if not _is_minimal_bsgs(base_i, gens_i):\n+ mbsgs = get_minimal_bsgs(base_i, gens_i)\n+ if not mbsgs:\n+ can = canonicalize_naive(g, dummies, msym, *v)\n+ return can\n+ base_i, gens_i = mbsgs\n+ v1.append((base_i, gens_i, [[]] * n_i, sym_i))\n+ num_tensors += n_i\n+\n+ if num_types == 1 and not isinstance(msym, list):\n+ dummies = [dummies]\n+ msym = [msym]\n+ flat_dummies = []\n+ for dumx in dummies:\n+ flat_dummies.extend(dumx)\n+\n+ if flat_dummies and flat_dummies != list(range(flat_dummies[0], flat_dummies[-1] + 1)):\n+ raise ValueError('dummies is not valid')\n+\n+ # slot symmetry of the tensor\n+ size1, sbase, sgens = gens_products(*v1)\n+ if size != size1:\n+ raise ValueError(\n+ 'g has size %d, generators have size %d' % (size, size1))\n+ free = [i for i in range(size - 2) if i not in flat_dummies]\n+ num_free = len(free)\n+\n+ # g1 minimal tensor under slot symmetry\n+ g1 = canonical_free(sbase, sgens, g, num_free)\n+ if not flat_dummies:\n+ return g1\n+ # save the sign of g1\n+ sign = 0 if g1[-1] == size - 1 else 1\n+\n+ # the free indices are kept fixed.\n+ # Determine free_i, the list of slots of tensors which are fixed\n+ # since they are occupied by free indices, which are fixed.\n+ start = 0\n+ for i, (base_i, gens_i, n_i, sym_i) in enumerate(v):\n+ free_i = []\n+ len_tens = gens_i[0].size - 2\n+ # for each component tensor get a list od fixed islots\n+ for j in range(n_i):\n+ # get the elements corresponding to the component tensor\n+ h = g1[start:(start + len_tens)]\n+ fr = []\n+ # get the positions of the fixed elements in h\n+ for k in free:\n+ if k in h:\n+ fr.append(h.index(k))\n+ free_i.append(fr)\n+ start += len_tens\n+ v1[i] = (base_i, gens_i, free_i, sym_i)\n+ # BSGS of the tensor with fixed free indices\n+ # if tensor_gens fails in gens_product, use canonicalize_naive\n+ size, sbase, sgens = gens_products(*v1)\n+\n+ # reduce the permutations getting rid of the free indices\n+ pos_free = [g1.index(x) for x in range(num_free)]\n+ size_red = size - num_free\n+ g1_red = [x - num_free for x in g1 if x in flat_dummies]\n+ if sign:\n+ g1_red.extend([size_red - 1, size_red - 2])\n+ else:\n+ g1_red.extend([size_red - 2, size_red - 1])\n+ map_slots = _get_map_slots(size, pos_free)\n+ sbase_red = [map_slots[i] for i in sbase if i not in pos_free]\n+ sgens_red = [_af_new([map_slots[i] for i in y._array_form if i not in pos_free]) for y in sgens]\n+ dummies_red = [[x - num_free for x in y] for y in dummies]\n+ transv_red = get_transversals(sbase_red, sgens_red)\n+ g1_red = _af_new(g1_red)\n+ g2 = double_coset_can_rep(\n+ dummies_red, msym, sbase_red, sgens_red, transv_red, g1_red)\n+ if g2 == 0:\n+ return 0\n+ # lift to the case with the free indices\n+ g3 = _lift_sgens(size, pos_free, free, g2)\n+ return g3\n \n \n def perm_af_direct_product(gens1, gens2, signed=True):\n", "test": null }
null
{ "code": "diff --git a/sympy/combinatorics/tensor_can.py b/sympy/combinatorics/tensor_can.py\nindex d43e96ed27..bcd183ae41 100644\n--- a/sympy/combinatorics/tensor_can.py\n+++ b/sympy/combinatorics/tensor_can.py\n@@ -755,103 +755,6 @@ def canonicalize(g, dummies, msym, *v):\n >>> canonicalize(g, dummies, [0, 0], t0, t1)\n [0, 2, 4, 1, 6, 8, 10, 3, 11, 7, 12, 5, 13, 9, 15, 14]\n \"\"\"\n- from sympy.combinatorics.testutil import canonicalize_naive\n- if not isinstance(msym, list):\n- if msym not in (0, 1, None):\n- raise ValueError('msym must be 0, 1 or None')\n- num_types = 1\n- else:\n- num_types = len(msym)\n- if not all(msymx in (0, 1, None) for msymx in msym):\n- raise ValueError('msym entries must be 0, 1 or None')\n- if len(dummies) != num_types:\n- raise ValueError(\n- 'dummies and msym must have the same number of elements')\n- size = g.size\n- num_tensors = 0\n- v1 = []\n- for base_i, gens_i, n_i, sym_i in v:\n- # check that the BSGS is minimal;\n- # this property is used in double_coset_can_rep;\n- # if it is not minimal use canonicalize_naive\n- if not _is_minimal_bsgs(base_i, gens_i):\n- mbsgs = get_minimal_bsgs(base_i, gens_i)\n- if not mbsgs:\n- can = canonicalize_naive(g, dummies, msym, *v)\n- return can\n- base_i, gens_i = mbsgs\n- v1.append((base_i, gens_i, [[]] * n_i, sym_i))\n- num_tensors += n_i\n-\n- if num_types == 1 and not isinstance(msym, list):\n- dummies = [dummies]\n- msym = [msym]\n- flat_dummies = []\n- for dumx in dummies:\n- flat_dummies.extend(dumx)\n-\n- if flat_dummies and flat_dummies != list(range(flat_dummies[0], flat_dummies[-1] + 1)):\n- raise ValueError('dummies is not valid')\n-\n- # slot symmetry of the tensor\n- size1, sbase, sgens = gens_products(*v1)\n- if size != size1:\n- raise ValueError(\n- 'g has size %d, generators have size %d' % (size, size1))\n- free = [i for i in range(size - 2) if i not in flat_dummies]\n- num_free = len(free)\n-\n- # g1 minimal tensor under slot symmetry\n- g1 = canonical_free(sbase, sgens, g, num_free)\n- if not flat_dummies:\n- return g1\n- # save the sign of g1\n- sign = 0 if g1[-1] == size - 1 else 1\n-\n- # the free indices are kept fixed.\n- # Determine free_i, the list of slots of tensors which are fixed\n- # since they are occupied by free indices, which are fixed.\n- start = 0\n- for i, (base_i, gens_i, n_i, sym_i) in enumerate(v):\n- free_i = []\n- len_tens = gens_i[0].size - 2\n- # for each component tensor get a list od fixed islots\n- for j in range(n_i):\n- # get the elements corresponding to the component tensor\n- h = g1[start:(start + len_tens)]\n- fr = []\n- # get the positions of the fixed elements in h\n- for k in free:\n- if k in h:\n- fr.append(h.index(k))\n- free_i.append(fr)\n- start += len_tens\n- v1[i] = (base_i, gens_i, free_i, sym_i)\n- # BSGS of the tensor with fixed free indices\n- # if tensor_gens fails in gens_product, use canonicalize_naive\n- size, sbase, sgens = gens_products(*v1)\n-\n- # reduce the permutations getting rid of the free indices\n- pos_free = [g1.index(x) for x in range(num_free)]\n- size_red = size - num_free\n- g1_red = [x - num_free for x in g1 if x in flat_dummies]\n- if sign:\n- g1_red.extend([size_red - 1, size_red - 2])\n- else:\n- g1_red.extend([size_red - 2, size_red - 1])\n- map_slots = _get_map_slots(size, pos_free)\n- sbase_red = [map_slots[i] for i in sbase if i not in pos_free]\n- sgens_red = [_af_new([map_slots[i] for i in y._array_form if i not in pos_free]) for y in sgens]\n- dummies_red = [[x - num_free for x in y] for y in dummies]\n- transv_red = get_transversals(sbase_red, sgens_red)\n- g1_red = _af_new(g1_red)\n- g2 = double_coset_can_rep(\n- dummies_red, msym, sbase_red, sgens_red, transv_red, g1_red)\n- if g2 == 0:\n- return 0\n- # lift to the case with the free indices\n- g3 = _lift_sgens(size, pos_free, free, g2)\n- return g3\n \n \n def perm_af_direct_product(gens1, gens2, signed=True):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/combinatorics/tensor_can.py.\nHere is the description for the function:\ndef canonicalize(g, dummies, msym, *v):\n \"\"\"\n canonicalize tensor formed by tensors\n\n Parameters\n ==========\n\n g : permutation representing the tensor\n\n dummies : list representing the dummy indices\n it can be a list of dummy indices of the same type\n or a list of lists of dummy indices, one list for each\n type of index;\n the dummy indices must come after the free indices,\n and put in order contravariant, covariant\n [d0, -d0, d1,-d1,...]\n\n msym : symmetry of the metric(s)\n it can be an integer or a list;\n in the first case it is the symmetry of the dummy index metric;\n in the second case it is the list of the symmetries of the\n index metric for each type\n\n v : list, (base_i, gens_i, n_i, sym_i) for tensors of type `i`\n\n base_i, gens_i : BSGS for tensors of this type.\n The BSGS should have minimal base under lexicographic ordering;\n if not, an attempt is made do get the minimal BSGS;\n in case of failure,\n canonicalize_naive is used, which is much slower.\n\n n_i : number of tensors of type `i`.\n\n sym_i : symmetry under exchange of component tensors of type `i`.\n\n Both for msym and sym_i the cases are\n * None no symmetry\n * 0 commuting\n * 1 anticommuting\n\n Returns\n =======\n\n 0 if the tensor is zero, else return the array form of\n the permutation representing the canonical form of the tensor.\n\n Algorithm\n =========\n\n First one uses canonical_free to get the minimum tensor under\n lexicographic order, using only the slot symmetries.\n If the component tensors have not minimal BSGS, it is attempted\n to find it; if the attempt fails canonicalize_naive\n is used instead.\n\n Compute the residual slot symmetry keeping fixed the free indices\n using tensor_gens(base, gens, list_free_indices, sym).\n\n Reduce the problem eliminating the free indices.\n\n Then use double_coset_can_rep and lift back the result reintroducing\n the free indices.\n\n Examples\n ========\n\n one type of index with commuting metric;\n\n `A_{a b}` and `B_{a b}` antisymmetric and commuting\n\n `T = A_{d0 d1} * B^{d0}{}_{d2} * B^{d2 d1}`\n\n `ord = [d0,-d0,d1,-d1,d2,-d2]` order of the indices\n\n g = [1, 3, 0, 5, 4, 2, 6, 7]\n\n `T_c = 0`\n\n >>> from sympy.combinatorics.tensor_can import get_symmetric_group_sgs, canonicalize, bsgs_direct_product\n >>> from sympy.combinatorics import Permutation\n >>> base2a, gens2a = get_symmetric_group_sgs(2, 1)\n >>> t0 = (base2a, gens2a, 1, 0)\n >>> t1 = (base2a, gens2a, 2, 0)\n >>> g = Permutation([1, 3, 0, 5, 4, 2, 6, 7])\n >>> canonicalize(g, range(6), 0, t0, t1)\n 0\n\n same as above, but with `B_{a b}` anticommuting\n\n `T_c = -A^{d0 d1} * B_{d0}{}^{d2} * B_{d1 d2}`\n\n can = [0,2,1,4,3,5,7,6]\n\n >>> t1 = (base2a, gens2a, 2, 1)\n >>> canonicalize(g, range(6), 0, t0, t1)\n [0, 2, 1, 4, 3, 5, 7, 6]\n\n two types of indices `[a,b,c,d,e,f]` and `[m,n]`, in this order,\n both with commuting metric\n\n `f^{a b c}` antisymmetric, commuting\n\n `A_{m a}` no symmetry, commuting\n\n `T = f^c{}_{d a} * f^f{}_{e b} * A_m{}^d * A^{m b} * A_n{}^a * A^{n e}`\n\n ord = [c,f,a,-a,b,-b,d,-d,e,-e,m,-m,n,-n]\n\n g = [0,7,3, 1,9,5, 11,6, 10,4, 13,2, 12,8, 14,15]\n\n The canonical tensor is\n `T_c = -f^{c a b} * f^{f d e} * A^m{}_a * A_{m d} * A^n{}_b * A_{n e}`\n\n can = [0,2,4, 1,6,8, 10,3, 11,7, 12,5, 13,9, 15,14]\n\n >>> base_f, gens_f = get_symmetric_group_sgs(3, 1)\n >>> base1, gens1 = get_symmetric_group_sgs(1)\n >>> base_A, gens_A = bsgs_direct_product(base1, gens1, base1, gens1)\n >>> t0 = (base_f, gens_f, 2, 0)\n >>> t1 = (base_A, gens_A, 4, 0)\n >>> dummies = [range(2, 10), range(10, 14)]\n >>> g = Permutation([0, 7, 3, 1, 9, 5, 11, 6, 10, 4, 13, 2, 12, 8, 14, 15])\n >>> canonicalize(g, dummies, [0, 0], t0, t1)\n [0, 2, 4, 1, 6, 8, 10, 3, 11, 7, 12, 5, 13, 9, 15, 14]\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/tensor/tests/test_tensor.py::test_canonicalize_no_slot_sym", "sympy/tensor/tests/test_tensor.py::test_canonicalize_no_dummies", "sympy/tensor/tests/test_tensor.py::test_no_metric_symmetry", "sympy/tensor/tests/test_tensor.py::test_canonicalize1", "sympy/tensor/tests/test_tensor.py::test_riemann_invariants", "sympy/tensor/tests/test_tensor.py::test_riemann_products", "sympy/tensor/tests/test_tensor.py::test_canonicalize2", "sympy/tensor/tests/test_tensor.py::test_canonicalize3", "sympy/tensor/tests/test_tensor.py::test_canonicalize4", "sympy/tensor/tests/test_tensor.py::test_TensorIndexType", "sympy/tensor/tests/test_tensor.py::test_add1", "sympy/tensor/tests/test_tensor.py::test_special_eq_ne", "sympy/tensor/tests/test_tensor.py::test_add2", "sympy/tensor/tests/test_tensor.py::test_riemann_cyclic", "sympy/tensor/tests/test_tensor.py::test_contract_metric1", "sympy/tensor/tests/test_tensor.py::test_contract_metric2", "sympy/tensor/tests/test_tensor.py::test_metric_contract3", "sympy/tensor/tests/test_tensor.py::test_contract_metric4", "sympy/tensor/tests/test_tensor.py::test_epsilon", "sympy/tensor/tests/test_tensor.py::test_contract_delta1", "sympy/tensor/tests/test_tensor.py::test_fun", "sympy/tensor/tests/test_tensor.py::test_TensorManager", "sympy/tensor/tests/test_tensor.py::test_valued_canon_bp_swapaxes", "sympy/tensor/tests/test_tensor.py::test_TensMul_data", "sympy/tensor/tests/test_tensor.py::test_tensor_expand", "sympy/tensor/tests/test_tensor.py::test_TensAdd_matching", "sympy/tensor/tests/test_tensor.py::test_TensMul_matching", "sympy/tensor/tests/test_tensor_operators.py::test_eval_partial_derivative_expr1", "sympy/combinatorics/tests/test_tensor_can.py::test_canonicalize_no_slot_sym", "sympy/combinatorics/tests/test_tensor_can.py::test_canonicalize_no_dummies", "sympy/combinatorics/tests/test_tensor_can.py::test_no_metric_symmetry", "sympy/combinatorics/tests/test_tensor_can.py::test_canonical_free", "sympy/combinatorics/tests/test_tensor_can.py::test_canonicalize1", "sympy/combinatorics/tests/test_tensor_can.py::test_riemann_invariants", "sympy/combinatorics/tests/test_tensor_can.py::test_riemann_products", "sympy/combinatorics/tests/test_tensor_can.py::test_graph_certificate", "sympy/physics/hep/tests/test_gamma_matrices.py::test_kahane_algorithm", "sympy/physics/hep/tests/test_gamma_matrices.py::test_kahane_simplify1", "sympy/physics/hep/tests/test_gamma_matrices.py::test_gamma_matrix_class", "sympy/physics/hep/tests/test_gamma_matrices.py::test_gamma_matrix_trace", "sympy/physics/hep/tests/test_gamma_matrices.py::test_bug_13636" ], "PASS_TO_PASS": null }
sympy__sympy-40
1.0
{ "code": "diff --git b/sympy/printing/codeprinter.py a/sympy/printing/codeprinter.py\nindex e46c0dab5b..765f7f01f4 100644\n--- b/sympy/printing/codeprinter.py\n+++ a/sympy/printing/codeprinter.py\n@@ -778,6 +778,8 @@ def ccode(expr, assign_to=None, standard='c99', **settings):\n }\n A[2] = sin(x);\n \"\"\"\n+ from sympy.printing.c import c_code_printers\n+ return c_code_printers[standard.lower()](settings).doprint(expr, assign_to)\n \n def print_ccode(expr, **settings):\n \"\"\"Prints C representation of the given expression.\"\"\"\n", "test": null }
null
{ "code": "diff --git a/sympy/printing/codeprinter.py b/sympy/printing/codeprinter.py\nindex 765f7f01f4..e46c0dab5b 100644\n--- a/sympy/printing/codeprinter.py\n+++ b/sympy/printing/codeprinter.py\n@@ -778,8 +778,6 @@ def ccode(expr, assign_to=None, standard='c99', **settings):\n }\n A[2] = sin(x);\n \"\"\"\n- from sympy.printing.c import c_code_printers\n- return c_code_printers[standard.lower()](settings).doprint(expr, assign_to)\n \n def print_ccode(expr, **settings):\n \"\"\"Prints C representation of the given expression.\"\"\"\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/printing/codeprinter.py.\nHere is the description for the function:\ndef ccode(expr, assign_to=None, standard='c99', **settings):\n \"\"\"Converts an expr to a string of c code\n\n Parameters\n ==========\n\n expr : Expr\n A SymPy expression to be converted.\n assign_to : optional\n When given, the argument is used as the name of the variable to which\n the expression is assigned. Can be a string, ``Symbol``,\n ``MatrixSymbol``, or ``Indexed`` type. This is helpful in case of\n line-wrapping, or for expressions that generate multi-line statements.\n standard : str, optional\n String specifying the standard. If your compiler supports a more modern\n standard you may set this to 'c99' to allow the printer to use more math\n functions. [default='c89'].\n precision : integer, optional\n The precision for numbers such as pi [default=17].\n user_functions : dict, optional\n A dictionary where the keys are string representations of either\n ``FunctionClass`` or ``UndefinedFunction`` instances and the values\n are their desired C string representations. Alternatively, the\n dictionary value can be a list of tuples i.e. [(argument_test,\n cfunction_string)] or [(argument_test, cfunction_formater)]. See below\n for examples.\n dereference : iterable, optional\n An iterable of symbols that should be dereferenced in the printed code\n expression. These would be values passed by address to the function.\n For example, if ``dereference=[a]``, the resulting code would print\n ``(*a)`` instead of ``a``.\n human : bool, optional\n If True, the result is a single string that may contain some constant\n declarations for the number symbols. If False, the same information is\n returned in a tuple of (symbols_to_declare, not_supported_functions,\n code_text). [default=True].\n contract: bool, optional\n If True, ``Indexed`` instances are assumed to obey tensor contraction\n rules and the corresponding nested loops over indices are generated.\n Setting contract=False will not generate loops, instead the user is\n responsible to provide values for the indices in the code.\n [default=True].\n\n Examples\n ========\n\n >>> from sympy import ccode, symbols, Rational, sin, ceiling, Abs, Function\n >>> x, tau = symbols(\"x, tau\")\n >>> expr = (2*tau)**Rational(7, 2)\n >>> ccode(expr)\n '8*M_SQRT2*pow(tau, 7.0/2.0)'\n >>> ccode(expr, math_macros={})\n '8*sqrt(2)*pow(tau, 7.0/2.0)'\n >>> ccode(sin(x), assign_to=\"s\")\n 's = sin(x);'\n >>> from sympy.codegen.ast import real, float80\n >>> ccode(expr, type_aliases={real: float80})\n '8*M_SQRT2l*powl(tau, 7.0L/2.0L)'\n\n Simple custom printing can be defined for certain types by passing a\n dictionary of {\"type\" : \"function\"} to the ``user_functions`` kwarg.\n Alternatively, the dictionary value can be a list of tuples i.e.\n [(argument_test, cfunction_string)].\n\n >>> custom_functions = {\n ... \"ceiling\": \"CEIL\",\n ... \"Abs\": [(lambda x: not x.is_integer, \"fabs\"),\n ... (lambda x: x.is_integer, \"ABS\")],\n ... \"func\": \"f\"\n ... }\n >>> func = Function('func')\n >>> ccode(func(Abs(x) + ceiling(x)), standard='C89', user_functions=custom_functions)\n 'f(fabs(x) + CEIL(x))'\n\n or if the C-function takes a subset of the original arguments:\n\n >>> ccode(2**x + 3**x, standard='C99', user_functions={'Pow': [\n ... (lambda b, e: b == 2, lambda b, e: 'exp2(%s)' % e),\n ... (lambda b, e: b != 2, 'pow')]})\n 'exp2(x) + pow(3, x)'\n\n ``Piecewise`` expressions are converted into conditionals. If an\n ``assign_to`` variable is provided an if statement is created, otherwise\n the ternary operator is used. Note that if the ``Piecewise`` lacks a\n default term, represented by ``(expr, True)`` then an error will be thrown.\n This is to prevent generating an expression that may not evaluate to\n anything.\n\n >>> from sympy import Piecewise\n >>> expr = Piecewise((x + 1, x > 0), (x, True))\n >>> print(ccode(expr, tau, standard='C89'))\n if (x > 0) {\n tau = x + 1;\n }\n else {\n tau = x;\n }\n\n Support for loops is provided through ``Indexed`` types. With\n ``contract=True`` these expressions will be turned into loops, whereas\n ``contract=False`` will just print the assignment expression that should be\n looped over:\n\n >>> from sympy import Eq, IndexedBase, Idx\n >>> len_y = 5\n >>> y = IndexedBase('y', shape=(len_y,))\n >>> t = IndexedBase('t', shape=(len_y,))\n >>> Dy = IndexedBase('Dy', shape=(len_y-1,))\n >>> i = Idx('i', len_y-1)\n >>> e=Eq(Dy[i], (y[i+1]-y[i])/(t[i+1]-t[i]))\n >>> ccode(e.rhs, assign_to=e.lhs, contract=False, standard='C89')\n 'Dy[i] = (y[i + 1] - y[i])/(t[i + 1] - t[i]);'\n\n Matrices are also supported, but a ``MatrixSymbol`` of the same dimensions\n must be provided to ``assign_to``. Note that any expression that can be\n generated normally can also exist inside a Matrix:\n\n >>> from sympy import Matrix, MatrixSymbol\n >>> mat = Matrix([x**2, Piecewise((x + 1, x > 0), (x, True)), sin(x)])\n >>> A = MatrixSymbol('A', 3, 1)\n >>> print(ccode(mat, A, standard='C89'))\n A[0] = pow(x, 2);\n if (x > 0) {\n A[1] = x + 1;\n }\n else {\n A[1] = x;\n }\n A[2] = sin(x);\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/printing/tests/test_c.py::test_printmethod", "sympy/printing/tests/test_c.py::test_ccode_sqrt", "sympy/printing/tests/test_c.py::test_ccode_Pow", "sympy/printing/tests/test_c.py::test_ccode_Max", "sympy/printing/tests/test_c.py::test_ccode_Min_performance", "sympy/printing/tests/test_c.py::test_ccode_constants_mathh", "sympy/printing/tests/test_c.py::test_ccode_constants_other", "sympy/printing/tests/test_c.py::test_ccode_Rational", "sympy/printing/tests/test_c.py::test_ccode_Integer", "sympy/printing/tests/test_c.py::test_ccode_functions", "sympy/printing/tests/test_c.py::test_ccode_inline_function", "sympy/printing/tests/test_c.py::test_ccode_exceptions", "sympy/printing/tests/test_c.py::test_ccode_functions2", "sympy/printing/tests/test_c.py::test_ccode_user_functions", "sympy/printing/tests/test_c.py::test_ccode_boolean", "sympy/printing/tests/test_c.py::test_ccode_Relational", "sympy/printing/tests/test_c.py::test_ccode_Piecewise", "sympy/printing/tests/test_c.py::test_ccode_sinc", "sympy/printing/tests/test_c.py::test_ccode_Piecewise_deep", "sympy/printing/tests/test_c.py::test_ccode_ITE", "sympy/printing/tests/test_c.py::test_ccode_settings", "sympy/printing/tests/test_c.py::test_ccode_Indexed", "sympy/printing/tests/test_c.py::test_Element", "sympy/printing/tests/test_c.py::test_ccode_Indexed_without_looking_for_contraction", "sympy/printing/tests/test_c.py::test_ccode_loops_matrix_vector", "sympy/printing/tests/test_c.py::test_dummy_loops", "sympy/printing/tests/test_c.py::test_ccode_loops_add", "sympy/printing/tests/test_c.py::test_ccode_loops_multiple_contractions", "sympy/printing/tests/test_c.py::test_ccode_loops_addfactor", "sympy/printing/tests/test_c.py::test_ccode_loops_multiple_terms", "sympy/printing/tests/test_c.py::test_dereference_printing", "sympy/printing/tests/test_c.py::test_Matrix_printing", "sympy/printing/tests/test_c.py::test_sparse_matrix", "sympy/printing/tests/test_c.py::test_ccode_reserved_words", "sympy/printing/tests/test_c.py::test_ccode_sign", "sympy/printing/tests/test_c.py::test_ccode_Assignment", "sympy/printing/tests/test_c.py::test_ccode_For", "sympy/printing/tests/test_c.py::test_ccode_Max_Min", "sympy/printing/tests/test_c.py::test_ccode_standard", "sympy/printing/tests/test_c.py::test_ccode_Declaration", "sympy/printing/tests/test_c.py::test_C99CodePrinter_custom_type", "sympy/printing/tests/test_c.py::test_MatrixElement_printing", "sympy/printing/tests/test_c.py::test_ccode_math_macros", "sympy/printing/tests/test_c.py::test_ccode_Type", "sympy/printing/tests/test_c.py::test_ccode_codegen_ast", "sympy/printing/tests/test_c.py::test_ccode_UnevaluatedExpr", "sympy/printing/tests/test_c.py::test_ccode_array_like_containers", "sympy/printing/tests/test_c.py::test_ccode__isinf_isnan", "sympy/codegen/tests/test_rewriting.py::test_create_expand_pow_optimization", "sympy/codegen/tests/test_cnodes.py::test_alignof", "sympy/codegen/tests/test_cnodes.py::test_CommaOperator", "sympy/codegen/tests/test_cnodes.py::test_goto_Label", "sympy/codegen/tests/test_cnodes.py::test_PreDecrement", "sympy/codegen/tests/test_cnodes.py::test_PostDecrement", "sympy/codegen/tests/test_cnodes.py::test_PreIncrement", "sympy/codegen/tests/test_cnodes.py::test_PostIncrement", "sympy/codegen/tests/test_cnodes.py::test_sizeof", "sympy/codegen/tests/test_cnodes.py::test_struct", "sympy/codegen/tests/test_cnodes.py::test_union" ], "PASS_TO_PASS": null }
sympy__sympy-41
1.0
{ "code": "diff --git b/sympy/utilities/codegen.py a/sympy/utilities/codegen.py\nindex 5069e9bf4c..d60bc4d4bb 100644\n--- b/sympy/utilities/codegen.py\n+++ a/sympy/utilities/codegen.py\n@@ -2119,6 +2119,31 @@ def codegen(name_expr, language=None, prefix=None, project=\"project\",\n \n \"\"\"\n \n+ # Initialize the code generator.\n+ if language is None:\n+ if code_gen is None:\n+ raise ValueError(\"Need either language or code_gen\")\n+ else:\n+ if code_gen is not None:\n+ raise ValueError(\"You cannot specify both language and code_gen.\")\n+ code_gen = get_code_generator(language, project, standard, printer)\n+\n+ if isinstance(name_expr[0], str):\n+ # single tuple is given, turn it into a singleton list with a tuple.\n+ name_expr = [name_expr]\n+\n+ if prefix is None:\n+ prefix = name_expr[0][0]\n+\n+ # Construct Routines appropriate for this code_gen from (name, expr) pairs.\n+ routines = []\n+ for name, expr in name_expr:\n+ routines.append(code_gen.routine(name, expr, argument_sequence,\n+ global_vars))\n+\n+ # Write the code.\n+ return code_gen.write(routines, prefix, to_files, header, empty)\n+\n \n def make_routine(name, expr, argument_sequence=None,\n global_vars=None, language=\"F95\"):\n", "test": null }
null
{ "code": "diff --git a/sympy/utilities/codegen.py b/sympy/utilities/codegen.py\nindex d60bc4d4bb..5069e9bf4c 100644\n--- a/sympy/utilities/codegen.py\n+++ b/sympy/utilities/codegen.py\n@@ -2119,31 +2119,6 @@ def codegen(name_expr, language=None, prefix=None, project=\"project\",\n \n \"\"\"\n \n- # Initialize the code generator.\n- if language is None:\n- if code_gen is None:\n- raise ValueError(\"Need either language or code_gen\")\n- else:\n- if code_gen is not None:\n- raise ValueError(\"You cannot specify both language and code_gen.\")\n- code_gen = get_code_generator(language, project, standard, printer)\n-\n- if isinstance(name_expr[0], str):\n- # single tuple is given, turn it into a singleton list with a tuple.\n- name_expr = [name_expr]\n-\n- if prefix is None:\n- prefix = name_expr[0][0]\n-\n- # Construct Routines appropriate for this code_gen from (name, expr) pairs.\n- routines = []\n- for name, expr in name_expr:\n- routines.append(code_gen.routine(name, expr, argument_sequence,\n- global_vars))\n-\n- # Write the code.\n- return code_gen.write(routines, prefix, to_files, header, empty)\n-\n \n def make_routine(name, expr, argument_sequence=None,\n global_vars=None, language=\"F95\"):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/utilities/codegen.py.\nHere is the description for the function:\ndef codegen(name_expr, language=None, prefix=None, project=\"project\",\n to_files=False, header=True, empty=True, argument_sequence=None,\n global_vars=None, standard=None, code_gen=None, printer=None):\n \"\"\"Generate source code for expressions in a given language.\n\n Parameters\n ==========\n\n name_expr : tuple, or list of tuples\n A single (name, expression) tuple or a list of (name, expression)\n tuples. Each tuple corresponds to a routine. If the expression is\n an equality (an instance of class Equality) the left hand side is\n considered an output argument. If expression is an iterable, then\n the routine will have multiple outputs.\n\n language : string,\n A string that indicates the source code language. This is case\n insensitive. Currently, 'C', 'F95' and 'Octave' are supported.\n 'Octave' generates code compatible with both Octave and Matlab.\n\n prefix : string, optional\n A prefix for the names of the files that contain the source code.\n Language-dependent suffixes will be appended. If omitted, the name\n of the first name_expr tuple is used.\n\n project : string, optional\n A project name, used for making unique preprocessor instructions.\n [default: \"project\"]\n\n to_files : bool, optional\n When True, the code will be written to one or more files with the\n given prefix, otherwise strings with the names and contents of\n these files are returned. [default: False]\n\n header : bool, optional\n When True, a header is written on top of each source file.\n [default: True]\n\n empty : bool, optional\n When True, empty lines are used to structure the code.\n [default: True]\n\n argument_sequence : iterable, optional\n Sequence of arguments for the routine in a preferred order. A\n CodeGenError is raised if required arguments are missing.\n Redundant arguments are used without warning. If omitted,\n arguments will be ordered alphabetically, but with all input\n arguments first, and then output or in-out arguments.\n\n global_vars : iterable, optional\n Sequence of global variables used by the routine. Variables\n listed here will not show up as function arguments.\n\n standard : string, optional\n\n code_gen : CodeGen instance, optional\n An instance of a CodeGen subclass. Overrides ``language``.\n\n printer : Printer instance, optional\n An instance of a Printer subclass.\n\n Examples\n ========\n\n >>> from sympy.utilities.codegen import codegen\n >>> from sympy.abc import x, y, z\n >>> [(c_name, c_code), (h_name, c_header)] = codegen(\n ... (\"f\", x+y*z), \"C89\", \"test\", header=False, empty=False)\n >>> print(c_name)\n test.c\n >>> print(c_code)\n #include \"test.h\"\n #include <math.h>\n double f(double x, double y, double z) {\n double f_result;\n f_result = x + y*z;\n return f_result;\n }\n <BLANKLINE>\n >>> print(h_name)\n test.h\n >>> print(c_header)\n #ifndef PROJECT__TEST__H\n #define PROJECT__TEST__H\n double f(double x, double y, double z);\n #endif\n <BLANKLINE>\n\n Another example using Equality objects to give named outputs. Here the\n filename (prefix) is taken from the first (name, expr) pair.\n\n >>> from sympy.abc import f, g\n >>> from sympy import Eq\n >>> [(c_name, c_code), (h_name, c_header)] = codegen(\n ... [(\"myfcn\", x + y), (\"fcn2\", [Eq(f, 2*x), Eq(g, y)])],\n ... \"C99\", header=False, empty=False)\n >>> print(c_name)\n myfcn.c\n >>> print(c_code)\n #include \"myfcn.h\"\n #include <math.h>\n double myfcn(double x, double y) {\n double myfcn_result;\n myfcn_result = x + y;\n return myfcn_result;\n }\n void fcn2(double x, double y, double *f, double *g) {\n (*f) = 2*x;\n (*g) = y;\n }\n <BLANKLINE>\n\n If the generated function(s) will be part of a larger project where various\n global variables have been defined, the 'global_vars' option can be used\n to remove the specified variables from the function signature\n\n >>> from sympy.utilities.codegen import codegen\n >>> from sympy.abc import x, y, z\n >>> [(f_name, f_code), header] = codegen(\n ... (\"f\", x+y*z), \"F95\", header=False, empty=False,\n ... argument_sequence=(x, y), global_vars=(z,))\n >>> print(f_code)\n REAL*8 function f(x, y)\n implicit none\n REAL*8, intent(in) :: x\n REAL*8, intent(in) :: y\n f = x + y*z\n end function\n <BLANKLINE>\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/utilities/tests/test_codegen.py::test_simple_c_codegen", "sympy/utilities/tests/test_codegen.py::test_ansi_math1_codegen", "sympy/utilities/tests/test_codegen.py::test_ansi_math2_codegen", "sympy/utilities/tests/test_codegen.py::test_complicated_codegen", "sympy/utilities/tests/test_codegen.py::test_loops_c", "sympy/utilities/tests/test_codegen.py::test_partial_loops_c", "sympy/utilities/tests/test_codegen.py::test_ccode_results_named_ordered", "sympy/utilities/tests/test_codegen.py::test_ccode_matrixsymbol_slice", "sympy/utilities/tests/test_codegen.py::test_ccode_cse", "sympy/utilities/tests/test_codegen.py::test_ccode_unused_array_arg", "sympy/utilities/tests/test_codegen.py::test_ccode_unused_array_arg_func", "sympy/utilities/tests/test_codegen.py::test_simple_f_codegen", "sympy/utilities/tests/test_codegen.py::test_intrinsic_math_codegen", "sympy/utilities/tests/test_codegen.py::test_intrinsic_math2_codegen", "sympy/utilities/tests/test_codegen.py::test_complicated_codegen_f95", "sympy/utilities/tests/test_codegen.py::test_loops", "sympy/utilities/tests/test_codegen.py::test_loops_InOut", "sympy/utilities/tests/test_codegen.py::test_partial_loops_f", "sympy/utilities/tests/test_codegen.py::test_check_case", "sympy/utilities/tests/test_codegen.py::test_check_case_false_positive", "sympy/utilities/tests/test_codegen.py::test_c_fortran_omit_routine_name", "sympy/utilities/tests/test_codegen.py::test_fcode_matrix_output", "sympy/utilities/tests/test_codegen.py::test_fcode_results_named_ordered", "sympy/utilities/tests/test_codegen.py::test_fcode_matrixsymbol_slice", "sympy/utilities/tests/test_codegen.py::test_fcode_matrixsymbol_slice_autoname", "sympy/utilities/tests/test_codegen.py::test_global_vars", "sympy/utilities/tests/test_codegen.py::test_custom_codegen", "sympy/utilities/tests/test_codegen.py::test_c_with_printer", "sympy/utilities/tests/test_codegen.py::test_fcode_complex", "sympy/utilities/tests/test_codegen_julia.py::test_jl_simple_code", "sympy/utilities/tests/test_codegen_julia.py::test_jl_simple_code_with_header", "sympy/utilities/tests/test_codegen_octave.py::test_m_simple_code", "sympy/utilities/tests/test_codegen_julia.py::test_jl_simple_code_nameout", "sympy/utilities/tests/test_codegen_octave.py::test_m_simple_code_with_header", "sympy/utilities/tests/test_codegen_julia.py::test_jl_numbersymbol", "sympy/utilities/tests/test_codegen_octave.py::test_m_simple_code_nameout", "sympy/utilities/tests/test_codegen_octave.py::test_m_numbersymbol", "sympy/utilities/tests/test_codegen_julia.py::test_multiple_results_m", "sympy/utilities/tests/test_codegen_octave.py::test_multiple_results_m", "sympy/utilities/tests/test_codegen_julia.py::test_results_named_unordered", "sympy/utilities/tests/test_codegen_octave.py::test_results_named_unordered", "sympy/utilities/tests/test_codegen_julia.py::test_results_named_ordered", "sympy/utilities/tests/test_codegen_octave.py::test_results_named_ordered", "sympy/utilities/tests/test_codegen_julia.py::test_complicated_jl_codegen", "sympy/utilities/tests/test_codegen_octave.py::test_complicated_m_codegen", "sympy/utilities/tests/test_codegen_julia.py::test_jl_output_arg_mixed_unordered", "sympy/utilities/tests/test_codegen_octave.py::test_m_output_arg_mixed_unordered", "sympy/utilities/tests/test_codegen_julia.py::test_jl_piecewise_", "sympy/utilities/tests/test_codegen_octave.py::test_m_piecewise_", "sympy/utilities/tests/test_codegen_julia.py::test_jl_multifcns_per_file", "sympy/utilities/tests/test_codegen_octave.py::test_m_multifcns_per_file", "sympy/utilities/tests/test_codegen_julia.py::test_jl_multifcns_per_file_w_header", "sympy/utilities/tests/test_codegen_octave.py::test_m_multifcns_per_file_w_header", "sympy/utilities/tests/test_codegen_julia.py::test_jl_filename_match_prefix", "sympy/utilities/tests/test_codegen_octave.py::test_m_filename_match_first_fcn", "sympy/utilities/tests/test_codegen_julia.py::test_jl_matrix_named", "sympy/utilities/tests/test_codegen_octave.py::test_m_matrix_named", "sympy/utilities/tests/test_codegen_octave.py::test_m_matrix_named_matsym", "sympy/utilities/tests/test_codegen_julia.py::test_jl_matrix_named_matsym", "sympy/utilities/tests/test_codegen_octave.py::test_m_matrix_output_autoname", "sympy/utilities/tests/test_codegen_octave.py::test_m_matrix_output_autoname_2", "sympy/utilities/tests/test_codegen_julia.py::test_jl_matrix_output_autoname", "sympy/utilities/tests/test_codegen_octave.py::test_m_results_matrix_named_ordered", "sympy/utilities/tests/test_codegen_julia.py::test_jl_matrix_output_autoname_2", "sympy/utilities/tests/test_codegen_julia.py::test_jl_results_matrix_named_ordered", "sympy/utilities/tests/test_codegen_julia.py::test_jl_matrixsymbol_slice", "sympy/utilities/tests/test_codegen_octave.py::test_m_matrixsymbol_slice", "sympy/utilities/tests/test_codegen_octave.py::test_m_matrixsymbol_slice2", "sympy/utilities/tests/test_codegen_octave.py::test_m_matrixsymbol_slice3", "sympy/utilities/tests/test_codegen_octave.py::test_m_matrixsymbol_slice_autoname", "sympy/utilities/tests/test_codegen_octave.py::test_m_loops", "sympy/utilities/tests/test_codegen_octave.py::test_m_tensor_loops_multiple_contractions", "sympy/utilities/tests/test_codegen_octave.py::test_m_InOutArgument", "sympy/utilities/tests/test_codegen_julia.py::test_jl_matrixsymbol_slice2", "sympy/utilities/tests/test_codegen_julia.py::test_jl_matrixsymbol_slice3", "sympy/utilities/tests/test_codegen_julia.py::test_jl_matrixsymbol_slice_autoname", "sympy/utilities/tests/test_codegen_octave.py::test_m_InOutArgument_order", "sympy/utilities/tests/test_codegen_julia.py::test_jl_loops", "sympy/utilities/tests/test_codegen_octave.py::test_m_not_supported", "sympy/utilities/tests/test_codegen_julia.py::test_jl_tensor_loops_multiple_contractions", "sympy/utilities/tests/test_codegen_octave.py::test_global_vars_octave", "sympy/utilities/tests/test_codegen_julia.py::test_jl_InOutArgument", "sympy/utilities/tests/test_codegen_julia.py::test_jl_InOutArgument_order", "sympy/utilities/tests/test_codegen_julia.py::test_jl_not_supported", "sympy/utilities/tests/test_codegen_julia.py::test_global_vars_octave", "sympy/utilities/tests/test_codegen_rust.py::test_simple_rust_code", "sympy/utilities/tests/test_codegen_rust.py::test_simple_code_with_header", "sympy/utilities/tests/test_codegen_rust.py::test_simple_code_nameout", "sympy/utilities/tests/test_codegen_rust.py::test_numbersymbol", "sympy/utilities/tests/test_codegen_rust.py::test_multiple_results_rust", "sympy/utilities/tests/test_codegen_rust.py::test_results_named_unordered", "sympy/utilities/tests/test_codegen_rust.py::test_results_named_ordered", "sympy/utilities/tests/test_codegen_rust.py::test_complicated_rs_codegen", "sympy/utilities/tests/test_codegen_rust.py::test_output_arg_mixed_unordered", "sympy/utilities/tests/test_codegen_rust.py::test_piecewise_", "sympy/utilities/tests/test_codegen_rust.py::test_multifcns_per_file", "sympy/utilities/tests/test_codegen_rust.py::test_multifcns_per_file_w_header", "sympy/utilities/tests/test_codegen_rust.py::test_filename_match_prefix", "sympy/utilities/tests/test_codegen_rust.py::test_InOutArgument", "sympy/utilities/tests/test_codegen_rust.py::test_InOutArgument_order", "sympy/utilities/tests/test_codegen_rust.py::test_not_supported", "sympy/utilities/tests/test_codegen_rust.py::test_global_vars_rust" ], "PASS_TO_PASS": null }
sympy__sympy-42
1.0
{ "code": "diff --git b/sympy/discrete/convolutions.py a/sympy/discrete/convolutions.py\nindex d1c12a3afd..ac9a3dbbb2 100644\n--- b/sympy/discrete/convolutions.py\n+++ a/sympy/discrete/convolutions.py\n@@ -71,6 +71,52 @@ def convolution(a, b, cycle=0, dps=None, prime=None, dyadic=None, subset=None):\n \n \"\"\"\n \n+ c = as_int(cycle)\n+ if c < 0:\n+ raise ValueError(\"The length for cyclic convolution \"\n+ \"must be non-negative\")\n+\n+ dyadic = True if dyadic else None\n+ subset = True if subset else None\n+ if sum(x is not None for x in (prime, dps, dyadic, subset)) > 1:\n+ raise TypeError(\"Ambiguity in determining the type of convolution\")\n+\n+ if prime is not None:\n+ ls = convolution_ntt(a, b, prime=prime)\n+ return ls if not c else [sum(ls[i::c]) % prime for i in range(c)]\n+\n+ if dyadic:\n+ ls = convolution_fwht(a, b)\n+ elif subset:\n+ ls = convolution_subset(a, b)\n+ else:\n+ def loop(a):\n+ dens = []\n+ for i in a:\n+ if isinstance(i, Rational) and i.q - 1:\n+ dens.append(i.q)\n+ elif not isinstance(i, int):\n+ return\n+ if dens:\n+ l = lcm(*dens)\n+ return [i*l if type(i) is int else i.p*(l//i.q) for i in a], l\n+ # no lcm of den to deal with\n+ return a, 1\n+ ls = None\n+ da = loop(a)\n+ if da is not None:\n+ db = loop(b)\n+ if db is not None:\n+ (ia, ma), (ib, mb) = da, db\n+ den = ma*mb\n+ ls = convolution_int(ia, ib)\n+ if den != 1:\n+ ls = [Rational(i, den) for i in ls]\n+ if ls is None:\n+ ls = convolution_fft(a, b, dps)\n+\n+ return ls if not c else [sum(ls[i::c]) for i in range(c)]\n+\n \n #----------------------------------------------------------------------------#\n # #\n", "test": null }
null
{ "code": "diff --git a/sympy/discrete/convolutions.py b/sympy/discrete/convolutions.py\nindex ac9a3dbbb2..d1c12a3afd 100644\n--- a/sympy/discrete/convolutions.py\n+++ b/sympy/discrete/convolutions.py\n@@ -71,52 +71,6 @@ def convolution(a, b, cycle=0, dps=None, prime=None, dyadic=None, subset=None):\n \n \"\"\"\n \n- c = as_int(cycle)\n- if c < 0:\n- raise ValueError(\"The length for cyclic convolution \"\n- \"must be non-negative\")\n-\n- dyadic = True if dyadic else None\n- subset = True if subset else None\n- if sum(x is not None for x in (prime, dps, dyadic, subset)) > 1:\n- raise TypeError(\"Ambiguity in determining the type of convolution\")\n-\n- if prime is not None:\n- ls = convolution_ntt(a, b, prime=prime)\n- return ls if not c else [sum(ls[i::c]) % prime for i in range(c)]\n-\n- if dyadic:\n- ls = convolution_fwht(a, b)\n- elif subset:\n- ls = convolution_subset(a, b)\n- else:\n- def loop(a):\n- dens = []\n- for i in a:\n- if isinstance(i, Rational) and i.q - 1:\n- dens.append(i.q)\n- elif not isinstance(i, int):\n- return\n- if dens:\n- l = lcm(*dens)\n- return [i*l if type(i) is int else i.p*(l//i.q) for i in a], l\n- # no lcm of den to deal with\n- return a, 1\n- ls = None\n- da = loop(a)\n- if da is not None:\n- db = loop(b)\n- if db is not None:\n- (ia, ma), (ib, mb) = da, db\n- den = ma*mb\n- ls = convolution_int(ia, ib)\n- if den != 1:\n- ls = [Rational(i, den) for i in ls]\n- if ls is None:\n- ls = convolution_fft(a, b, dps)\n-\n- return ls if not c else [sum(ls[i::c]) for i in range(c)]\n-\n \n #----------------------------------------------------------------------------#\n # #\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/discrete/convolutions.py.\nHere is the description for the function:\ndef convolution(a, b, cycle=0, dps=None, prime=None, dyadic=None, subset=None):\n \"\"\"\n Performs convolution by determining the type of desired\n convolution using hints.\n\n Exactly one of ``dps``, ``prime``, ``dyadic``, ``subset`` arguments\n should be specified explicitly for identifying the type of convolution,\n and the argument ``cycle`` can be specified optionally.\n\n For the default arguments, linear convolution is performed using **FFT**.\n\n Parameters\n ==========\n\n a, b : iterables\n The sequences for which convolution is performed.\n cycle : Integer\n Specifies the length for doing cyclic convolution.\n dps : Integer\n Specifies the number of decimal digits for precision for\n performing **FFT** on the sequence.\n prime : Integer\n Prime modulus of the form `(m 2^k + 1)` to be used for\n performing **NTT** on the sequence.\n dyadic : bool\n Identifies the convolution type as dyadic (*bitwise-XOR*)\n convolution, which is performed using **FWHT**.\n subset : bool\n Identifies the convolution type as subset convolution.\n\n Examples\n ========\n\n >>> from sympy import convolution, symbols, S, I\n >>> u, v, w, x, y, z = symbols('u v w x y z')\n\n >>> convolution([1 + 2*I, 4 + 3*I], [S(5)/4, 6], dps=3)\n [1.25 + 2.5*I, 11.0 + 15.8*I, 24.0 + 18.0*I]\n >>> convolution([1, 2, 3], [4, 5, 6], cycle=3)\n [31, 31, 28]\n\n >>> convolution([111, 777], [888, 444], prime=19*2**10 + 1)\n [1283, 19351, 14219]\n >>> convolution([111, 777], [888, 444], prime=19*2**10 + 1, cycle=2)\n [15502, 19351]\n\n >>> convolution([u, v], [x, y, z], dyadic=True)\n [u*x + v*y, u*y + v*x, u*z, v*z]\n >>> convolution([u, v], [x, y, z], dyadic=True, cycle=2)\n [u*x + u*z + v*y, u*y + v*x + v*z]\n\n >>> convolution([u, v, w], [x, y, z], subset=True)\n [u*x, u*y + v*x, u*z + w*x, v*z + w*y]\n >>> convolution([u, v, w], [x, y, z], subset=True, cycle=3)\n [u*x + v*z + w*y, u*y + v*x, u*z + w*x]\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/discrete/tests/test_convolutions.py::test_convolution", "sympy/discrete/tests/test_convolutions.py::test_cyclic_convolution", "sympy/series/tests/test_formal.py::test_fps__product" ], "PASS_TO_PASS": null }
sympy__sympy-43
1.0
{ "code": "diff --git b/sympy/combinatorics/coset_table.py a/sympy/combinatorics/coset_table.py\nindex 598c1f1efb..853d35dfa1 100644\n--- b/sympy/combinatorics/coset_table.py\n+++ a/sympy/combinatorics/coset_table.py\n@@ -1114,6 +1114,48 @@ def coset_enumeration_r(fp_grp, Y, max_cosets=None, draft=None,\n \"Handbook of computational group theory\"\n \n \"\"\"\n+ # 1. Initialize a coset table C for < X|R >\n+ C = CosetTable(fp_grp, Y, max_cosets=max_cosets)\n+ # Define coset table methods.\n+ if modified:\n+ _scan_and_fill = C.modified_scan_and_fill\n+ _define = C.modified_define\n+ else:\n+ _scan_and_fill = C.scan_and_fill\n+ _define = C.define\n+ if draft:\n+ C.table = draft.table[:]\n+ C.p = draft.p[:]\n+ R = fp_grp.relators\n+ A_dict = C.A_dict\n+ p = C.p\n+ for i in range(len(Y)):\n+ if modified:\n+ _scan_and_fill(0, Y[i], C._grp.generators[i])\n+ else:\n+ _scan_and_fill(0, Y[i])\n+ alpha = 0\n+ while alpha < C.n:\n+ if p[alpha] == alpha:\n+ try:\n+ for w in R:\n+ if modified:\n+ _scan_and_fill(alpha, w, C._grp.identity)\n+ else:\n+ _scan_and_fill(alpha, w)\n+ # if alpha was eliminated during the scan then break\n+ if p[alpha] < alpha:\n+ break\n+ if p[alpha] == alpha:\n+ for x in A_dict:\n+ if C.table[alpha][A_dict[x]] is None:\n+ _define(alpha, x)\n+ except ValueError as e:\n+ if incomplete:\n+ return C\n+ raise e\n+ alpha += 1\n+ return C\n \n def modified_coset_enumeration_r(fp_grp, Y, max_cosets=None, draft=None,\n incomplete=False):\n", "test": null }
null
{ "code": "diff --git a/sympy/combinatorics/coset_table.py b/sympy/combinatorics/coset_table.py\nindex 853d35dfa1..598c1f1efb 100644\n--- a/sympy/combinatorics/coset_table.py\n+++ b/sympy/combinatorics/coset_table.py\n@@ -1114,48 +1114,6 @@ def coset_enumeration_r(fp_grp, Y, max_cosets=None, draft=None,\n \"Handbook of computational group theory\"\n \n \"\"\"\n- # 1. Initialize a coset table C for < X|R >\n- C = CosetTable(fp_grp, Y, max_cosets=max_cosets)\n- # Define coset table methods.\n- if modified:\n- _scan_and_fill = C.modified_scan_and_fill\n- _define = C.modified_define\n- else:\n- _scan_and_fill = C.scan_and_fill\n- _define = C.define\n- if draft:\n- C.table = draft.table[:]\n- C.p = draft.p[:]\n- R = fp_grp.relators\n- A_dict = C.A_dict\n- p = C.p\n- for i in range(len(Y)):\n- if modified:\n- _scan_and_fill(0, Y[i], C._grp.generators[i])\n- else:\n- _scan_and_fill(0, Y[i])\n- alpha = 0\n- while alpha < C.n:\n- if p[alpha] == alpha:\n- try:\n- for w in R:\n- if modified:\n- _scan_and_fill(alpha, w, C._grp.identity)\n- else:\n- _scan_and_fill(alpha, w)\n- # if alpha was eliminated during the scan then break\n- if p[alpha] < alpha:\n- break\n- if p[alpha] == alpha:\n- for x in A_dict:\n- if C.table[alpha][A_dict[x]] is None:\n- _define(alpha, x)\n- except ValueError as e:\n- if incomplete:\n- return C\n- raise e\n- alpha += 1\n- return C\n \n def modified_coset_enumeration_r(fp_grp, Y, max_cosets=None, draft=None,\n incomplete=False):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/combinatorics/coset_table.py.\nHere is the description for the function:\ndef coset_enumeration_r(fp_grp, Y, max_cosets=None, draft=None,\n incomplete=False, modified=False):\n \"\"\"\n This is easier of the two implemented methods of coset enumeration.\n and is often called the HLT method, after Hazelgrove, Leech, Trotter\n The idea is that we make use of ``scan_and_fill`` makes new definitions\n whenever the scan is incomplete to enable the scan to complete; this way\n we fill in the gaps in the scan of the relator or subgroup generator,\n that's why the name relator-based method.\n\n An instance of `CosetTable` for `fp_grp` can be passed as the keyword\n argument `draft` in which case the coset enumeration will start with\n that instance and attempt to complete it.\n\n When `incomplete` is `True` and the function is unable to complete for\n some reason, the partially complete table will be returned.\n\n # TODO: complete the docstring\n\n See Also\n ========\n\n scan_and_fill,\n\n Examples\n ========\n\n >>> from sympy.combinatorics.free_groups import free_group\n >>> from sympy.combinatorics.fp_groups import FpGroup, coset_enumeration_r\n >>> F, x, y = free_group(\"x, y\")\n\n # Example 5.1 from [1]\n >>> f = FpGroup(F, [x**3, y**3, x**-1*y**-1*x*y])\n >>> C = coset_enumeration_r(f, [x])\n >>> for i in range(len(C.p)):\n ... if C.p[i] == i:\n ... print(C.table[i])\n [0, 0, 1, 2]\n [1, 1, 2, 0]\n [2, 2, 0, 1]\n >>> C.p\n [0, 1, 2, 1, 1]\n\n # Example from exercises Q2 [1]\n >>> f = FpGroup(F, [x**2*y**2, y**-1*x*y*x**-3])\n >>> C = coset_enumeration_r(f, [])\n >>> C.compress(); C.standardize()\n >>> C.table\n [[1, 2, 3, 4],\n [5, 0, 6, 7],\n [0, 5, 7, 6],\n [7, 6, 5, 0],\n [6, 7, 0, 5],\n [2, 1, 4, 3],\n [3, 4, 2, 1],\n [4, 3, 1, 2]]\n\n # Example 5.2\n >>> f = FpGroup(F, [x**2, y**3, (x*y)**3])\n >>> Y = [x*y]\n >>> C = coset_enumeration_r(f, Y)\n >>> for i in range(len(C.p)):\n ... if C.p[i] == i:\n ... print(C.table[i])\n [1, 1, 2, 1]\n [0, 0, 0, 2]\n [3, 3, 1, 0]\n [2, 2, 3, 3]\n\n # Example 5.3\n >>> f = FpGroup(F, [x**2*y**2, x**3*y**5])\n >>> Y = []\n >>> C = coset_enumeration_r(f, Y)\n >>> for i in range(len(C.p)):\n ... if C.p[i] == i:\n ... print(C.table[i])\n [1, 3, 1, 3]\n [2, 0, 2, 0]\n [3, 1, 3, 1]\n [0, 2, 0, 2]\n\n # Example 5.4\n >>> F, a, b, c, d, e = free_group(\"a, b, c, d, e\")\n >>> f = FpGroup(F, [a*b*c**-1, b*c*d**-1, c*d*e**-1, d*e*a**-1, e*a*b**-1])\n >>> Y = [a]\n >>> C = coset_enumeration_r(f, Y)\n >>> for i in range(len(C.p)):\n ... if C.p[i] == i:\n ... print(C.table[i])\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n\n # example of \"compress\" method\n >>> C.compress()\n >>> C.table\n [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]\n\n # Exercises Pg. 161, Q2.\n >>> F, x, y = free_group(\"x, y\")\n >>> f = FpGroup(F, [x**2*y**2, y**-1*x*y*x**-3])\n >>> Y = []\n >>> C = coset_enumeration_r(f, Y)\n >>> C.compress()\n >>> C.standardize()\n >>> C.table\n [[1, 2, 3, 4],\n [5, 0, 6, 7],\n [0, 5, 7, 6],\n [7, 6, 5, 0],\n [6, 7, 0, 5],\n [2, 1, 4, 3],\n [3, 4, 2, 1],\n [4, 3, 1, 2]]\n\n # John J. Cannon; Lucien A. Dimino; George Havas; Jane M. Watson\n # Mathematics of Computation, Vol. 27, No. 123. (Jul., 1973), pp. 463-490\n # from 1973chwd.pdf\n # Table 1. Ex. 1\n >>> F, r, s, t = free_group(\"r, s, t\")\n >>> E1 = FpGroup(F, [t**-1*r*t*r**-2, r**-1*s*r*s**-2, s**-1*t*s*t**-2])\n >>> C = coset_enumeration_r(E1, [r])\n >>> for i in range(len(C.p)):\n ... if C.p[i] == i:\n ... print(C.table[i])\n [0, 0, 0, 0, 0, 0]\n\n Ex. 2\n >>> F, a, b = free_group(\"a, b\")\n >>> Cox = FpGroup(F, [a**6, b**6, (a*b)**2, (a**2*b**2)**2, (a**3*b**3)**5])\n >>> C = coset_enumeration_r(Cox, [a])\n >>> index = 0\n >>> for i in range(len(C.p)):\n ... if C.p[i] == i:\n ... index += 1\n >>> index\n 500\n\n # Ex. 3\n >>> F, a, b = free_group(\"a, b\")\n >>> B_2_4 = FpGroup(F, [a**4, b**4, (a*b)**4, (a**-1*b)**4, (a**2*b)**4, \\\n (a*b**2)**4, (a**2*b**2)**4, (a**-1*b*a*b)**4, (a*b**-1*a*b)**4])\n >>> C = coset_enumeration_r(B_2_4, [a])\n >>> index = 0\n >>> for i in range(len(C.p)):\n ... if C.p[i] == i:\n ... index += 1\n >>> index\n 1024\n\n References\n ==========\n\n .. [1] Holt, D., Eick, B., O'Brien, E.\n \"Handbook of computational group theory\"\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/combinatorics/tests/test_fp_groups.py::test_subgroup_presentations", "sympy/combinatorics/tests/test_fp_groups.py::test_fp_subgroup", "sympy/combinatorics/tests/test_fp_groups.py::test_permutation_methods", "sympy/combinatorics/tests/test_fp_groups.py::test_cyclic", "sympy/combinatorics/tests/test_fp_groups.py::test_abelian_invariants", "sympy/combinatorics/tests/test_homomorphisms.py::test_homomorphism", "sympy/combinatorics/tests/test_homomorphisms.py::test_isomorphisms", "sympy/combinatorics/tests/test_coset_table.py::test_modified_methods" ], "PASS_TO_PASS": null }
sympy__sympy-44
1.0
{ "code": "diff --git b/sympy/simplify/cse_main.py a/sympy/simplify/cse_main.py\nindex 955d3899de..bcd1b2e50a 100644\n--- b/sympy/simplify/cse_main.py\n+++ a/sympy/simplify/cse_main.py\n@@ -805,6 +805,77 @@ def cse(exprs, symbols=None, optimizations=None, postprocess=None,\n >>> cse(x, list=False)\n ([], x)\n \"\"\"\n+ if not list:\n+ return _cse_homogeneous(exprs,\n+ symbols=symbols, optimizations=optimizations,\n+ postprocess=postprocess, order=order, ignore=ignore)\n+\n+ if isinstance(exprs, (int, float)):\n+ exprs = sympify(exprs)\n+\n+ # Handle the case if just one expression was passed.\n+ if isinstance(exprs, (Basic, MatrixBase)):\n+ exprs = [exprs]\n+\n+ copy = exprs\n+ temp = []\n+ for e in exprs:\n+ if isinstance(e, (Matrix, ImmutableMatrix)):\n+ temp.append(Tuple(*e.flat()))\n+ elif isinstance(e, (SparseMatrix, ImmutableSparseMatrix)):\n+ temp.append(Tuple(*e.todok().items()))\n+ else:\n+ temp.append(e)\n+ exprs = temp\n+ del temp\n+\n+ if optimizations is None:\n+ optimizations = []\n+ elif optimizations == 'basic':\n+ optimizations = basic_optimizations\n+\n+ # Preprocess the expressions to give us better optimization opportunities.\n+ reduced_exprs = [preprocess_for_cse(e, optimizations) for e in exprs]\n+\n+ if symbols is None:\n+ symbols = numbered_symbols(cls=Symbol)\n+ else:\n+ # In case we get passed an iterable with an __iter__ method instead of\n+ # an actual iterator.\n+ symbols = iter(symbols)\n+\n+ # Find other optimization opportunities.\n+ opt_subs = opt_cse(reduced_exprs, order)\n+\n+ # Main CSE algorithm.\n+ replacements, reduced_exprs = tree_cse(reduced_exprs, symbols, opt_subs,\n+ order, ignore)\n+\n+ # Postprocess the expressions to return the expressions to canonical form.\n+ exprs = copy\n+ replacements = [(sym, postprocess_for_cse(subtree, optimizations))\n+ for sym, subtree in replacements]\n+ reduced_exprs = [postprocess_for_cse(e, optimizations)\n+ for e in reduced_exprs]\n+\n+ # Get the matrices back\n+ for i, e in enumerate(exprs):\n+ if isinstance(e, (Matrix, ImmutableMatrix)):\n+ reduced_exprs[i] = Matrix(e.rows, e.cols, reduced_exprs[i])\n+ if isinstance(e, ImmutableMatrix):\n+ reduced_exprs[i] = reduced_exprs[i].as_immutable()\n+ elif isinstance(e, (SparseMatrix, ImmutableSparseMatrix)):\n+ m = SparseMatrix(e.rows, e.cols, {})\n+ for k, v in reduced_exprs[i]:\n+ m[k] = v\n+ if isinstance(e, ImmutableSparseMatrix):\n+ m = m.as_immutable()\n+ reduced_exprs[i] = m\n+\n+ if postprocess is None:\n+ return replacements, reduced_exprs\n+\n+ return postprocess(replacements, reduced_exprs)\n \n \n def _cse_homogeneous(exprs, **kwargs):\n", "test": null }
null
{ "code": "diff --git a/sympy/simplify/cse_main.py b/sympy/simplify/cse_main.py\nindex bcd1b2e50a..955d3899de 100644\n--- a/sympy/simplify/cse_main.py\n+++ b/sympy/simplify/cse_main.py\n@@ -805,77 +805,6 @@ def cse(exprs, symbols=None, optimizations=None, postprocess=None,\n >>> cse(x, list=False)\n ([], x)\n \"\"\"\n- if not list:\n- return _cse_homogeneous(exprs,\n- symbols=symbols, optimizations=optimizations,\n- postprocess=postprocess, order=order, ignore=ignore)\n-\n- if isinstance(exprs, (int, float)):\n- exprs = sympify(exprs)\n-\n- # Handle the case if just one expression was passed.\n- if isinstance(exprs, (Basic, MatrixBase)):\n- exprs = [exprs]\n-\n- copy = exprs\n- temp = []\n- for e in exprs:\n- if isinstance(e, (Matrix, ImmutableMatrix)):\n- temp.append(Tuple(*e.flat()))\n- elif isinstance(e, (SparseMatrix, ImmutableSparseMatrix)):\n- temp.append(Tuple(*e.todok().items()))\n- else:\n- temp.append(e)\n- exprs = temp\n- del temp\n-\n- if optimizations is None:\n- optimizations = []\n- elif optimizations == 'basic':\n- optimizations = basic_optimizations\n-\n- # Preprocess the expressions to give us better optimization opportunities.\n- reduced_exprs = [preprocess_for_cse(e, optimizations) for e in exprs]\n-\n- if symbols is None:\n- symbols = numbered_symbols(cls=Symbol)\n- else:\n- # In case we get passed an iterable with an __iter__ method instead of\n- # an actual iterator.\n- symbols = iter(symbols)\n-\n- # Find other optimization opportunities.\n- opt_subs = opt_cse(reduced_exprs, order)\n-\n- # Main CSE algorithm.\n- replacements, reduced_exprs = tree_cse(reduced_exprs, symbols, opt_subs,\n- order, ignore)\n-\n- # Postprocess the expressions to return the expressions to canonical form.\n- exprs = copy\n- replacements = [(sym, postprocess_for_cse(subtree, optimizations))\n- for sym, subtree in replacements]\n- reduced_exprs = [postprocess_for_cse(e, optimizations)\n- for e in reduced_exprs]\n-\n- # Get the matrices back\n- for i, e in enumerate(exprs):\n- if isinstance(e, (Matrix, ImmutableMatrix)):\n- reduced_exprs[i] = Matrix(e.rows, e.cols, reduced_exprs[i])\n- if isinstance(e, ImmutableMatrix):\n- reduced_exprs[i] = reduced_exprs[i].as_immutable()\n- elif isinstance(e, (SparseMatrix, ImmutableSparseMatrix)):\n- m = SparseMatrix(e.rows, e.cols, {})\n- for k, v in reduced_exprs[i]:\n- m[k] = v\n- if isinstance(e, ImmutableSparseMatrix):\n- m = m.as_immutable()\n- reduced_exprs[i] = m\n-\n- if postprocess is None:\n- return replacements, reduced_exprs\n-\n- return postprocess(replacements, reduced_exprs)\n \n \n def _cse_homogeneous(exprs, **kwargs):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/simplify/cse_main.py.\nHere is the description for the function:\ndef cse(exprs, symbols=None, optimizations=None, postprocess=None,\n order='canonical', ignore=(), list=True):\n \"\"\" Perform common subexpression elimination on an expression.\n\n Parameters\n ==========\n\n exprs : list of SymPy expressions, or a single SymPy expression\n The expressions to reduce.\n symbols : infinite iterator yielding unique Symbols\n The symbols used to label the common subexpressions which are pulled\n out. The ``numbered_symbols`` generator is useful. The default is a\n stream of symbols of the form \"x0\", \"x1\", etc. This must be an\n infinite iterator.\n optimizations : list of (callable, callable) pairs\n The (preprocessor, postprocessor) pairs of external optimization\n functions. Optionally 'basic' can be passed for a set of predefined\n basic optimizations. Such 'basic' optimizations were used by default\n in old implementation, however they can be really slow on larger\n expressions. Now, no pre or post optimizations are made by default.\n postprocess : a function which accepts the two return values of cse and\n returns the desired form of output from cse, e.g. if you want the\n replacements reversed the function might be the following lambda:\n lambda r, e: return reversed(r), e\n order : string, 'none' or 'canonical'\n The order by which Mul and Add arguments are processed. If set to\n 'canonical', arguments will be canonically ordered. If set to 'none',\n ordering will be faster but dependent on expressions hashes, thus\n machine dependent and variable. For large expressions where speed is a\n concern, use the setting order='none'.\n ignore : iterable of Symbols\n Substitutions containing any Symbol from ``ignore`` will be ignored.\n list : bool, (default True)\n Returns expression in list or else with same type as input (when False).\n\n Returns\n =======\n\n replacements : list of (Symbol, expression) pairs\n All of the common subexpressions that were replaced. Subexpressions\n earlier in this list might show up in subexpressions later in this\n list.\n reduced_exprs : list of SymPy expressions\n The reduced expressions with all of the replacements above.\n\n Examples\n ========\n\n >>> from sympy import cse, SparseMatrix\n >>> from sympy.abc import x, y, z, w\n >>> cse(((w + x + y + z)*(w + y + z))/(w + x)**3)\n ([(x0, y + z), (x1, w + x)], [(w + x0)*(x0 + x1)/x1**3])\n\n\n List of expressions with recursive substitutions:\n\n >>> m = SparseMatrix([x + y, x + y + z])\n >>> cse([(x+y)**2, x + y + z, y + z, x + z + y, m])\n ([(x0, x + y), (x1, x0 + z)], [x0**2, x1, y + z, x1, Matrix([\n [x0],\n [x1]])])\n\n Note: the type and mutability of input matrices is retained.\n\n >>> isinstance(_[1][-1], SparseMatrix)\n True\n\n The user may disallow substitutions containing certain symbols:\n\n >>> cse([y**2*(x + 1), 3*y**2*(x + 1)], ignore=(y,))\n ([(x0, x + 1)], [x0*y**2, 3*x0*y**2])\n\n The default return value for the reduced expression(s) is a list, even if there is only\n one expression. The `list` flag preserves the type of the input in the output:\n\n >>> cse(x)\n ([], [x])\n >>> cse(x, list=False)\n ([], x)\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/simplify/tests/test_cse.py::test_cse_single", "sympy/simplify/tests/test_cse.py::test_cse_single2", "sympy/simplify/tests/test_cse.py::test_cse_not_possible", "sympy/simplify/tests/test_cse.py::test_nested_substitution", "sympy/simplify/tests/test_cse.py::test_subtraction_opt", "sympy/simplify/tests/test_cse.py::test_multiple_expressions", "sympy/simplify/tests/test_cse.py::test_bypass_non_commutatives", "sympy/simplify/tests/test_cse.py::test_issue_4498", "sympy/simplify/tests/test_cse.py::test_issue_4020", "sympy/simplify/tests/test_cse.py::test_issue_4203", "sympy/simplify/tests/test_cse.py::test_issue_6263", "sympy/utilities/tests/test_codegen.py::test_multidim_c_argument_cse", "sympy/simplify/tests/test_cse.py::test_issue_25043", "sympy/simplify/tests/test_cse.py::test_dont_cse_tuples", "sympy/utilities/tests/test_codegen.py::test_ccode_cse", "sympy/simplify/tests/test_cse.py::test_pow_invpow", "sympy/simplify/tests/test_cse.py::test_postprocess", "sympy/simplify/tests/test_cse.py::test_issue_4499", "sympy/core/tests/test_subs.py::test_derivative_subs", "sympy/simplify/tests/test_cse.py::test_issue_6169", "sympy/simplify/tests/test_cse.py::test_cse_Indexed", "sympy/simplify/tests/test_cse.py::test_cse_MatrixSymbol", "sympy/simplify/tests/test_cse.py::test_cse_MatrixExpr", "sympy/simplify/tests/test_cse.py::test_Piecewise", "sympy/simplify/tests/test_cse.py::test_ignore_order_terms", "sympy/core/tests/test_subs.py::test_issue_6559", "sympy/simplify/tests/test_cse.py::test_name_conflict", "sympy/simplify/tests/test_cse.py::test_name_conflict_cust_symbols", "sympy/simplify/tests/test_cse.py::test_symbols_exhausted_error", "sympy/simplify/tests/test_cse.py::test_issue_7840", "sympy/simplify/tests/test_cse.py::test_issue_8891", "sympy/utilities/tests/test_lambdify.py::test_lambdify_derivative_and_functions_as_arguments", "sympy/simplify/tests/test_cse.py::test_issue_11230", "sympy/simplify/tests/test_cse.py::test_hollow_rejection", "sympy/simplify/tests/test_cse.py::test_cse_ignore", "sympy/utilities/tests/test_lambdify.py::test_lambdify_cse", "sympy/utilities/tests/test_lambdify.py::test_issue_25288", "sympy/simplify/tests/test_cse.py::test_cse_ignore_issue_15002", "sympy/utilities/tests/test_lambdify.py::test_23536_lambdify_cse_dummy", "sympy/simplify/tests/test_cse.py::test_cse_unevaluated", "sympy/simplify/tests/test_cse.py::test_cse__performance", "sympy/simplify/tests/test_cse.py::test_issue_12070", "sympy/simplify/tests/test_cse.py::test_issue_13000", "sympy/simplify/tests/test_cse.py::test_issue_18203", "sympy/simplify/tests/test_cse.py::test_unevaluated_mul", "sympy/simplify/tests/test_cse.py::test_cse_release_variables", "sympy/simplify/tests/test_cse.py::test_cse_list", "sympy/simplify/tests/test_cse.py::test_unevaluated_Mul", "sympy/simplify/tests/test_cse.py::test_cse_matrix_expression_inverse", "sympy/simplify/tests/test_cse.py::test_cse_matrix_expression_matmul_inverse", "sympy/simplify/tests/test_cse.py::test_cse_matrix_negate_matrix", "sympy/simplify/tests/test_cse.py::test_cse_matrix_negate_matmul_not_extracted", "sympy/simplify/tests/test_cse.py::test_cse_matrix_optimize_out_single_argument_mul", "sympy/simplify/tests/test_cse.py::test_cse_matrix_optimize_out_single_argument_add", "sympy/simplify/tests/test_cse.py::test_cse_matrix_expression_matrix_solve", "sympy/simplify/tests/test_cse.py::test_cse_matrix_matrix_expression", "sympy/simplify/tests/test_cse.py::test_cse_matrix_kalman_filter", "sympy/solvers/ode/tests/test_ode.py::test_dsolve_all_hint", "sympy/codegen/tests/test_ast.py::test_CodeBlock_cse", "sympy/codegen/tests/test_ast.py::test_CodeBlock_cse__issue_14118", "sympy/solvers/ode/tests/test_ode.py::test_dsolve_ics", "sympy/simplify/tests/test_cse_diff.py::test_forward_jacobian[expr0-wrt0]", "sympy/simplify/tests/test_cse_diff.py::test_forward_jacobian[expr1-wrt1]", "sympy/simplify/tests/test_cse_diff.py::test_forward_jacobian[expr2-wrt2]", "sympy/simplify/tests/test_cse_diff.py::test_forward_jacobian[expr3-wrt3]", "sympy/simplify/tests/test_cse_diff.py::test_forward_jacobian[expr4-wrt4]", "sympy/simplify/tests/test_cse_diff.py::test_forward_jacobian[expr5-wrt5]", "sympy/simplify/tests/test_cse_diff.py::test_forward_jacobian[expr6-wrt6]", "sympy/simplify/tests/test_cse_diff.py::test_forward_jacobian[expr7-wrt7]", "sympy/simplify/tests/test_cse_diff.py::test_forward_jacobian[expr8-wrt8]", "sympy/simplify/tests/test_cse_diff.py::test_forward_jacobian[expr9-wrt9]", "sympy/simplify/tests/test_cse_diff.py::test_forward_jacobian[expr10-wrt10]", "sympy/simplify/tests/test_cse_diff.py::test_forward_jacobian[expr11-wrt11]", "sympy/simplify/tests/test_cse_diff.py::test_forward_jacobian[expr12-wrt12]", "sympy/simplify/tests/test_cse_diff.py::test_forward_jacobian[expr13-wrt13]", "sympy/simplify/tests/test_cse_diff.py::test_forward_jacobian[expr14-wrt14]", "sympy/simplify/tests/test_cse_diff.py::test_forward_jacobian[expr15-wrt15]", "sympy/simplify/tests/test_cse_diff.py::test_forward_jacobian[expr16-wrt16]", "sympy/simplify/tests/test_cse_diff.py::test_forward_jacobian[expr17-wrt17]", "sympy/simplify/tests/test_cse_diff.py::test_process_cse", "sympy/simplify/tests/test_cse_diff.py::test_io_matrix_type", "sympy/simplify/tests/test_cse_diff.py::test_forward_jacobian_input_output", "sympy/simplify/tests/test_cse_diff.py::test_jacobian_hessian", "sympy/simplify/tests/test_cse_diff.py::test_jacobian_metrics", "sympy/simplify/tests/test_cse_diff.py::test_jacobian2", "sympy/simplify/tests/test_cse_diff.py::test_issue_4564", "sympy/simplify/tests/test_cse_diff.py::test_nonvectorJacobian", "sympy/solvers/ode/tests/test_ode.py::test_solve_ics", "sympy/solvers/ode/tests/test_single.py::test_linear_coefficients", "sympy/solvers/ode/tests/test_single.py::test_Airy_equation", "sympy/solvers/ode/tests/test_single.py::test_2nd_2F1_hypergeometric_integral", "sympy/solvers/tests/test_constantsimp.py::test_constant_mul", "sympy/solvers/tests/test_constantsimp.py::test_constant_add", "sympy/solvers/tests/test_constantsimp.py::test_constant_power_as_base", "sympy/solvers/tests/test_constantsimp.py::test_constant_power_as_exp", "sympy/solvers/tests/test_constantsimp.py::test_constant_function", "sympy/solvers/tests/test_constantsimp.py::test_constant_function_multiple", "sympy/solvers/ode/tests/test_ode.py::test_issue_5770", "sympy/solvers/tests/test_constantsimp.py::test_constant_multiple", "sympy/solvers/tests/test_constantsimp.py::test_ode_solutions", "sympy/solvers/tests/test_constantsimp.py::test_constant_Eq", "sympy/solvers/tests/test_pde.py::test_checkpdesol", "sympy/solvers/ode/tests/test_ode.py::test_constantsimp_take_problem", "sympy/solvers/ode/tests/test_ode.py::test_series", "sympy/solvers/ode/tests/test_ode.py::test_2nd_power_series_regular", "sympy/solvers/ode/tests/test_ode.py::test_dsolve_remove_redundant_solutions", "sympy/solvers/ode/tests/test_ode.py::test_issue_13060", "sympy/solvers/ode/tests/test_ode.py::test_issue_22523", "sympy/solvers/ode/tests/test_single.py::test_nth_linear_constant_coeff_var_of_parameters", "sympy/codegen/tests/test_algorithms.py::test_newtons_method_function__rtol_cse_nan", "sympy/solvers/tests/test_pde.py::test_pdsolve_variable_coeff", "sympy/physics/mechanics/tests/test_kane5.py::test_kane_rolling_disc_lu", "sympy/solvers/ode/tests/test_single.py::test_nth_order_reducible", "sympy/solvers/ode/tests/test_single.py::test_Riccati_special_minus2", "sympy/solvers/ode/tests/test_lie_group.py::test_user_infinitesimals", "sympy/solvers/ode/tests/test_single.py::test_Bernoulli", "sympy/solvers/ode/tests/test_systems.py::test_higher_order_to_first_order", "sympy/solvers/ode/tests/test_single.py::test_1st_linear", "sympy/solvers/ode/tests/test_single.py::test_almost_linear", "sympy/solvers/ode/tests/test_single.py::test_nth_order_linear_euler_eq_homogeneous", "sympy/solvers/ode/tests/test_single.py::test_nth_order_linear_euler_eq_nonhomogeneous_undetermined_coefficients", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_Beam3D", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_deflection_Beam3D", "sympy/solvers/ode/tests/test_systems.py::test_second_order_type2_slow1", "sympy/solvers/ode/tests/test_systems.py::test_nonlinear_2eq_order1" ], "PASS_TO_PASS": null }
sympy__sympy-45
1.0
{ "code": "diff --git b/sympy/polys/matrices/dense.py a/sympy/polys/matrices/dense.py\nindex b043395374..47ab2d6897 100644\n--- b/sympy/polys/matrices/dense.py\n+++ a/sympy/polys/matrices/dense.py\n@@ -295,6 +295,133 @@ def ddm_irref_den(a, K):\n George C. Nakos , Peter R. Turner , Robert M. Williams.\n https://dl.acm.org/doi/10.1145/271130.271133\n \"\"\"\n+ #\n+ # A simpler presentation of this algorithm is given in [1]:\n+ #\n+ # Given an n x n matrix A and n x 1 matrix b:\n+ #\n+ # for i in range(n):\n+ # if i != 0:\n+ # d = a[i-1][i-1]\n+ # for j in range(n):\n+ # if j == i:\n+ # continue\n+ # b[j] = a[i][i]*b[j] - a[j][i]*b[i]\n+ # for k in range(n):\n+ # a[j][k] = a[i][i]*a[j][k] - a[j][i]*a[i][k]\n+ # if i != 0:\n+ # a[j][k] /= d\n+ #\n+ # Our version here is a bit more complicated because:\n+ #\n+ # 1. We use row-swaps to avoid zero pivots.\n+ # 2. We allow for some columns to be missing pivots.\n+ # 3. We avoid a lot of redundant arithmetic.\n+ #\n+ # TODO: Use a non-trivial pivoting strategy. Even just row swapping makes a\n+ # big difference to performance if e.g. the upper-left entry of the matrix\n+ # is a huge polynomial.\n+\n+ # a is (m x n)\n+ m = len(a)\n+ if not m:\n+ return K.one, []\n+ n = len(a[0])\n+\n+ d = None\n+ pivots = []\n+ no_pivots = []\n+\n+ # i, j will be the row and column indices of the current pivot\n+ i = 0\n+ for j in range(n):\n+ # next pivot?\n+ aij = a[i][j]\n+\n+ # swap rows if zero\n+ if not aij:\n+ for ip in range(i+1, m):\n+ aij = a[ip][j]\n+ # row-swap\n+ if aij:\n+ a[i], a[ip] = a[ip], a[i]\n+ break\n+ else:\n+ # go to next column\n+ no_pivots.append(j)\n+ continue\n+\n+ # Now aij is the pivot and i,j are the row and column. We need to clear\n+ # the column above and below but we also need to keep track of the\n+ # denominator of the RREF which means also multiplying everything above\n+ # and to the left by the current pivot aij and dividing by d (which we\n+ # multiplied everything by in the previous iteration so this is an\n+ # exact division).\n+ #\n+ # First handle the upper left corner which is usually already diagonal\n+ # with all diagonal entries equal to the current denominator but there\n+ # can be other non-zero entries in any column that has no pivot.\n+\n+ # Update previous pivots in the matrix\n+ if pivots:\n+ pivot_val = aij * a[0][pivots[0]]\n+ # Divide out the common factor\n+ if d is not None:\n+ pivot_val = K.exquo(pivot_val, d)\n+\n+ # Could defer this until the end but it is pretty cheap and\n+ # helps when debugging.\n+ for ip, jp in enumerate(pivots):\n+ a[ip][jp] = pivot_val\n+\n+ # Update columns without pivots\n+ for jnp in no_pivots:\n+ for ip in range(i):\n+ aijp = a[ip][jnp]\n+ if aijp:\n+ aijp *= aij\n+ if d is not None:\n+ aijp = K.exquo(aijp, d)\n+ a[ip][jnp] = aijp\n+\n+ # Eliminate above, below and to the right as in ordinary division free\n+ # Gauss-Jordan elmination except also dividing out d from every entry.\n+\n+ for jp, aj in enumerate(a):\n+\n+ # Skip the current row\n+ if jp == i:\n+ continue\n+\n+ # Eliminate to the right in all rows\n+ for kp in range(j+1, n):\n+ ajk = aij * aj[kp] - aj[j] * a[i][kp]\n+ if d is not None:\n+ ajk = K.exquo(ajk, d)\n+ aj[kp] = ajk\n+\n+ # Set to zero above and below the pivot\n+ aj[j] = K.zero\n+\n+ # next row\n+ pivots.append(j)\n+ i += 1\n+\n+ # no more rows left?\n+ if i >= m:\n+ break\n+\n+ if not K.is_one(aij):\n+ d = aij\n+ else:\n+ d = None\n+\n+ if not pivots:\n+ denom = K.one\n+ else:\n+ denom = a[0][pivots[0]]\n+\n+ return denom, pivots\n \n \n def ddm_idet(a, K):\n", "test": null }
null
{ "code": "diff --git a/sympy/polys/matrices/dense.py b/sympy/polys/matrices/dense.py\nindex 47ab2d6897..b043395374 100644\n--- a/sympy/polys/matrices/dense.py\n+++ b/sympy/polys/matrices/dense.py\n@@ -295,133 +295,6 @@ def ddm_irref_den(a, K):\n George C. Nakos , Peter R. Turner , Robert M. Williams.\n https://dl.acm.org/doi/10.1145/271130.271133\n \"\"\"\n- #\n- # A simpler presentation of this algorithm is given in [1]:\n- #\n- # Given an n x n matrix A and n x 1 matrix b:\n- #\n- # for i in range(n):\n- # if i != 0:\n- # d = a[i-1][i-1]\n- # for j in range(n):\n- # if j == i:\n- # continue\n- # b[j] = a[i][i]*b[j] - a[j][i]*b[i]\n- # for k in range(n):\n- # a[j][k] = a[i][i]*a[j][k] - a[j][i]*a[i][k]\n- # if i != 0:\n- # a[j][k] /= d\n- #\n- # Our version here is a bit more complicated because:\n- #\n- # 1. We use row-swaps to avoid zero pivots.\n- # 2. We allow for some columns to be missing pivots.\n- # 3. We avoid a lot of redundant arithmetic.\n- #\n- # TODO: Use a non-trivial pivoting strategy. Even just row swapping makes a\n- # big difference to performance if e.g. the upper-left entry of the matrix\n- # is a huge polynomial.\n-\n- # a is (m x n)\n- m = len(a)\n- if not m:\n- return K.one, []\n- n = len(a[0])\n-\n- d = None\n- pivots = []\n- no_pivots = []\n-\n- # i, j will be the row and column indices of the current pivot\n- i = 0\n- for j in range(n):\n- # next pivot?\n- aij = a[i][j]\n-\n- # swap rows if zero\n- if not aij:\n- for ip in range(i+1, m):\n- aij = a[ip][j]\n- # row-swap\n- if aij:\n- a[i], a[ip] = a[ip], a[i]\n- break\n- else:\n- # go to next column\n- no_pivots.append(j)\n- continue\n-\n- # Now aij is the pivot and i,j are the row and column. We need to clear\n- # the column above and below but we also need to keep track of the\n- # denominator of the RREF which means also multiplying everything above\n- # and to the left by the current pivot aij and dividing by d (which we\n- # multiplied everything by in the previous iteration so this is an\n- # exact division).\n- #\n- # First handle the upper left corner which is usually already diagonal\n- # with all diagonal entries equal to the current denominator but there\n- # can be other non-zero entries in any column that has no pivot.\n-\n- # Update previous pivots in the matrix\n- if pivots:\n- pivot_val = aij * a[0][pivots[0]]\n- # Divide out the common factor\n- if d is not None:\n- pivot_val = K.exquo(pivot_val, d)\n-\n- # Could defer this until the end but it is pretty cheap and\n- # helps when debugging.\n- for ip, jp in enumerate(pivots):\n- a[ip][jp] = pivot_val\n-\n- # Update columns without pivots\n- for jnp in no_pivots:\n- for ip in range(i):\n- aijp = a[ip][jnp]\n- if aijp:\n- aijp *= aij\n- if d is not None:\n- aijp = K.exquo(aijp, d)\n- a[ip][jnp] = aijp\n-\n- # Eliminate above, below and to the right as in ordinary division free\n- # Gauss-Jordan elmination except also dividing out d from every entry.\n-\n- for jp, aj in enumerate(a):\n-\n- # Skip the current row\n- if jp == i:\n- continue\n-\n- # Eliminate to the right in all rows\n- for kp in range(j+1, n):\n- ajk = aij * aj[kp] - aj[j] * a[i][kp]\n- if d is not None:\n- ajk = K.exquo(ajk, d)\n- aj[kp] = ajk\n-\n- # Set to zero above and below the pivot\n- aj[j] = K.zero\n-\n- # next row\n- pivots.append(j)\n- i += 1\n-\n- # no more rows left?\n- if i >= m:\n- break\n-\n- if not K.is_one(aij):\n- d = aij\n- else:\n- d = None\n-\n- if not pivots:\n- denom = K.one\n- else:\n- denom = a[0][pivots[0]]\n-\n- return denom, pivots\n \n \n def ddm_idet(a, K):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/polys/matrices/dense.py.\nHere is the description for the function:\ndef ddm_irref_den(a, K):\n \"\"\"a <-- rref(a); return (den, pivots)\n\n Compute the fraction-free reduced row echelon form (RREF) of $a$. Modifies\n $a$ in place and returns a tuple containing the denominator of the RREF and\n a list of the pivot columns.\n\n Explanation\n ===========\n\n The algorithm used is the fraction-free version of Gauss-Jordan elimination\n described as FFGJ in [1]_. Here it is modified to handle zero or missing\n pivots and to avoid redundant arithmetic.\n\n The domain $K$ must support exact division (``K.exquo``) but does not need\n to be a field. This method is suitable for most exact rings and fields like\n :ref:`ZZ`, :ref:`QQ` and :ref:`QQ(a)`. In the case of :ref:`QQ` or\n :ref:`K(x)` it might be more efficient to clear denominators and use\n :ref:`ZZ` or :ref:`K[x]` instead.\n\n For inexact domains like :ref:`RR` and :ref:`CC` use ``ddm_irref`` instead.\n\n Examples\n ========\n\n >>> from sympy.polys.matrices.dense import ddm_irref_den\n >>> from sympy import ZZ, Matrix\n >>> M = [[ZZ(1), ZZ(2), ZZ(3)], [ZZ(4), ZZ(5), ZZ(6)]]\n >>> den, pivots = ddm_irref_den(M, ZZ)\n >>> M\n [[-3, 0, 3], [0, -3, -6]]\n >>> den\n -3\n >>> pivots\n [0, 1]\n >>> Matrix(M).rref()[0]\n Matrix([\n [1, 0, -1],\n [0, 1, 2]])\n\n See Also\n ========\n\n ddm_irref\n A version of this routine that uses field division.\n sdm_irref\n A sparse version of :func:`ddm_irref`.\n sdm_rref_den\n A sparse version of :func:`ddm_irref_den`.\n sympy.polys.matrices.domainmatrix.DomainMatrix.rref_den\n Higher level interface.\n\n References\n ==========\n\n .. [1] Fraction-free algorithms for linear and polynomial equations.\n George C. Nakos , Peter R. Turner , Robert M. Williams.\n https://dl.acm.org/doi/10.1145/271130.271133\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/polys/matrices/tests/test_domainmatrix.py::test_DomainMatrix_rref", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_1-A0-A_rref0-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_2-A1-A_rref1-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_3-A2-A_rref2-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_4-A3-A_rref3-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_5-A4-A_rref4-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_6-A5-A_rref5-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_7-A6-A_rref6-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_8-A7-A_rref7-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_9-A8-A_rref8-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_10-A9-A_rref9-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_11-A10-A_rref10-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_12-A11-A_rref11-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_13-A12-A_rref12-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_14-A13-A_rref13-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_15-A14-A_rref14-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_16-A15-A_rref15-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_17-A16-A_rref16-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_18-A17-A_rref17-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_19-A18-A_rref18-3]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_20-A19-A_rref19-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_21-A20-A_rref20-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_22-A21-A_rref21-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_large_1-A22-A_rref22-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_large_2-A23-A_rref23-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_large_3-A24-A_rref24-2028539767964472550625641331179545072876560857886207583101]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[qq_1-A25-A_rref25-den25]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[qq_2-A26-A_rref26-den26]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[qq_3-A27-A_rref27-den27]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[qq_4-A28-A_rref28-den28]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[qq_5-A29-A_rref29-den29]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[qq_6-A30-A_rref30-den30]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[qq_large_1-A31-A_rref31-den31]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[qq_large_2-A32-A_rref32-den32]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[qq_7-A33-A_rref33-den33]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[zz_i_1-A34-A_rref34-den34]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_rref_den[EX_1-A35-A_rref35-den35]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_1-A0-A_rref0-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_2-A1-A_rref1-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_3-A2-A_rref2-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_4-A3-A_rref3-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_5-A4-A_rref4-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_6-A5-A_rref5-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_7-A6-A_rref6-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_8-A7-A_rref7-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_9-A8-A_rref8-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_10-A9-A_rref9-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_11-A10-A_rref10-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_12-A11-A_rref11-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_13-A12-A_rref12-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_14-A13-A_rref13-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_15-A14-A_rref14-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_16-A15-A_rref15-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_17-A16-A_rref16-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_18-A17-A_rref17-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_19-A18-A_rref18-3]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_20-A19-A_rref19-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_21-A20-A_rref20-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_22-A21-A_rref21-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_large_1-A22-A_rref22-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_large_2-A23-A_rref23-1]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_large_3-A24-A_rref24-2028539767964472550625641331179545072876560857886207583101]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[qq_1-A25-A_rref25-den25]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[qq_2-A26-A_rref26-den26]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[qq_3-A27-A_rref27-den27]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[qq_4-A28-A_rref28-den28]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[qq_5-A29-A_rref29-den29]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[qq_6-A30-A_rref30-den30]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[qq_large_1-A31-A_rref31-den31]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[qq_large_2-A32-A_rref32-den32]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[qq_7-A33-A_rref33-den33]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[zz_i_1-A34-A_rref34-den34]", "sympy/polys/matrices/tests/test_rref.py::test_ddm_irref_den[EX_1-A35-A_rref35-den35]" ], "PASS_TO_PASS": null }
sympy__sympy-46
1.0
{ "code": "diff --git b/sympy/core/sorting.py a/sympy/core/sorting.py\nindex 2faf924e54..399a7efa1f 100644\n--- b/sympy/core/sorting.py\n+++ a/sympy/core/sorting.py\n@@ -120,6 +120,49 @@ def default_sort_key(item, order=None):\n ordered, sympy.core.expr.Expr.as_ordered_factors, sympy.core.expr.Expr.as_ordered_terms\n \n \"\"\"\n+ from .basic import Basic\n+ from .singleton import S\n+\n+ if isinstance(item, Basic):\n+ return item.sort_key(order=order)\n+\n+ if iterable(item, exclude=str):\n+ if isinstance(item, dict):\n+ args = item.items()\n+ unordered = True\n+ elif isinstance(item, set):\n+ args = item\n+ unordered = True\n+ else:\n+ # e.g. tuple, list\n+ args = list(item)\n+ unordered = False\n+\n+ args = [default_sort_key(arg, order=order) for arg in args]\n+\n+ if unordered:\n+ # e.g. dict, set\n+ args = sorted(args)\n+\n+ cls_index, args = 10, (len(args), tuple(args))\n+ else:\n+ if not isinstance(item, str):\n+ try:\n+ item = sympify(item, strict=True)\n+ except SympifyError:\n+ # e.g. lambda x: x\n+ pass\n+ else:\n+ if isinstance(item, Basic):\n+ # e.g int -> Integer\n+ return default_sort_key(item)\n+ # e.g. UndefinedFunction\n+\n+ # e.g. str\n+ cls_index, args = 0, (1, (str(item),))\n+\n+ return (cls_index, 0, item.__class__.__name__\n+ ), args, S.One.sort_key(), S.One\n \n \n def _node_count(e):\n", "test": null }
null
{ "code": "diff --git a/sympy/core/sorting.py b/sympy/core/sorting.py\nindex 399a7efa1f..2faf924e54 100644\n--- a/sympy/core/sorting.py\n+++ b/sympy/core/sorting.py\n@@ -120,49 +120,6 @@ def default_sort_key(item, order=None):\n ordered, sympy.core.expr.Expr.as_ordered_factors, sympy.core.expr.Expr.as_ordered_terms\n \n \"\"\"\n- from .basic import Basic\n- from .singleton import S\n-\n- if isinstance(item, Basic):\n- return item.sort_key(order=order)\n-\n- if iterable(item, exclude=str):\n- if isinstance(item, dict):\n- args = item.items()\n- unordered = True\n- elif isinstance(item, set):\n- args = item\n- unordered = True\n- else:\n- # e.g. tuple, list\n- args = list(item)\n- unordered = False\n-\n- args = [default_sort_key(arg, order=order) for arg in args]\n-\n- if unordered:\n- # e.g. dict, set\n- args = sorted(args)\n-\n- cls_index, args = 10, (len(args), tuple(args))\n- else:\n- if not isinstance(item, str):\n- try:\n- item = sympify(item, strict=True)\n- except SympifyError:\n- # e.g. lambda x: x\n- pass\n- else:\n- if isinstance(item, Basic):\n- # e.g int -> Integer\n- return default_sort_key(item)\n- # e.g. UndefinedFunction\n-\n- # e.g. str\n- cls_index, args = 0, (1, (str(item),))\n-\n- return (cls_index, 0, item.__class__.__name__\n- ), args, S.One.sort_key(), S.One\n \n \n def _node_count(e):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/core/sorting.py.\nHere is the description for the function:\ndef default_sort_key(item, order=None):\n \"\"\"Return a key that can be used for sorting.\n\n The key has the structure:\n\n (class_key, (len(args), args), exponent.sort_key(), coefficient)\n\n This key is supplied by the sort_key routine of Basic objects when\n ``item`` is a Basic object or an object (other than a string) that\n sympifies to a Basic object. Otherwise, this function produces the\n key.\n\n The ``order`` argument is passed along to the sort_key routine and is\n used to determine how the terms *within* an expression are ordered.\n (See examples below) ``order`` options are: 'lex', 'grlex', 'grevlex',\n and reversed values of the same (e.g. 'rev-lex'). The default order\n value is None (which translates to 'lex').\n\n Examples\n ========\n\n >>> from sympy import S, I, default_sort_key, sin, cos, sqrt\n >>> from sympy.core.function import UndefinedFunction\n >>> from sympy.abc import x\n\n The following are equivalent ways of getting the key for an object:\n\n >>> x.sort_key() == default_sort_key(x)\n True\n\n Here are some examples of the key that is produced:\n\n >>> default_sort_key(UndefinedFunction('f'))\n ((0, 0, 'UndefinedFunction'), (1, ('f',)), ((1, 0, 'Number'),\n (0, ()), (), 1), 1)\n >>> default_sort_key('1')\n ((0, 0, 'str'), (1, ('1',)), ((1, 0, 'Number'), (0, ()), (), 1), 1)\n >>> default_sort_key(S.One)\n ((1, 0, 'Number'), (0, ()), (), 1)\n >>> default_sort_key(2)\n ((1, 0, 'Number'), (0, ()), (), 2)\n\n While sort_key is a method only defined for SymPy objects,\n default_sort_key will accept anything as an argument so it is\n more robust as a sorting key. For the following, using key=\n lambda i: i.sort_key() would fail because 2 does not have a sort_key\n method; that's why default_sort_key is used. Note, that it also\n handles sympification of non-string items likes ints:\n\n >>> a = [2, I, -I]\n >>> sorted(a, key=default_sort_key)\n [2, -I, I]\n\n The returned key can be used anywhere that a key can be specified for\n a function, e.g. sort, min, max, etc...:\n\n >>> a.sort(key=default_sort_key); a[0]\n 2\n >>> min(a, key=default_sort_key)\n 2\n\n Notes\n =====\n\n The key returned is useful for getting items into a canonical order\n that will be the same across platforms. It is not directly useful for\n sorting lists of expressions:\n\n >>> a, b = x, 1/x\n\n Since ``a`` has only 1 term, its value of sort_key is unaffected by\n ``order``:\n\n >>> a.sort_key() == a.sort_key('rev-lex')\n True\n\n If ``a`` and ``b`` are combined then the key will differ because there\n are terms that can be ordered:\n\n >>> eq = a + b\n >>> eq.sort_key() == eq.sort_key('rev-lex')\n False\n >>> eq.as_ordered_terms()\n [x, 1/x]\n >>> eq.as_ordered_terms('rev-lex')\n [1/x, x]\n\n But since the keys for each of these terms are independent of ``order``'s\n value, they do not sort differently when they appear separately in a list:\n\n >>> sorted(eq.args, key=default_sort_key)\n [1/x, x]\n >>> sorted(eq.args, key=lambda i: default_sort_key(i, order='rev-lex'))\n [1/x, x]\n\n The order of terms obtained when using these keys is the order that would\n be obtained if those terms were *factors* in a product.\n\n Although it is useful for quickly putting expressions in canonical order,\n it does not sort expressions based on their complexity defined by the\n number of operations, power of variables and others:\n\n >>> sorted([sin(x)*cos(x), sin(x)], key=default_sort_key)\n [sin(x)*cos(x), sin(x)]\n >>> sorted([x, x**2, sqrt(x), x**3], key=default_sort_key)\n [sqrt(x), x, x**2, x**3]\n\n See Also\n ========\n\n ordered, sympy.core.expr.Expr.as_ordered_factors, sympy.core.expr.Expr.as_ordered_terms\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "assumptions/tests/test_matrices.py::test_invertible_fullrank", "assumptions/tests/test_matrices.py::test_non_trivial_implies", "assumptions/tests/test_query.py::test_bounded_xfail", "assumptions/tests/test_query.py::test_evenness_in_ternary_integer_product_with_odd", "assumptions/tests/test_query.py::test_oddness_in_ternary_integer_product_with_odd", "assumptions/tests/test_query.py::test_issue_7246_failing", "assumptions/tests/test_rel_queries.py::test_failing_number_line_properties", "assumptions/tests/test_rel_queries.py::test_equality_failing", "assumptions/tests/test_satask.py::test_invertible", "bin/test_executable.py::test_executable", "bin/test_external_imports.py::test_external_imports", "bin/test_submodule_imports.py::test_submodule_imports", "calculus/tests/test_accumulationbounds.py::test_AccumBounds_powf", "calculus/tests/test_util.py::test_continuous_domain_acot", "calculus/tests/test_util.py::test_continuous_domain_gamma", "calculus/tests/test_util.py::test_continuous_domain_neg_power", "codegen/tests/test_algorithms.py::test_newtons_method_function__ccode", "codegen/tests/test_algorithms.py::test_newtons_method_function__fcode", "codegen/tests/test_algorithms.py::test_newtons_method_function__ccode_parameters", "codegen/tests/test_applications.py::test_copying_function", "codegen/tests/test_fnodes.py::test_size_assumed_shape", "codegen/tests/test_fnodes.py::test_ImpliedDoLoop", "codegen/tests/test_fnodes.py::test_Program", "codegen/tests/test_fnodes.py::test_Module", "codegen/tests/test_fnodes.py::test_Subroutine", "codegen/tests/test_fnodes.py::test_bind_C", "codegen/tests/test_matrix_nodes.py::test_matrix_solve_derivative_numpy", "codegen/tests/test_rewriting.py::test_optims_numpy_TODO", "codegen/tests/test_rewriting.py::test_compiled_ccode_with_rewriting", "combinatorics/tests/test_perm_groups.py::test_rubik", "combinatorics/tests/test_perm_groups.py::test_subgroup_search2", "combinatorics/tests/test_tensor_can.py::test_riemann_invariants1", "concrete/tests/test_sums_products.py::test_evalf_fast_series", "concrete/tests/test_sums_products.py::test_evalf_fast_series_issue_4021", "concrete/tests/test_sums_products.py::test_evalf_slow_series", "concrete/tests/test_sums_products.py::test_telescopic_sums", "concrete/tests/test_sums_products.py::test_convergent_failing", "concrete/tests/test_sums_products.py::test_matrixsymbol_summation_symbolic_limits", "core/tests/test_args.py::test_all_classes_are_tested", "core/tests/test_args.py::test_sympy__assumptions__assume__Predicate", "core/tests/test_args.py::test_sympy__assumptions__relation__binrel__BinaryRelation", "core/tests/test_args.py::test_sympy__codegen__ast__CodegenAST", "core/tests/test_args.py::test_sympy__codegen__ast__AssignmentBase", "core/tests/test_args.py::test_sympy__codegen__ast__AugmentedAssignment", "core/tests/test_args.py::test_sympy__concrete__expr_with_limits__ExprWithLimits", "core/tests/test_args.py::test_sympy__concrete__expr_with_limits__AddWithLimits", "core/tests/test_args.py::test_sympy__concrete__expr_with_intlimits__ExprWithIntLimits", "core/tests/test_args.py::test_sympy__core__function__Function", "core/tests/test_args.py::test_sympy__core__numbers__IntegerConstant", "core/tests/test_args.py::test_sympy__core__numbers__RationalConstant", "core/tests/test_args.py::test_sympy__core__operations__AssocOp", "core/tests/test_args.py::test_sympy__core__operations__LatticeOp", "core/tests/test_args.py::test_sympy__core__relational__Relational", "core/tests/test_args.py::test_sympy__sets__sets__Set", "core/tests/test_args.py::test_sympy__stats__rv__Distribution", "core/tests/test_args.py::test_sympy__stats__crv__SingleContinuousDistribution", "core/tests/test_args.py::test_sympy__stats__drv__SingleDiscreteDistribution", "core/tests/test_args.py::test_sympy__stats__drv__DiscreteDistribution", "core/tests/test_args.py::test_sympy__stats__drv__DiscreteDomain", "core/tests/test_args.py::test_sympy__stats__rv__SinglePSpace", "core/tests/test_args.py::test_sympy__stats__rv__ProductPSpace", "core/tests/test_args.py::test_sympy__stats__frv__SingleFiniteDistribution", "core/tests/test_args.py::test_sympy__stats__crv__ContinuousDistribution", "core/tests/test_args.py::test_sympy__functions__combinatorial__factorials__CombinatorialFunction", "core/tests/test_args.py::test_sympy__functions__elementary__exponential__ExpBase", "core/tests/test_args.py::test_sympy__functions__elementary__hyperbolic__HyperbolicFunction", "core/tests/test_args.py::test_sympy__functions__elementary__hyperbolic__ReciprocalHyperbolicFunction", "core/tests/test_args.py::test_sympy__functions__elementary__hyperbolic__InverseHyperbolicFunction", "core/tests/test_args.py::test_sympy__functions__elementary__integers__RoundFunction", "core/tests/test_args.py::test_sympy__functions__elementary__miscellaneous__MinMaxBase", "core/tests/test_args.py::test_sympy__functions__elementary__trigonometric__TrigonometricFunction", "core/tests/test_args.py::test_sympy__functions__elementary__trigonometric__ReciprocalTrigonometricFunction", "core/tests/test_args.py::test_sympy__functions__elementary__trigonometric__InverseTrigonometricFunction", "core/tests/test_args.py::test_sympy__functions__special__bessel__BesselBase", "core/tests/test_args.py::test_sympy__functions__special__bessel__SphericalBesselBase", "core/tests/test_args.py::test_sympy__functions__special__bessel__SphericalHankelBase", "core/tests/test_args.py::test_sympy__functions__special__error_functions__FresnelIntegral", "core/tests/test_args.py::test_sympy__functions__special__error_functions__TrigonometricIntegral", "core/tests/test_args.py::test_sympy__functions__special__hyper__TupleParametersBase", "core/tests/test_args.py::test_sympy__functions__special__hyper__TupleArg", "core/tests/test_args.py::test_sympy__functions__special__hyper__HyperRep", "core/tests/test_args.py::test_sympy__functions__special__polynomials__OrthogonalPolynomial", "core/tests/test_args.py::test_sympy__integrals__transforms__IntegralTransform", "core/tests/test_args.py::test_sympy__integrals__transforms__FourierTypeTransform", "core/tests/test_args.py::test_sympy__integrals__transforms__SineCosineTypeTransform", "core/tests/test_args.py::test_sympy__integrals__transforms__HankelTypeTransform", "core/tests/test_args.py::test_sympy__logic__boolalg__Boolean", "core/tests/test_args.py::test_sympy__logic__boolalg__BooleanAtom", "core/tests/test_args.py::test_sympy__matrices__expressions__matexpr__MatrixBase", "core/tests/test_args.py::test_sympy__matrices__immutable__ImmutableRepMatrix", "core/tests/test_args.py::test_sympy__matrices__expressions__matexpr__MatrixExpr", "core/tests/test_args.py::test_sympy__matrices__expressions__factorizations__Factorization", "core/tests/test_args.py::test_sympy__physics__biomechanics__curve__CharacteristicCurveFunction", "core/tests/test_args.py::test_sympy__physics__quantum__shor__CMod", "core/tests/test_args.py::test_sympy__physics__secondquant__Annihilator", "core/tests/test_args.py::test_sympy__physics__secondquant__BosonicOperator", "core/tests/test_args.py::test_sympy__physics__secondquant__Creator", "core/tests/test_args.py::test_sympy__polys__rootoftools__RootOf", "core/tests/test_args.py::test_sympy__series__sequences__SeqBase", "core/tests/test_args.py::test_sympy__series__sequences__SeqExpr", "core/tests/test_args.py::test_sympy__series__series_class__SeriesBase", "core/tests/test_args.py::test_sympy__series__formal__FiniteFormalPowerSeries", "core/tests/test_args.py::test_sympy__tensor__array__ndim_array__ImmutableNDimArray", "core/tests/test_args.py::test_sympy__tensor__tensor__TensorType", "core/tests/test_args.py::test_sympy__tensor__tensor__TensExpr", "core/tests/test_args.py::test_sympy__geometry__line__LinearEntity", "core/tests/test_args.py::test_sympy__geometry__line__LinearEntity2D", "core/tests/test_args.py::test_sympy__geometry__line__LinearEntity3D", "core/tests/test_args.py::test_sympy__geometry__entity__GeometrySet", "core/tests/test_args.py::test_sympy__categories__baseclasses__Morphism", "core/tests/test_arit.py::test_evenness_in_ternary_integer_product_with_odd", "core/tests/test_arit.py::test_oddness_in_ternary_integer_product_with_odd", "core/tests/test_assumptions.py::test_symbol_infinitereal_mul", "core/tests/test_assumptions.py::test_neg_symbol_falsenonnegative", "core/tests/test_assumptions.py::test_issue_6275", "core/tests/test_assumptions.py::test_issue_7993", "core/tests/test_constructor_postprocessor.py::test_subexpression_postprocessors", "core/tests/test_eval.py::test_pow_eval_X1", "core/tests/test_evalf.py::test_evalf_complex_bug", "core/tests/test_evalf.py::test_evalf_complex_powers_bug", "core/tests/test_evalf.py::test_evalf_sum", "core/tests/test_evalf.py::test_evalf_divergent_series", "core/tests/test_expr.py::test_call_2", "core/tests/test_expr.py::test_float_0_fail", "core/tests/test_function.py::test_Subs2", "core/tests/test_match.py::test_functions_X1", "core/tests/test_match.py::test_issue_4883", "core/tests/test_noncommutative.py::test_collect", "core/tests/test_noncommutative.py::test_ratsimp", "core/tests/test_noncommutative.py::test_rcollect", "core/tests/test_numbers.py::test_mpmath_issues", "core/tests/test_numbers.py::test_numpy_to_float", "core/tests/test_relational.py::test_multivariate_relational_as_set", "core/tests/test_relational.py::test_issue_8444_nonworkingtests", "core/tests/test_subs.py::test_mul2", "core/tests/test_sympify.py::test_issue_16772", "core/tests/test_sympify.py::test_issue_19399", "core/tests/test_sympify.py::test_issue_10295", "core/tests/test_sympify.py::test_sympify_numpy", "core/tests/test_sympify.py::test_sympify_rational_numbers_set", "core/tests/test_sympify.py::test_issue_13924", "core/tests/test_sympify.py::test_numpy_sympify_args", "core/tests/test_sympify.py::test_issue_14706", "external/tests/test_autowrap.py::test_issue_15230", "external/tests/test_autowrap.py::test_wrap_twice_f95_f2py", "external/tests/test_autowrap.py::test_autowrap_trace_f95_f2py", "external/tests/test_autowrap.py::test_autowrap_matrix_vector_f95_f2py", "external/tests/test_autowrap.py::test_autowrap_matrix_matrix_f95_f2py", "external/tests/test_autowrap.py::test_ufuncify_f95_f2py", "external/tests/test_autowrap.py::test_issue_15337_f95_f2py", "external/tests/test_autowrap.py::test_wrap_twice_c_cython", "external/tests/test_autowrap.py::test_autowrap_trace_C_Cython", "external/tests/test_autowrap.py::test_autowrap_matrix_vector_C_cython", "external/tests/test_autowrap.py::test_autowrap_matrix_matrix_C_cython", "external/tests/test_autowrap.py::test_ufuncify_C_Cython", "external/tests/test_autowrap.py::test_issue_10274_C_cython", "external/tests/test_autowrap.py::test_issue_15337_C_cython", "external/tests/test_autowrap.py::test_autowrap_custom_printer", "external/tests/test_autowrap.py::test_ufuncify_numpy", "external/tests/test_codegen.py::test_C89_cc", "external/tests/test_codegen.py::test_C99_cc", "external/tests/test_codegen.py::test_F95_ifort", "external/tests/test_codegen.py::test_F95_gfortran", "external/tests/test_codegen.py::test_F95_g95", "external/tests/test_numpy.py::test_systematic_basic", "external/tests/test_numpy.py::test_basics", "external/tests/test_numpy.py::test_arrays", "external/tests/test_numpy.py::test_conversion1", "external/tests/test_numpy.py::test_conversion2", "external/tests/test_numpy.py::test_list2numpy", "external/tests/test_numpy.py::test_Matrix1", "external/tests/test_numpy.py::test_Matrix2", "external/tests/test_numpy.py::test_Matrix3", "external/tests/test_numpy.py::test_Matrix4", "external/tests/test_numpy.py::test_Matrix_sum", "external/tests/test_numpy.py::test_Matrix_mul", "external/tests/test_numpy.py::test_Matrix_array", "external/tests/test_numpy.py::test_matrix2numpy", "external/tests/test_numpy.py::test_matrix2numpy_conversion", "external/tests/test_numpy.py::test_issue_3728", "external/tests/test_numpy.py::test_lambdify", "external/tests/test_numpy.py::test_lambdify_matrix", "external/tests/test_numpy.py::test_lambdify_matrix_multi_input", "external/tests/test_numpy.py::test_lambdify_matrix_vec_input", "external/tests/test_numpy.py::test_lambdify_transl", "external/tests/test_numpy.py::test_symarray", "external/tests/test_numpy.py::test_vectorize", "external/tests/test_scipy.py::test_jn_zeros", "functions/combinatorial/tests/test_comb_factorials.py::test_rf_lambdify_mpmath", "functions/combinatorial/tests/test_comb_factorials.py::test_factorial_simplify_fail", "functions/combinatorial/tests/test_comb_numbers.py::test_bell", "functions/elementary/tests/test_complexes.py::test_sign_issue_3068", "functions/elementary/tests/test_complexes.py::test_principal_branch_fail", "functions/elementary/tests/test_complexes.py::test_issue_6167_6151", "functions/elementary/tests/test_exponential.py::test_log_expand_fail", "functions/elementary/tests/test_exponential.py::test_log_product_simplify_to_sum", "functions/elementary/tests/test_integers.py::test_issue_4149", "functions/elementary/tests/test_miscellaneous.py::test_issue_11463", "functions/elementary/tests/test_piecewise.py::test_piecewise_lambdify", "functions/elementary/tests/test_trigonometric.py::test_tan_cot_sin_cos_ratsimp", "functions/elementary/tests/test_trigonometric.py::test_sin_cos_with_infinity", "integrals/tests/test_failing_integrals.py::test_issue_3880", "integrals/tests/test_failing_integrals.py::test_issue_4212", "integrals/tests/test_failing_integrals.py::test_integrate_DiracDelta_fails", "integrals/tests/test_failing_integrals.py::test_issue_4525", "integrals/tests/test_failing_integrals.py::test_issue_4540", "integrals/tests/test_failing_integrals.py::test_issue_4891", "integrals/tests/test_failing_integrals.py::test_issue_1796a", "integrals/tests/test_failing_integrals.py::test_issue_4895b", "integrals/tests/test_failing_integrals.py::test_issue_4895c", "integrals/tests/test_failing_integrals.py::test_issue_4895d", "integrals/tests/test_failing_integrals.py::test_issue_4941", "integrals/tests/test_failing_integrals.py::test_issue_4992", "integrals/tests/test_failing_integrals.py::test_issue_16396a", "integrals/tests/test_failing_integrals.py::test_issue_16396b", "integrals/tests/test_failing_integrals.py::test_issue_16046", "integrals/tests/test_failing_integrals.py::test_issue_15925a", "integrals/tests/test_failing_integrals.py::test_issue_15925b_manual", "integrals/tests/test_failing_integrals.py::test_issue_15227", "integrals/tests/test_failing_integrals.py::test_issue_14716", "integrals/tests/test_failing_integrals.py::test_issue_14709a", "integrals/tests/test_failing_integrals.py::test_issue_14398", "integrals/tests/test_failing_integrals.py::test_issue_14074", "integrals/tests/test_failing_integrals.py::test_issue_14078b", "integrals/tests/test_failing_integrals.py::test_issue_13792", "integrals/tests/test_failing_integrals.py::test_issue_11845a", "integrals/tests/test_failing_integrals.py::test_issue_11845b", "integrals/tests/test_failing_integrals.py::test_issue_11813", "integrals/tests/test_failing_integrals.py::test_issue_11254c", "integrals/tests/test_failing_integrals.py::test_issue_10584", "integrals/tests/test_failing_integrals.py::test_issue_9101", "integrals/tests/test_failing_integrals.py::test_issue_7147", "integrals/tests/test_failing_integrals.py::test_issue_7109", "integrals/tests/test_failing_integrals.py::test_integrate_Piecewise_rational_over_reals", "integrals/tests/test_failing_integrals.py::test_issue_4311_slow", "integrals/tests/test_failing_integrals.py::test_issue_20370", "integrals/tests/test_failing_integrals.py::test_polylog", "integrals/tests/test_failing_integrals.py::test_polylog_manual", "integrals/tests/test_heurisch.py::test_heurisch_function_derivative", "integrals/tests/test_transforms.py::test_mellin_transform_fail", "interactive/tests/test_ipython.py::test_automatic_symbols", "interactive/tests/test_ipython.py::test_int_to_Integer", "interactive/tests/test_ipython.py::test_ipythonprinting", "interactive/tests/test_ipython.py::test_print_builtin_option", "interactive/tests/test_ipython.py::test_builtin_containers", "interactive/tests/test_ipython.py::test_matplotlib_bad_latex", "interactive/tests/test_ipython.py::test_override_repr_latex", "logic/tests/test_boolalg.py::test_multivariate_bool_as_set", "logic/tests/test_inference.py::test_literal", "logic/tests/test_inference.py::test_z3", "logic/tests/test_inference.py::test_z3_vs_lra_dpll2", "logic/tests/test_lra_theory.py::test_random_problems", "logic/tests/test_lra_theory.py::test_pos_neg_zero", "logic/tests/test_lra_theory.py::test_pos_neg_infinite", "logic/tests/test_lra_theory.py::test_infinite_strict_inequalities", "matrices/expressions/tests/test_indexing.py::test_block_index_symbolic_fail", "matrices/expressions/tests/test_matadd.py::test_matrix_Add_with_scalar", "matrices/expressions/tests/test_matexpr.py::test_factor_expand", "matrices/expressions/tests/test_matexpr.py::test_numpy_conversion", "matrices/expressions/tests/test_matexpr.py::test_MatAdd_postprocessor_xfail", "matrices/expressions/tests/test_matmul.py::test_matmul_args_cnc_symbols", "matrices/expressions/tests/test_slice.py::test_symmetry", "matrices/tests/test_commonmatrix.py::test_diff", "matrices/tests/test_eigen.py::test_eigen_vects", "matrices/tests/test_matrices.py::test_issue_3979", "matrices/tests/test_matrices.py::test_from_ndarray", "matrices/tests/test_matrices.py::test_17522_numpy", "matrices/tests/test_matrices.py::test_17522_scipy", "matrices/tests/test_matrices.py::test_issue_14943", "matrices/tests/test_matrixbase.py::test_numpy_conversion", "matrices/tests/test_matrixbase.py::test_from_ndarray", "matrices/tests/test_matrixbase.py::test_17522_numpy", "matrices/tests/test_matrixbase.py::test_17522_scipy", "matrices/tests/test_matrixbase.py::test_issue_14943", "parsing/tests/test_autolev.py::test_rule_tests", "parsing/tests/test_autolev.py::test_pydy_examples", "parsing/tests/test_autolev.py::test_output_01", "parsing/tests/test_custom_latex.py::test_custom1", "parsing/tests/test_custom_latex.py::test_custom2", "parsing/tests/test_latex.py::test_parseable", "parsing/tests/test_latex.py::test_not_parseable", "parsing/tests/test_latex.py::test_failing_not_parseable", "parsing/tests/test_latex.py::test_strict_mode", "parsing/tests/test_latex_lark.py::test_symbol_expressions", "parsing/tests/test_latex_lark.py::test_simple_expressions", "parsing/tests/test_latex_lark.py::test_fraction_expressions", "parsing/tests/test_latex_lark.py::test_relation_expressions", "parsing/tests/test_latex_lark.py::test_power_expressions", "parsing/tests/test_latex_lark.py::test_integral_expressions", "parsing/tests/test_latex_lark.py::test_derivative_expressions", "parsing/tests/test_latex_lark.py::test_trigonometric_expressions", "parsing/tests/test_latex_lark.py::test_limit_expressions", "parsing/tests/test_latex_lark.py::test_square_root_expressions", "parsing/tests/test_latex_lark.py::test_factorial_expressions", "parsing/tests/test_latex_lark.py::test_sum_expressions", "parsing/tests/test_latex_lark.py::test_product_expressions", "parsing/tests/test_latex_lark.py::test_applied_function_expressions", "parsing/tests/test_latex_lark.py::test_common_function_expressions", "parsing/tests/test_latex_lark.py::test_spacing", "parsing/tests/test_latex_lark.py::test_binomial_expressions", "parsing/tests/test_latex_lark.py::test_miscellaneous_expressions", "parsing/tests/test_latex_lark.py::test_literal_complex_number_expressions", "parsing/tests/test_latex_lark.py::test_matrix_expressions", "physics/biomechanics/tests/test_curve.py::TestTendonForceLengthDeGroote2016::test_lambdify", "physics/biomechanics/tests/test_curve.py::TestTendonForceLengthDeGroote2016::test_lambdify_numpy", "physics/biomechanics/tests/test_curve.py::TestTendonForceLengthDeGroote2016::test_lambdify_jax", "physics/biomechanics/tests/test_curve.py::TestTendonForceLengthInverseDeGroote2016::test_lambdify", "physics/biomechanics/tests/test_curve.py::TestTendonForceLengthInverseDeGroote2016::test_lambdify_numpy", "physics/biomechanics/tests/test_curve.py::TestTendonForceLengthInverseDeGroote2016::test_lambdify_jax", "physics/biomechanics/tests/test_curve.py::TestFiberForceLengthPassiveDeGroote2016::test_lambdify", "physics/biomechanics/tests/test_curve.py::TestFiberForceLengthPassiveDeGroote2016::test_lambdify_numpy", "physics/biomechanics/tests/test_curve.py::TestFiberForceLengthPassiveDeGroote2016::test_lambdify_jax", "physics/biomechanics/tests/test_curve.py::TestFiberForceLengthPassiveInverseDeGroote2016::test_lambdify", "physics/biomechanics/tests/test_curve.py::TestFiberForceLengthPassiveInverseDeGroote2016::test_lambdify_numpy", "physics/biomechanics/tests/test_curve.py::TestFiberForceLengthPassiveInverseDeGroote2016::test_lambdify_jax", "physics/biomechanics/tests/test_curve.py::TestFiberForceLengthActiveDeGroote2016::test_lambdify", "physics/biomechanics/tests/test_curve.py::TestFiberForceLengthActiveDeGroote2016::test_lambdify_numpy", "physics/biomechanics/tests/test_curve.py::TestFiberForceLengthActiveDeGroote2016::test_lambdify_jax", "physics/biomechanics/tests/test_curve.py::TestFiberForceVelocityDeGroote2016::test_lambdify", "physics/biomechanics/tests/test_curve.py::TestFiberForceVelocityDeGroote2016::test_lambdify_numpy", "physics/biomechanics/tests/test_curve.py::TestFiberForceVelocityDeGroote2016::test_lambdify_jax", "physics/biomechanics/tests/test_curve.py::TestFiberForceVelocityInverseDeGroote2016::test_lambdify", "physics/biomechanics/tests/test_curve.py::TestFiberForceVelocityInverseDeGroote2016::test_lambdify_numpy", "physics/biomechanics/tests/test_curve.py::TestFiberForceVelocityInverseDeGroote2016::test_lambdify_jax", "physics/biomechanics/tests/test_curve.py::TestCharacteristicCurveCollection::test_invalid_constructor_keyword_only", "physics/control/tests/test_control_plots.py::test_errors", "physics/control/tests/test_control_plots.py::test_bode", "physics/control/tests/test_control_plots.py::test_impulse_response", "physics/control/tests/test_control_plots.py::test_step_response", "physics/control/tests/test_control_plots.py::test_ramp_response", "physics/mechanics/tests/test_jointsmethod.py::test_four_bar_linkage_with_manual_constraints", "physics/mechanics/tests/test_kane5.py::test_kane_rolling_disc_lu", "physics/mechanics/tests/test_kane5.py::test_kane_rolling_disc_kdes_callable", "physics/quantum/tests/test_circuitplot.py::test_cnot", "physics/quantum/tests/test_circuitplot.py::test_ex1", "physics/quantum/tests/test_circuitplot.py::test_ex4", "physics/quantum/tests/test_dagger.py::test_numpy_dagger", "physics/quantum/tests/test_dagger.py::test_scipy_sparse_dagger", "physics/quantum/tests/test_identitysearch.py::test_is_scalar_sparse_matrix", "physics/quantum/tests/test_matrixutils.py::test_to_numpy", "physics/quantum/tests/test_matrixutils.py::test_matrix_tensor_product", "physics/quantum/tests/test_matrixutils.py::test_to_scipy_sparse", "physics/quantum/tests/test_matrixutils.py::test_matrix_zeros_numpy", "physics/quantum/tests/test_matrixutils.py::test_matrix_zeros_scipy", "physics/quantum/tests/test_printing.py::test_gate_failing", "physics/quantum/tests/test_represent.py::test_format_numpy", "physics/quantum/tests/test_represent.py::test_scalar_numpy", "physics/quantum/tests/test_represent.py::test_format_scipy_sparse", "physics/quantum/tests/test_represent.py::test_scalar_scipy_sparse", "physics/quantum/tests/test_sho1d.py::test_RaisingOp", "physics/quantum/tests/test_shor.py::test_CMod", "physics/tests/test_clebsch_gordan.py::test_clebsch_gordan_numpy", "physics/tests/test_paulialgebra.py::test_Pauli_should_work", "plotting/intervalmath/tests/test_interval_functions.py::test_interval_pow", "plotting/intervalmath/tests/test_interval_functions.py::test_exp", "plotting/intervalmath/tests/test_interval_functions.py::test_log", "plotting/intervalmath/tests/test_interval_functions.py::test_log10", "plotting/intervalmath/tests/test_interval_functions.py::test_atan", "plotting/intervalmath/tests/test_interval_functions.py::test_sin", "plotting/intervalmath/tests/test_interval_functions.py::test_cos", "plotting/intervalmath/tests/test_interval_functions.py::test_tan", "plotting/intervalmath/tests/test_interval_functions.py::test_sqrt", "plotting/intervalmath/tests/test_interval_functions.py::test_sinh", "plotting/intervalmath/tests/test_interval_functions.py::test_cosh", "plotting/intervalmath/tests/test_interval_functions.py::test_tanh", "plotting/intervalmath/tests/test_interval_functions.py::test_asin", "plotting/intervalmath/tests/test_interval_functions.py::test_acos", "plotting/intervalmath/tests/test_interval_functions.py::test_ceil", "plotting/intervalmath/tests/test_interval_functions.py::test_floor", "plotting/intervalmath/tests/test_interval_functions.py::test_asinh", "plotting/intervalmath/tests/test_interval_functions.py::test_acosh", "plotting/intervalmath/tests/test_interval_functions.py::test_atanh", "plotting/pygletplot/tests/test_plotting.py::test_plot_2d", "plotting/pygletplot/tests/test_plotting.py::test_plot_2d_discontinuous", "plotting/pygletplot/tests/test_plotting.py::test_plot_3d", "plotting/pygletplot/tests/test_plotting.py::test_plot_3d_discontinuous", "plotting/pygletplot/tests/test_plotting.py::test_plot_2d_polar", "plotting/pygletplot/tests/test_plotting.py::test_plot_3d_cylinder", "plotting/pygletplot/tests/test_plotting.py::test_plot_3d_spherical", "plotting/pygletplot/tests/test_plotting.py::test_plot_2d_parametric", "plotting/pygletplot/tests/test_plotting.py::test_plot_3d_parametric", "plotting/pygletplot/tests/test_plotting.py::test_plot_integral", "plotting/tests/test_plot.py::test_plot_and_save_1[True]", "plotting/tests/test_plot.py::test_plot_and_save_1[False]", "plotting/tests/test_plot.py::test_plot_and_save_2[True]", "plotting/tests/test_plot.py::test_plot_and_save_2[False]", "plotting/tests/test_plot.py::test_plot_and_save_3[True]", "plotting/tests/test_plot.py::test_plot_and_save_3[False]", "plotting/tests/test_plot.py::test_plot_and_save_4[True]", "plotting/tests/test_plot.py::test_plot_and_save_5[True]", "plotting/tests/test_plot.py::test_plot_and_save_5[False]", "plotting/tests/test_plot.py::test_plot_and_save_6[True]", "plotting/tests/test_plot.py::test_plot_and_save_6[False]", "plotting/tests/test_plot.py::test_plotgrid_and_save[True]", "plotting/tests/test_plot.py::test_plotgrid_and_save[False]", "plotting/tests/test_plot.py::test_append_issue_7140[True]", "plotting/tests/test_plot.py::test_append_issue_7140[False]", "plotting/tests/test_plot.py::test_issue_15265[True]", "plotting/tests/test_plot.py::test_issue_15265[False]", "plotting/tests/test_plot.py::test_empty_Plot", "plotting/tests/test_plot.py::test_issue_17405[True]", "plotting/tests/test_plot.py::test_issue_17405[False]", "plotting/tests/test_plot.py::test_logplot_PR_16796[True]", "plotting/tests/test_plot.py::test_logplot_PR_16796[False]", "plotting/tests/test_plot.py::test_issue_16572[True]", "plotting/tests/test_plot.py::test_issue_16572[False]", "plotting/tests/test_plot.py::test_issue_11865[True]", "plotting/tests/test_plot.py::test_issue_11865[False]", "plotting/tests/test_plot.py::test_issue_11461", "plotting/tests/test_plot.py::test_issue_11764[True]", "plotting/tests/test_plot.py::test_issue_11764[False]", "plotting/tests/test_plot.py::test_issue_13516[True]", "plotting/tests/test_plot.py::test_issue_13516[False]", "plotting/tests/test_plot.py::test_plot_limits[True]", "plotting/tests/test_plot.py::test_plot_limits[False]", "plotting/tests/test_plot.py::test_plot3d_parametric_line_limits[True]", "plotting/tests/test_plot.py::test_plot3d_parametric_line_limits[False]", "plotting/tests/test_plot.py::test_plot_size[True]", "plotting/tests/test_plot.py::test_plot_size[False]", "plotting/tests/test_plot.py::test_issue_20113", "plotting/tests/test_plot.py::test_deprecated_get_segments[True]", "plotting/tests/test_plot.py::test_deprecated_get_segments[False]", "plotting/tests/test_plot.py::test_generic_data_series[True]", "plotting/tests/test_plot.py::test_generic_data_series[False]", "plotting/tests/test_plot.py::test_deprecated_markers_annotations_rectangles_fill", "plotting/tests/test_plot.py::test_back_compatibility", "plotting/tests/test_plot.py::test_plot_arguments", "plotting/tests/test_plot.py::test_plot_parametric_arguments", "plotting/tests/test_plot.py::test_plot3d_parametric_line_arguments", "plotting/tests/test_plot.py::test_plot3d_plot_contour_arguments", "plotting/tests/test_plot.py::test_plot3d_parametric_surface_arguments", "plotting/tests/test_plot_implicit.py::test_no_adaptive_meshing", "plotting/tests/test_plot_implicit.py::test_matplotlib", "plotting/tests/test_plot_implicit.py::test_region_and", "plotting/tests/test_series.py::test_adaptive", "plotting/tests/test_series.py::test_detect_poles", "plotting/tests/test_series.py::test_number_discretization_points", "plotting/tests/test_series.py::test_list2dseries", "plotting/tests/test_series.py::test_lin_log_scale", "plotting/tests/test_series.py::test_rendering_kw", "plotting/tests/test_series.py::test_data_shape", "plotting/tests/test_series.py::test_only_integers", "plotting/tests/test_series.py::test_is_point_is_filled", "plotting/tests/test_series.py::test_steps", "plotting/tests/test_series.py::test_interactive_data", "plotting/tests/test_series.py::test_list2dseries_interactive", "plotting/tests/test_series.py::test_mpmath", "plotting/tests/test_series.py::test_use_cm", "plotting/tests/test_series.py::test_sums", "plotting/tests/test_series.py::test_apply_transforms", "plotting/tests/test_series.py::test_series_labels", "plotting/tests/test_series.py::test_is_polar_2d_parametric", "plotting/tests/test_series.py::test_is_polar_3d", "plotting/tests/test_series.py::test_color_func", "plotting/tests/test_series.py::test_color_func_scalar_val", "plotting/tests/test_series.py::test_color_func_expression", "plotting/tests/test_series.py::test_complex_adaptive_false", "plotting/tests/test_series.py::test_expr_is_lambda_function", "plotting/tests/test_series.py::test_particular_case_1_with_adaptive_true", "plotting/tests/test_series.py::test_particular_case_1_with_adaptive_false", "plotting/tests/test_series.py::test_complex_params_number_eval", "plotting/tests/test_series.py::test_complex_range_line_plot_1", "plotting/tests/test_series.py::test_complex_range_line_plot_2", "plotting/tests/test_series.py::test_force_real_eval", "plotting/tests/test_series.py::test_symbolic_plotting_ranges", "plotting/tests/test_series.py::test_exclude_points", "plotting/tests/test_series.py::test_unwrap", "plotting/tests/test_textplot.py::test_axes_alignment", "plotting/tests/test_textplot.py::test_singularity", "plotting/tests/test_textplot.py::test_sinc", "plotting/tests/test_textplot.py::test_imaginary", "polys/matrices/tests/test_domainmatrix.py::test_DomainMatrix_from_list_flat", "polys/matrices/tests/test_xxm.py::test_XDM_getitem[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XDM_setitem[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_extract_slice[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_extract[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_from_list[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_to_list[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_to_list_flat[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_from_list_flat[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_to_flat_nz[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_from_flat_nz[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_to_dod[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_from_dod[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_to_dok[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_from_dok[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_iter_values[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_iter_items[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_from_ddm[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_zeros[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_ones[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_eye[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_diag[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_transpose[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_add[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_sub[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_mul[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_matmul[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_mul_elementwise[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_neg[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_convert_to[DM_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_scc[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_hstack[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_vstack[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_applyfunc[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_is_upper[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_is_lower[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_is_diagonal[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_diagonal[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_is_zero_matrix[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_det_ZZ[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_det_QQ[DMQ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_inv_QQ[DMQ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_inv_ZZ[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_charpoly_ZZ[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_charpoly_QQ[DMQ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_lu_solve_ZZ[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_lu_solve_QQ[DMQ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_nullspace_QQ[DMQ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_lll[DMZ_dfm]", "polys/numberfields/tests/test_galoisgroups.py::test__galois_group_degree_4_root_approx", "polys/numberfields/tests/test_galoisgroups.py::test__galois_group_degree_5_hybrid", "polys/numberfields/tests/test_utilities.py::test_isolate", "polys/tests/test_constructor.py::test_rootof_primitive_element", "polys/tests/test_factortools.py::test_dmp_zz_wang_fail", "polys/tests/test_fields.py::test_FracElement___call__", "polys/tests/test_partfrac.py::test_noncommutative_pseudomultivariate", "polys/tests/test_polytools.py::test_Poly_rootof_extension_primitive_element", "polys/tests/test_polytools.py::test_Poly_rootof_same_symbol_issue_26808", "polys/tests/test_rootoftools.py::test_eval_approx_relative", "printing/tests/test_aesaracode.py::test_example_symbols", "printing/tests/test_aesaracode.py::test_Symbol", "printing/tests/test_aesaracode.py::test_MatrixSymbol", "printing/tests/test_aesaracode.py::test_MatrixSymbol_wrong_dims", "printing/tests/test_aesaracode.py::test_AppliedUndef", "printing/tests/test_aesaracode.py::test_add", "printing/tests/test_aesaracode.py::test_trig", "printing/tests/test_aesaracode.py::test_many", "printing/tests/test_aesaracode.py::test_dtype", "printing/tests/test_aesaracode.py::test_broadcastables", "printing/tests/test_aesaracode.py::test_broadcasting", "printing/tests/test_aesaracode.py::test_MatMul", "printing/tests/test_aesaracode.py::test_Transpose", "printing/tests/test_aesaracode.py::test_MatAdd", "printing/tests/test_aesaracode.py::test_Rationals", "printing/tests/test_aesaracode.py::test_Integers", "printing/tests/test_aesaracode.py::test_factorial", "printing/tests/test_aesaracode.py::test_Derivative", "printing/tests/test_aesaracode.py::test_aesara_function_simple", "printing/tests/test_aesaracode.py::test_aesara_function_multi", "printing/tests/test_aesaracode.py::test_aesara_function_numpy", "printing/tests/test_aesaracode.py::test_aesara_function_matrix", "printing/tests/test_aesaracode.py::test_aesara_function_kwargs", "printing/tests/test_aesaracode.py::test_aesara_function_scalar", "printing/tests/test_aesaracode.py::test_slice", "printing/tests/test_aesaracode.py::test_MatrixSlice", "printing/tests/test_aesaracode.py::test_BlockMatrix", "printing/tests/test_aesaracode.py::test_BlockMatrix_Inverse_execution", "printing/tests/test_aesaracode.py::test_DenseMatrix", "printing/tests/test_aesaracode.py::test_cache_basic", "printing/tests/test_aesaracode.py::test_global_cache", "printing/tests/test_aesaracode.py::test_cache_types_distinct", "printing/tests/test_aesaracode.py::test_symbols_are_created_once", "printing/tests/test_aesaracode.py::test_cache_complex", "printing/tests/test_aesaracode.py::test_Piecewise", "printing/tests/test_aesaracode.py::test_Relationals", "printing/tests/test_aesaracode.py::test_complexfunctions", "printing/tests/test_aesaracode.py::test_constantfunctions", "printing/tests/test_c.py::test_C99CodePrinter__precision_f80", "printing/tests/test_conventions.py::test_requires_partial_unspecified_variables", "printing/tests/test_cupy.py::test_cupy_sum", "printing/tests/test_gtk.py::test_1", "printing/tests/test_jax.py::test_jax_sum", "printing/tests/test_jax.py::test_jax_multiple_sums", "printing/tests/test_jax.py::test_jax_codegen_einsum", "printing/tests/test_jax.py::test_jax_codegen_extra", "printing/tests/test_jax.py::test_jax_relational", "printing/tests/test_jax.py::test_jax_mod", "printing/tests/test_jax.py::test_jax_pow", "printing/tests/test_jax.py::test_jax_expm1", "printing/tests/test_jax.py::test_jax_log1p", "printing/tests/test_jax.py::test_jax_hypot", "printing/tests/test_jax.py::test_jax_log10", "printing/tests/test_jax.py::test_jax_exp2", "printing/tests/test_jax.py::test_jax_log2", "printing/tests/test_jax.py::test_jax_Sqrt", "printing/tests/test_jax.py::test_jax_sqrt", "printing/tests/test_jax.py::test_jax_matsolve", "printing/tests/test_jax.py::test_16857", "printing/tests/test_jax.py::test_issue_17006", "printing/tests/test_julia.py::test_Matrices_entries_not_hadamard", "printing/tests/test_lambdarepr.py::test_sum__1", "printing/tests/test_lambdarepr.py::test_sum__2", "printing/tests/test_lambdarepr.py::test_multiple_sums", "printing/tests/test_latex.py::test_latex_symbols_failing", "printing/tests/test_latex.py::test_builtin_without_args_mismatched_names", "printing/tests/test_llvmjit.py::test_simple_expr", "printing/tests/test_llvmjit.py::test_two_arg", "printing/tests/test_llvmjit.py::test_func", "printing/tests/test_llvmjit.py::test_two_func", "printing/tests/test_llvmjit.py::test_two_sqrt", "printing/tests/test_llvmjit.py::test_two_pow", "printing/tests/test_llvmjit.py::test_callback", "printing/tests/test_llvmjit.py::test_callback_cubature", "printing/tests/test_llvmjit.py::test_callback_two", "printing/tests/test_llvmjit.py::test_callback_alt_two", "printing/tests/test_llvmjit.py::test_multiple_statements", "printing/tests/test_llvmjit.py::test_cse", "printing/tests/test_llvmjit.py::test_cse_multiple", "printing/tests/test_llvmjit.py::test_callback_cubature_multiple", "printing/tests/test_llvmjit.py::test_symbol_not_found", "printing/tests/test_llvmjit.py::test_bad_callback", "printing/tests/test_numpy.py::test_sum", "printing/tests/test_numpy.py::test_multiple_sums", "printing/tests/test_numpy.py::test_codegen_einsum", "printing/tests/test_numpy.py::test_codegen_extra", "printing/tests/test_numpy.py::test_relational", "printing/tests/test_numpy.py::test_mod", "printing/tests/test_numpy.py::test_pow", "printing/tests/test_numpy.py::test_expm1", "printing/tests/test_numpy.py::test_log1p", "printing/tests/test_numpy.py::test_hypot", "printing/tests/test_numpy.py::test_log10", "printing/tests/test_numpy.py::test_exp2", "printing/tests/test_numpy.py::test_log2", "printing/tests/test_numpy.py::test_Sqrt", "printing/tests/test_numpy.py::test_sqrt", "printing/tests/test_numpy.py::test_matsolve", "printing/tests/test_numpy.py::test_16857", "printing/tests/test_numpy.py::test_issue_17006", "printing/tests/test_numpy.py::test_jax_tuple_compatibility", "printing/tests/test_octave.py::test_Matrices_entries_not_hadamard", "printing/tests/test_pycode.py::test_issue_18770", "printing/tests/test_python.py::test_python_functions_conjugates", "printing/tests/test_tensorflow.py::test_tensorflow_math", "printing/tests/test_tensorflow.py::test_tensorflow_relational", "printing/tests/test_tensorflow.py::test_tensorflow_matrices", "printing/tests/test_tensorflow.py::test_codegen_einsum", "printing/tests/test_tensorflow.py::test_codegen_extra", "printing/tests/test_tensorflow.py::test_tensorflow_isnan_isinf", "printing/tests/test_theanocode.py::test_example_symbols", "printing/tests/test_theanocode.py::test_Symbol", "printing/tests/test_theanocode.py::test_MatrixSymbol", "printing/tests/test_theanocode.py::test_MatrixSymbol_wrong_dims", "printing/tests/test_theanocode.py::test_AppliedUndef", "printing/tests/test_theanocode.py::test_add", "printing/tests/test_theanocode.py::test_trig", "printing/tests/test_theanocode.py::test_many", "printing/tests/test_theanocode.py::test_dtype", "printing/tests/test_theanocode.py::test_broadcastables", "printing/tests/test_theanocode.py::test_broadcasting", "printing/tests/test_theanocode.py::test_MatMul", "printing/tests/test_theanocode.py::test_Transpose", "printing/tests/test_theanocode.py::test_MatAdd", "printing/tests/test_theanocode.py::test_Rationals", "printing/tests/test_theanocode.py::test_Integers", "printing/tests/test_theanocode.py::test_factorial", "printing/tests/test_theanocode.py::test_Derivative", "printing/tests/test_theanocode.py::test_theano_function_simple", "printing/tests/test_theanocode.py::test_theano_function_multi", "printing/tests/test_theanocode.py::test_theano_function_numpy", "printing/tests/test_theanocode.py::test_theano_function_matrix", "printing/tests/test_theanocode.py::test_theano_function_kwargs", "printing/tests/test_theanocode.py::test_theano_function_scalar", "printing/tests/test_theanocode.py::test_slice", "printing/tests/test_theanocode.py::test_MatrixSlice", "printing/tests/test_theanocode.py::test_BlockMatrix", "printing/tests/test_theanocode.py::test_BlockMatrix_Inverse_execution", "printing/tests/test_theanocode.py::test_DenseMatrix", "printing/tests/test_theanocode.py::test_cache_basic", "printing/tests/test_theanocode.py::test_global_cache", "printing/tests/test_theanocode.py::test_cache_types_distinct", "printing/tests/test_theanocode.py::test_symbols_are_created_once", "printing/tests/test_theanocode.py::test_cache_complex", "printing/tests/test_theanocode.py::test_Piecewise", "printing/tests/test_theanocode.py::test_Relationals", "printing/tests/test_theanocode.py::test_complexfunctions", "printing/tests/test_theanocode.py::test_constantfunctions", "printing/tests/test_theanocode.py::test_Exp1", "printing/tests/test_tree.py::test_print_tree_MatAdd", "series/tests/test_formal.py::test_fps__logarithmic_singularity_fail", "series/tests/test_gruntz.py::test_gruntz_evaluation_slow", "series/tests/test_gruntz.py::test_gruntz_eval_special_slow", "series/tests/test_gruntz.py::test_grunts_eval_special_slow_sometimes_fail", "series/tests/test_gruntz.py::test_gruntz_eval_special_fail", "series/tests/test_gruntz.py::test_MrvTestCase_page47_ex3_21", "series/tests/test_gruntz.py::test_issue_5172", "series/tests/test_limits.py::test_doit2", "series/tests/test_limits.py::test_order_oo", "series/tests/test_limits.py::test_issue_5172", "series/tests/test_limitseq.py::test_limit_seq_fail", "series/tests/test_nseries.py::test_series1_failing", "series/tests/test_order.py::test_order_failing_due_to_solveset", "series/tests/test_residues.py::test_expressions_failing", "sets/tests/test_fancysets.py::test_halfcircle_fail", "sets/tests/test_fancysets.py::test_issue_16871b", "sets/tests/test_powerset.py::test_failing_powerset__contains__", "sets/tests/test_sets.py::test_Complement_as_relational_fail", "sets/tests/test_sets.py::test_image_Intersection", "sets/tests/test_sets.py::test_union_boundary_of_joining_sets", "sets/tests/test_sets.py::test_issue_16878b", "sets/tests/test_sets.py::test_intersection_symbolic_failing", "simplify/tests/test_cse.py::test_non_commutative_cse", "simplify/tests/test_cse.py::test_non_commutative_order", "simplify/tests/test_cse.py::test_issue_10228", "simplify/tests/test_cse.py::test_powers", "simplify/tests/test_cse.py::test_issue_11577", "simplify/tests/test_cse.py::test_cse_matrix_nested_matmul_collapsed", "simplify/tests/test_cse.py::test_cse_matrix_optimize_out_single_argument_mul_combined", "simplify/tests/test_cse.py::test_cse_matrix_optimize_out_single_argument_add_combined", "simplify/tests/test_hyperexpand.py::test_roach_fail", "simplify/tests/test_hyperexpand.py::test_meijerg_expand_fail", "simplify/tests/test_hyperexpand.py::test_prudnikov_3_slow", "simplify/tests/test_hyperexpand.py::test_prudnikov_fail_2F1", "simplify/tests/test_hyperexpand.py::test_prudnikov_fail_3F2", "simplify/tests/test_hyperexpand.py::test_prudnikov_fail_other", "simplify/tests/test_simplify.py::test_simplify_float_vs_integer", "simplify/tests/test_simplify.py::test_issue_18642", "simplify/tests/test_simplify.py::test_issue_18389", "simplify/tests/test_trigsimp.py::test_issue_6811_fail", "solvers/diophantine/tests/test_diophantine.py::test_fail_holzer", "solvers/diophantine/tests/test_diophantine.py::test_not_implemented", "solvers/ode/tests/test_lie_group.py::test_kamke", "solvers/ode/tests/test_lie_group.py::test_lie_group_issue15219", "solvers/ode/tests/test_ode.py::test_noncircularized_real_imaginary_parts", "solvers/ode/tests/test_ode.py::test_issue_25820", "solvers/ode/tests/test_systems.py::test_linear_new_order1_type2_de_lorentz_slow_check", "solvers/ode/tests/test_systems.py::test_linear_3eq_order1_type4_long_dsolve_slow_xfail", "solvers/ode/tests/test_systems.py::test_linear_3eq_order1_type4_long_dsolve_dotprodsimp", "solvers/ode/tests/test_systems.py::test_linear_3eq_order1_type4_long_check", "solvers/ode/tests/test_systems.py::test_nonlinear_3eq_order1_type1", "solvers/ode/tests/test_systems.py::test_nonlinear_3eq_order1_type4", "solvers/ode/tests/test_systems.py::test_nonlinear_3eq_order1_type3", "solvers/ode/tests/test_systems.py::test_nonlinear_3eq_order1_type5", "solvers/tests/test_constantsimp.py::test_nonlocal_simplification", "solvers/tests/test_decompogen.py::test_decompogen_fails", "solvers/tests/test_inequalities.py::test_slow_general_univariate", "solvers/tests/test_inequalities.py::test_isolve_Sets", "solvers/tests/test_numeric.py::test_nsolve_fail", "solvers/tests/test_numeric.py::test_nsolve_denominator", "solvers/tests/test_numeric.py::test_nsolve", "solvers/tests/test_numeric.py::test_issue_6408", "solvers/tests/test_numeric.py::test_issue_6408_integral", "solvers/tests/test_numeric.py::test_increased_dps", "solvers/tests/test_numeric.py::test_nsolve_precision", "solvers/tests/test_numeric.py::test_nsolve_complex", "solvers/tests/test_numeric.py::test_nsolve_dict_kwarg", "solvers/tests/test_numeric.py::test_nsolve_rational", "solvers/tests/test_numeric.py::test_issue_14950", "solvers/tests/test_recurr.py::test_rsolve_ratio_missed", "solvers/tests/test_solvers.py::test_linear_system_xfail", "solvers/tests/test_solvers.py::test_issue_24609_xfail", "solvers/tests/test_solvers.py::test_unrad_fail", "solvers/tests/test_solvers.py::test_other_lambert", "solvers/tests/test_solvers.py::test_rewrite_trigh", "solvers/tests/test_solvers.py::test_issue_7547", "solvers/tests/test_solveset.py::test_issue_18449", "solvers/tests/test_solveset.py::test_solve_sqrt_fail", "solvers/tests/test_solveset.py::test_solve_quintics", "solvers/tests/test_solveset.py::test_solve_trig_simplified", "solvers/tests/test_solveset.py::test_solve_lambert", "solvers/tests/test_solveset.py::test_other_lambert", "solvers/tests/test_solveset.py::test_conditionset_equality", "solvers/tests/test_solveset.py::test_trig_system_fail", "solvers/tests/test_solveset.py::test_solve_nonlinear_trans", "solvers/tests/test_solveset.py::test_issue_5114_solveset", "solvers/tests/test_solveset.py::test_issue_17933", "solvers/tests/test_solveset.py::test_exponential_complex", "solvers/tests/test_solveset.py::test_issue_10864", "solvers/tests/test_solveset.py::test_solve_only_exp_2", "solvers/tests/test_solveset.py::test_uselogcombine_2", "stats/sampling/tests/test_sample_continuous_rv.py::test_sample_numpy", "stats/sampling/tests/test_sample_continuous_rv.py::test_sample_scipy", "stats/sampling/tests/test_sample_continuous_rv.py::test_sample_pymc", "stats/sampling/tests/test_sample_continuous_rv.py::test_sampling_gamma_inverse", "stats/sampling/tests/test_sample_continuous_rv.py::test_lognormal_sampling", "stats/sampling/tests/test_sample_continuous_rv.py::test_sampling_gaussian_inverse", "stats/sampling/tests/test_sample_continuous_rv.py::test_prefab_sampling", "stats/sampling/tests/test_sample_continuous_rv.py::test_sample_continuous", "stats/sampling/tests/test_sample_discrete_rv.py::test_sample_numpy", "stats/sampling/tests/test_sample_discrete_rv.py::test_sample_scipy", "stats/sampling/tests/test_sample_discrete_rv.py::test_sample_pymc", "stats/sampling/tests/test_sample_discrete_rv.py::test_sample_discrete", "stats/sampling/tests/test_sample_finite_rv.py::test_given_sample", "stats/sampling/tests/test_sample_finite_rv.py::test_sample_numpy", "stats/sampling/tests/test_sample_finite_rv.py::test_sample_scipy", "stats/sampling/tests/test_sample_finite_rv.py::test_sample_pymc", "stats/tests/test_continuous_rv.py::test_uniform_P", "stats/tests/test_continuous_rv.py::test_precomputed_characteristic_functions", "stats/tests/test_discrete_rv.py::test_precomputed_characteristic_functions", "stats/tests/test_joint_rv.py::test_NegativeMultinomial", "stats/tests/test_joint_rv.py::test_joint_vector_expectation", "stats/tests/test_joint_rv.py::test_sample_numpy", "stats/tests/test_joint_rv.py::test_sample_scipy", "stats/tests/test_joint_rv.py::test_sample_pymc", "stats/tests/test_joint_rv.py::test_issue_21057_pymc", "stats/tests/test_matrix_distributions.py::test_sample_scipy", "stats/tests/test_matrix_distributions.py::test_sample_pymc", "stats/tests/test_rv.py::test_sample_iter", "stats/tests/test_rv.py::test_Sample", "stats/tests/test_rv.py::test_samplingE", "stats/tests/test_stochastic_process.py::test_sample_stochastic_process", "tensor/tests/test_tensor.py::test_div", "testing/tests/test_code_quality.py::test_files", "testing/tests/test_module_imports.py::test_module_imports_are_direct", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_no_paths", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_one_file[sympy/core/tests/test_basic.py]", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_one_file[_basic]", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_partial_path_from_root", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_multiple_paths_from_root", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_multiple_paths_from_non_root[paths0-expected_paths0]", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_string_as_keyword[paths0]", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_string_as_keyword[paths1]", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_string_as_keyword[paths2]", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_string_as_keyword[paths3]", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_string_as_keyword[paths4]", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_integer_as_keyword[paths0]", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_integer_as_keyword[paths1]", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_integer_as_keyword[paths2]", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_integer_as_keyword[paths3]", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_multiple_keywords", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_keyword_match_in_multiple_files", "utilities/_compilation/tests/test_compilation.py::test_compile_link_import_strings", "utilities/_compilation/tests/test_compilation.py::test_compile_sources", "utilities/tests/test_codegen_julia.py::test_jl_numbersymbol_no_inline", "utilities/tests/test_codegen_julia.py::test_jl_piecewise_no_inline", "utilities/tests/test_codegen_octave.py::test_m_numbersymbol_no_inline", "utilities/tests/test_codegen_octave.py::test_m_piecewise_no_inline", "utilities/tests/test_codegen_rust.py::test_numbersymbol_inline", "utilities/tests/test_codegen_rust.py::test_piecewise_inline", "utilities/tests/test_lambdify.py::test_no_args", "utilities/tests/test_lambdify.py::test_single_arg", "utilities/tests/test_lambdify.py::test_list_args", "utilities/tests/test_lambdify.py::test_nested_args", "utilities/tests/test_lambdify.py::test_str_args", "utilities/tests/test_lambdify.py::test_own_namespace_1", "utilities/tests/test_lambdify.py::test_own_namespace_2", "utilities/tests/test_lambdify.py::test_own_module", "utilities/tests/test_lambdify.py::test_atoms", "utilities/tests/test_lambdify.py::test_sympy_lambda", "utilities/tests/test_lambdify.py::test_math_lambda", "utilities/tests/test_lambdify.py::test_mpmath_lambda", "utilities/tests/test_lambdify.py::test_number_precision", "utilities/tests/test_lambdify.py::test_mpmath_precision", "utilities/tests/test_lambdify.py::test_numpy_transl", "utilities/tests/test_lambdify.py::test_scipy_transl", "utilities/tests/test_lambdify.py::test_numpy_translation_abs", "utilities/tests/test_lambdify.py::test_numexpr_printer", "utilities/tests/test_lambdify.py::test_issue_9334", "utilities/tests/test_lambdify.py::test_issue_12984", "utilities/tests/test_lambdify.py::test_empty_modules", "utilities/tests/test_lambdify.py::test_exponentiation", "utilities/tests/test_lambdify.py::test_sqrt", "utilities/tests/test_lambdify.py::test_trig", "utilities/tests/test_lambdify.py::test_integral", "utilities/tests/test_lambdify.py::test_double_integral", "utilities/tests/test_lambdify.py::test_spherical_bessel", "utilities/tests/test_lambdify.py::test_vector_simple", "utilities/tests/test_lambdify.py::test_vector_discontinuous", "utilities/tests/test_lambdify.py::test_trig_symbolic", "utilities/tests/test_lambdify.py::test_trig_float", "utilities/tests/test_lambdify.py::test_docs", "utilities/tests/test_lambdify.py::test_math", "utilities/tests/test_lambdify.py::test_sin", "utilities/tests/test_lambdify.py::test_matrix", "utilities/tests/test_lambdify.py::test_numpy_matrix", "utilities/tests/test_lambdify.py::test_numpy_transpose", "utilities/tests/test_lambdify.py::test_numpy_dotproduct", "utilities/tests/test_lambdify.py::test_numpy_inverse", "utilities/tests/test_lambdify.py::test_numpy_old_matrix", "utilities/tests/test_lambdify.py::test_scipy_sparse_matrix", "utilities/tests/test_lambdify.py::test_python_div_zero_issue_11306", "utilities/tests/test_lambdify.py::test_issue9474", "utilities/tests/test_lambdify.py::test_issue_9871", "utilities/tests/test_lambdify.py::test_numpy_piecewise", "utilities/tests/test_lambdify.py::test_numpy_logical_ops", "utilities/tests/test_lambdify.py::test_numpy_matmul", "utilities/tests/test_lambdify.py::test_numpy_numexpr", "utilities/tests/test_lambdify.py::test_numexpr_userfunctions", "utilities/tests/test_lambdify.py::test_tensorflow_basic_math", "utilities/tests/test_lambdify.py::test_tensorflow_placeholders", "utilities/tests/test_lambdify.py::test_tensorflow_variables", "utilities/tests/test_lambdify.py::test_tensorflow_logical_operations", "utilities/tests/test_lambdify.py::test_tensorflow_piecewise", "utilities/tests/test_lambdify.py::test_tensorflow_multi_max", "utilities/tests/test_lambdify.py::test_tensorflow_multi_min", "utilities/tests/test_lambdify.py::test_tensorflow_relational", "utilities/tests/test_lambdify.py::test_tensorflow_complexes", "utilities/tests/test_lambdify.py::test_tensorflow_array_arg", "utilities/tests/test_lambdify.py::test_sym_single_arg", "utilities/tests/test_lambdify.py::test_sym_list_args", "utilities/tests/test_lambdify.py::test_sym_integral", "utilities/tests/test_lambdify.py::test_namespace_order", "utilities/tests/test_lambdify.py::test_imps", "utilities/tests/test_lambdify.py::test_lambdify_imps", "utilities/tests/test_lambdify.py::test_dummification", "utilities/tests/test_lambdify.py::test_lambdify__arguments_with_invalid_python_identifiers", "utilities/tests/test_lambdify.py::test_curly_matrix_symbol", "utilities/tests/test_lambdify.py::test_python_keywords", "utilities/tests/test_lambdify.py::test_lambdify_docstring", "utilities/tests/test_lambdify.py::test_special_printers", "utilities/tests/test_lambdify.py::test_true_false", "utilities/tests/test_lambdify.py::test_issue_2790", "utilities/tests/test_lambdify.py::test_ITE", "utilities/tests/test_lambdify.py::test_Min_Max", "utilities/tests/test_lambdify.py::test_Indexed", "utilities/tests/test_lambdify.py::test_Idx", "utilities/tests/test_lambdify.py::test_issue_12173", "utilities/tests/test_lambdify.py::test_issue_13642", "utilities/tests/test_lambdify.py::test_sinc_mpmath", "utilities/tests/test_lambdify.py::test_lambdify_dummy_arg", "utilities/tests/test_lambdify.py::test_lambdify_mixed_symbol_dummy_args", "utilities/tests/test_lambdify.py::test_numpy_array_arg", "utilities/tests/test_lambdify.py::test_scipy_fns", "utilities/tests/test_lambdify.py::test_scipy_polys", "utilities/tests/test_lambdify.py::test_lambdify_inspect", "utilities/tests/test_lambdify.py::test_issue_14941", "utilities/tests/test_lambdify.py::test_lambdify_Derivative_arg_issue_16468", "utilities/tests/test_lambdify.py::test_lambdify_Derivative_zeta", "utilities/tests/test_lambdify.py::test_lambdify_Derivative_custom_printer", "utilities/tests/test_lambdify.py::test_lambdify_derivative_and_functions_as_arguments", "utilities/tests/test_lambdify.py::test_imag_real", "utilities/tests/test_lambdify.py::test_MatrixSymbol_issue_15578", "utilities/tests/test_lambdify.py::test_issue_15654", "utilities/tests/test_lambdify.py::test_issue_15827", "utilities/tests/test_lambdify.py::test_issue_16930", "utilities/tests/test_lambdify.py::test_issue_17898", "utilities/tests/test_lambdify.py::test_issue_13167_21411", "utilities/tests/test_lambdify.py::test_single_e", "utilities/tests/test_lambdify.py::test_issue_16536", "utilities/tests/test_lambdify.py::test_issue_22726", "utilities/tests/test_lambdify.py::test_issue_22739", "utilities/tests/test_lambdify.py::test_issue_22992", "utilities/tests/test_lambdify.py::test_issue_19764", "utilities/tests/test_lambdify.py::test_issue_20070", "utilities/tests/test_lambdify.py::test_fresnel_integrals_scipy", "utilities/tests/test_lambdify.py::test_beta_scipy", "utilities/tests/test_lambdify.py::test_beta_math", "utilities/tests/test_lambdify.py::test_betainc_scipy", "utilities/tests/test_lambdify.py::test_betainc_regularized_scipy", "utilities/tests/test_lambdify.py::test_numpy_special_math", "utilities/tests/test_lambdify.py::test_scipy_special_math", "utilities/tests/test_lambdify.py::test_scipy_bernoulli", "utilities/tests/test_lambdify.py::test_scipy_harmonic", "utilities/tests/test_lambdify.py::test_cupy_array_arg", "utilities/tests/test_lambdify.py::test_cupy_array_arg_using_numpy", "utilities/tests/test_lambdify.py::test_cupy_dotproduct", "utilities/tests/test_lambdify.py::test_jax_array_arg", "utilities/tests/test_lambdify.py::test_jax_array_arg_using_numpy", "utilities/tests/test_lambdify.py::test_jax_dotproduct", "utilities/tests/test_lambdify.py::test_lambdify_cse", "utilities/tests/test_lambdify.py::test_issue_25288", "utilities/tests/test_lambdify.py::test_deprecated_set", "utilities/tests/test_lambdify.py::test_issue_13881", "utilities/tests/test_lambdify.py::test_23536_lambdify_cse_dummy", "utilities/tests/test_lambdify.py::test_lambdify_docstring_size_limit_simple_symbol", "utilities/tests/test_lambdify.py::test_lambdify_docstring_size_limit_nested_expr", "utilities/tests/test_lambdify.py::test_lambdify_docstring_size_limit_matrix", "utilities/tests/test_lambdify.py::test_lambdify_empty_tuple", "utilities/tests/test_lambdify.py::test_Piecewise", "utilities/tests/test_lambdify.py::test_array_symbol", "utilities/tests/test_matchpy_connector.py::test_matchpy_connector", "utilities/tests/test_matchpy_connector.py::test_matchpy_optional", "utilities/tests/test_matchpy_connector.py::test_replacer", "utilities/tests/test_mathml.py::test_xxe", "utilities/tests/test_misc.py::test_debug_output", "utilities/tests/test_pickling.py::test_core_undefinedfunctions_fail", "utilities/tests/test_pickling.py::test_plotting", "utilities/tests/test_pickling.py::test_plotting2", "utilities/tests/test_pickling.py::test_pickling_polys_rings", "utilities/tests/test_pickling.py::test_printing1", "utilities/tests/test_pickling.py::test_printing2", "utilities/tests/test_pickling.py::test_printing3", "utilities/tests/test_wester.py::test_C19", "utilities/tests/test_wester.py::test_C22", "utilities/tests/test_wester.py::test_C24", "utilities/tests/test_wester.py::test_D5", "utilities/tests/test_wester.py::test_D6", "utilities/tests/test_wester.py::test_D7", "utilities/tests/test_wester.py::test_D8", "utilities/tests/test_wester.py::test_D9", "utilities/tests/test_wester.py::test_D10", "utilities/tests/test_wester.py::test_D11", "utilities/tests/test_wester.py::test_D12", "utilities/tests/test_wester.py::test_D13", "utilities/tests/test_wester.py::test_F3", "utilities/tests/test_wester.py::test_F4", "utilities/tests/test_wester.py::test_F5", "utilities/tests/test_wester.py::test_G2", "utilities/tests/test_wester.py::test_G3", "utilities/tests/test_wester.py::test_G19", "utilities/tests/test_wester.py::test_G20b", "utilities/tests/test_wester.py::test_H13", "utilities/tests/test_wester.py::test_H18", "utilities/tests/test_wester.py::test_H20", "utilities/tests/test_wester.py::test_H21", "utilities/tests/test_wester.py::test_H28", "utilities/tests/test_wester.py::test_H29", "utilities/tests/test_wester.py::test_H32", "utilities/tests/test_wester.py::test_I2", "utilities/tests/test_wester.py::test_I5", "utilities/tests/test_wester.py::test_I6", "utilities/tests/test_wester.py::test_I7", "utilities/tests/test_wester.py::test_I8", "utilities/tests/test_wester.py::test_I9", "utilities/tests/test_wester.py::test_I11", "utilities/tests/test_wester.py::test_I12", "utilities/tests/test_wester.py::test_J3", "utilities/tests/test_wester.py::test_J15", "utilities/tests/test_wester.py::test_J16", "utilities/tests/test_wester.py::test_J18", "utilities/tests/test_wester.py::test_K3", "utilities/tests/test_wester.py::test_L5", "utilities/tests/test_wester.py::test_L7", "utilities/tests/test_wester.py::test_L8", "utilities/tests/test_wester.py::test_L9", "utilities/tests/test_wester.py::test_M1", "utilities/tests/test_wester.py::test_M5", "utilities/tests/test_wester.py::test_M8", "utilities/tests/test_wester.py::test_M9", "utilities/tests/test_wester.py::test_M11", "utilities/tests/test_wester.py::test_M13", "utilities/tests/test_wester.py::test_M14", "utilities/tests/test_wester.py::test_M16", "utilities/tests/test_wester.py::test_M17", "utilities/tests/test_wester.py::test_M18", "utilities/tests/test_wester.py::test_M28", "utilities/tests/test_wester.py::test_M32", "utilities/tests/test_wester.py::test_M33", "utilities/tests/test_wester.py::test_M34", "utilities/tests/test_wester.py::test_N2", "utilities/tests/test_wester.py::test_N3", "utilities/tests/test_wester.py::test_N4", "utilities/tests/test_wester.py::test_N5", "utilities/tests/test_wester.py::test_N6", "utilities/tests/test_wester.py::test_N7", "utilities/tests/test_wester.py::test_N8", "utilities/tests/test_wester.py::test_N14", "utilities/tests/test_wester.py::test_N17", "utilities/tests/test_wester.py::test_O3", "utilities/tests/test_wester.py::test_O5", "utilities/tests/test_wester.py::test_P4", "utilities/tests/test_wester.py::test_P10", "utilities/tests/test_wester.py::test_P11", "utilities/tests/test_wester.py::test_P20", "utilities/tests/test_wester.py::test_P28", "utilities/tests/test_wester.py::test_P29", "utilities/tests/test_wester.py::test_P31", "utilities/tests/test_wester.py::test_P34", "utilities/tests/test_wester.py::test_P35", "utilities/tests/test_wester.py::test_P36", "utilities/tests/test_wester.py::test_P38", "utilities/tests/test_wester.py::test_P39", "utilities/tests/test_wester.py::test_R1", "utilities/tests/test_wester.py::test_R2", "utilities/tests/test_wester.py::test_R3", "utilities/tests/test_wester.py::test_R4", "utilities/tests/test_wester.py::test_R5", "utilities/tests/test_wester.py::test_R8", "utilities/tests/test_wester.py::test_R10", "utilities/tests/test_wester.py::test_R11", "utilities/tests/test_wester.py::test_R12", "utilities/tests/test_wester.py::test_R13", "utilities/tests/test_wester.py::test_R14", "utilities/tests/test_wester.py::test_R15", "utilities/tests/test_wester.py::test_R17", "utilities/tests/test_wester.py::test_R19", "utilities/tests/test_wester.py::test_R20", "utilities/tests/test_wester.py::test_R21", "utilities/tests/test_wester.py::test_R23", "utilities/tests/test_wester.py::test_S6", "utilities/tests/test_wester.py::test_S7", "utilities/tests/test_wester.py::test_S8", "utilities/tests/test_wester.py::test_S9", "utilities/tests/test_wester.py::test_S10", "utilities/tests/test_wester.py::test_T9", "utilities/tests/test_wester.py::test_T10", "utilities/tests/test_wester.py::test_T11", "utilities/tests/test_wester.py::test_U4", "utilities/tests/test_wester.py::test_U7", "utilities/tests/test_wester.py::test_U11", "utilities/tests/test_wester.py::test_U12", "utilities/tests/test_wester.py::test_U14", "utilities/tests/test_wester.py::test_U15", "utilities/tests/test_wester.py::test_U16", "utilities/tests/test_wester.py::test_U17", "utilities/tests/test_wester.py::test_V5", "utilities/tests/test_wester.py::test_V6", "utilities/tests/test_wester.py::test_V8_V9", "utilities/tests/test_wester.py::test_V13", "utilities/tests/test_wester.py::test_V14", "utilities/tests/test_wester.py::test_V16", "utilities/tests/test_wester.py::test_V17", "utilities/tests/test_wester.py::test_W1", "utilities/tests/test_wester.py::test_W2", "utilities/tests/test_wester.py::test_W3", "utilities/tests/test_wester.py::test_W4", "utilities/tests/test_wester.py::test_W5", "utilities/tests/test_wester.py::test_W6", "utilities/tests/test_wester.py::test_W8", "utilities/tests/test_wester.py::test_W9", "utilities/tests/test_wester.py::test_W10", "utilities/tests/test_wester.py::test_W11", "utilities/tests/test_wester.py::test_W13", "utilities/tests/test_wester.py::test_W15", "utilities/tests/test_wester.py::test_W19", "utilities/tests/test_wester.py::test_W20", "utilities/tests/test_wester.py::test_W24", "utilities/tests/test_wester.py::test_W25", "utilities/tests/test_wester.py::test_X5", "utilities/tests/test_wester.py::test_X12", "utilities/tests/test_wester.py::test_X14", "utilities/tests/test_wester.py::test_X15", "utilities/tests/test_wester.py::test_X17", "utilities/tests/test_wester.py::test_X18", "utilities/tests/test_wester.py::test_X19", "utilities/tests/test_wester.py::test_X20", "utilities/tests/test_wester.py::test_X22", "utilities/tests/test_wester.py::test_Y7", "utilities/tests/test_wester.py::test_Y8", "utilities/tests/test_wester.py::test_Y11", "utilities/tests/test_wester.py::test_Y12", "utilities/tests/test_wester.py::test_Y13", "utilities/tests/test_wester.py::test_Y14", "utilities/tests/test_wester.py::test_Z4", "utilities/tests/test_wester.py::test_Z5", "utilities/tests/test_wester.py::test_Z6", "vector/tests/test_printing.py::test_pretty_printing_ascii" ], "PASS_TO_PASS": null }
sympy__sympy-47
1.0
{ "code": "diff --git b/sympy/solvers/diophantine/diophantine.py a/sympy/solvers/diophantine/diophantine.py\nindex 8b900238ae..8200ef6da2 100644\n--- b/sympy/solvers/diophantine/diophantine.py\n+++ a/sympy/solvers/diophantine/diophantine.py\n@@ -1319,6 +1319,192 @@ def diophantine(eq, param=symbols(\"t\", integer=True), syms=None,\n sympy.utilities.iterables.signed_permutations\n \"\"\"\n \n+ eq = _sympify(eq)\n+\n+ if isinstance(eq, Eq):\n+ eq = eq.lhs - eq.rhs\n+\n+ try:\n+ var = list(eq.expand(force=True).free_symbols)\n+ var.sort(key=default_sort_key)\n+ if syms:\n+ if not is_sequence(syms):\n+ raise TypeError(\n+ 'syms should be given as a sequence, e.g. a list')\n+ syms = [i for i in syms if i in var]\n+ if syms != var:\n+ dict_sym_index = dict(zip(syms, range(len(syms))))\n+ return {tuple([t[dict_sym_index[i]] for i in var])\n+ for t in diophantine(eq, param, permute=permute)}\n+ n, d = eq.as_numer_denom()\n+ if n.is_number:\n+ return set()\n+ if not d.is_number:\n+ dsol = diophantine(d)\n+ good = diophantine(n) - dsol\n+ return {s for s in good if _mexpand(d.subs(zip(var, s)))}\n+ eq = factor_terms(n)\n+ assert not eq.is_number\n+ eq = eq.as_independent(*var, as_Add=False)[1]\n+ p = Poly(eq)\n+ assert not any(g.is_number for g in p.gens)\n+ eq = p.as_expr()\n+ assert eq.is_polynomial()\n+ except (GeneratorsNeeded, AssertionError):\n+ raise TypeError(filldedent('''\n+ Equation should be a polynomial with Rational coefficients.'''))\n+\n+ # permute only sign\n+ do_permute_signs = False\n+ # permute sign and values\n+ do_permute_signs_var = False\n+ # permute few signs\n+ permute_few_signs = False\n+ try:\n+ # if we know that factoring should not be attempted, skip\n+ # the factoring step\n+ v, c, t = classify_diop(eq)\n+\n+ # check for permute sign\n+ if permute:\n+ len_var = len(v)\n+ permute_signs_for = [\n+ GeneralSumOfSquares.name,\n+ GeneralSumOfEvenPowers.name]\n+ permute_signs_check = [\n+ HomogeneousTernaryQuadratic.name,\n+ HomogeneousTernaryQuadraticNormal.name,\n+ BinaryQuadratic.name]\n+ if t in permute_signs_for:\n+ do_permute_signs_var = True\n+ elif t in permute_signs_check:\n+ # if all the variables in eq have even powers\n+ # then do_permute_sign = True\n+ if len_var == 3:\n+ var_mul = list(subsets(v, 2))\n+ # here var_mul is like [(x, y), (x, z), (y, z)]\n+ xy_coeff = True\n+ x_coeff = True\n+ var1_mul_var2 = (a[0]*a[1] for a in var_mul)\n+ # if coeff(y*z), coeff(y*x), coeff(x*z) is not 0 then\n+ # `xy_coeff` => True and do_permute_sign => False.\n+ # Means no permuted solution.\n+ for v1_mul_v2 in var1_mul_var2:\n+ try:\n+ coeff = c[v1_mul_v2]\n+ except KeyError:\n+ coeff = 0\n+ xy_coeff = bool(xy_coeff) and bool(coeff)\n+ var_mul = list(subsets(v, 1))\n+ # here var_mul is like [(x,), (y, )]\n+ for v1 in var_mul:\n+ try:\n+ coeff = c[v1[0]]\n+ except KeyError:\n+ coeff = 0\n+ x_coeff = bool(x_coeff) and bool(coeff)\n+ if not any((xy_coeff, x_coeff)):\n+ # means only x**2, y**2, z**2, const is present\n+ do_permute_signs = True\n+ elif not x_coeff:\n+ permute_few_signs = True\n+ elif len_var == 2:\n+ var_mul = list(subsets(v, 2))\n+ # here var_mul is like [(x, y)]\n+ xy_coeff = True\n+ x_coeff = True\n+ var1_mul_var2 = (x[0]*x[1] for x in var_mul)\n+ for v1_mul_v2 in var1_mul_var2:\n+ try:\n+ coeff = c[v1_mul_v2]\n+ except KeyError:\n+ coeff = 0\n+ xy_coeff = bool(xy_coeff) and bool(coeff)\n+ var_mul = list(subsets(v, 1))\n+ # here var_mul is like [(x,), (y, )]\n+ for v1 in var_mul:\n+ try:\n+ coeff = c[v1[0]]\n+ except KeyError:\n+ coeff = 0\n+ x_coeff = bool(x_coeff) and bool(coeff)\n+ if not any((xy_coeff, x_coeff)):\n+ # means only x**2, y**2 and const is present\n+ # so we can get more soln by permuting this soln.\n+ do_permute_signs = True\n+ elif not x_coeff:\n+ # when coeff(x), coeff(y) is not present then signs of\n+ # x, y can be permuted such that their sign are same\n+ # as sign of x*y.\n+ # e.g 1. (x_val,y_val)=> (x_val,y_val), (-x_val,-y_val)\n+ # 2. (-x_vall, y_val)=> (-x_val,y_val), (x_val,-y_val)\n+ permute_few_signs = True\n+ if t == 'general_sum_of_squares':\n+ # trying to factor such expressions will sometimes hang\n+ terms = [(eq, 1)]\n+ else:\n+ raise TypeError\n+ except (TypeError, NotImplementedError):\n+ fl = factor_list(eq)\n+ if fl[0].is_Rational and fl[0] != 1:\n+ return diophantine(eq/fl[0], param=param, syms=syms, permute=permute)\n+ terms = fl[1]\n+\n+ sols = set()\n+\n+ for term in terms:\n+\n+ base, _ = term\n+ var_t, _, eq_type = classify_diop(base, _dict=False)\n+ _, base = signsimp(base, evaluate=False).as_coeff_Mul()\n+ solution = diop_solve(base, param)\n+\n+ if eq_type in [\n+ Linear.name,\n+ HomogeneousTernaryQuadratic.name,\n+ HomogeneousTernaryQuadraticNormal.name,\n+ GeneralPythagorean.name]:\n+ sols.add(merge_solution(var, var_t, solution))\n+\n+ elif eq_type in [\n+ BinaryQuadratic.name,\n+ GeneralSumOfSquares.name,\n+ GeneralSumOfEvenPowers.name,\n+ Univariate.name]:\n+ sols.update(merge_solution(var, var_t, sol) for sol in solution)\n+\n+ else:\n+ raise NotImplementedError('unhandled type: %s' % eq_type)\n+\n+ # remove null merge results\n+ if () in sols:\n+ sols.remove(())\n+ null = tuple([0]*len(var))\n+ # if there is no solution, return trivial solution\n+ if not sols and eq.subs(zip(var, null)).is_zero:\n+ if all(check_assumptions(val, **s.assumptions0) is not False for val, s in zip(null, var)):\n+ sols.add(null)\n+\n+ final_soln = set()\n+ for sol in sols:\n+ if all(int_valued(s) for s in sol):\n+ if do_permute_signs:\n+ permuted_sign = set(permute_signs(sol))\n+ final_soln.update(permuted_sign)\n+ elif permute_few_signs:\n+ lst = list(permute_signs(sol))\n+ lst = list(filter(lambda x: x[0]*x[1] == sol[1]*sol[0], lst))\n+ permuted_sign = set(lst)\n+ final_soln.update(permuted_sign)\n+ elif do_permute_signs_var:\n+ permuted_sign_var = set(signed_permutations(sol))\n+ final_soln.update(permuted_sign_var)\n+ else:\n+ final_soln.add(sol)\n+ else:\n+ final_soln.add(sol)\n+ return final_soln\n+\n \n def merge_solution(var, var_t, solution):\n \"\"\"\n", "test": null }
null
{ "code": "diff --git a/sympy/solvers/diophantine/diophantine.py b/sympy/solvers/diophantine/diophantine.py\nindex 8200ef6da2..8b900238ae 100644\n--- a/sympy/solvers/diophantine/diophantine.py\n+++ b/sympy/solvers/diophantine/diophantine.py\n@@ -1319,192 +1319,6 @@ def diophantine(eq, param=symbols(\"t\", integer=True), syms=None,\n sympy.utilities.iterables.signed_permutations\n \"\"\"\n \n- eq = _sympify(eq)\n-\n- if isinstance(eq, Eq):\n- eq = eq.lhs - eq.rhs\n-\n- try:\n- var = list(eq.expand(force=True).free_symbols)\n- var.sort(key=default_sort_key)\n- if syms:\n- if not is_sequence(syms):\n- raise TypeError(\n- 'syms should be given as a sequence, e.g. a list')\n- syms = [i for i in syms if i in var]\n- if syms != var:\n- dict_sym_index = dict(zip(syms, range(len(syms))))\n- return {tuple([t[dict_sym_index[i]] for i in var])\n- for t in diophantine(eq, param, permute=permute)}\n- n, d = eq.as_numer_denom()\n- if n.is_number:\n- return set()\n- if not d.is_number:\n- dsol = diophantine(d)\n- good = diophantine(n) - dsol\n- return {s for s in good if _mexpand(d.subs(zip(var, s)))}\n- eq = factor_terms(n)\n- assert not eq.is_number\n- eq = eq.as_independent(*var, as_Add=False)[1]\n- p = Poly(eq)\n- assert not any(g.is_number for g in p.gens)\n- eq = p.as_expr()\n- assert eq.is_polynomial()\n- except (GeneratorsNeeded, AssertionError):\n- raise TypeError(filldedent('''\n- Equation should be a polynomial with Rational coefficients.'''))\n-\n- # permute only sign\n- do_permute_signs = False\n- # permute sign and values\n- do_permute_signs_var = False\n- # permute few signs\n- permute_few_signs = False\n- try:\n- # if we know that factoring should not be attempted, skip\n- # the factoring step\n- v, c, t = classify_diop(eq)\n-\n- # check for permute sign\n- if permute:\n- len_var = len(v)\n- permute_signs_for = [\n- GeneralSumOfSquares.name,\n- GeneralSumOfEvenPowers.name]\n- permute_signs_check = [\n- HomogeneousTernaryQuadratic.name,\n- HomogeneousTernaryQuadraticNormal.name,\n- BinaryQuadratic.name]\n- if t in permute_signs_for:\n- do_permute_signs_var = True\n- elif t in permute_signs_check:\n- # if all the variables in eq have even powers\n- # then do_permute_sign = True\n- if len_var == 3:\n- var_mul = list(subsets(v, 2))\n- # here var_mul is like [(x, y), (x, z), (y, z)]\n- xy_coeff = True\n- x_coeff = True\n- var1_mul_var2 = (a[0]*a[1] for a in var_mul)\n- # if coeff(y*z), coeff(y*x), coeff(x*z) is not 0 then\n- # `xy_coeff` => True and do_permute_sign => False.\n- # Means no permuted solution.\n- for v1_mul_v2 in var1_mul_var2:\n- try:\n- coeff = c[v1_mul_v2]\n- except KeyError:\n- coeff = 0\n- xy_coeff = bool(xy_coeff) and bool(coeff)\n- var_mul = list(subsets(v, 1))\n- # here var_mul is like [(x,), (y, )]\n- for v1 in var_mul:\n- try:\n- coeff = c[v1[0]]\n- except KeyError:\n- coeff = 0\n- x_coeff = bool(x_coeff) and bool(coeff)\n- if not any((xy_coeff, x_coeff)):\n- # means only x**2, y**2, z**2, const is present\n- do_permute_signs = True\n- elif not x_coeff:\n- permute_few_signs = True\n- elif len_var == 2:\n- var_mul = list(subsets(v, 2))\n- # here var_mul is like [(x, y)]\n- xy_coeff = True\n- x_coeff = True\n- var1_mul_var2 = (x[0]*x[1] for x in var_mul)\n- for v1_mul_v2 in var1_mul_var2:\n- try:\n- coeff = c[v1_mul_v2]\n- except KeyError:\n- coeff = 0\n- xy_coeff = bool(xy_coeff) and bool(coeff)\n- var_mul = list(subsets(v, 1))\n- # here var_mul is like [(x,), (y, )]\n- for v1 in var_mul:\n- try:\n- coeff = c[v1[0]]\n- except KeyError:\n- coeff = 0\n- x_coeff = bool(x_coeff) and bool(coeff)\n- if not any((xy_coeff, x_coeff)):\n- # means only x**2, y**2 and const is present\n- # so we can get more soln by permuting this soln.\n- do_permute_signs = True\n- elif not x_coeff:\n- # when coeff(x), coeff(y) is not present then signs of\n- # x, y can be permuted such that their sign are same\n- # as sign of x*y.\n- # e.g 1. (x_val,y_val)=> (x_val,y_val), (-x_val,-y_val)\n- # 2. (-x_vall, y_val)=> (-x_val,y_val), (x_val,-y_val)\n- permute_few_signs = True\n- if t == 'general_sum_of_squares':\n- # trying to factor such expressions will sometimes hang\n- terms = [(eq, 1)]\n- else:\n- raise TypeError\n- except (TypeError, NotImplementedError):\n- fl = factor_list(eq)\n- if fl[0].is_Rational and fl[0] != 1:\n- return diophantine(eq/fl[0], param=param, syms=syms, permute=permute)\n- terms = fl[1]\n-\n- sols = set()\n-\n- for term in terms:\n-\n- base, _ = term\n- var_t, _, eq_type = classify_diop(base, _dict=False)\n- _, base = signsimp(base, evaluate=False).as_coeff_Mul()\n- solution = diop_solve(base, param)\n-\n- if eq_type in [\n- Linear.name,\n- HomogeneousTernaryQuadratic.name,\n- HomogeneousTernaryQuadraticNormal.name,\n- GeneralPythagorean.name]:\n- sols.add(merge_solution(var, var_t, solution))\n-\n- elif eq_type in [\n- BinaryQuadratic.name,\n- GeneralSumOfSquares.name,\n- GeneralSumOfEvenPowers.name,\n- Univariate.name]:\n- sols.update(merge_solution(var, var_t, sol) for sol in solution)\n-\n- else:\n- raise NotImplementedError('unhandled type: %s' % eq_type)\n-\n- # remove null merge results\n- if () in sols:\n- sols.remove(())\n- null = tuple([0]*len(var))\n- # if there is no solution, return trivial solution\n- if not sols and eq.subs(zip(var, null)).is_zero:\n- if all(check_assumptions(val, **s.assumptions0) is not False for val, s in zip(null, var)):\n- sols.add(null)\n-\n- final_soln = set()\n- for sol in sols:\n- if all(int_valued(s) for s in sol):\n- if do_permute_signs:\n- permuted_sign = set(permute_signs(sol))\n- final_soln.update(permuted_sign)\n- elif permute_few_signs:\n- lst = list(permute_signs(sol))\n- lst = list(filter(lambda x: x[0]*x[1] == sol[1]*sol[0], lst))\n- permuted_sign = set(lst)\n- final_soln.update(permuted_sign)\n- elif do_permute_signs_var:\n- permuted_sign_var = set(signed_permutations(sol))\n- final_soln.update(permuted_sign_var)\n- else:\n- final_soln.add(sol)\n- else:\n- final_soln.add(sol)\n- return final_soln\n-\n \n def merge_solution(var, var_t, solution):\n \"\"\"\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/solvers/diophantine/diophantine.py.\nHere is the description for the function:\ndef diophantine(eq, param=symbols(\"t\", integer=True), syms=None,\n permute=False):\n \"\"\"\n Simplify the solution procedure of diophantine equation ``eq`` by\n converting it into a product of terms which should equal zero.\n\n Explanation\n ===========\n\n For example, when solving, `x^2 - y^2 = 0` this is treated as\n `(x + y)(x - y) = 0` and `x + y = 0` and `x - y = 0` are solved\n independently and combined. Each term is solved by calling\n ``diop_solve()``. (Although it is possible to call ``diop_solve()``\n directly, one must be careful to pass an equation in the correct\n form and to interpret the output correctly; ``diophantine()`` is\n the public-facing function to use in general.)\n\n Output of ``diophantine()`` is a set of tuples. The elements of the\n tuple are the solutions for each variable in the equation and\n are arranged according to the alphabetic ordering of the variables.\n e.g. For an equation with two variables, `a` and `b`, the first\n element of the tuple is the solution for `a` and the second for `b`.\n\n Usage\n =====\n\n ``diophantine(eq, t, syms)``: Solve the diophantine\n equation ``eq``.\n ``t`` is the optional parameter to be used by ``diop_solve()``.\n ``syms`` is an optional list of symbols which determines the\n order of the elements in the returned tuple.\n\n By default, only the base solution is returned. If ``permute`` is set to\n True then permutations of the base solution and/or permutations of the\n signs of the values will be returned when applicable.\n\n Details\n =======\n\n ``eq`` should be an expression which is assumed to be zero.\n ``t`` is the parameter to be used in the solution.\n\n Examples\n ========\n\n >>> from sympy import diophantine\n >>> from sympy.abc import a, b\n >>> eq = a**4 + b**4 - (2**4 + 3**4)\n >>> diophantine(eq)\n {(2, 3)}\n >>> diophantine(eq, permute=True)\n {(-3, -2), (-3, 2), (-2, -3), (-2, 3), (2, -3), (2, 3), (3, -2), (3, 2)}\n\n >>> from sympy.abc import x, y, z\n >>> diophantine(x**2 - y**2)\n {(t_0, -t_0), (t_0, t_0)}\n\n >>> diophantine(x*(2*x + 3*y - z))\n {(0, n1, n2), (t_0, t_1, 2*t_0 + 3*t_1)}\n >>> diophantine(x**2 + 3*x*y + 4*x)\n {(0, n1), (-3*t_0 - 4, t_0)}\n\n See Also\n ========\n\n diop_solve\n sympy.utilities.iterables.permute_signs\n sympy.utilities.iterables.signed_permutations\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/sets/tests/test_fancysets.py::test_infinitely_indexed_set_1", "sympy/sets/tests/test_fancysets.py::test_imageset_intersect_diophantine", "sympy/sets/tests/test_fancysets.py::test_infinitely_indexed_set_3", "sympy/sets/tests/test_fancysets.py::test_issue_16871", "sympy/solvers/diophantine/tests/test_diophantine.py::test_input_format", "sympy/solvers/diophantine/tests/test_diophantine.py::test_nosols", "sympy/solvers/diophantine/tests/test_diophantine.py::test_quadratic_simple_hyperbolic_case", "sympy/solvers/diophantine/tests/test_diophantine.py::test_quadratic_parabolic_case", "sympy/solvers/diophantine/tests/test_diophantine.py::test_quadratic_perfect_square", "sympy/solvers/diophantine/tests/test_diophantine.py::test_quadratic_non_perfect_square", "sympy/solvers/diophantine/tests/test_diophantine.py::test_issue_9106", "sympy/solvers/diophantine/tests/test_diophantine.py::test_issue_18138", "sympy/solvers/diophantine/tests/test_diophantine.py::test_diop_ternary_quadratic_normal", "sympy/solvers/diophantine/tests/test_diophantine.py::test_diop_ternary_quadratic", "sympy/solvers/diophantine/tests/test_diophantine.py::test_parametrize_ternary_quadratic", "sympy/solvers/diophantine/tests/test_diophantine.py::test_no_square_ternary_quadratic", "sympy/solvers/diophantine/tests/test_diophantine.py::test_diophantine", "sympy/solvers/diophantine/tests/test_diophantine.py::test_general_pythagorean", "sympy/solvers/diophantine/tests/test_diophantine.py::test_diop_general_sum_of_squares_quick", "sympy/solvers/diophantine/tests/test_diophantine.py::test_issue_23807", "sympy/solvers/diophantine/tests/test_diophantine.py::test_assumptions", "sympy/solvers/diophantine/tests/test_diophantine.py::test_diopcoverage", "sympy/solvers/diophantine/tests/test_diophantine.py::test_issue_9539", "sympy/solvers/diophantine/tests/test_diophantine.py::test_issue_8943", "sympy/solvers/diophantine/tests/test_diophantine.py::test_diop_sum_of_even_powers", "sympy/solvers/diophantine/tests/test_diophantine.py::test_diophantine_permute_sign", "sympy/solvers/diophantine/tests/test_diophantine.py::test_issue_9538", "sympy/solvers/diophantine/tests/test_diophantine.py::test_ternary_quadratic", "sympy/solvers/diophantine/tests/test_diophantine.py::test_issue_18628", "sympy/calculus/tests/test_util.py::test_continuous_domain", "sympy/vector/tests/test_implicitregion.py::test_regular_point", "sympy/vector/tests/test_implicitregion.py::test_rational_parametrization", "sympy/calculus/tests/test_util.py::test_stationary_points", "sympy/vector/tests/test_integrals.py::test_vector_integrate", "sympy/solvers/tests/test_solveset.py::test_solveset_complex_tan", "sympy/solvers/tests/test_solveset.py::test_issue_9616", "sympy/solvers/tests/test_solveset.py::test_issue_26077" ], "PASS_TO_PASS": null }
sympy__sympy-48
1.0
{ "code": "diff --git b/sympy/printing/dot.py a/sympy/printing/dot.py\nindex 95e3d763ac..c968fee389 100644\n--- b/sympy/printing/dot.py\n+++ a/sympy/printing/dot.py\n@@ -273,3 +273,22 @@ def dotprint(expr,\n }\n \n \"\"\"\n+ # repeat works by adding a signature tuple to the end of each node for its\n+ # position in the graph. For example, for expr = Add(x, Pow(x, 2)), the x in the\n+ # Pow will have the tuple (1, 0), meaning it is expr.args[1].args[0].\n+ graphstyle = _graphstyle.copy()\n+ graphstyle.update(kwargs)\n+\n+ nodes = []\n+ edges = []\n+ def traverse(e, depth, pos=()):\n+ nodes.append(dotnode(e, styles, labelfunc=labelfunc, pos=pos, repeat=repeat))\n+ if maxdepth and depth >= maxdepth:\n+ return\n+ edges.extend(dotedges(e, atom=atom, pos=pos, repeat=repeat))\n+ [traverse(arg, depth+1, pos + (i,)) for i, arg in enumerate(e.args) if not atom(arg)]\n+ traverse(expr, 0)\n+\n+ return template%{'graphstyle': attrprint(graphstyle, delimiter='\\n'),\n+ 'nodes': '\\n'.join(nodes),\n+ 'edges': '\\n'.join(edges)}\n", "test": null }
null
{ "code": "diff --git a/sympy/printing/dot.py b/sympy/printing/dot.py\nindex c968fee389..95e3d763ac 100644\n--- a/sympy/printing/dot.py\n+++ b/sympy/printing/dot.py\n@@ -273,22 +273,3 @@ def dotprint(expr,\n }\n \n \"\"\"\n- # repeat works by adding a signature tuple to the end of each node for its\n- # position in the graph. For example, for expr = Add(x, Pow(x, 2)), the x in the\n- # Pow will have the tuple (1, 0), meaning it is expr.args[1].args[0].\n- graphstyle = _graphstyle.copy()\n- graphstyle.update(kwargs)\n-\n- nodes = []\n- edges = []\n- def traverse(e, depth, pos=()):\n- nodes.append(dotnode(e, styles, labelfunc=labelfunc, pos=pos, repeat=repeat))\n- if maxdepth and depth >= maxdepth:\n- return\n- edges.extend(dotedges(e, atom=atom, pos=pos, repeat=repeat))\n- [traverse(arg, depth+1, pos + (i,)) for i, arg in enumerate(e.args) if not atom(arg)]\n- traverse(expr, 0)\n-\n- return template%{'graphstyle': attrprint(graphstyle, delimiter='\\n'),\n- 'nodes': '\\n'.join(nodes),\n- 'edges': '\\n'.join(edges)}\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/printing/dot.py.\nHere is the description for the function:\ndef dotprint(expr,\n styles=default_styles, atom=lambda x: not isinstance(x, Basic),\n maxdepth=None, repeat=True, labelfunc=str, **kwargs):\n \"\"\"DOT description of a SymPy expression tree\n\n Parameters\n ==========\n\n styles : list of lists composed of (Class, mapping), optional\n Styles for different classes.\n\n The default is\n\n .. code-block:: python\n\n (\n (Basic, {'color': 'blue', 'shape': 'ellipse'}),\n (Expr, {'color': 'black'})\n )\n\n atom : function, optional\n Function used to determine if an arg is an atom.\n\n A good choice is ``lambda x: not x.args``.\n\n The default is ``lambda x: not isinstance(x, Basic)``.\n\n maxdepth : integer, optional\n The maximum depth.\n\n The default is ``None``, meaning no limit.\n\n repeat : boolean, optional\n Whether to use different nodes for common subexpressions.\n\n The default is ``True``.\n\n For example, for ``x + x*y`` with ``repeat=True``, it will have\n two nodes for ``x``; with ``repeat=False``, it will have one\n node.\n\n .. warning::\n Even if a node appears twice in the same object like ``x`` in\n ``Pow(x, x)``, it will still only appear once.\n Hence, with ``repeat=False``, the number of arrows out of an\n object might not equal the number of args it has.\n\n labelfunc : function, optional\n A function to create a label for a given leaf node.\n\n The default is ``str``.\n\n Another good option is ``srepr``.\n\n For example with ``str``, the leaf nodes of ``x + 1`` are labeled,\n ``x`` and ``1``. With ``srepr``, they are labeled ``Symbol('x')``\n and ``Integer(1)``.\n\n **kwargs : optional\n Additional keyword arguments are included as styles for the graph.\n\n Examples\n ========\n\n >>> from sympy import dotprint\n >>> from sympy.abc import x\n >>> print(dotprint(x+2)) # doctest: +NORMALIZE_WHITESPACE\n digraph{\n <BLANKLINE>\n # Graph style\n \"ordering\"=\"out\"\n \"rankdir\"=\"TD\"\n <BLANKLINE>\n #########\n # Nodes #\n #########\n <BLANKLINE>\n \"Add(Integer(2), Symbol('x'))_()\" [\"color\"=\"black\", \"label\"=\"Add\", \"shape\"=\"ellipse\"];\n \"Integer(2)_(0,)\" [\"color\"=\"black\", \"label\"=\"2\", \"shape\"=\"ellipse\"];\n \"Symbol('x')_(1,)\" [\"color\"=\"black\", \"label\"=\"x\", \"shape\"=\"ellipse\"];\n <BLANKLINE>\n #########\n # Edges #\n #########\n <BLANKLINE>\n \"Add(Integer(2), Symbol('x'))_()\" -> \"Integer(2)_(0,)\";\n \"Add(Integer(2), Symbol('x'))_()\" -> \"Symbol('x')_(1,)\";\n }\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/printing/tests/test_dot.py::test_dotprint", "sympy/printing/tests/test_dot.py::test_dotprint_depth", "sympy/printing/tests/test_dot.py::test_Matrix_and_non_basics", "sympy/printing/tests/test_dot.py::test_labelfunc", "sympy/printing/tests/test_dot.py::test_commutative" ], "PASS_TO_PASS": null }
sympy__sympy-49
1.0
{ "code": "diff --git b/sympy/ntheory/egyptian_fraction.py a/sympy/ntheory/egyptian_fraction.py\nindex c86f18f908..8a42540b37 100644\n--- b/sympy/ntheory/egyptian_fraction.py\n+++ a/sympy/ntheory/egyptian_fraction.py\n@@ -104,6 +104,40 @@ def egyptian_fraction(r, algorithm=\"Greedy\"):\n \n \"\"\"\n \n+ if not isinstance(r, Rational):\n+ if isinstance(r, (Tuple, tuple)) and len(r) == 2:\n+ r = Rational(*r)\n+ else:\n+ raise ValueError(\"Value must be a Rational or tuple of ints\")\n+ if r <= 0:\n+ raise ValueError(\"Value must be positive\")\n+\n+ # common cases that all methods agree on\n+ x, y = r.as_numer_denom()\n+ if y == 1 and x == 2:\n+ return [Integer(i) for i in [1, 2, 3, 6]]\n+ if x == y + 1:\n+ return [S.One, y]\n+\n+ prefix, rem = egypt_harmonic(r)\n+ if rem == 0:\n+ return prefix\n+ # work in Python ints\n+ x, y = rem.p, rem.q\n+ # assert x < y and gcd(x, y) = 1\n+\n+ if algorithm == \"Greedy\":\n+ postfix = egypt_greedy(x, y)\n+ elif algorithm == \"Graham Jewett\":\n+ postfix = egypt_graham_jewett(x, y)\n+ elif algorithm == \"Takenouchi\":\n+ postfix = egypt_takenouchi(x, y)\n+ elif algorithm == \"Golomb\":\n+ postfix = egypt_golomb(x, y)\n+ else:\n+ raise ValueError(\"Entered invalid algorithm\")\n+ return prefix + [Integer(i) for i in postfix]\n+\n \n def egypt_greedy(x, y):\n # assumes gcd(x, y) == 1\n", "test": null }
null
{ "code": "diff --git a/sympy/ntheory/egyptian_fraction.py b/sympy/ntheory/egyptian_fraction.py\nindex 8a42540b37..c86f18f908 100644\n--- a/sympy/ntheory/egyptian_fraction.py\n+++ b/sympy/ntheory/egyptian_fraction.py\n@@ -104,40 +104,6 @@ def egyptian_fraction(r, algorithm=\"Greedy\"):\n \n \"\"\"\n \n- if not isinstance(r, Rational):\n- if isinstance(r, (Tuple, tuple)) and len(r) == 2:\n- r = Rational(*r)\n- else:\n- raise ValueError(\"Value must be a Rational or tuple of ints\")\n- if r <= 0:\n- raise ValueError(\"Value must be positive\")\n-\n- # common cases that all methods agree on\n- x, y = r.as_numer_denom()\n- if y == 1 and x == 2:\n- return [Integer(i) for i in [1, 2, 3, 6]]\n- if x == y + 1:\n- return [S.One, y]\n-\n- prefix, rem = egypt_harmonic(r)\n- if rem == 0:\n- return prefix\n- # work in Python ints\n- x, y = rem.p, rem.q\n- # assert x < y and gcd(x, y) = 1\n-\n- if algorithm == \"Greedy\":\n- postfix = egypt_greedy(x, y)\n- elif algorithm == \"Graham Jewett\":\n- postfix = egypt_graham_jewett(x, y)\n- elif algorithm == \"Takenouchi\":\n- postfix = egypt_takenouchi(x, y)\n- elif algorithm == \"Golomb\":\n- postfix = egypt_golomb(x, y)\n- else:\n- raise ValueError(\"Entered invalid algorithm\")\n- return prefix + [Integer(i) for i in postfix]\n-\n \n def egypt_greedy(x, y):\n # assumes gcd(x, y) == 1\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/ntheory/egyptian_fraction.py.\nHere is the description for the function:\ndef egyptian_fraction(r, algorithm=\"Greedy\"):\n \"\"\"\n Return the list of denominators of an Egyptian fraction\n expansion [1]_ of the said rational `r`.\n\n Parameters\n ==========\n\n r : Rational or (p, q)\n a positive rational number, ``p/q``.\n algorithm : { \"Greedy\", \"Graham Jewett\", \"Takenouchi\", \"Golomb\" }, optional\n Denotes the algorithm to be used (the default is \"Greedy\").\n\n Examples\n ========\n\n >>> from sympy import Rational\n >>> from sympy.ntheory.egyptian_fraction import egyptian_fraction\n >>> egyptian_fraction(Rational(3, 7))\n [3, 11, 231]\n >>> egyptian_fraction((3, 7), \"Graham Jewett\")\n [7, 8, 9, 56, 57, 72, 3192]\n >>> egyptian_fraction((3, 7), \"Takenouchi\")\n [4, 7, 28]\n >>> egyptian_fraction((3, 7), \"Golomb\")\n [3, 15, 35]\n >>> egyptian_fraction((11, 5), \"Golomb\")\n [1, 2, 3, 4, 9, 234, 1118, 2580]\n\n See Also\n ========\n\n sympy.core.numbers.Rational\n\n Notes\n =====\n\n Currently the following algorithms are supported:\n\n 1) Greedy Algorithm\n\n Also called the Fibonacci-Sylvester algorithm [2]_.\n At each step, extract the largest unit fraction less\n than the target and replace the target with the remainder.\n\n It has some distinct properties:\n\n a) Given `p/q` in lowest terms, generates an expansion of maximum\n length `p`. Even as the numerators get large, the number of\n terms is seldom more than a handful.\n\n b) Uses minimal memory.\n\n c) The terms can blow up (standard examples of this are 5/121 and\n 31/311). The denominator is at most squared at each step\n (doubly-exponential growth) and typically exhibits\n singly-exponential growth.\n\n 2) Graham Jewett Algorithm\n\n The algorithm suggested by the result of Graham and Jewett.\n Note that this has a tendency to blow up: the length of the\n resulting expansion is always ``2**(x/gcd(x, y)) - 1``. See [3]_.\n\n 3) Takenouchi Algorithm\n\n The algorithm suggested by Takenouchi (1921).\n Differs from the Graham-Jewett algorithm only in the handling\n of duplicates. See [3]_.\n\n 4) Golomb's Algorithm\n\n A method given by Golumb (1962), using modular arithmetic and\n inverses. It yields the same results as a method using continued\n fractions proposed by Bleicher (1972). See [4]_.\n\n If the given rational is greater than or equal to 1, a greedy algorithm\n of summing the harmonic sequence 1/1 + 1/2 + 1/3 + ... is used, taking\n all the unit fractions of this sequence until adding one more would be\n greater than the given number. This list of denominators is prefixed\n to the result from the requested algorithm used on the remainder. For\n example, if r is 8/3, using the Greedy algorithm, we get [1, 2, 3, 4,\n 5, 6, 7, 14, 420], where the beginning of the sequence, [1, 2, 3, 4, 5,\n 6, 7] is part of the harmonic sequence summing to 363/140, leaving a\n remainder of 31/420, which yields [14, 420] by the Greedy algorithm.\n The result of egyptian_fraction(Rational(8, 3), \"Golomb\") is [1, 2, 3,\n 4, 5, 6, 7, 14, 574, 2788, 6460, 11590, 33062, 113820], and so on.\n\n References\n ==========\n\n .. [1] https://en.wikipedia.org/wiki/Egyptian_fraction\n .. [2] https://en.wikipedia.org/wiki/Greedy_algorithm_for_Egyptian_fractions\n .. [3] https://www.ics.uci.edu/~eppstein/numth/egypt/conflict.html\n .. [4] https://web.archive.org/web/20180413004012/https://ami.ektf.hu/uploads/papers/finalpdf/AMI_42_from129to134.pdf\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/ntheory/tests/test_egyptian_fraction.py::test_egyptian_fraction", "sympy/ntheory/tests/test_egyptian_fraction.py::test_input" ], "PASS_TO_PASS": null }
sympy__sympy-50
1.0
{ "code": "diff --git b/sympy/crypto/crypto.py a/sympy/crypto/crypto.py\nindex f3504d5feb..62c50072ca 100644\n--- b/sympy/crypto/crypto.py\n+++ a/sympy/crypto/crypto.py\n@@ -271,6 +271,10 @@ def encipher_shift(msg, key, symbols=None):\n decipher_shift\n \n \"\"\"\n+ msg, _, A = _prep(msg, '', symbols)\n+ shift = len(A) - key % len(A)\n+ key = A[shift:] + A[:shift]\n+ return translate(msg, key, A)\n \n \n def decipher_shift(msg, key, symbols=None):\n", "test": null }
null
{ "code": "diff --git a/sympy/crypto/crypto.py b/sympy/crypto/crypto.py\nindex 62c50072ca..f3504d5feb 100644\n--- a/sympy/crypto/crypto.py\n+++ b/sympy/crypto/crypto.py\n@@ -271,10 +271,6 @@ def encipher_shift(msg, key, symbols=None):\n decipher_shift\n \n \"\"\"\n- msg, _, A = _prep(msg, '', symbols)\n- shift = len(A) - key % len(A)\n- key = A[shift:] + A[:shift]\n- return translate(msg, key, A)\n \n \n def decipher_shift(msg, key, symbols=None):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/crypto/crypto.py.\nHere is the description for the function:\ndef encipher_shift(msg, key, symbols=None):\n \"\"\"\n Performs shift cipher encryption on plaintext msg, and returns the\n ciphertext.\n\n Parameters\n ==========\n\n key : int\n The secret key.\n\n msg : str\n Plaintext of upper-case letters.\n\n Returns\n =======\n\n str\n Ciphertext of upper-case letters.\n\n Examples\n ========\n\n >>> from sympy.crypto.crypto import encipher_shift, decipher_shift\n >>> msg = \"GONAVYBEATARMY\"\n >>> ct = encipher_shift(msg, 1); ct\n 'HPOBWZCFBUBSNZ'\n\n To decipher the shifted text, change the sign of the key:\n\n >>> encipher_shift(ct, -1)\n 'GONAVYBEATARMY'\n\n There is also a convenience function that does this with the\n original key:\n\n >>> decipher_shift(ct, 1)\n 'GONAVYBEATARMY'\n\n Notes\n =====\n\n ALGORITHM:\n\n STEPS:\n 0. Number the letters of the alphabet from 0, ..., N\n 1. Compute from the string ``msg`` a list ``L1`` of\n corresponding integers.\n 2. Compute from the list ``L1`` a new list ``L2``, given by\n adding ``(k mod 26)`` to each element in ``L1``.\n 3. Compute from the list ``L2`` a string ``ct`` of\n corresponding letters.\n\n The shift cipher is also called the Caesar cipher, after\n Julius Caesar, who, according to Suetonius, used it with a\n shift of three to protect messages of military significance.\n Caesar's nephew Augustus reportedly used a similar cipher, but\n with a right shift of 1.\n\n References\n ==========\n\n .. [1] https://en.wikipedia.org/wiki/Caesar_cipher\n .. [2] https://mathworld.wolfram.com/CaesarsMethod.html\n\n See Also\n ========\n\n decipher_shift\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/crypto/tests/test_crypto.py::test_encipher_shift", "sympy/crypto/tests/test_crypto.py::test_encipher_rot13" ], "PASS_TO_PASS": null }
sympy__sympy-51
1.0
{ "code": "diff --git b/sympy/crypto/crypto.py a/sympy/crypto/crypto.py\nindex 575f563429..62c50072ca 100644\n--- b/sympy/crypto/crypto.py\n+++ a/sympy/crypto/crypto.py\n@@ -753,6 +753,16 @@ def encipher_vigenere(msg, key, symbols=None):\n (short URL: https://goo.gl/ijr22d)\n \n \"\"\"\n+ msg, key, A = _prep(msg, key, symbols)\n+ map = {c: i for i, c in enumerate(A)}\n+ key = [map[c] for c in key]\n+ N = len(map)\n+ k = len(key)\n+ rv = []\n+ for i, m in enumerate(msg):\n+ rv.append(A[(map[m] + key[i % k]) % N])\n+ rv = ''.join(rv)\n+ return rv\n \n \n def decipher_vigenere(msg, key, symbols=None):\n", "test": null }
null
{ "code": "diff --git a/sympy/crypto/crypto.py b/sympy/crypto/crypto.py\nindex 62c50072ca..575f563429 100644\n--- a/sympy/crypto/crypto.py\n+++ b/sympy/crypto/crypto.py\n@@ -753,16 +753,6 @@ def encipher_vigenere(msg, key, symbols=None):\n (short URL: https://goo.gl/ijr22d)\n \n \"\"\"\n- msg, key, A = _prep(msg, key, symbols)\n- map = {c: i for i, c in enumerate(A)}\n- key = [map[c] for c in key]\n- N = len(map)\n- k = len(key)\n- rv = []\n- for i, m in enumerate(msg):\n- rv.append(A[(map[m] + key[i % k]) % N])\n- rv = ''.join(rv)\n- return rv\n \n \n def decipher_vigenere(msg, key, symbols=None):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/crypto/crypto.py.\nHere is the description for the function:\ndef encipher_vigenere(msg, key, symbols=None):\n \"\"\"\n Performs the Vigenere cipher encryption on plaintext ``msg``, and\n returns the ciphertext.\n\n Examples\n ========\n\n >>> from sympy.crypto.crypto import encipher_vigenere, AZ\n >>> key = \"encrypt\"\n >>> msg = \"meet me on monday\"\n >>> encipher_vigenere(msg, key)\n 'QRGKKTHRZQEBPR'\n\n Section 1 of the Kryptos sculpture at the CIA headquarters\n uses this cipher and also changes the order of the\n alphabet [2]_. Here is the first line of that section of\n the sculpture:\n\n >>> from sympy.crypto.crypto import decipher_vigenere, padded_key\n >>> alp = padded_key('KRYPTOS', AZ())\n >>> key = 'PALIMPSEST'\n >>> msg = 'EMUFPHZLRFAXYUSDJKZLDKRNSHGNFIVJ'\n >>> decipher_vigenere(msg, key, alp)\n 'BETWEENSUBTLESHADINGANDTHEABSENC'\n\n Explanation\n ===========\n\n The Vigenere cipher is named after Blaise de Vigenere, a sixteenth\n century diplomat and cryptographer, by a historical accident.\n Vigenere actually invented a different and more complicated cipher.\n The so-called *Vigenere cipher* was actually invented\n by Giovan Batista Belaso in 1553.\n\n This cipher was used in the 1800's, for example, during the American\n Civil War. The Confederacy used a brass cipher disk to implement the\n Vigenere cipher (now on display in the NSA Museum in Fort\n Meade) [1]_.\n\n The Vigenere cipher is a generalization of the shift cipher.\n Whereas the shift cipher shifts each letter by the same amount\n (that amount being the key of the shift cipher) the Vigenere\n cipher shifts a letter by an amount determined by the key (which is\n a word or phrase known only to the sender and receiver).\n\n For example, if the key was a single letter, such as \"C\", then the\n so-called Vigenere cipher is actually a shift cipher with a\n shift of `2` (since \"C\" is the 2nd letter of the alphabet, if\n you start counting at `0`). If the key was a word with two\n letters, such as \"CA\", then the so-called Vigenere cipher will\n shift letters in even positions by `2` and letters in odd positions\n are left alone (shifted by `0`, since \"A\" is the 0th letter, if\n you start counting at `0`).\n\n\n ALGORITHM:\n\n INPUT:\n\n ``msg``: string of characters that appear in ``symbols``\n (the plaintext)\n\n ``key``: a string of characters that appear in ``symbols``\n (the secret key)\n\n ``symbols``: a string of letters defining the alphabet\n\n\n OUTPUT:\n\n ``ct``: string of characters (the ciphertext message)\n\n STEPS:\n 0. Number the letters of the alphabet from 0, ..., N\n 1. Compute from the string ``key`` a list ``L1`` of\n corresponding integers. Let ``n1 = len(L1)``.\n 2. Compute from the string ``msg`` a list ``L2`` of\n corresponding integers. Let ``n2 = len(L2)``.\n 3. Break ``L2`` up sequentially into sublists of size\n ``n1``; the last sublist may be smaller than ``n1``\n 4. For each of these sublists ``L`` of ``L2``, compute a\n new list ``C`` given by ``C[i] = L[i] + L1[i] (mod N)``\n to the ``i``-th element in the sublist, for each ``i``.\n 5. Assemble these lists ``C`` by concatenation into a new\n list of length ``n2``.\n 6. Compute from the new list a string ``ct`` of\n corresponding letters.\n\n Once it is known that the key is, say, `n` characters long,\n frequency analysis can be applied to every `n`-th letter of\n the ciphertext to determine the plaintext. This method is\n called *Kasiski examination* (although it was first discovered\n by Babbage). If they key is as long as the message and is\n comprised of randomly selected characters -- a one-time pad -- the\n message is theoretically unbreakable.\n\n The cipher Vigenere actually discovered is an \"auto-key\" cipher\n described as follows.\n\n ALGORITHM:\n\n INPUT:\n\n ``key``: a string of letters (the secret key)\n\n ``msg``: string of letters (the plaintext message)\n\n OUTPUT:\n\n ``ct``: string of upper-case letters (the ciphertext message)\n\n STEPS:\n 0. Number the letters of the alphabet from 0, ..., N\n 1. Compute from the string ``msg`` a list ``L2`` of\n corresponding integers. Let ``n2 = len(L2)``.\n 2. Let ``n1`` be the length of the key. Append to the\n string ``key`` the first ``n2 - n1`` characters of\n the plaintext message. Compute from this string (also of\n length ``n2``) a list ``L1`` of integers corresponding\n to the letter numbers in the first step.\n 3. Compute a new list ``C`` given by\n ``C[i] = L1[i] + L2[i] (mod N)``.\n 4. Compute from the new list a string ``ct`` of letters\n corresponding to the new integers.\n\n To decipher the auto-key ciphertext, the key is used to decipher\n the first ``n1`` characters and then those characters become the\n key to decipher the next ``n1`` characters, etc...:\n\n >>> m = AZ('go navy, beat army! yes you can'); m\n 'GONAVYBEATARMYYESYOUCAN'\n >>> key = AZ('gold bug'); n1 = len(key); n2 = len(m)\n >>> auto_key = key + m[:n2 - n1]; auto_key\n 'GOLDBUGGONAVYBEATARMYYE'\n >>> ct = encipher_vigenere(m, auto_key); ct\n 'MCYDWSHKOGAMKZCELYFGAYR'\n >>> n1 = len(key)\n >>> pt = []\n >>> while ct:\n ... part, ct = ct[:n1], ct[n1:]\n ... pt.append(decipher_vigenere(part, key))\n ... key = pt[-1]\n ...\n >>> ''.join(pt) == m\n True\n\n References\n ==========\n\n .. [1] https://en.wikipedia.org/wiki/Vigenere_cipher\n .. [2] https://web.archive.org/web/20071116100808/https://filebox.vt.edu/users/batman/kryptos.html\n (short URL: https://goo.gl/ijr22d)\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/crypto/tests/test_crypto.py::test_encipher_vigenere" ], "PASS_TO_PASS": null }
sympy__sympy-52
1.0
{ "code": "diff --git b/sympy/physics/secondquant.py a/sympy/physics/secondquant.py\nindex a9f68aa5fa..6e2cc218e2 100644\n--- b/sympy/physics/secondquant.py\n+++ a/sympy/physics/secondquant.py\n@@ -2356,6 +2356,49 @@ def evaluate_deltas(e):\n f(_i)*KroneckerDelta(_i, _p)\n \"\"\"\n \n+ # We treat Deltas only in mul objects\n+ # for general function objects we don't evaluate KroneckerDeltas in arguments,\n+ # but here we hard code exceptions to this rule\n+ accepted_functions = (\n+ Add,\n+ )\n+ if isinstance(e, accepted_functions):\n+ return e.func(*[evaluate_deltas(arg) for arg in e.args])\n+\n+ elif isinstance(e, Mul):\n+ # find all occurrences of delta function and count each index present in\n+ # expression.\n+ deltas = []\n+ indices = {}\n+ for i in e.args:\n+ for s in i.free_symbols:\n+ if s in indices:\n+ indices[s] += 1\n+ else:\n+ indices[s] = 0 # geek counting simplifies logic below\n+ if isinstance(i, KroneckerDelta):\n+ deltas.append(i)\n+\n+ for d in deltas:\n+ # If we do something, and there are more deltas, we should recurse\n+ # to treat the resulting expression properly\n+ if d.killable_index.is_Symbol and indices[d.killable_index]:\n+ e = e.subs(d.killable_index, d.preferred_index)\n+ if len(deltas) > 1:\n+ return evaluate_deltas(e)\n+ elif (d.preferred_index.is_Symbol and indices[d.preferred_index]\n+ and d.indices_contain_equal_information):\n+ e = e.subs(d.preferred_index, d.killable_index)\n+ if len(deltas) > 1:\n+ return evaluate_deltas(e)\n+ else:\n+ pass\n+\n+ return e\n+ # nothing to do, maybe we hit a Symbol or a number\n+ else:\n+ return e\n+\n \n def substitute_dummies(expr, new_indices=False, pretty_indices={}):\n \"\"\"\n", "test": null }
null
{ "code": "diff --git a/sympy/physics/secondquant.py b/sympy/physics/secondquant.py\nindex 6e2cc218e2..a9f68aa5fa 100644\n--- a/sympy/physics/secondquant.py\n+++ b/sympy/physics/secondquant.py\n@@ -2356,49 +2356,6 @@ def evaluate_deltas(e):\n f(_i)*KroneckerDelta(_i, _p)\n \"\"\"\n \n- # We treat Deltas only in mul objects\n- # for general function objects we don't evaluate KroneckerDeltas in arguments,\n- # but here we hard code exceptions to this rule\n- accepted_functions = (\n- Add,\n- )\n- if isinstance(e, accepted_functions):\n- return e.func(*[evaluate_deltas(arg) for arg in e.args])\n-\n- elif isinstance(e, Mul):\n- # find all occurrences of delta function and count each index present in\n- # expression.\n- deltas = []\n- indices = {}\n- for i in e.args:\n- for s in i.free_symbols:\n- if s in indices:\n- indices[s] += 1\n- else:\n- indices[s] = 0 # geek counting simplifies logic below\n- if isinstance(i, KroneckerDelta):\n- deltas.append(i)\n-\n- for d in deltas:\n- # If we do something, and there are more deltas, we should recurse\n- # to treat the resulting expression properly\n- if d.killable_index.is_Symbol and indices[d.killable_index]:\n- e = e.subs(d.killable_index, d.preferred_index)\n- if len(deltas) > 1:\n- return evaluate_deltas(e)\n- elif (d.preferred_index.is_Symbol and indices[d.preferred_index]\n- and d.indices_contain_equal_information):\n- e = e.subs(d.preferred_index, d.killable_index)\n- if len(deltas) > 1:\n- return evaluate_deltas(e)\n- else:\n- pass\n-\n- return e\n- # nothing to do, maybe we hit a Symbol or a number\n- else:\n- return e\n-\n \n def substitute_dummies(expr, new_indices=False, pretty_indices={}):\n \"\"\"\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/physics/secondquant.py.\nHere is the description for the function:\ndef evaluate_deltas(e):\n \"\"\"\n We evaluate KroneckerDelta symbols in the expression assuming Einstein summation.\n\n Explanation\n ===========\n\n If one index is repeated it is summed over and in effect substituted with\n the other one. If both indices are repeated we substitute according to what\n is the preferred index. this is determined by\n KroneckerDelta.preferred_index and KroneckerDelta.killable_index.\n\n In case there are no possible substitutions or if a substitution would\n imply a loss of information, nothing is done.\n\n In case an index appears in more than one KroneckerDelta, the resulting\n substitution depends on the order of the factors. Since the ordering is platform\n dependent, the literal expression resulting from this function may be hard to\n predict.\n\n Examples\n ========\n\n We assume the following:\n\n >>> from sympy import symbols, Function, Dummy, KroneckerDelta\n >>> from sympy.physics.secondquant import evaluate_deltas\n >>> i,j = symbols('i j', below_fermi=True, cls=Dummy)\n >>> a,b = symbols('a b', above_fermi=True, cls=Dummy)\n >>> p,q = symbols('p q', cls=Dummy)\n >>> f = Function('f')\n >>> t = Function('t')\n\n The order of preference for these indices according to KroneckerDelta is\n (a, b, i, j, p, q).\n\n Trivial cases:\n\n >>> evaluate_deltas(KroneckerDelta(i,j)*f(i)) # d_ij f(i) -> f(j)\n f(_j)\n >>> evaluate_deltas(KroneckerDelta(i,j)*f(j)) # d_ij f(j) -> f(i)\n f(_i)\n >>> evaluate_deltas(KroneckerDelta(i,p)*f(p)) # d_ip f(p) -> f(i)\n f(_i)\n >>> evaluate_deltas(KroneckerDelta(q,p)*f(p)) # d_qp f(p) -> f(q)\n f(_q)\n >>> evaluate_deltas(KroneckerDelta(q,p)*f(q)) # d_qp f(q) -> f(p)\n f(_p)\n\n More interesting cases:\n\n >>> evaluate_deltas(KroneckerDelta(i,p)*t(a,i)*f(p,q))\n f(_i, _q)*t(_a, _i)\n >>> evaluate_deltas(KroneckerDelta(a,p)*t(a,i)*f(p,q))\n f(_a, _q)*t(_a, _i)\n >>> evaluate_deltas(KroneckerDelta(p,q)*f(p,q))\n f(_p, _p)\n\n Finally, here are some cases where nothing is done, because that would\n imply a loss of information:\n\n >>> evaluate_deltas(KroneckerDelta(i,p)*f(q))\n f(_q)*KroneckerDelta(_i, _p)\n >>> evaluate_deltas(KroneckerDelta(i,p)*f(i))\n f(_i)*KroneckerDelta(_i, _p)\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/physics/tests/test_secondquant.py::test_contraction", "sympy/physics/tests/test_secondquant.py::test_evaluate_deltas", "sympy/physics/tests/test_secondquant.py::test_fully_contracted", "sympy/functions/special/tests/test_tensor_functions.py::test_kronecker_delta_secondquant" ], "PASS_TO_PASS": null }
sympy__sympy-53
1.0
{ "code": "diff --git b/sympy/core/function.py a/sympy/core/function.py\nindex ebc0c96a81..97ac4c051a 100644\n--- b/sympy/core/function.py\n+++ a/sympy/core/function.py\n@@ -3048,6 +3048,9 @@ def expand_power_base(expr, deep=True, force=False):\n expand\n \n \"\"\"\n+ return sympify(expr).expand(deep=deep, log=False, mul=False,\n+ power_exp=False, power_base=True, multinomial=False,\n+ basic=False, force=force)\n \n \n def expand_power_exp(expr, deep=True):\n", "test": null }
null
{ "code": "diff --git a/sympy/core/function.py b/sympy/core/function.py\nindex 97ac4c051a..ebc0c96a81 100644\n--- a/sympy/core/function.py\n+++ b/sympy/core/function.py\n@@ -3048,9 +3048,6 @@ def expand_power_base(expr, deep=True, force=False):\n expand\n \n \"\"\"\n- return sympify(expr).expand(deep=deep, log=False, mul=False,\n- power_exp=False, power_base=True, multinomial=False,\n- basic=False, force=force)\n \n \n def expand_power_exp(expr, deep=True):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/core/function.py.\nHere is the description for the function:\ndef expand_power_base(expr, deep=True, force=False):\n \"\"\"\n Wrapper around expand that only uses the power_base hint.\n\n A wrapper to expand(power_base=True) which separates a power with a base\n that is a Mul into a product of powers, without performing any other\n expansions, provided that assumptions about the power's base and exponent\n allow.\n\n deep=False (default is True) will only apply to the top-level expression.\n\n force=True (default is False) will cause the expansion to ignore\n assumptions about the base and exponent. When False, the expansion will\n only happen if the base is non-negative or the exponent is an integer.\n\n >>> from sympy.abc import x, y, z\n >>> from sympy import expand_power_base, sin, cos, exp, Symbol\n\n >>> (x*y)**2\n x**2*y**2\n\n >>> (2*x)**y\n (2*x)**y\n >>> expand_power_base(_)\n 2**y*x**y\n\n >>> expand_power_base((x*y)**z)\n (x*y)**z\n >>> expand_power_base((x*y)**z, force=True)\n x**z*y**z\n >>> expand_power_base(sin((x*y)**z), deep=False)\n sin((x*y)**z)\n >>> expand_power_base(sin((x*y)**z), force=True)\n sin(x**z*y**z)\n\n >>> expand_power_base((2*sin(x))**y + (2*cos(x))**y)\n 2**y*sin(x)**y + 2**y*cos(x)**y\n\n >>> expand_power_base((2*exp(y))**x)\n 2**x*exp(y)**x\n\n >>> expand_power_base((2*cos(x))**y)\n 2**y*cos(x)**y\n\n Notice that sums are left untouched. If this is not the desired behavior,\n apply full ``expand()`` to the expression:\n\n >>> expand_power_base(((x+y)*z)**2)\n z**2*(x + y)**2\n >>> (((x+y)*z)**2).expand()\n x**2*z**2 + 2*x*y*z**2 + y**2*z**2\n\n >>> expand_power_base((2*y)**(1+z))\n 2**(z + 1)*y**(z + 1)\n >>> ((2*y)**(1+z)).expand()\n 2*2**z*y**(z + 1)\n\n The power that is unexpanded can be expanded safely when\n ``y != 0``, otherwise different values might be obtained for the expression:\n\n >>> prev = _\n\n If we indicate that ``y`` is positive but then replace it with\n a value of 0 after expansion, the expression becomes 0:\n\n >>> p = Symbol('p', positive=True)\n >>> prev.subs(y, p).expand().subs(p, 0)\n 0\n\n But if ``z = -1`` the expression would not be zero:\n\n >>> prev.subs(y, 0).subs(z, -1)\n 1\n\n See Also\n ========\n\n expand\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/integrals/tests/test_integrals.py::test_improper_integral", "sympy/utilities/tests/test_wester.py::test_C20", "sympy/solvers/tests/test_solveset.py::test_invert_real", "sympy/series/tests/test_limits.py::test_basic1", "sympy/solvers/tests/test_solvers.py::test_swap_back", "sympy/sets/tests/test_sets.py::test_imageset", "sympy/core/tests/test_arit.py::test_bug1", "sympy/series/tests/test_nseries.py::test_simple_1", "sympy/stats/tests/test_continuous_rv.py::test_single_normal", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise1", "sympy/series/tests/test_order.py::test_caching_bug", "sympy/functions/elementary/tests/test_trigonometric.py::test_sin", "sympy/matrices/tests/test_matrixbase.py::test_limit", "sympy/functions/elementary/tests/test_hyperbolic.py::test_sinh_series", "sympy/series/tests/test_limits.py::test_basic2", "sympy/printing/tests/test_str.py::test_Add", "sympy/utilities/tests/test_wester.py::test_C21", "sympy/simplify/tests/test_simplify.py::test_simplify_expr", "sympy/series/tests/test_order.py::test_free_symbols", "sympy/polys/tests/test_polytools.py::test_Poly_rootof_extension_to_sympy", "sympy/core/tests/test_expr.py::test_series_expansion_for_uniform_order", "sympy/series/tests/test_nseries.py::test_mul_0", "sympy/matrices/tests/test_matrices.py::test_multiplication_inf_zero", "sympy/series/tests/test_order.py::test_simple_1", "sympy/printing/tests/test_latex.py::test_latex_functions", "sympy/concrete/tests/test_sums_products.py::test_arithmetic_sums", "sympy/series/tests/test_order.py::test_simple_2", "sympy/functions/elementary/tests/test_hyperbolic.py::test_cosh_series", "sympy/stats/tests/test_continuous_rv.py::test_conditional_1d", "sympy/printing/pretty/tests/test_pretty.py::test_pretty_ordering", "sympy/core/tests/test_evalf.py::test_evalf_integer_parts", "sympy/core/tests/test_expr.py::test_leadterm", "sympy/series/tests/test_order.py::test_simple_3", "sympy/series/tests/test_nseries.py::test_mul_1", "sympy/integrals/tests/test_integrals.py::test_multiple_integration", "sympy/series/tests/test_order.py::test_simple_4", "sympy/sets/tests/test_sets.py::test_intersect1", "sympy/series/tests/test_order.py::test_simple_5", "sympy/functions/elementary/tests/test_hyperbolic.py::test_tanh_series", "sympy/printing/tests/test_latex.py::test_latex_FourierSeries", "sympy/core/tests/test_expr.py::test_as_leading_term", "sympy/stats/tests/test_continuous_rv.py::test_multiple_normal", "sympy/printing/tests/test_latex.py::test_latex_FormalPowerSeries", "sympy/simplify/tests/test_cse.py::test_ignore_order_terms", "sympy/series/tests/test_nseries.py::test_pow_0", "sympy/series/tests/test_limits.py::test_basic3", "sympy/series/tests/test_order.py::test_simple_6", "sympy/solvers/tests/test_solveset.py::test_invert_trig_hyp_real", "sympy/solvers/tests/test_solvers.py::test_guess_transcendental", "sympy/concrete/tests/test_sums_products.py::test_geometric_sums", "sympy/series/tests/test_order.py::test_simple_7", "sympy/series/tests/test_nseries.py::test_pow_1", "sympy/core/tests/test_expr.py::test_leadterm2", "sympy/printing/tests/test_str.py::test_Order", "sympy/core/tests/test_function.py::test_function__eval_nseries", "sympy/series/tests/test_limits.py::test_basic4", "sympy/functions/elementary/tests/test_hyperbolic.py::test_coth_series", "sympy/integrals/tests/test_integrals.py::test_issue_3532", "sympy/utilities/tests/test_lambdify.py::test_sym_integral", "sympy/series/tests/test_order.py::test_simple_8", "sympy/printing/pretty/tests/test_pretty.py::test_pretty_order", "sympy/series/tests/test_order.py::test_as_expr_variables", "sympy/core/tests/test_arit.py::test_Add_is_negative_positive", "sympy/stats/tests/test_continuous_rv.py::test_symbolic", "sympy/series/tests/test_order.py::test_contains_0", "sympy/core/tests/test_expr.py::test_leadterm3", "sympy/series/tests/test_nseries.py::test_geometric_1", "sympy/series/tests/test_order.py::test_contains_1", "sympy/functions/elementary/tests/test_hyperbolic.py::test_csch_series", "sympy/series/tests/test_order.py::test_contains_2", "sympy/series/tests/test_limits.py::test_log", "sympy/series/tests/test_order.py::test_contains_3", "sympy/core/tests/test_expr.py::test_as_leading_term2", "sympy/printing/tests/test_str.py::test_Sum", "sympy/core/tests/test_function.py::test_issue_7231", "sympy/core/tests/test_assumptions.py::test_special_assumptions", "sympy/series/tests/test_nseries.py::test_sqrt_1", "sympy/series/tests/test_order.py::test_contains_4", "sympy/solvers/tests/test_solvers.py::test_solve_args", "sympy/stats/tests/test_continuous_rv.py::test_cdf", "sympy/core/tests/test_expr.py::test_as_leading_term3", "sympy/series/tests/test_limits.py::test_piecewise", "sympy/functions/elementary/tests/test_hyperbolic.py::test_sech_series", "sympy/series/tests/test_nseries.py::test_exp_1", "sympy/polys/tests/test_rings.py::test_issue_18894", "sympy/core/tests/test_expr.py::test_as_leading_term4", "sympy/series/tests/test_order.py::test_contains", "sympy/integrals/tests/test_integrals.py::test_issue_3664", "sympy/series/tests/test_order.py::test_add_1", "sympy/sets/tests/test_sets.py::test_is_subset", "sympy/series/tests/test_nseries.py::test_exp_sqrt_1", "sympy/solvers/tests/test_solveset.py::test_invert_complex", "sympy/printing/pretty/tests/test_pretty.py::test_pretty_FourierSeries", "sympy/simplify/tests/test_simplify.py::test_nthroot", "sympy/series/tests/test_order.py::test_ln_args", "sympy/functions/elementary/tests/test_hyperbolic.py::test_asinh_leading_term", "sympy/core/tests/test_numbers.py::test_simplify_AlgebraicNumber", "sympy/series/tests/test_limits.py::test_piecewise2", "sympy/printing/pretty/tests/test_pretty.py::test_pretty_FormalPowerSeries", "sympy/integrals/tests/test_integrals.py::test_issue_3686", "sympy/sets/tests/test_sets.py::test_contains", "sympy/matrices/tests/test_determinant.py::test_issue_14517", "sympy/matrices/tests/test_commonmatrix.py::test_limit", "sympy/core/tests/test_expr.py::test_as_leading_term_stub", "sympy/series/tests/test_order.py::test_multivar_0", "sympy/matrices/tests/test_matrixbase.py::test_issue_17247_expression_blowup_12", "sympy/series/tests/test_nseries.py::test_power_x_x1", "sympy/matrices/tests/test_matrices.py::test_issue_17247_expression_blowup_12", "sympy/stats/tests/test_continuous_rv.py::test_ContinuousRV", "sympy/series/tests/test_order.py::test_multivar_0a", "sympy/core/tests/test_expr.py::test_as_leading_term_deriv_integral", "sympy/series/tests/test_order.py::test_multivar_1", "sympy/logic/tests/test_boolalg.py::test_bool_as_set", "sympy/sets/tests/test_fancysets.py::test_Integers_eval_imageset", "sympy/series/tests/test_order.py::test_multivar_2", "sympy/integrals/tests/test_integrals.py::test_transcendental_functions", "sympy/series/tests/test_nseries.py::test_power_x_x2", "sympy/functions/elementary/tests/test_trigonometric.py::test_sin_series", "sympy/series/tests/test_order.py::test_multivar_mul_1", "sympy/functions/elementary/tests/test_hyperbolic.py::test_asinh_series", "sympy/series/tests/test_order.py::test_multivar_3", "sympy/series/tests/test_limits.py::test_basic5", "sympy/core/tests/test_evalf.py::test_issue_4806", "sympy/stats/tests/test_continuous_rv.py::test_beta", "sympy/series/tests/test_nseries.py::test_log_singular1", "sympy/series/tests/test_order.py::test_issue_3468", "sympy/series/tests/test_order.py::test_leading_order", "sympy/sets/tests/test_fancysets.py::test_imageset_intersect_real", "sympy/integrals/tests/test_integrals.py::test_log_polylog", "sympy/series/tests/test_order.py::test_leading_order2", "sympy/series/tests/test_nseries.py::test_log_power1", "sympy/series/tests/test_limits.py::test_issue_3885", "sympy/stats/tests/test_continuous_rv.py::test_betaprime", "sympy/core/tests/test_expr.py::test_replace", "sympy/functions/elementary/tests/test_hyperbolic.py::test_asinh_nseries", "sympy/core/tests/test_arit.py::test_issue_8247_8354", "sympy/sets/tests/test_fancysets.py::test_imageset_intersect_diophantine", "sympy/series/tests/test_order.py::test_order_leadterm", "sympy/series/tests/test_order.py::test_order_symbols", "sympy/sets/tests/test_sets.py::test_image_interval", "sympy/matrices/tests/test_matrixbase.py::test_issue_17247_expression_blowup_19", "sympy/matrices/tests/test_matrices.py::test_issue_17247_expression_blowup_19", "sympy/integrals/tests/test_integrals.py::test_issue_3788", "sympy/core/tests/test_expr.py::test_as_coeff_exponent", "sympy/series/tests/test_nseries.py::test_log_series", "sympy/series/tests/test_order.py::test_nan", "sympy/series/tests/test_limits.py::test_Limit", "sympy/series/tests/test_order.py::test_O1", "sympy/core/tests/test_function.py::test_issue_10503", "sympy/series/tests/test_order.py::test_getn", "sympy/sets/tests/test_fancysets.py::test_ImageSet_simplification", "sympy/series/tests/test_order.py::test_diff", "sympy/stats/tests/test_continuous_rv.py::test_BoundedPareto", "sympy/sets/tests/test_sets.py::test_image_piecewise", "sympy/series/tests/test_nseries.py::test_log3", "sympy/core/tests/test_arit.py::test_Add_is_zero", "sympy/series/tests/test_limits.py::test_floor", "sympy/core/tests/test_expr.py::test_action_verbs", "sympy/series/tests/test_order.py::test_getO", "sympy/sets/tests/test_fancysets.py::test_ImageSet_contains", "sympy/series/tests/test_order.py::test_leading_term", "sympy/integrals/tests/test_integrals.py::test_issue_7450", "sympy/series/tests/test_limits.py::test_floor_requires_robust_assumptions", "sympy/series/tests/test_nseries.py::test_series1", "sympy/simplify/tests/test_simplify.py::test_nthroot1", "sympy/core/tests/test_expr.py::test_eval_interval", "sympy/matrices/tests/test_matrices.py::test_issue_17247_expression_blowup_23", "sympy/functions/elementary/tests/test_trigonometric.py::test_cos_series", "sympy/functions/elementary/tests/test_hyperbolic.py::test_acosh_leading_term", "sympy/series/tests/test_order.py::test_eval", "sympy/series/tests/test_nseries.py::test_seriesbug1", "sympy/integrals/tests/test_integrals.py::test_issue_8623", "sympy/series/tests/test_order.py::test_issue_4279", "sympy/series/tests/test_order.py::test_issue_4855", "sympy/polys/tests/test_polytools.py::test_issue_20427", "sympy/matrices/tests/test_matrixbase.py::test_issue_17247_expression_blowup_23", "sympy/series/tests/test_order.py::test_order_conjugate_transpose", "sympy/core/tests/test_expr.py::test_eval_interval_zoo", "sympy/sets/tests/test_fancysets.py::test_ComplexRegion_union", "sympy/stats/tests/test_continuous_rv.py::test_chi_squared", "sympy/series/tests/test_limits.py::test_ceiling", "sympy/series/tests/test_order.py::test_order_noncommutative", "sympy/series/tests/test_nseries.py::test_series2x", "sympy/integrals/tests/test_integrals.py::test_issue_9569", "sympy/matrices/tests/test_matrices.py::test_issue_17247_expression_blowup_24", "sympy/series/tests/test_order.py::test_issue_6753", "sympy/series/tests/test_nseries.py::test_bug2", "sympy/core/tests/test_match.py::test_match_exclude", "sympy/sets/tests/test_sets.py::test_issue_10113", "sympy/functions/elementary/tests/test_hyperbolic.py::test_acosh_series", "sympy/core/tests/test_expr.py::test_equals", "sympy/integrals/tests/test_integrals.py::test_issue_13733", "sympy/matrices/tests/test_matrixbase.py::test_issue_17247_expression_blowup_24", "sympy/stats/tests/test_continuous_rv.py::test_exgaussian", "sympy/series/tests/test_order.py::test_order_at_infinity", "sympy/series/tests/test_limits.py::test_ceiling_requires_robust_assumptions", "sympy/series/tests/test_nseries.py::test_exp", "sympy/functions/elementary/tests/test_hyperbolic.py::test_acosh_nseries", "sympy/core/tests/test_args.py::test_sympy__series__order__Order", "sympy/functions/elementary/tests/test_trigonometric.py::test_tan_series", "sympy/matrices/tests/test_matrices.py::test_issue_17247_expression_blowup_25", "sympy/series/tests/test_order.py::test_mixing_order_at_zero_and_infinity", "sympy/core/tests/test_power.py::test_nseries", "sympy/core/tests/test_match.py::test_derivative2", "sympy/series/tests/test_limits.py::test_frac", "sympy/physics/control/tests/test_lti.py::test_TransferFunction_functions", "sympy/series/tests/test_order.py::test_order_at_some_point", "sympy/series/tests/test_nseries.py::test_exp2", "sympy/series/tests/test_order.py::test_order_subs_limits", "sympy/series/tests/test_series.py::test_sin", "sympy/core/tests/test_args.py::test_sympy__series__fourier__FourierSeries", "sympy/core/tests/test_power.py::test_issue_6990", "sympy/matrices/tests/test_matrixbase.py::test_issue_17247_expression_blowup_25", "sympy/integrals/tests/test_integrals.py::test_issue_13749", "sympy/simplify/tests/test_simplify.py::test_besselsimp", "sympy/series/tests/test_order.py::test_issue_9351", "sympy/series/tests/test_series.py::test_cos", "sympy/series/tests/test_limits.py::test_issue_14355", "sympy/core/tests/test_match.py::test_match_polynomial", "sympy/functions/combinatorial/tests/test_comb_numbers.py::test_fibonacci", "sympy/series/tests/test_nseries.py::test_bug3", "sympy/functions/elementary/tests/test_exponential.py::test_exp_leading_term", "sympy/functions/elementary/tests/test_hyperbolic.py::test_asech_leading_term", "sympy/polys/tests/test_polytools.py::test_factor", "sympy/integrals/tests/test_integrals.py::test_issue_18133", "sympy/functions/combinatorial/tests/test_comb_numbers.py::test_tribonacci", "sympy/series/tests/test_series.py::test_exp", "sympy/core/tests/test_power.py::test_issue_6068", "sympy/core/tests/test_args.py::test_sympy__series__formal__FormalPowerSeries", "sympy/series/tests/test_order.py::test_issue_9910", "sympy/core/tests/test_match.py::test_issue_3883", "sympy/series/tests/test_nseries.py::test_generalexponent", "sympy/series/tests/test_limits.py::test_atan", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_series", "sympy/simplify/tests/test_simplify.py::test_issue_6920", "sympy/stats/tests/test_continuous_rv.py::test_Lomax", "sympy/functions/elementary/tests/test_exponential.py::test_log_exact", "sympy/series/tests/test_series.py::test_exp2", "sympy/series/tests/test_nseries.py::test_genexp_x", "sympy/functions/combinatorial/tests/test_comb_numbers.py::test_bell", "sympy/core/tests/test_match.py::test_match_issue_17397", "sympy/series/tests/test_gruntz.py::test_gruntz_Ei", "sympy/core/tests/test_power.py::test_issue_6782", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_11045", "sympy/functions/elementary/tests/test_hyperbolic.py::test_asech_series", "sympy/series/tests/test_order.py::test_performance_of_adding_order", "sympy/series/tests/test_nseries.py::test_genexp_x2", "sympy/integrals/tests/test_integrals.py::test_issue_21741", "sympy/series/tests/test_order.py::test_issue_14622", "sympy/series/tests/test_order.py::test_issue_15539", "sympy/stats/tests/test_continuous_rv.py::test_maxwell", "sympy/core/tests/test_args.py::test_sympy__series__formal__FormalPowerSeriesProduct", "sympy/series/tests/test_series.py::test_issue_5223", "sympy/core/tests/test_power.py::test_issue_6653", "sympy/functions/elementary/tests/test_hyperbolic.py::test_asech_nseries", "sympy/series/tests/test_limits.py::test_set_signs", "sympy/functions/elementary/tests/test_trigonometric.py::test_cot_series", "sympy/stats/tests/test_rv.py::test_H", "sympy/series/tests/test_gruntz.py::test_gruntz_hyperbolic", "sympy/solvers/ode/tests/test_ode.py::test_dsolve_all_hint", "sympy/integrals/tests/test_manual.py::test_manualintegrate_polynomials", "sympy/series/tests/test_nseries.py::test_seriesbug2", "sympy/series/tests/test_series.py::test_issue_6350", "sympy/series/tests/test_order.py::test_issue_22165", "sympy/polys/tests/test_rootoftools.py::test_CRootOf___eval_Eq__", "sympy/core/tests/test_power.py::test_issue_6429", "sympy/series/tests/test_limits.py::test_heuristic", "sympy/polys/tests/test_polyroots.py::test_issue_7724", "sympy/series/tests/test_gruntz.py::test_compare1", "sympy/integrals/tests/test_integrals.py::test_integrate_functions", "sympy/series/tests/test_order.py::test_issue_23231", "sympy/stats/tests/test_continuous_rv.py::test_nakagami", "sympy/core/tests/test_args.py::test_sympy__series__formal__FormalPowerSeriesCompose", "sympy/tensor/tests/test_indexed.py::test_indexed_series", "sympy/functions/elementary/tests/test_complexes.py::test_sign", "sympy/series/tests/test_nseries.py::test_seriesbug2b", "sympy/stats/tests/test_rv.py::test_factorial_moment", "sympy/functions/elementary/tests/test_hyperbolic.py::test_acsch_leading_term", "sympy/integrals/tests/test_heurisch.py::test_issue_10680", "sympy/utilities/tests/test_pickling.py::test_series", "sympy/integrals/tests/test_manual.py::test_manualintegrate_exponentials", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_12557", "sympy/functions/elementary/tests/test_exponential.py::test_log_leading_term", "sympy/series/tests/test_limits.py::test_issue_3871", "sympy/polys/tests/test_polytools.py::test_all_roots", "sympy/solvers/ode/tests/test_ode.py::test_dsolve_ics", "sympy/series/tests/test_series.py::test_issue_11313", "sympy/integrals/tests/test_integrals.py::test_integrate_derivatives", "sympy/integrals/tests/test_risch.py::test_integrate_hyperexponential", "sympy/simplify/tests/test_simplify.py::test_issue_13474", "sympy/integrals/tests/test_meijerint.py::test_rewrite_single", "sympy/polys/domains/tests/test_domains.py::test_EX_convert", "sympy/integrals/tests/test_manual.py::test_manualintegrate_parts", "sympy/series/tests/test_nseries.py::test_seriesbug2d", "sympy/series/tests/test_order.py::test_issue_9917", "sympy/simplify/tests/test_trigsimp.py::test_trigsimp1", "sympy/core/tests/test_args.py::test_sympy__series__formal__FormalPowerSeriesInverse", "sympy/functions/elementary/tests/test_exponential.py::test_log_nseries", "sympy/series/tests/test_gruntz.py::test_compare2", "sympy/stats/tests/test_continuous_rv.py::test_gaussian_inverse", "sympy/series/tests/test_limits.py::test_exponential", "sympy/series/tests/test_series.py::test_series_of_Subs", "sympy/integrals/tests/test_integrals.py::test_transform", "sympy/stats/tests/test_rv.py::test_dependence", "sympy/functions/elementary/tests/test_complexes.py::test_Abs", "sympy/functions/combinatorial/tests/test_comb_numbers.py::test_harmonic_calculus", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_4313", "sympy/series/tests/test_series.py::test_issue_3978", "sympy/core/tests/test_power.py::test_issue_18762", "sympy/integrals/tests/test_heurisch.py::test_issue_21166", "sympy/solvers/ode/tests/test_ode.py::test_classify_ode", "sympy/series/tests/test_nseries.py::test_seriesbug2c", "sympy/integrals/tests/test_meijerint.py::test_rewrite1", "sympy/functions/elementary/tests/test_exponential.py::test_log_series", "sympy/simplify/tests/test_hyperexpand.py::test_hyperexpand", "sympy/simplify/tests/test_radsimp.py::test_radsimp", "sympy/functions/elementary/tests/test_hyperbolic.py::test_acsch_series", "sympy/integrals/tests/test_manual.py::test_manualintegrate_trigonometry", "sympy/functions/special/tests/test_bessel.py::test_besselj_leading_term", "sympy/polys/tests/test_ring_series.py::test_RR", "sympy/functions/elementary/tests/test_trigonometric.py::test_sinc", "sympy/series/tests/test_order.py::test_issue_22836", "sympy/integrals/tests/test_meijerint.py::test_meijerint_indefinite_numerically", "sympy/functions/combinatorial/tests/test_comb_numbers.py::test_andre", "sympy/series/tests/test_gruntz.py::test_compare3", "sympy/functions/special/tests/test_error_functions.py::test_erf", "sympy/stats/tests/test_continuous_rv.py::test_pareto", "sympy/functions/elementary/tests/test_hyperbolic.py::test_acsch_nseries", "sympy/solvers/tests/test_solvers.py::test_solve_nonlinear", "sympy/integrals/tests/test_heurisch.py::test_heurisch_polynomials", "sympy/integrals/tests/test_integrals.py::test_issue_4052", "sympy/simplify/tests/test_trigsimp.py::test_trigsimp1a", "sympy/solvers/ode/tests/test_ode.py::test_classify_ode_ics", "sympy/series/tests/test_limits.py::test_exponential2", "sympy/series/tests/test_nseries.py::test_expbug4", "sympy/polys/tests/test_polytools.py::test_nroots", "sympy/functions/special/tests/test_bessel.py::test_bessely_leading_term", "sympy/integrals/tests/test_manual.py::test_manualintegrate_trig_substitution", "sympy/series/tests/test_gruntz.py::test_sign1", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_Beam", "sympy/integrals/tests/test_heurisch.py::test_heurisch_fractions", "sympy/functions/elementary/tests/test_trigonometric.py::test_asin_series", "sympy/functions/special/tests/test_error_functions.py::test_erf_series", "sympy/functions/special/tests/test_bessel.py::test_besseli_leading_term", "sympy/core/tests/test_power.py::test_issue_25165", "sympy/simplify/tests/test_fu.py::test_hyper_as_trig", "sympy/integrals/tests/test_integrals.py::test_evalf_issue_939", "sympy/series/tests/test_nseries.py::test_logbug4", "sympy/series/tests/test_series.py::test_issue_5852", "sympy/integrals/tests/test_heurisch.py::test_heurisch_log", "sympy/stats/tests/test_rv.py::test_normality", "sympy/stats/tests/test_continuous_rv.py::test_pareto_numeric", "sympy/solvers/ode/tests/test_ode.py::test_classify_sysode", "sympy/functions/elementary/tests/test_exponential.py::test_issue_18473", "sympy/series/tests/test_gruntz.py::test_mrv1", "sympy/concrete/tests/test_sums_products.py::test_euler_maclaurin", "sympy/series/tests/test_nseries.py::test_expbug5", "sympy/integrals/tests/test_manual.py::test_manualintegrate_trivial_substitution", "sympy/utilities/tests/test_wester.py::test_H30", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_insufficient_bconditions", "sympy/solvers/tests/test_inequalities.py::test_solve_univariate_inequality", "sympy/integrals/tests/test_heurisch.py::test_heurisch_exp", "sympy/functions/special/tests/test_error_functions.py::test__erfs", "sympy/series/tests/test_series.py::test_issue_4583", "sympy/functions/special/tests/test_bessel.py::test_besselk_leading_term", "sympy/solvers/tests/test_solvers.py::test_issue_7190", "sympy/integrals/tests/test_meijerint.py::test_recursive", "sympy/functions/elementary/tests/test_trigonometric.py::test_asin_leading_term", "sympy/series/tests/test_gruntz.py::test_mrv2a", "sympy/series/tests/test_nseries.py::test_sinsinbug", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_statically_indeterminate", "sympy/solvers/ode/tests/test_ode.py::test_solve_ics", "sympy/integrals/tests/test_heurisch.py::test_heurisch_trigonometric", "sympy/polys/tests/test_rootoftools.py::test_CRootOf_all_roots", "sympy/functions/elementary/tests/test_hyperbolic.py::test_atanh_leading_term", "sympy/integrals/tests/test_integrals.py::test_double_previously_failing_integrals", "sympy/simplify/tests/test_radsimp.py::test_collect_1", "sympy/integrals/tests/test_heurisch.py::test_heurisch_hyperbolic", "sympy/functions/special/tests/test_bessel.py::test_besselj_series", "sympy/integrals/tests/test_meijerint.py::test_bessel", "sympy/stats/tests/test_continuous_rv.py::test_rayleigh", "sympy/polys/tests/test_factortools.py::test_dup_qq_i_factor", "sympy/simplify/tests/test_radsimp.py::test_collect_2", "sympy/series/tests/test_gruntz.py::test_mrv2b", "sympy/series/tests/test_series.py::test_issue_6318", "sympy/integrals/tests/test_heurisch.py::test_heurisch_mixed", "sympy/functions/special/tests/test_error_functions.py::test_erfc", "sympy/series/tests/test_limits.py::test_doit", "sympy/integrals/tests/test_manual.py::test_manualintegrate_rational", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_beam_units", "sympy/functions/special/tests/test_bessel.py::test_bessely_series", "sympy/series/tests/test_nseries.py::test_issue_3258", "sympy/simplify/tests/test_trigsimp.py::test_issue_3210", "sympy/series/tests/test_gruntz.py::test_mrv2c", "sympy/integrals/tests/test_integrals.py::test_integrate_DiracDelta", "sympy/simplify/tests/test_radsimp.py::test_collect_3", "sympy/solvers/ode/tests/test_ode.py::test_homogeneous_order", "sympy/solvers/ode/tests/test_systems.py::test__classify_linear_system", "sympy/series/tests/test_series.py::test_x_is_base_detection", "sympy/integrals/tests/test_meijerint.py::test_inversion", "sympy/functions/special/tests/test_error_functions.py::test_erfc_series", "sympy/polys/numberfields/tests/test_minpoly.py::test_minimal_polynomial", "sympy/stats/tests/test_rv.py::test_issue_12237", "sympy/simplify/tests/test_radsimp.py::test_collect_4", "sympy/integrals/tests/test_manual.py::test_manualintegrate_special", "sympy/integrals/tests/test_heurisch.py::test_heurisch_radicals", "sympy/series/tests/test_limits.py::test_series_AccumBounds", "sympy/functions/elementary/tests/test_hyperbolic.py::test_atanh_series", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_variable_moment", "sympy/polys/tests/test_polyroots.py::test_issue_14522", "sympy/series/tests/test_nseries.py::test_issue_3204", "sympy/functions/special/tests/test_bessel.py::test_besseli_series", "sympy/integrals/tests/test_heurisch.py::test_heurisch_special", "sympy/series/tests/test_series.py::test_issue_7203", "sympy/simplify/tests/test_radsimp.py::test_collect_5", "sympy/integrals/tests/test_meijerint.py::test_inversion_conditional_output", "sympy/polys/numberfields/tests/test_minpoly.py::test_issue_26903", "sympy/integrals/tests/test_integrals.py::test_integrate_returns_piecewise", "sympy/solvers/ode/tests/test_ode.py::test_collect_respecting_exponentials", "sympy/series/tests/test_gruntz.py::test_mrv3", "sympy/functions/elementary/tests/test_trigonometric.py::test_acos_leading_term", "sympy/functions/elementary/tests/test_hyperbolic.py::test_atanh_nseries", "sympy/integrals/tests/test_heurisch.py::test_heurisch_symbolic_coeffs", "sympy/functions/special/tests/test_error_functions.py::test_erfi_series", "sympy/solvers/ode/tests/test_ode.py::test_undetermined_coefficients_match", "sympy/polys/tests/test_factortools.py::test_dup_zz_i_factor", "sympy/concrete/tests/test_delta.py::test_deltasummation_basic_numerical", "sympy/stats/tests/test_rv.py::test_issue_20286", "sympy/simplify/tests/test_radsimp.py::test_collect_pr19431", "sympy/stats/tests/test_finite_rv.py::test_dice", "sympy/simplify/tests/test_radsimp.py::test_collect_D", "sympy/functions/special/tests/test_gamma_functions.py::test_gamma_series", "sympy/functions/special/tests/test_bessel.py::test_besselk_series", "sympy/integrals/tests/test_heurisch.py::test_heurisch_symbolic_coeffs_1130", "sympy/polys/tests/test_polytools.py::test_issue_5786", "sympy/polys/numberfields/tests/test_minpoly.py::test_minimal_polynomial_issue_19732", "sympy/series/tests/test_nseries.py::test_issue_3224", "sympy/series/tests/test_gruntz.py::test_mrv4", "sympy/series/tests/test_series.py::test_exp_product_positive_factors", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_composite_beam", "sympy/concrete/tests/test_sums_products.py::test_Sum_doit", "sympy/simplify/tests/test_radsimp.py::test_collect_func", "sympy/utilities/tests/test_wester.py::test_L3", "sympy/integrals/tests/test_meijerint.py::test_inversion_exp_real_nonreal_shift", "sympy/integrals/tests/test_meijerint.py::test_branch_bug", "sympy/series/tests/test_nseries.py::test_issue_3463", "sympy/solvers/tests/test_inequalities.py::test_trig_inequalities", "sympy/functions/special/tests/test_error_functions.py::test_ei", "sympy/series/tests/test_limits.py::test_bessel_functions_at_infinity", "sympy/integrals/tests/test_heurisch.py::test_heurisch_hacking", "sympy/functions/special/tests/test_gamma_functions.py::test_lowergamma", "sympy/matrices/tests/test_matrices.py::test_issue_3749", "sympy/integrals/tests/test_integrals.py::test_integrate_max_min", "sympy/holonomic/tests/test_holonomic.py::test_series", "sympy/series/tests/test_nseries.py::test_sin", "sympy/series/tests/test_gruntz.py::test_rewrite1", "sympy/integrals/tests/test_heurisch.py::test_heurisch_function", "sympy/series/tests/test_series.py::test_issue_9549", "sympy/polys/numberfields/tests/test_minpoly.py::test_minimal_polynomial_hi_prec", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_point_cflexure", "sympy/simplify/tests/test_radsimp.py::test_collect_order", "sympy/functions/elementary/tests/test_hyperbolic.py::test_acoth_leading_term", "sympy/functions/special/tests/test_bessel.py::test_besselk_frac_order_series", "sympy/stats/tests/test_continuous_rv.py::test_uniform", "sympy/simplify/tests/test_trigsimp.py::test_trigsimp_issue_7761", "sympy/simplify/tests/test_radsimp.py::test_rcollect", "sympy/integrals/tests/test_meijerint.py::test_linear_subs", "sympy/solvers/ode/tests/test_ode.py::test_issue_4785_22462", "sympy/integrals/tests/test_heurisch.py::test_heurisch_wrapper", "sympy/polys/numberfields/tests/test_minpoly.py::test_minimal_polynomial_sq", "sympy/series/tests/test_gruntz.py::test_rewrite2", "sympy/core/tests/test_expr.py::test_issue_11877", "sympy/simplify/tests/test_radsimp.py::test_collect_D_0", "sympy/series/tests/test_limits.py::test_issue_2929", "sympy/integrals/tests/test_heurisch.py::test_issue_3609", "sympy/simplify/tests/test_trigsimp.py::test_trigsimp_noncommutative", "sympy/series/tests/test_series.py::test_issue_10761", "sympy/functions/special/tests/test_error_functions.py::test_expint", "sympy/series/tests/test_nseries.py::test_issue_3515", "sympy/simplify/tests/test_radsimp.py::test_collect_Wild", "sympy/holonomic/tests/test_holonomic.py::test_expr_to_holonomic", "sympy/integrals/tests/test_heurisch.py::test_pmint_rat", "sympy/polys/numberfields/tests/test_minpoly.py::test_minpoly_compose", "sympy/stats/tests/test_continuous_rv.py::test_weibull", "sympy/series/tests/test_gruntz.py::test_rewrite3", "sympy/integrals/tests/test_meijerint.py::test_messy", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_apply_support", "sympy/solvers/ode/tests/test_ode.py::test_issue_4825", "sympy/simplify/tests/test_radsimp.py::test_issue_13143", "sympy/functions/elementary/tests/test_trigonometric.py::test_acos_series", "sympy/series/tests/test_series.py::test_issue_12578", "sympy/integrals/tests/test_heurisch.py::test_pmint_trig", "sympy/polys/tests/test_polytools.py::test_issue_19360", "sympy/series/tests/test_limits.py::test_issue_3792", "sympy/series/tests/test_nseries.py::test_issue_3505", "sympy/integrals/tests/test_manual.py::test_manualintegrate_Heaviside", "sympy/simplify/tests/test_radsimp.py::test_issue_6097", "sympy/integrals/tests/test_heurisch.py::test_pmint_logexp", "sympy/functions/elementary/tests/test_hyperbolic.py::test_acoth_series", "sympy/polys/numberfields/tests/test_minpoly.py::test_minpoly_issue_7113", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_apply_rotation_hinge", "sympy/series/tests/test_gruntz.py::test_mrv_leadterm1", "sympy/utilities/tests/test_wester.py::test_M10", "sympy/simplify/tests/test_powsimp.py::test_issue_6367", "sympy/integrals/tests/test_heurisch.py::test_pmint_erf", "sympy/simplify/tests/test_radsimp.py::test_issue_5615", "sympy/holonomic/tests/test_holonomic.py::test_to_expr", "sympy/series/tests/test_nseries.py::test_issue_3501", "sympy/functions/elementary/tests/test_hyperbolic.py::test_acoth_nseries", "sympy/simplify/tests/test_trigsimp.py::test_hyperbolic_simp", "sympy/functions/special/tests/test_gamma_functions.py::test_loggamma", "sympy/concrete/tests/test_sums_products.py::test_noncommutativity_honoured", "sympy/series/tests/test_formal.py::test_rational_algorithm", "sympy/series/tests/test_limits.py::test_issue_4090", "sympy/stats/tests/test_continuous_rv.py::test_weibull_numeric", "sympy/functions/elementary/tests/test_trigonometric.py::test_atan_leading_term", "sympy/series/tests/test_gruntz.py::test_mrv_leadterm2", "sympy/solvers/ode/tests/test_ode.py::test_issue_5770", "sympy/polys/numberfields/tests/test_minpoly.py::test_minpoly_issue_23677", "sympy/functions/special/tests/test_error_functions.py::test__eis", "sympy/integrals/tests/test_heurisch.py::test_pmint_LambertW", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_apply_sliding_hinge", "sympy/integrals/tests/test_manual.py::test_manualintegrate_orthogonal_poly", "sympy/series/tests/test_nseries.py::test_issue_3502", "sympy/simplify/tests/test_radsimp.py::test_issue_5933", "sympy/series/tests/test_series.py::test_issue_12791", "sympy/integrals/tests/test_meijerint.py::test_issue_6122", "sympy/functions/combinatorial/tests/test_comb_numbers.py::test_nD_derangements", "sympy/integrals/tests/test_heurisch.py::test_pmint_besselj", "sympy/solvers/ode/tests/test_systems.py::test_sysode_linear_neq_order1_type1", "sympy/series/tests/test_series.py::test_issue_14384", "sympy/series/tests/test_gruntz.py::test_mrv_leadterm3", "sympy/functions/special/tests/test_bessel.py::test_expand", "sympy/matrices/tests/test_eigen.py::test_issue_19210", "sympy/polys/numberfields/tests/test_minpoly.py::test_minpoly_issue_7574", "sympy/holonomic/tests/test_holonomic.py::test_integrate", "sympy/matrices/tests/test_matrices.py::test_limit", "sympy/series/tests/test_limits.py::test_issue_4547", "sympy/stats/tests/test_continuous_rv.py::test_wignersemicircle", "sympy/simplify/tests/test_powsimp.py::test_issue_19627", "sympy/integrals/tests/test_heurisch.py::test_pmint_WrightOmega", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_shear_force", "sympy/functions/special/tests/test_error_functions.py::test_li", "sympy/stats/tests/test_discrete_rv.py::test_PoissonDistribution", "sympy/series/tests/test_nseries.py::test_issue_3503", "sympy/functions/special/tests/test_gamma_functions.py::test_polygamma_expansion", "sympy/functions/elementary/tests/test_hyperbolic.py::test_leading_term", "sympy/utilities/tests/test_wester.py::test_M24", "sympy/geometry/tests/test_ellipse.py::test_is_tangent", "sympy/series/tests/test_formal.py::test_simpleDE", "sympy/series/tests/test_series.py::test_issue_14885", "sympy/solvers/ode/tests/test_ode.py::test_issue_5095", "sympy/series/tests/test_demidovich.py::test_leadterm", "sympy/polys/numberfields/tests/test_minpoly.py::test_minpoly_fraction_field", "sympy/integrals/tests/test_meijerint.py::test_issue_6252", "sympy/integrals/tests/test_heurisch.py::test_RR", "sympy/integrals/tests/test_integrals.py::test_issue_4884", "sympy/series/tests/test_limits.py::test_issue_5164", "sympy/solvers/ode/tests/test_systems.py::test_sysode_linear_neq_order1_type2", "sympy/polys/numberfields/tests/test_minpoly.py::test_minpoly_domain", "sympy/integrals/tests/test_heurisch.py::test_issue_22527", "sympy/stats/tests/test_continuous_rv.py::test_unevaluated", "sympy/integrals/tests/test_manual.py::test_issue_12251", "sympy/series/tests/test_series.py::test_issue_15539", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_bmoment", "sympy/series/tests/test_demidovich.py::test_Limits_simple_0", "sympy/series/tests/test_gruntz.py::test_limit1", "sympy/functions/special/tests/test_gamma_functions.py::test_polygamma_leading_term", "sympy/functions/elementary/tests/test_hyperbolic.py::test_issue_25175", "sympy/series/tests/test_nseries.py::test_issue_3506", "sympy/series/tests/test_formal.py::test_hyper_re", "sympy/series/tests/test_limits.py::test_issue_5383", "sympy/polys/numberfields/tests/test_minpoly.py::test_issue_14831", "sympy/core/tests/test_expand.py::test_expand_power_base", "sympy/simplify/tests/test_radsimp.py::test_issue_14608", "sympy/core/tests/test_expand.py::test_expand_arit", "sympy/geometry/tests/test_ellipse.py::test_issue_15797_equals", "sympy/series/tests/test_formal.py::test_fps", "sympy/integrals/tests/test_meijerint.py::test_issue_6348", "sympy/integrals/tests/test_integrals.py::test_issue_18153", "sympy/integrals/tests/test_heurisch.py::test_heurisch_complex_erf_issue_26338", "sympy/holonomic/tests/test_holonomic.py::test_diff", "sympy/matrices/tests/test_matrices.py::test_cholesky", "sympy/stats/tests/test_discrete_rv.py::test_Poisson", "sympy/functions/combinatorial/tests/test_comb_factorials.py::test_factorial_series", "sympy/series/tests/test_gruntz.py::test_limit2", "sympy/functions/special/tests/test_error_functions.py::test_Li", "sympy/functions/elementary/tests/test_trigonometric.py::test_acot_leading_term", "sympy/simplify/tests/test_radsimp.py::test_issue_19149", "sympy/series/tests/test_demidovich.py::test_Limits_simple_1", "sympy/series/tests/test_series.py::test_issue_7259", "sympy/concrete/tests/test_products.py::test_product_pow", "sympy/polys/numberfields/tests/test_minpoly.py::test_issue_18248", "sympy/integrals/tests/test_manual.py::test_issue_3796", "sympy/series/tests/test_nseries.py::test_issue_3508", "sympy/simplify/tests/test_radsimp.py::test_issue_19719", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_deflection", "sympy/solvers/ode/tests/test_ode.py::test_series", "sympy/integrals/tests/test_heurisch.py::test_issue_15498", "sympy/stats/tests/test_continuous_rv.py::test_NormalDistribution", "sympy/integrals/tests/test_integrals.py::test_series", "sympy/matrices/tests/test_eigen.py::test_issue_20275", "sympy/solvers/ode/tests/test_systems.py::test_sysode_linear_neq_order1_type3", "sympy/solvers/ode/tests/test_ode.py::test_2nd_power_series_regular", "sympy/integrals/tests/test_meijerint.py::test_fresnel", "sympy/series/tests/test_formal.py::test_fps_shift", "sympy/series/tests/test_series.py::test_issue_11884", "sympy/series/tests/test_nseries.py::test_issue_3507", "sympy/series/tests/test_demidovich.py::test_Limits_simple_2", "sympy/functions/special/tests/test_zeta_functions.py::test_zeta_series", "sympy/series/tests/test_limits.py::test_issue_14793", "sympy/integrals/tests/test_manual.py::test_manual_true", "sympy/sets/tests/test_setexpr.py::test_SetExpr_Interval_div", "sympy/stats/tests/test_discrete_rv.py::test_FlorySchulz", "sympy/series/tests/test_gruntz.py::test_limit3", "sympy/matrices/tests/test_matrices.py::test_matrix_norm", "sympy/concrete/tests/test_products.py::test_Product_is_convergent", "sympy/functions/special/tests/test_bessel.py::test_airyai", "sympy/integrals/tests/test_meijerint.py::test_issue_6860", "sympy/stats/tests/test_continuous_rv.py::test_random_parameters", "sympy/integrals/tests/test_manual.py::test_issue_6746", "sympy/series/tests/test_nseries.py::test_issue_3639", "sympy/solvers/ode/tests/test_ode.py::test_dsolve_remove_redundant_solutions", "sympy/series/tests/test_demidovich.py::test_Limits_simple_3a", "sympy/series/tests/test_formal.py::test_fps__Add_expr", "sympy/functions/special/tests/test_error_functions.py::test_si", "sympy/calculus/tests/test_util.py::test_function_range", "sympy/series/tests/test_gruntz.py::test_limit4", "sympy/integrals/tests/test_integrals.py::test_trig_nonelementary_integrals", "sympy/integrals/tests/test_heurisch.py::test_heurisch_issue_26922", "sympy/polys/numberfields/tests/test_minpoly.py::test_issue_13230", "sympy/solvers/ode/tests/test_riccati.py::test_riccati_reduced", "sympy/series/tests/test_limitseq.py::test_limit_seq", "sympy/functions/special/tests/test_bessel.py::test_airybi", "sympy/series/tests/test_series.py::test_issue_18008", "sympy/solvers/tests/test_recurr.py::test_rsolve_poly", "sympy/sets/tests/test_setexpr.py::test_SetExpr_Interval_pow", "sympy/solvers/ode/tests/test_systems.py::test_sysode_linear_neq_order1_type5_type6", "sympy/integrals/tests/test_meijerint.py::test_issue_7337", "sympy/stats/tests/test_discrete_rv.py::test_Hermite", "sympy/functions/elementary/tests/test_trigonometric.py::test_leading_terms", "sympy/concrete/tests/test_products.py::test_issue_9983", "sympy/matrices/tests/test_matrixbase.py::test_issue_3749", "sympy/series/tests/test_limits.py::test_issue_5183", "sympy/integrals/tests/test_manual.py::test_issue_9462", "sympy/series/tests/test_nseries.py::test_hyperbolic", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_solve_for_ild_reactions", "sympy/solvers/tests/test_recurr.py::test_rsolve_ratio", "sympy/integrals/tests/test_integrals.py::test_issue_4403", "sympy/solvers/ode/tests/test_riccati.py::test_match_riccati", "sympy/stats/tests/test_continuous_rv.py::test_conjugate_priors", "sympy/physics/mechanics/tests/test_joint.py::test_prismatic_joint_arbitrary_axis", "sympy/series/tests/test_demidovich.py::test_Limits_simple_3b", "sympy/functions/special/tests/test_bessel.py::test_airyaiprime", "sympy/series/tests/test_formal.py::test_fps__asymptotic", "sympy/functions/special/tests/test_error_functions.py::test_ci", "sympy/solvers/ode/tests/test_ode.py::test_issue_13060", "sympy/series/tests/test_gruntz.py::test_gruntz_I", "sympy/calculus/tests/test_util.py::test_continuous_domain", "sympy/integrals/tests/test_meijerint.py::test_issue_8368", "sympy/series/tests/test_limits.py::test_issue_5184", "sympy/series/tests/test_nseries.py::test_series2", "sympy/series/tests/test_limitseq.py::test_alternating_sign", "sympy/physics/control/tests/test_lti.py::test_StateSpace_dsolve", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_solve_for_ild_shear", "sympy/stats/tests/test_discrete_rv.py::test_Logarithmic", "sympy/functions/special/tests/test_bessel.py::test_airybiprime", "sympy/series/tests/test_gruntz.py::test_intractable", "sympy/series/tests/test_series.py::test_issue_18842", "sympy/functions/elementary/tests/test_trigonometric.py::test_atan2_expansion", "sympy/series/tests/test_limitseq.py::test_accum_bounds", "sympy/solvers/tests/test_recurr.py::test_rsolve_hyper", "sympy/series/tests/test_nseries.py::test_series3", "sympy/integrals/tests/test_manual.py::test_cyclic_parts", "sympy/solvers/ode/tests/test_single.py::test_SingleODESolver", "sympy/solvers/ode/tests/test_systems.py::test_higher_order_to_first_order", "sympy/solvers/ode/tests/test_ode.py::test_issue_22523", "sympy/integrals/tests/test_integrals.py::test_issue_4403_2", "sympy/integrals/tests/test_meijerint.py::test_issue_10211", "sympy/series/tests/test_demidovich.py::test_Limits_simple_4a", "sympy/series/tests/test_formal.py::test_fps__fractional", "sympy/functions/special/tests/test_error_functions.py::test_fresnel", "sympy/polys/numberfields/tests/test_minpoly.py::test_issue_19760", "sympy/holonomic/tests/test_holonomic.py::test_to_meijerg", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_solve_for_ild_moment", "sympy/solvers/tests/test_recurr.py::test_rsolve_bulk", "sympy/stats/tests/test_continuous_rv.py::test_precomputed_cdf", "sympy/stats/tests/test_discrete_rv.py::test_negative_binomial", "sympy/series/tests/test_limitseq.py::test_limitseq_sum", "sympy/series/tests/test_limits.py::test_issue_5229", "sympy/series/tests/test_gruntz.py::test_aseries_trig", "sympy/printing/tests/test_precedence.py::test_Order", "sympy/series/tests/test_nseries.py::test_bug4", "sympy/core/tests/test_exprtools.py::test_gcd_terms", "sympy/integrals/tests/test_meijerint.py::test_issue_11806", "sympy/polys/numberfields/tests/test_minpoly.py::test_issue_20163", "sympy/functions/special/tests/test_error_functions.py::test_fresnel_series", "sympy/solvers/tests/test_recurr.py::test_rsolve_0_sol_homogeneous", "sympy/series/tests/test_series.py::test_issue_19534", "sympy/integrals/tests/test_integrals.py::test_issue_4100", "sympy/integrals/tests/test_manual.py::test_issue_12641", "sympy/solvers/ode/tests/test_single.py::test_linear_coefficients", "sympy/functions/special/tests/test_hyper.py::test_expand_func", "sympy/series/tests/test_formal.py::test_fps__logarithmic_singularity", "sympy/solvers/ode/tests/test_riccati.py::test_solve_riccati", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_ild_with_rotation_hinge", "sympy/series/tests/test_demidovich.py::test_limits_simple_4aa", "sympy/solvers/ode/tests/test_ode.py::test_issue_22604", "sympy/stats/tests/test_discrete_rv.py::test_skellam", "sympy/functions/elementary/tests/test_trigonometric.py::test_aseries", "sympy/functions/elementary/tests/test_integers.py::test_series", "sympy/integrals/tests/test_meijerint.py::test_issue_10681", "sympy/series/tests/test_nseries.py::test_bug5", "sympy/polys/tests/test_partfrac.py::test_apart_extension", "sympy/series/tests/test_limitseq.py::test_issue_9308", "sympy/solvers/ode/tests/test_systems.py::test_higher_order_to_first_order_12", "sympy/integrals/tests/test_manual.py::test_issue_14470", "sympy/series/tests/test_residues.py::test_basic1", "sympy/polys/numberfields/tests/test_minpoly.py::test_issue_22559", "sympy/series/tests/test_series.py::test_issue_11407", "sympy/series/tests/test_nseries.py::test_issue_4115", "sympy/solvers/tests/test_recurr.py::test_rsolve", "sympy/series/tests/test_limits.py::test_issue_4546", "sympy/integrals/tests/test_integrals.py::test_issue_5167", "sympy/integrals/tests/test_rationaltools.py::test_ratint", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_ild_with_sliding_hinge", "sympy/series/tests/test_demidovich.py::test_Limits_simple_4b", "sympy/polys/numberfields/tests/test_minpoly.py::test_issue_22561", "sympy/series/tests/test_residues.py::test_basic2", "sympy/concrete/tests/test_sums_products.py::test_is_absolutely_convergent", "sympy/functions/elementary/tests/test_integers.py::test_issue_14355", "sympy/series/tests/test_formal.py::test_fps_symbolic", "sympy/series/tests/test_gruntz.py::test_exp_log_series", "sympy/solvers/tests/test_recurr.py::test_rsolve_raises", "sympy/integrals/tests/test_meijerint.py::test_issue_13536", "sympy/integrals/tests/test_transforms.py::test_undefined_function", "sympy/stats/tests/test_discrete_rv.py::test_yule_simon", "sympy/solvers/ode/tests/test_single.py::test_Airy_equation", "sympy/holonomic/tests/test_holonomic.py::test_beta", "sympy/series/tests/test_series.py::test_issue_14037", "sympy/series/tests/test_limits.py::test_issue_3934", "sympy/integrals/tests/test_rationaltools.py::test_issue_5414", "sympy/functions/elementary/tests/test_trigonometric.py::test_sec", "sympy/integrals/tests/test_manual.py::test_issue_8520", "sympy/integrals/tests/test_integrals.py::test_issue_4890", "sympy/series/tests/test_nseries.py::test_pole", "sympy/functions/special/tests/test_zeta_functions.py::test_polylog_series", "sympy/series/tests/test_residues.py::test_f", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_Beam3D", "sympy/series/tests/test_limitseq.py::test_issue_10382", "sympy/matrices/expressions/tests/test_derivatives.py::test_matrix_derivative_vectors_and_scalars", "sympy/solvers/ode/tests/test_ode.py::test_issue_22462", "sympy/simplify/tests/test_trigsimp.py::test_exptrigsimp", "sympy/solvers/tests/test_recurr.py::test_issue_6844", "sympy/matrices/tests/test_matrixbase.py::test_cholesky", "sympy/stats/tests/test_continuous_rv.py::test_issue_20756", "sympy/integrals/tests/test_rationaltools.py::test_issue_5817", "sympy/series/tests/test_demidovich.py::test_Limits_simple_4c", "sympy/series/tests/test_formal.py::test_fps__slow", "sympy/matrices/tests/test_decompositions.py::test_singular_value_decompositionD", "sympy/concrete/tests/test_sums_products.py::test_issue_10973", "sympy/series/tests/test_gruntz.py::test_issue_3644", "sympy/series/tests/test_series.py::test_issue_20551", "sympy/integrals/tests/test_meijerint.py::test_issue_6462", "sympy/solvers/tests/test_recurr.py::test_issue_18751", "sympy/stats/tests/test_discrete_rv.py::test_zeta", "sympy/holonomic/tests/test_holonomic.py::test_gamma", "sympy/physics/optics/tests/test_utils.py::test_mirror_formula", "sympy/series/tests/test_residues.py::test_functions", "sympy/integrals/tests/test_rationaltools.py::test_issue_5981", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_22533", "sympy/polys/tests/test_polyroots.py::test_issue_21287", "sympy/solvers/ode/tests/test_systems.py::test_second_order_to_first_order_2", "sympy/integrals/tests/test_integrals.py::test_issue_4551", "sympy/series/tests/test_demidovich.py::test_bounded", "sympy/integrals/tests/test_transforms.py::test_as_integral", "sympy/series/tests/test_nseries.py::test_expsinbug", "sympy/functions/special/tests/test_zeta_functions.py::test_issue_8404", "sympy/series/tests/test_nseries.py::test_floor", "sympy/solvers/ode/tests/test_ode.py::test_issue_23425", "sympy/series/tests/test_gruntz.py::test_issue_6843", "sympy/series/tests/test_limits.py::test_calculate_series", "sympy/series/tests/test_series.py::test_issue_20697", "sympy/solvers/tests/test_recurr.py::test_constant_naming", "sympy/solvers/ode/tests/test_single.py::test_2nd_2F1_hypergeometric_integral", "sympy/series/tests/test_formal.py::test_fps__operations", "sympy/simplify/tests/test_trigsimp.py::test_issue_21594", "sympy/stats/tests/test_continuous_rv.py::test_union", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_parabolic_loads", "sympy/concrete/tests/test_gosper.py::test_gosper_sum", "sympy/integrals/tests/test_meijerint.py::test_indefinite_1_bug", "sympy/functions/elementary/tests/test_trigonometric.py::test_csc", "sympy/integrals/tests/test_manual.py::test_quadratic_denom", "sympy/matrices/tests/test_matrixbase.py::test_matrix_norm", "sympy/series/tests/test_residues.py::test_expressions", "sympy/stats/tests/test_joint_rv.py::test_Normal", "sympy/physics/optics/tests/test_utils.py::test_lens_formula", "sympy/integrals/tests/test_rationaltools.py::test_issue_10488", "sympy/series/tests/test_limitseq.py::test_issue_11672", "sympy/solvers/tests/test_recurr.py::test_issue_17990", "sympy/functions/special/tests/test_hyper.py::test_limits", "sympy/integrals/tests/test_integrals.py::test_issue_4376", "sympy/matrices/expressions/tests/test_derivatives.py::test_matrix_derivatives_of_traces", "sympy/series/tests/test_residues.py::test_NotImplemented", "sympy/series/tests/test_demidovich.py::test_f1a", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_cross_section", "sympy/series/tests/test_nseries.py::test_frac", "sympy/series/tests/test_formal.py::test_fps__product", "sympy/physics/quantum/tests/test_density.py::test_represent", "sympy/series/tests/test_limits.py::test_issue_5955", "sympy/stats/tests/test_discrete_rv.py::test_DiscreteRV", "sympy/solvers/ode/tests/test_systems.py::test_second_order_to_first_order_slow4", "sympy/series/tests/test_limitseq.py::test_issue_14196", "sympy/integrals/tests/test_rationaltools.py::test_issues_8246_12050_13501_14080", "sympy/integrals/tests/test_meijerint.py::test_pr_23583", "sympy/solvers/tests/test_recurr.py::test_issue_8697", "sympy/printing/tests/test_python.py::test_python_limits", "sympy/series/tests/test_nseries.py::test_ceiling", "sympy/series/tests/test_gruntz.py::test_issue_4190", "sympy/integrals/tests/test_transforms.py::test_mellin_transform", "sympy/solvers/ode/tests/test_single.py::test_2nd_nonlinear_autonomous_conserved_integral", "sympy/integrals/tests/test_manual.py::test_issue_22757", "sympy/series/tests/test_series.py::test_issue_21245", "sympy/integrals/tests/test_integrals.py::test_issue_4517", "sympy/functions/special/tests/test_hyper.py::test_eval_nseries", "sympy/series/tests/test_residues.py::test_bug", "sympy/stats/tests/test_joint_rv.py::test_MultivariateTDist", "sympy/concrete/tests/test_sums_products.py::test_issue_14112", "sympy/stats/tests/test_continuous_rv.py::test_Or", "sympy/solvers/tests/test_recurr.py::test_diofantissue_294", "sympy/matrices/tests/test_decompositions.py::test_LDLdecomposition", "sympy/series/tests/test_formal.py::test_fps__compose", "sympy/integrals/tests/test_rationaltools.py::test_issue_6308", "sympy/functions/elementary/tests/test_trigonometric.py::test_asec_leading_term", "sympy/series/tests/test_nseries.py::test_abs", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_deflection_Beam3D", "sympy/series/tests/test_limits.py::test_newissue", "sympy/calculus/tests/test_util.py::test_periodicity", "sympy/solvers/tests/test_pde.py::test_pde_classify", "sympy/series/tests/test_limitseq.py::test_issue_16735", "sympy/series/tests/test_gruntz.py::test_issue_4109", "sympy/series/tests/test_demidovich.py::test_f1a2", "sympy/series/tests/test_residues.py::test_issue_5654", "sympy/integrals/tests/test_meijerint.py::test_integrate_function_of_square_over_negatives", "sympy/solvers/ode/tests/test_single.py::test_nth_linear_constant_coeff_var_of_parameters", "sympy/matrices/expressions/tests/test_trace.py::test_trace_rewrite", "sympy/integrals/tests/test_manual.py::test_issue_23348", "sympy/integrals/tests/test_integrals.py::test_issue_4527", "sympy/solvers/tests/test_pde.py::test_checkpdesol", "sympy/solvers/tests/test_recurr.py::test_issue_15553", "sympy/integrals/tests/test_transforms.py::test_mellin_transform2", "sympy/concrete/tests/test_sums_products.py::test_sin_times_absolutely_convergent", "sympy/series/tests/test_nseries.py::test_dir", "sympy/stats/tests/test_joint_rv.py::test_GeneralizedMultivariateLogGammaDistribution", "sympy/series/tests/test_formal.py::test_fps__inverse", "sympy/series/tests/test_gruntz.py::test_issue_6682", "sympy/series/tests/test_series.py::test_issue_21938", "sympy/integrals/tests/test_rationaltools.py::test_issue_5907", "sympy/integrals/tests/test_meijerint.py::test_issue_25949", "sympy/series/tests/test_nseries.py::test_cdir", "sympy/series/tests/test_residues.py::test_issue_6499", "sympy/solvers/tests/test_pde.py::test_solvefun", "sympy/series/tests/test_limits.py::test_issue_5436", "sympy/solvers/ode/tests/test_systems.py::test_component_division", "sympy/series/tests/test_limitseq.py::test_issue_19868", "sympy/solvers/tests/test_pde.py::test_pde_1st_linear_constant_coeff_homogeneous", "sympy/integrals/tests/test_transforms.py::test_fourier_transform", "sympy/integrals/tests/test_integrals.py::test_issue_4199", "sympy/functions/elementary/tests/test_trigonometric.py::test_asec_series", "sympy/integrals/tests/test_manual.py::test_issue_23566", "sympy/series/tests/test_nseries.py::test_issue_3504", "sympy/integrals/tests/test_rationaltools.py::test_issue_25896", "sympy/series/tests/test_series.py::test_issue_23432", "sympy/series/tests/test_demidovich.py::test_f1b", "sympy/series/tests/test_residues.py::test_issue_14037", "sympy/solvers/tests/test_pde.py::test_pde_1st_linear_constant_coeff", "sympy/series/tests/test_gruntz.py::test_issue_7096", "sympy/series/tests/test_fourier.py::test_FourierSeries", "sympy/solvers/ode/tests/test_single.py::test_1st_exact_integral", "sympy/series/tests/test_limits.py::test_polynomial", "sympy/stats/tests/test_discrete_rv.py::test_product_spaces", "sympy/series/tests/test_residues.py::test_issue_21176", "sympy/concrete/tests/test_sums_products.py::test_issue_14111", "sympy/series/tests/test_gruntz.py::test_issue_24210_25885", "sympy/solvers/tests/test_pde.py::test_pdsolve_all", "sympy/series/tests/test_fourier.py::test_FourierSeries_2", "sympy/solvers/ode/tests/test_systems.py::test_linodesolve", "sympy/series/tests/test_demidovich.py::test_f2a", "sympy/solvers/tests/test_pde.py::test_pdsolve_variable_coeff", "sympy/series/tests/test_nseries.py::test_issue_4441", "sympy/integrals/tests/test_integrals.py::test_issue_3940", "sympy/functions/elementary/tests/test_trigonometric.py::test_acsc_leading_term", "sympy/integrals/tests/test_manual.py::test_nested_pow", "sympy/calculus/tests/test_singularities.py::test_singularities", "sympy/integrals/tests/test_transforms.py::test_sine_transform", "sympy/series/tests/test_lseries.py::test_sin", "sympy/series/tests/test_series.py::test_issue_23727", "sympy/series/tests/test_residues.py::test_issue_21177", "sympy/series/tests/test_limits.py::test_rational", "sympy/series/tests/test_nseries.py::test_issue_4329", "sympy/physics/quantum/tests/test_state.py::test_wavefunction", "sympy/solvers/ode/tests/test_single.py::test_nth_order_reducible", "sympy/concrete/tests/test_sums_products.py::test_issue_14484", "sympy/integrals/tests/test_integrals.py::test_issue_5413", "sympy/series/tests/test_lseries.py::test_cos", "sympy/integrals/tests/test_manual.py::test_manualintegrate_sqrt_linear", "sympy/series/tests/test_fourier.py::test_sawtooth_wave", "sympy/solvers/ode/tests/test_systems.py::test_neq_order1_type4_slow3", "sympy/integrals/tests/test_transforms.py::test_cosine_transform", "sympy/solvers/ode/tests/test_lie_group.py::test_heuristic1", "sympy/series/tests/test_demidovich.py::test_f2", "sympy/series/tests/test_nseries.py::test_issue_5183", "sympy/geometry/tests/test_util.py::test_intersection", "sympy/series/tests/test_fourier.py::test_FourierSeries__operations", "sympy/series/tests/test_limits.py::test_issue_5740", "sympy/concrete/tests/test_guess.py::test_guess_generating_function", "sympy/series/tests/test_series.py::test_issue_24266", "sympy/solvers/ode/tests/test_lie_group.py::test_heuristic3", "sympy/functions/elementary/tests/test_trigonometric.py::test_acsc_series", "sympy/solvers/tests/test_solvers.py::test_solve_undetermined_coeffs", "sympy/stats/tests/test_joint_rv.py::test_JointRV", "sympy/utilities/tests/test_wester.py::test_P32", "sympy/series/tests/test_lseries.py::test_exp", "sympy/physics/vector/tests/test_functions.py::test_get_motion_methods", "sympy/series/tests/test_demidovich.py::test_f3", "sympy/solvers/ode/tests/test_single.py::test_Riccati_special_minus2", "sympy/integrals/tests/test_manual.py::test_manualintegrate_sqrt_quadratic", "sympy/solvers/ode/tests/test_lie_group.py::test_heuristic_function_sum", "sympy/series/tests/test_lseries.py::test_exp2", "sympy/integrals/tests/test_integrals.py::test_issue_4892b", "sympy/series/tests/test_fourier.py::test_FourierSeries__neg", "sympy/series/tests/test_nseries.py::test_issue_5654", "sympy/integrals/tests/test_transforms.py::test_hankel_transform", "sympy/geometry/tests/test_curve.py::test_length", "sympy/solvers/ode/tests/test_systems.py::test_dsolve_system", "sympy/solvers/ode/tests/test_lie_group.py::test_heuristic_abaco2_similar", "sympy/functions/elementary/tests/test_trigonometric.py::test_asin_nseries", "sympy/series/tests/test_fourier.py::test_FourierSeries__add__sub", "sympy/concrete/tests/test_sums_products.py::test_issue_14640", "sympy/series/tests/test_limits.py::test_issue_6366", "sympy/solvers/ode/tests/test_lie_group.py::test_heuristic_abaco2_unique_unknown", "sympy/functions/special/tests/test_singularity_functions.py::test_leading_term", "sympy/solvers/tests/test_solvers.py::test_issue_4793", "sympy/stats/tests/test_joint_rv.py::test_expectation", "sympy/calculus/tests/test_util.py::test_stationary_points", "sympy/solvers/tests/test_polysys.py::test_solve_poly_system", "sympy/series/tests/test_lseries.py::test_simple", "sympy/integrals/tests/test_manual.py::test_mul_pow_derivative", "sympy/physics/tests/test_qho_1d.py::test_norm", "sympy/series/tests/test_nseries.py::test_issue_5925", "sympy/physics/tests/test_hydrogen.py::test_norm", "sympy/concrete/tests/test_gosper.py::test_gosper_nan", "sympy/functions/special/tests/test_singularity_functions.py::test_series", "sympy/solvers/ode/tests/test_single.py::test_Bernoulli", "sympy/integrals/tests/test_transforms.py::test_issue_7181", "sympy/solvers/ode/tests/test_lie_group.py::test_heuristic_linear", "sympy/functions/special/tests/test_elliptic_integrals.py::test_K", "sympy/series/tests/test_limits.py::test_factorial", "sympy/solvers/ode/tests/test_systems.py::test_second_order_type2_slow1", "sympy/physics/tests/test_qho_1d.py::test_orthogonality", "sympy/integrals/tests/test_trigonometry.py::test_trigintegrate_odd", "sympy/functions/elementary/tests/test_trigonometric.py::test_acos_nseries", "sympy/solvers/ode/tests/test_lie_group.py::test_user_infinitesimals", "sympy/series/tests/test_lseries.py::test_issue_5183", "sympy/series/tests/test_nseries.py::test_exp_2", "sympy/solvers/tests/test_polysys.py::test_solve_biquadratic", "sympy/physics/tests/test_hydrogen.py::test_hydrogen_energies_relat", "sympy/polys/tests/test_modulargcd.py::test_modgcd_algebraic_field", "sympy/stats/tests/test_compound_rv.py::test_normal_CompoundDist", "sympy/stats/tests/test_symbolic_probability.py::test_literal_probability", "sympy/solvers/ode/tests/test_single.py::test_1st_linear", "sympy/solvers/tests/test_polysys.py::test_solve_triangulated", "sympy/functions/special/tests/test_elliptic_integrals.py::test_F", "sympy/calculus/tests/test_util.py::test_maximum", "sympy/integrals/tests/test_trigonometry.py::test_trigintegrate_even", "sympy/series/tests/test_lseries.py::test_issue_6999", "sympy/integrals/tests/test_transforms.py::test_issue_12591", "sympy/series/tests/test_limits.py::test_issue_6560", "sympy/concrete/tests/test_sums_products.py::test_issue_15852", "sympy/functions/elementary/tests/test_trigonometric.py::test_atan_nseries", "sympy/stats/tests/test_compound_rv.py::test_poisson_CompoundDist", "sympy/codegen/tests/test_approximations.py::test_SeriesApprox_trivial", "sympy/simplify/tests/test_hyperexpand.py::test_meijerg_with_Floats", "sympy/functions/elementary/tests/test_interface.py::test_function_series1", "sympy/stats/tests/test_symbolic_probability.py::test_symbolic_Moment", "sympy/integrals/tests/test_trigonometry.py::test_trigintegrate_mixed", "sympy/functions/special/tests/test_elliptic_integrals.py::test_E", "sympy/polys/numberfields/tests/test_subfield.py::test_field_isomorphism_pslq", "sympy/integrals/tests/test_integrals.py::test_issue_5178", "sympy/stats/tests/test_finite_rv.py::test_binomial_symbolic", "sympy/calculus/tests/test_util.py::test_minimum", "sympy/physics/quantum/tests/test_cartesian.py::test_x", "sympy/parsing/tests/test_maxima.py::test_maxima_functions", "sympy/functions/elementary/tests/test_interface.py::test_function_series2", "sympy/utilities/tests/test_wester.py::test_T1", "sympy/stats/tests/test_mix.py::test_density", "sympy/vector/tests/test_integrals.py::test_parametric_lineintegrals", "sympy/integrals/tests/test_integrals.py::test_integrate_series", "sympy/functions/elementary/tests/test_interface.py::test_function_series3", "sympy/solvers/ode/tests/test_single.py::test_almost_linear", "sympy/functions/elementary/tests/test_trigonometric.py::test_acot_nseries", "sympy/functions/special/tests/test_elliptic_integrals.py::test_P", "sympy/stats/tests/test_symbolic_probability.py::test_symbolic_CentralMoment", "sympy/polys/numberfields/tests/test_subfield.py::test_field_isomorphism", "sympy/solvers/ode/tests/test_systems.py::test_linear_2eq_order1", "sympy/calculus/tests/test_util.py::test_issue_19869", "sympy/series/tests/test_limits.py::test_issue_7088", "sympy/geometry/tests/test_polygon.py::test_intersection", "sympy/physics/quantum/tests/test_cartesian.py::test_p", "sympy/integrals/tests/test_integrals.py::test_atom_bug", "sympy/stats/tests/test_symbolic_multivariate.py::test_multivariate_expectation", "sympy/simplify/tests/test_hyperexpand.py::test_lerchphi", "sympy/solvers/tests/test_solvers.py::test_issue_5197", "sympy/utilities/tests/test_wester.py::test_T2", "sympy/stats/tests/test_compound_rv.py::test_unevaluated_CompoundDist", "sympy/functions/elementary/tests/test_trigonometric.py::test_asec_nseries", "sympy/integrals/tests/test_failing_integrals.py::test_issue_4511", "sympy/calculus/tests/test_util.py::test_issue_16469", "sympy/series/tests/test_limits.py::test_branch_cuts", "sympy/solvers/ode/tests/test_single.py::test_nth_order_linear_euler_eq_homogeneous", "sympy/integrals/tests/test_integrals.py::test_limit_bug", "sympy/concrete/tests/test_sums_products.py::test_issue_14313", "sympy/integrals/tests/test_failing_integrals.py::test_integrate_DiracDelta_no_meijerg", "sympy/polys/tests/test_polyroots.py::test_issue_17454", "sympy/stats/tests/test_compound_rv.py::test_Compound_Distribution", "sympy/geometry/tests/test_polygon.py::test_parameter_value", "sympy/series/tests/test_limits.py::test_issue_6364", "sympy/functions/elementary/tests/test_trigonometric.py::test_acsc_nseries", "sympy/series/tests/test_aseries.py::test_simple", "sympy/vector/tests/test_integrals.py::test_parametric_volumeintegrals", "sympy/integrals/tests/test_integrals.py::test_issue_4703", "sympy/solvers/ode/tests/test_single.py::test_nth_order_linear_euler_eq_nonhomogeneous_undetermined_coefficients", "sympy/integrals/tests/test_failing_integrals.py::test_issue_15925b", "sympy/utilities/tests/test_wester.py::test_T3", "sympy/series/tests/test_aseries.py::test_hierarchical", "sympy/concrete/tests/test_sums_products.py::test_issue_16735", "sympy/integrals/tests/test_singularityfunctions.py::test_singularityintegrate", "sympy/integrals/tests/test_integrals.py::test_issue_1888", "sympy/solvers/ode/tests/test_systems.py::test_nonlinear_2eq_order1", "sympy/geometry/tests/test_parabola.py::test_parabola_intersection", "sympy/series/tests/test_limits.py::test_issue_6682", "sympy/functions/elementary/tests/test_trigonometric.py::test_issue_25833", "sympy/vector/tests/test_integrals.py::test_vector_integrate", "sympy/solvers/tests/test_solvers.py::test_issue_4671_4463_4467", "sympy/integrals/tests/test_integrals.py::test_issue_3558", "sympy/utilities/tests/test_wester.py::test_T4", "sympy/concrete/tests/test_sums_products.py::test_issue_19379", "sympy/stats/tests/test_finite_rv.py::test_hypergeometric_symbolic", "sympy/integrals/tests/test_integrals.py::test_issue_4422", "sympy/utilities/tests/test_wester.py::test_T5", "sympy/series/tests/test_limits.py::test_issue_4099", "sympy/vector/tests/test_coordsysrect.py::test_check_orthogonality", "sympy/functions/elementary/tests/test_trigonometric.py::test_issue_23843", "sympy/solvers/tests/test_solvers.py::test_issue_5132", "sympy/concrete/tests/test_sums_products.py::test_issue_20777", "sympy/integrals/tests/test_integrals.py::test_issue_4493", "sympy/series/tests/test_limits.py::test_issue_4503", "sympy/concrete/tests/test_sums_products.py::test_summation_by_residues", "sympy/integrals/tests/test_integrals.py::test_issue_4737", "sympy/series/tests/test_limits.py::test_issue_6052", "sympy/utilities/tests/test_wester.py::test_T6", "sympy/integrals/tests/test_integrals.py::test_issue_4992", "sympy/series/tests/test_limits.py::test_issue_7224", "sympy/integrals/tests/test_integrals.py::test_issue_4487", "sympy/utilities/tests/test_wester.py::test_T7", "sympy/integrals/tests/test_integrals.py::test_issue_4215", "sympy/series/tests/test_limits.py::test_issue_7391_8166", "sympy/stats/tests/test_stochastic_process.py::test_PoissonProcess", "sympy/utilities/tests/test_wester.py::test_T8", "sympy/integrals/tests/test_integrals.py::test_issue_4400", "sympy/series/tests/test_limits.py::test_issue_8208", "sympy/integrals/tests/test_integrals.py::test_issue_6253", "sympy/series/tests/test_limits.py::test_issue_8229", "sympy/utilities/tests/test_wester.py::test_T12", "sympy/integrals/tests/test_integrals.py::test_issue_4153", "sympy/stats/tests/test_stochastic_process.py::test_WienerProcess", "sympy/utilities/tests/test_wester.py::test_T13", "sympy/series/tests/test_limits.py::test_issue_8433", "sympy/utilities/tests/test_wester.py::test_T14", "sympy/series/tests/test_limits.py::test_issue_8481", "sympy/stats/tests/test_stochastic_process.py::test_GammaProcess_symbolic", "sympy/series/tests/test_limits.py::test_issue_8462", "sympy/stats/tests/test_stochastic_process.py::test_GammaProcess_numeric", "sympy/integrals/tests/test_integrals.py::test_issue_4326", "sympy/solvers/tests/test_solvers.py::test_polysys", "sympy/series/tests/test_limits.py::test_issue_8634", "sympy/utilities/tests/test_wester.py::test_U6", "sympy/solvers/tests/test_solvers.py::test_issue_4463", "sympy/series/tests/test_limits.py::test_issue_8635_18176", "sympy/utilities/tests/test_wester.py::test_U10", "sympy/integrals/tests/test_integrals.py::test_manual_option", "sympy/series/tests/test_limits.py::test_issue_8730", "sympy/series/tests/test_limits.py::test_issue_9252", "sympy/utilities/tests/test_wester.py::test_U13", "sympy/integrals/tests/test_integrals.py::test_meijerg_option", "sympy/utilities/tests/test_wester.py::test_V3", "sympy/series/tests/test_limits.py::test_issue_9558", "sympy/integrals/tests/test_integrals.py::test_issue_6828", "sympy/series/tests/test_limits.py::test_issue_10801", "sympy/solvers/tests/test_solvers.py::test_issue_5901", "sympy/utilities/tests/test_wester.py::test_V4", "sympy/integrals/tests/test_integrals.py::test_issue_4234", "sympy/series/tests/test_limits.py::test_issue_10976", "sympy/utilities/tests/test_wester.py::test_V7", "sympy/integrals/tests/test_integrals.py::test_issue_4492", "sympy/series/tests/test_limits.py::test_issue_9041", "sympy/utilities/tests/test_wester.py::test_V10", "sympy/integrals/tests/test_integrals.py::test_issue_2708", "sympy/utilities/tests/test_wester.py::test_V11", "sympy/series/tests/test_limits.py::test_issue_9471", "sympy/integrals/tests/test_integrals.py::test_issue_8368i", "sympy/utilities/tests/test_wester.py::test_V12", "sympy/utilities/tests/test_wester.py::test_V15", "sympy/integrals/tests/test_integrals.py::test_issue_8901", "sympy/series/tests/test_limits.py::test_issue_10382", "sympy/integrals/tests/test_integrals.py::test_issue_11742", "sympy/utilities/tests/test_wester.py::test_W7", "sympy/series/tests/test_limits.py::test_issue_11496", "sympy/integrals/tests/test_integrals.py::test_issue_11856", "sympy/utilities/tests/test_wester.py::test_W12", "sympy/series/tests/test_limits.py::test_issue_11879", "sympy/integrals/tests/test_integrals.py::test_issue_4968", "sympy/utilities/tests/test_wester.py::test_W14", "sympy/integrals/tests/test_integrals.py::test_singularities", "sympy/series/tests/test_limits.py::test_limit_with_Float", "sympy/series/tests/test_limits.py::test_issue_10610", "sympy/utilities/tests/test_wester.py::test_W17", "sympy/integrals/tests/test_integrals.py::test_issue_12645", "sympy/series/tests/test_limits.py::test_issue_10868", "sympy/integrals/tests/test_integrals.py::test_issue_14078", "sympy/utilities/tests/test_wester.py::test_W18", "sympy/integrals/tests/test_integrals.py::test_issue_14064", "sympy/utilities/tests/test_wester.py::test_W21", "sympy/series/tests/test_limits.py::test_issue_6599", "sympy/integrals/tests/test_integrals.py::test_issue_8170", "sympy/utilities/tests/test_wester.py::test_W23b", "sympy/series/tests/test_limits.py::test_issue_12555", "sympy/utilities/tests/test_wester.py::test_X1", "sympy/integrals/tests/test_integrals.py::test_issue_8440_14040", "sympy/series/tests/test_limits.py::test_issue_12769", "sympy/integrals/tests/test_integrals.py::test_issue_14096", "sympy/utilities/tests/test_wester.py::test_X2", "sympy/integrals/tests/test_integrals.py::test_issue_14144", "sympy/utilities/tests/test_wester.py::test_X3", "sympy/series/tests/test_limits.py::test_issue_13332", "sympy/integrals/tests/test_integrals.py::test_issue_14375", "sympy/utilities/tests/test_wester.py::test_X4", "sympy/series/tests/test_limits.py::test_issue_12564", "sympy/integrals/tests/test_integrals.py::test_issue_14437", "sympy/utilities/tests/test_wester.py::test_X6", "sympy/integrals/tests/test_integrals.py::test_issue_14470", "sympy/series/tests/test_limits.py::test_issue_14411", "sympy/utilities/tests/test_wester.py::test_X7", "sympy/integrals/tests/test_integrals.py::test_issue_14782", "sympy/series/tests/test_limits.py::test_issue_13382", "sympy/utilities/tests/test_wester.py::test_X8", "sympy/integrals/tests/test_integrals.py::test_issue_12081", "sympy/integrals/tests/test_integrals.py::test_issue_15285", "sympy/series/tests/test_limits.py::test_issue_13403", "sympy/utilities/tests/test_wester.py::test_X9", "sympy/utilities/tests/test_wester.py::test_X10", "sympy/integrals/tests/test_integrals.py::test_issue_15432", "sympy/series/tests/test_limits.py::test_issue_13416", "sympy/integrals/tests/test_integrals.py::test_issue_15124", "sympy/utilities/tests/test_wester.py::test_X11", "sympy/series/tests/test_limits.py::test_issue_13462", "sympy/integrals/tests/test_integrals.py::test_issue_15292", "sympy/utilities/tests/test_wester.py::test_X13", "sympy/integrals/tests/test_integrals.py::test_issue_4514", "sympy/series/tests/test_limits.py::test_issue_13750", "sympy/utilities/tests/test_wester.py::test_X16", "sympy/integrals/tests/test_integrals.py::test_issue_15431", "sympy/series/tests/test_limits.py::test_issue_14276", "sympy/utilities/tests/test_wester.py::test_X21", "sympy/integrals/tests/test_integrals.py::test_issue_15640_log_substitutions", "sympy/series/tests/test_limits.py::test_issue_14514", "sympy/utilities/tests/test_wester.py::test_Y1", "sympy/integrals/tests/test_integrals.py::test_issue_15509", "sympy/integrals/tests/test_integrals.py::test_integrate_with_complex_constants", "sympy/utilities/tests/test_wester.py::test_Y3", "sympy/series/tests/test_limits.py::test_issues_14525", "sympy/integrals/tests/test_integrals.py::test_issue_14241", "sympy/integrals/tests/test_integrals.py::test_issue_13112", "sympy/utilities/tests/test_wester.py::test_Y4", "sympy/integrals/tests/test_integrals.py::test_issue_14709b", "sympy/series/tests/test_limits.py::test_issue_14574", "sympy/solvers/tests/test_solvers.py::test_issue_6528", "sympy/series/tests/test_limits.py::test_issue_10102", "sympy/integrals/tests/test_integrals.py::test_issue_8614", "sympy/utilities/tests/test_wester.py::test_Y5_Y6", "sympy/integrals/tests/test_integrals.py::test_li_integral", "sympy/series/tests/test_limits.py::test_issue_14377", "sympy/utilities/tests/test_wester.py::test_Y9", "sympy/integrals/tests/test_integrals.py::test_issue_17473", "sympy/series/tests/test_limits.py::test_issue_15146", "sympy/integrals/tests/test_integrals.py::test_issue_17671", "sympy/utilities/tests/test_wester.py::test_Y10", "sympy/integrals/tests/test_integrals.py::test_issue_2975", "sympy/series/tests/test_limits.py::test_issue_15202", "sympy/solvers/tests/test_solvers.py::test_issues_6819_6820_6821_6248_8692_25777_25779", "sympy/utilities/tests/test_wester.py::test_Z1", "sympy/integrals/tests/test_integrals.py::test_issue_7827", "sympy/utilities/tests/test_wester.py::test_Z2", "sympy/integrals/tests/test_integrals.py::test_issue_4231", "sympy/series/tests/test_limits.py::test_issue_15282", "sympy/utilities/tests/test_wester.py::test_Z3", "sympy/integrals/tests/test_integrals.py::test_issue_21034", "sympy/series/tests/test_limits.py::test_issue_15984", "sympy/series/tests/test_limits.py::test_issue_13571", "sympy/series/tests/test_limits.py::test_issue_13575", "sympy/solvers/tests/test_solvers.py::test_lambert_multivariate", "sympy/series/tests/test_limits.py::test_issue_17325", "sympy/series/tests/test_limits.py::test_issue_10978", "sympy/series/tests/test_limits.py::test_issue_14313_comment", "sympy/solvers/tests/test_solvers.py::test_rewrite_trig", "sympy/series/tests/test_limits.py::test_issue_15323", "sympy/series/tests/test_limits.py::test_issue_12571", "sympy/series/tests/test_limits.py::test_issue_14590", "sympy/series/tests/test_limits.py::test_issue_14393", "sympy/series/tests/test_limits.py::test_issue_14556", "sympy/series/tests/test_limits.py::test_issue_14811", "sympy/series/tests/test_limits.py::test_issue_16222", "sympy/series/tests/test_limits.py::test_issue_16714", "sympy/solvers/tests/test_solvers.py::test_base_0_exp_0", "sympy/series/tests/test_limits.py::test_issue_16722", "sympy/series/tests/test_limits.py::test_issue_17431", "sympy/series/tests/test_limits.py::test_issue_17671", "sympy/series/tests/test_limits.py::test_issue_17751", "sympy/series/tests/test_limits.py::test_issue_17792", "sympy/solvers/tests/test_solvers.py::test_issue_13849", "sympy/series/tests/test_limits.py::test_issue_18118", "sympy/series/tests/test_limits.py::test_issue_18306", "sympy/series/tests/test_limits.py::test_issue_18378", "sympy/series/tests/test_limits.py::test_issue_18399", "sympy/solvers/tests/test_solvers.py::test_issue_17452", "sympy/series/tests/test_limits.py::test_issue_18442", "sympy/series/tests/test_limits.py::test_issue_18452", "sympy/series/tests/test_limits.py::test_issue_18473", "sympy/series/tests/test_limits.py::test_issue_18482", "sympy/series/tests/test_limits.py::test_issue_18508", "sympy/series/tests/test_limits.py::test_issue_18521", "sympy/series/tests/test_limits.py::test_issue_18969", "sympy/series/tests/test_limits.py::test_issue_18992", "sympy/series/tests/test_limits.py::test_issue_19067", "sympy/series/tests/test_limits.py::test_issue_19586", "sympy/series/tests/test_limits.py::test_issue_13715", "sympy/series/tests/test_limits.py::test_issue_15055", "sympy/series/tests/test_limits.py::test_issue_16708", "sympy/integrals/tests/test_integrals.py::test_issue_4187", "sympy/series/tests/test_limits.py::test_issue_19154", "sympy/integrals/tests/test_integrals.py::test_issue_5547", "sympy/series/tests/test_limits.py::test_issue_19453", "sympy/integrals/tests/test_integrals.py::test_issue_15810", "sympy/integrals/tests/test_integrals.py::test_issue_21024", "sympy/series/tests/test_limits.py::test_issue_19739", "sympy/solvers/tests/test_solvers.py::test_issue_21034", "sympy/integrals/tests/test_integrals.py::test_issue_21721", "sympy/series/tests/test_limits.py::test_issue_19766", "sympy/integrals/tests/test_integrals.py::test_issue_21831", "sympy/series/tests/test_limits.py::test_issue_19770", "sympy/integrals/tests/test_integrals.py::test_issue_18527", "sympy/solvers/tests/test_solvers.py::test_issue_4886", "sympy/series/tests/test_limits.py::test_issue_7535", "sympy/solvers/tests/test_solvers.py::test_issue_17454", "sympy/integrals/tests/test_integrals.py::test_issue_23718", "sympy/series/tests/test_limits.py::test_issue_20365", "sympy/integrals/tests/test_integrals.py::test_issue_23566", "sympy/integrals/tests/test_integrals.py::test_pr_23583", "sympy/series/tests/test_limits.py::test_issue_21031", "sympy/integrals/tests/test_integrals.py::test_issue_7264", "sympy/solvers/tests/test_solvers.py::test_issue_10169", "sympy/series/tests/test_limits.py::test_issue_21038", "sympy/integrals/tests/test_integrals.py::test_issue_11254a", "sympy/series/tests/test_limits.py::test_issue_20578", "sympy/integrals/tests/test_integrals.py::test_issue_11254b", "sympy/solvers/tests/test_solvers.py::test_solve_undetermined_coeffs_issue_23927", "sympy/series/tests/test_limits.py::test_issue_21227", "sympy/integrals/tests/test_integrals.py::test_issue_11254d", "sympy/series/tests/test_limits.py::test_issue_21415", "sympy/integrals/tests/test_integrals.py::test_issue_22863", "sympy/integrals/tests/test_integrals.py::test_issue_9723", "sympy/series/tests/test_limits.py::test_issue_21530", "sympy/integrals/tests/test_integrals.py::test_exp_substitution", "sympy/series/tests/test_limits.py::test_issue_21550", "sympy/integrals/tests/test_integrals.py::test_hyperbolic", "sympy/series/tests/test_limits.py::test_issue_21661", "sympy/integrals/tests/test_integrals.py::test_nested_pow", "sympy/integrals/tests/test_integrals.py::test_sqrt_quadratic", "sympy/series/tests/test_limits.py::test_issue_21701", "sympy/integrals/tests/test_integrals.py::test_mul_pow_derivative", "sympy/series/tests/test_limits.py::test_issue_21721", "sympy/integrals/tests/test_integrals.py::test_issue_23942", "sympy/series/tests/test_limits.py::test_issue_21756", "sympy/integrals/tests/test_integrals.py::test_old_issues", "sympy/series/tests/test_limits.py::test_issue_21785", "sympy/integrals/tests/test_integrals.py::test_integral_issue_26566", "sympy/series/tests/test_limits.py::test_issue_22181", "sympy/series/tests/test_limits.py::test_issue_22220", "sympy/series/tests/test_limits.py::test_issue_22334", "sympy/series/tests/test_limits.py::test_issue_22836_limit", "sympy/series/tests/test_limits.py::test_sympyissue_22986", "sympy/series/tests/test_limits.py::test_issue_23231", "sympy/series/tests/test_limits.py::test_issue_23596", "sympy/series/tests/test_limits.py::test_issue_23752", "sympy/series/tests/test_limits.py::test_issue_24276", "sympy/series/tests/test_limits.py::test_issue_25230", "sympy/series/tests/test_limits.py::test_issue_25582", "sympy/series/tests/test_limits.py::test_issue_25847", "sympy/series/tests/test_limits.py::test_issue_26040", "sympy/series/tests/test_limits.py::test_issue_26250", "sympy/series/tests/test_limits.py::test_issue_26513", "sympy/series/tests/test_limits.py::test_issue_26916", "sympy/series/tests/test_limits.py::test_issue_22982_15323", "sympy/series/tests/test_limits.py::test_issue_26991", "sympy/solvers/tests/test_solveset.py::test_solveset_real_log", "sympy/solvers/tests/test_solveset.py::test_solve_abs", "sympy/solvers/tests/test_solveset.py::test_solveset_complex_rational", "sympy/solvers/tests/test_solveset.py::test_solveset_complex_exp", "sympy/solvers/tests/test_solveset.py::test_solve_complex_sqrt", "sympy/solvers/tests/test_solveset.py::test_solveset_complex_tan", "sympy/solvers/tests/test_solveset.py::test_solve_trig", "sympy/solvers/tests/test_solveset.py::test_solve_trig_hyp_by_inversion", "sympy/solvers/tests/test_solveset.py::test_old_trig_issues", "sympy/solvers/tests/test_solveset.py::test_solve_hyperbolic", "sympy/solvers/tests/test_solveset.py::test_solve_trig_hyp_symbolic", "sympy/solvers/tests/test_solveset.py::test_issue_9616", "sympy/solvers/tests/test_solveset.py::test_multi_exp", "sympy/solvers/tests/test_solveset.py::test_conditionset", "sympy/solvers/tests/test_solveset.py::test_abs_invert_solvify", "sympy/solvers/tests/test_solveset.py::test_solve_decomposition", "sympy/solvers/tests/test_solveset.py::test_nonlinsolve_polysys", "sympy/solvers/tests/test_solveset.py::test_nonlinsolve_complex", "sympy/solvers/tests/test_solveset.py::test_issue_14642", "sympy/solvers/tests/test_solveset.py::test_issue_19050", "sympy/solvers/tests/test_solveset.py::test_issue_5132_1", "sympy/solvers/tests/test_solveset.py::test_issue_5132_2", "sympy/solvers/tests/test_solveset.py::test_substitution_incorrect", "sympy/solvers/tests/test_solveset.py::test_issue_17933_bis", "sympy/solvers/tests/test_solveset.py::test_issue_13849", "sympy/solvers/tests/test_solveset.py::test_issue_14300", "sympy/solvers/tests/test_solveset.py::test_issue_17276", "sympy/solvers/tests/test_solveset.py::test_issue_19144", "sympy/solvers/tests/test_solveset.py::test_issue_22413" ], "PASS_TO_PASS": null }
sympy__sympy-54
1.0
{ "code": "diff --git b/sympy/printing/codeprinter.py a/sympy/printing/codeprinter.py\nindex 21da4737a6..765f7f01f4 100644\n--- b/sympy/printing/codeprinter.py\n+++ a/sympy/printing/codeprinter.py\n@@ -901,6 +901,8 @@ def fcode(expr, assign_to=None, **settings):\n end if\n A(3, 1) = sin(x)\n \"\"\"\n+ from sympy.printing.fortran import FCodePrinter\n+ return FCodePrinter(settings).doprint(expr, assign_to)\n \n \n def print_fcode(expr, **settings):\n", "test": null }
null
{ "code": "diff --git a/sympy/printing/codeprinter.py b/sympy/printing/codeprinter.py\nindex 765f7f01f4..21da4737a6 100644\n--- a/sympy/printing/codeprinter.py\n+++ b/sympy/printing/codeprinter.py\n@@ -901,8 +901,6 @@ def fcode(expr, assign_to=None, **settings):\n end if\n A(3, 1) = sin(x)\n \"\"\"\n- from sympy.printing.fortran import FCodePrinter\n- return FCodePrinter(settings).doprint(expr, assign_to)\n \n \n def print_fcode(expr, **settings):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/printing/codeprinter.py.\nHere is the description for the function:\ndef fcode(expr, assign_to=None, **settings):\n \"\"\"Converts an expr to a string of fortran code\n\n Parameters\n ==========\n\n expr : Expr\n A SymPy expression to be converted.\n assign_to : optional\n When given, the argument is used as the name of the variable to which\n the expression is assigned. Can be a string, ``Symbol``,\n ``MatrixSymbol``, or ``Indexed`` type. This is helpful in case of\n line-wrapping, or for expressions that generate multi-line statements.\n precision : integer, optional\n DEPRECATED. Use type_mappings instead. The precision for numbers such\n as pi [default=17].\n user_functions : dict, optional\n A dictionary where keys are ``FunctionClass`` instances and values are\n their string representations. Alternatively, the dictionary value can\n be a list of tuples i.e. [(argument_test, cfunction_string)]. See below\n for examples.\n human : bool, optional\n If True, the result is a single string that may contain some constant\n declarations for the number symbols. If False, the same information is\n returned in a tuple of (symbols_to_declare, not_supported_functions,\n code_text). [default=True].\n contract: bool, optional\n If True, ``Indexed`` instances are assumed to obey tensor contraction\n rules and the corresponding nested loops over indices are generated.\n Setting contract=False will not generate loops, instead the user is\n responsible to provide values for the indices in the code.\n [default=True].\n source_format : optional\n The source format can be either 'fixed' or 'free'. [default='fixed']\n standard : integer, optional\n The Fortran standard to be followed. This is specified as an integer.\n Acceptable standards are 66, 77, 90, 95, 2003, and 2008. Default is 77.\n Note that currently the only distinction internally is between\n standards before 95, and those 95 and after. This may change later as\n more features are added.\n name_mangling : bool, optional\n If True, then the variables that would become identical in\n case-insensitive Fortran are mangled by appending different number\n of ``_`` at the end. If False, SymPy Will not interfere with naming of\n variables. [default=True]\n\n Examples\n ========\n\n >>> from sympy import fcode, symbols, Rational, sin, ceiling, floor\n >>> x, tau = symbols(\"x, tau\")\n >>> fcode((2*tau)**Rational(7, 2))\n ' 8*sqrt(2.0d0)*tau**(7.0d0/2.0d0)'\n >>> fcode(sin(x), assign_to=\"s\")\n ' s = sin(x)'\n\n Custom printing can be defined for certain types by passing a dictionary of\n \"type\" : \"function\" to the ``user_functions`` kwarg. Alternatively, the\n dictionary value can be a list of tuples i.e. [(argument_test,\n cfunction_string)].\n\n >>> custom_functions = {\n ... \"ceiling\": \"CEIL\",\n ... \"floor\": [(lambda x: not x.is_integer, \"FLOOR1\"),\n ... (lambda x: x.is_integer, \"FLOOR2\")]\n ... }\n >>> fcode(floor(x) + ceiling(x), user_functions=custom_functions)\n ' CEIL(x) + FLOOR1(x)'\n\n ``Piecewise`` expressions are converted into conditionals. If an\n ``assign_to`` variable is provided an if statement is created, otherwise\n the ternary operator is used. Note that if the ``Piecewise`` lacks a\n default term, represented by ``(expr, True)`` then an error will be thrown.\n This is to prevent generating an expression that may not evaluate to\n anything.\n\n >>> from sympy import Piecewise\n >>> expr = Piecewise((x + 1, x > 0), (x, True))\n >>> print(fcode(expr, tau))\n if (x > 0) then\n tau = x + 1\n else\n tau = x\n end if\n\n Support for loops is provided through ``Indexed`` types. With\n ``contract=True`` these expressions will be turned into loops, whereas\n ``contract=False`` will just print the assignment expression that should be\n looped over:\n\n >>> from sympy import Eq, IndexedBase, Idx\n >>> len_y = 5\n >>> y = IndexedBase('y', shape=(len_y,))\n >>> t = IndexedBase('t', shape=(len_y,))\n >>> Dy = IndexedBase('Dy', shape=(len_y-1,))\n >>> i = Idx('i', len_y-1)\n >>> e=Eq(Dy[i], (y[i+1]-y[i])/(t[i+1]-t[i]))\n >>> fcode(e.rhs, assign_to=e.lhs, contract=False)\n ' Dy(i) = (y(i + 1) - y(i))/(t(i + 1) - t(i))'\n\n Matrices are also supported, but a ``MatrixSymbol`` of the same dimensions\n must be provided to ``assign_to``. Note that any expression that can be\n generated normally can also exist inside a Matrix:\n\n >>> from sympy import Matrix, MatrixSymbol\n >>> mat = Matrix([x**2, Piecewise((x + 1, x > 0), (x, True)), sin(x)])\n >>> A = MatrixSymbol('A', 3, 1)\n >>> print(fcode(mat, A))\n A(1, 1) = x**2\n if (x > 0) then\n A(2, 1) = x + 1\n else\n A(2, 1) = x\n end if\n A(3, 1) = sin(x)\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/printing/tests/test_fortran.py::test_UnevaluatedExpr", "sympy/printing/tests/test_fortran.py::test_printmethod", "sympy/printing/tests/test_fortran.py::test_fcode_sign", "sympy/printing/tests/test_fortran.py::test_fcode_Pow", "sympy/printing/tests/test_fortran.py::test_fcode_Rational", "sympy/printing/tests/test_fortran.py::test_fcode_Integer", "sympy/printing/tests/test_fortran.py::test_fcode_Float", "sympy/printing/tests/test_fortran.py::test_fcode_functions", "sympy/printing/tests/test_fortran.py::test_case", "sympy/printing/tests/test_fortran.py::test_fcode_functions_with_integers", "sympy/printing/tests/test_fortran.py::test_fcode_NumberSymbol", "sympy/printing/tests/test_fortran.py::test_fcode_complex", "sympy/printing/tests/test_fortran.py::test_implicit", "sympy/printing/tests/test_fortran.py::test_not_fortran", "sympy/printing/tests/test_fortran.py::test_user_functions", "sympy/printing/tests/test_fortran.py::test_inline_function", "sympy/printing/tests/test_fortran.py::test_assign_to", "sympy/printing/tests/test_fortran.py::test_line_wrapping", "sympy/printing/tests/test_fortran.py::test_fcode_precedence", "sympy/printing/tests/test_fortran.py::test_fcode_Logical", "sympy/printing/tests/test_fortran.py::test_fcode_Xlogical", "sympy/printing/tests/test_fortran.py::test_fcode_Relational", "sympy/printing/tests/test_fortran.py::test_fcode_Piecewise", "sympy/printing/tests/test_fortran.py::test_settings", "sympy/printing/tests/test_fortran.py::test_free_form_code_line", "sympy/printing/tests/test_fortran.py::test_free_form_continuation_line", "sympy/printing/tests/test_fortran.py::test_loops", "sympy/printing/tests/test_fortran.py::test_dummy_loops", "sympy/printing/tests/test_fortran.py::test_fcode_Indexed_without_looking_for_contraction", "sympy/printing/tests/test_fortran.py::test_element_like_objects", "sympy/printing/tests/test_fortran.py::test_Matrix_printing", "sympy/printing/tests/test_fortran.py::test_fcode_For", "sympy/printing/tests/test_fortran.py::test_fcode_Declaration", "sympy/printing/tests/test_fortran.py::test_MatrixElement_printing", "sympy/printing/tests/test_fortran.py::test_aug_assign", "sympy/printing/tests/test_fortran.py::test_While", "sympy/printing/tests/test_fortran.py::test_FunctionPrototype_print", "sympy/printing/tests/test_fortran.py::test_FunctionDefinition_print", "sympy/codegen/tests/test_fnodes.py::test_size", "sympy/codegen/tests/test_fnodes.py::test_isign", "sympy/codegen/tests/test_fnodes.py::test_dsign", "sympy/codegen/tests/test_fnodes.py::test_literal_dp" ], "PASS_TO_PASS": null }
sympy__sympy-55
1.0
{ "code": "diff --git b/sympy/calculus/finite_diff.py a/sympy/calculus/finite_diff.py\nindex 713be3b8f0..17eece149a 100644\n--- b/sympy/calculus/finite_diff.py\n+++ a/sympy/calculus/finite_diff.py\n@@ -161,6 +161,36 @@ def finite_diff_weights(order, x_list, x0=S.One):\n (1988); 699-706; doi:10.1090/S0025-5718-1988-0935077-0\n \n \"\"\"\n+ # The notation below closely corresponds to the one used in the paper.\n+ order = S(order)\n+ if not order.is_number:\n+ raise ValueError(\"Cannot handle symbolic order.\")\n+ if order < 0:\n+ raise ValueError(\"Negative derivative order illegal.\")\n+ if int(order) != order:\n+ raise ValueError(\"Non-integer order illegal\")\n+ M = order\n+ N = len(x_list) - 1\n+ delta = [[[0 for nu in range(N+1)] for n in range(N+1)] for\n+ m in range(M+1)]\n+ delta[0][0][0] = S.One\n+ c1 = S.One\n+ for n in range(1, N+1):\n+ c2 = S.One\n+ for nu in range(n):\n+ c3 = x_list[n] - x_list[nu]\n+ c2 = c2 * c3\n+ if n <= M:\n+ delta[n][n-1][nu] = 0\n+ for m in range(min(n, M)+1):\n+ delta[m][n][nu] = (x_list[n]-x0)*delta[m][n-1][nu] -\\\n+ m*delta[m-1][n-1][nu]\n+ delta[m][n][nu] /= c3\n+ for m in range(min(n, M)+1):\n+ delta[m][n][n] = c1/c2*(m*delta[m-1][n-1][n-1] -\n+ (x_list[n-1]-x0)*delta[m][n-1][n-1])\n+ c1 = c2\n+ return delta\n \n \n def apply_finite_diff(order, x_list, y_list, x0=S.Zero):\n", "test": null }
null
{ "code": "diff --git a/sympy/calculus/finite_diff.py b/sympy/calculus/finite_diff.py\nindex 17eece149a..713be3b8f0 100644\n--- a/sympy/calculus/finite_diff.py\n+++ b/sympy/calculus/finite_diff.py\n@@ -161,36 +161,6 @@ def finite_diff_weights(order, x_list, x0=S.One):\n (1988); 699-706; doi:10.1090/S0025-5718-1988-0935077-0\n \n \"\"\"\n- # The notation below closely corresponds to the one used in the paper.\n- order = S(order)\n- if not order.is_number:\n- raise ValueError(\"Cannot handle symbolic order.\")\n- if order < 0:\n- raise ValueError(\"Negative derivative order illegal.\")\n- if int(order) != order:\n- raise ValueError(\"Non-integer order illegal\")\n- M = order\n- N = len(x_list) - 1\n- delta = [[[0 for nu in range(N+1)] for n in range(N+1)] for\n- m in range(M+1)]\n- delta[0][0][0] = S.One\n- c1 = S.One\n- for n in range(1, N+1):\n- c2 = S.One\n- for nu in range(n):\n- c3 = x_list[n] - x_list[nu]\n- c2 = c2 * c3\n- if n <= M:\n- delta[n][n-1][nu] = 0\n- for m in range(min(n, M)+1):\n- delta[m][n][nu] = (x_list[n]-x0)*delta[m][n-1][nu] -\\\n- m*delta[m-1][n-1][nu]\n- delta[m][n][nu] /= c3\n- for m in range(min(n, M)+1):\n- delta[m][n][n] = c1/c2*(m*delta[m-1][n-1][n-1] -\n- (x_list[n-1]-x0)*delta[m][n-1][n-1])\n- c1 = c2\n- return delta\n \n \n def apply_finite_diff(order, x_list, y_list, x0=S.Zero):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/calculus/finite_diff.py.\nHere is the description for the function:\ndef finite_diff_weights(order, x_list, x0=S.One):\n \"\"\"\n Calculates the finite difference weights for an arbitrarily spaced\n one-dimensional grid (``x_list``) for derivatives at ``x0`` of order\n 0, 1, ..., up to ``order`` using a recursive formula. Order of accuracy\n is at least ``len(x_list) - order``, if ``x_list`` is defined correctly.\n\n Parameters\n ==========\n\n order: int\n Up to what derivative order weights should be calculated.\n 0 corresponds to interpolation.\n x_list: sequence\n Sequence of (unique) values for the independent variable.\n It is useful (but not necessary) to order ``x_list`` from\n nearest to furthest from ``x0``; see examples below.\n x0: Number or Symbol\n Root or value of the independent variable for which the finite\n difference weights should be generated. Default is ``S.One``.\n\n Returns\n =======\n\n list\n A list of sublists, each corresponding to coefficients for\n increasing derivative order, and each containing lists of\n coefficients for increasing subsets of x_list.\n\n Examples\n ========\n\n >>> from sympy import finite_diff_weights, S\n >>> res = finite_diff_weights(1, [-S(1)/2, S(1)/2, S(3)/2, S(5)/2], 0)\n >>> res\n [[[1, 0, 0, 0],\n [1/2, 1/2, 0, 0],\n [3/8, 3/4, -1/8, 0],\n [5/16, 15/16, -5/16, 1/16]],\n [[0, 0, 0, 0],\n [-1, 1, 0, 0],\n [-1, 1, 0, 0],\n [-23/24, 7/8, 1/8, -1/24]]]\n >>> res[0][-1] # FD weights for 0th derivative, using full x_list\n [5/16, 15/16, -5/16, 1/16]\n >>> res[1][-1] # FD weights for 1st derivative\n [-23/24, 7/8, 1/8, -1/24]\n >>> res[1][-2] # FD weights for 1st derivative, using x_list[:-1]\n [-1, 1, 0, 0]\n >>> res[1][-1][0] # FD weight for 1st deriv. for x_list[0]\n -23/24\n >>> res[1][-1][1] # FD weight for 1st deriv. for x_list[1], etc.\n 7/8\n\n Each sublist contains the most accurate formula at the end.\n Note, that in the above example ``res[1][1]`` is the same as ``res[1][2]``.\n Since res[1][2] has an order of accuracy of\n ``len(x_list[:3]) - order = 3 - 1 = 2``, the same is true for ``res[1][1]``!\n\n >>> res = finite_diff_weights(1, [S(0), S(1), -S(1), S(2), -S(2)], 0)[1]\n >>> res\n [[0, 0, 0, 0, 0],\n [-1, 1, 0, 0, 0],\n [0, 1/2, -1/2, 0, 0],\n [-1/2, 1, -1/3, -1/6, 0],\n [0, 2/3, -2/3, -1/12, 1/12]]\n >>> res[0] # no approximation possible, using x_list[0] only\n [0, 0, 0, 0, 0]\n >>> res[1] # classic forward step approximation\n [-1, 1, 0, 0, 0]\n >>> res[2] # classic centered approximation\n [0, 1/2, -1/2, 0, 0]\n >>> res[3:] # higher order approximations\n [[-1/2, 1, -1/3, -1/6, 0], [0, 2/3, -2/3, -1/12, 1/12]]\n\n Let us compare this to a differently defined ``x_list``. Pay attention to\n ``foo[i][k]`` corresponding to the gridpoint defined by ``x_list[k]``.\n\n >>> foo = finite_diff_weights(1, [-S(2), -S(1), S(0), S(1), S(2)], 0)[1]\n >>> foo\n [[0, 0, 0, 0, 0],\n [-1, 1, 0, 0, 0],\n [1/2, -2, 3/2, 0, 0],\n [1/6, -1, 1/2, 1/3, 0],\n [1/12, -2/3, 0, 2/3, -1/12]]\n >>> foo[1] # not the same and of lower accuracy as res[1]!\n [-1, 1, 0, 0, 0]\n >>> foo[2] # classic double backward step approximation\n [1/2, -2, 3/2, 0, 0]\n >>> foo[4] # the same as res[4]\n [1/12, -2/3, 0, 2/3, -1/12]\n\n Note that, unless you plan on using approximations based on subsets of\n ``x_list``, the order of gridpoints does not matter.\n\n The capability to generate weights at arbitrary points can be\n used e.g. to minimize Runge's phenomenon by using Chebyshev nodes:\n\n >>> from sympy import cos, symbols, pi, simplify\n >>> N, (h, x) = 4, symbols('h x')\n >>> x_list = [x+h*cos(i*pi/(N)) for i in range(N,-1,-1)] # chebyshev nodes\n >>> print(x_list)\n [-h + x, -sqrt(2)*h/2 + x, x, sqrt(2)*h/2 + x, h + x]\n >>> mycoeffs = finite_diff_weights(1, x_list, 0)[1][4]\n >>> [simplify(c) for c in mycoeffs] #doctest: +NORMALIZE_WHITESPACE\n [(h**3/2 + h**2*x - 3*h*x**2 - 4*x**3)/h**4,\n (-sqrt(2)*h**3 - 4*h**2*x + 3*sqrt(2)*h*x**2 + 8*x**3)/h**4,\n (6*h**2*x - 8*x**3)/h**4,\n (sqrt(2)*h**3 - 4*h**2*x - 3*sqrt(2)*h*x**2 + 8*x**3)/h**4,\n (-h**3/2 + h**2*x + 3*h*x**2 - 4*x**3)/h**4]\n\n Notes\n =====\n\n If weights for a finite difference approximation of 3rd order\n derivative is wanted, weights for 0th, 1st and 2nd order are\n calculated \"for free\", so are formulae using subsets of ``x_list``.\n This is something one can take advantage of to save computational cost.\n Be aware that one should define ``x_list`` from nearest to furthest from\n ``x0``. If not, subsets of ``x_list`` will yield poorer approximations,\n which might not grand an order of accuracy of ``len(x_list) - order``.\n\n See also\n ========\n\n sympy.calculus.finite_diff.apply_finite_diff\n\n References\n ==========\n\n .. [1] Generation of Finite Difference Formulas on Arbitrarily Spaced\n Grids, Bengt Fornberg; Mathematics of computation; 51; 184;\n (1988); 699-706; doi:10.1090/S0025-5718-1988-0935077-0\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/core/tests/test_function.py::test_Derivative_as_finite_difference", "sympy/calculus/tests/test_finite_diff.py::test_apply_finite_diff", "sympy/calculus/tests/test_finite_diff.py::test_finite_diff_weights", "sympy/calculus/tests/test_finite_diff.py::test_as_finite_diff", "sympy/calculus/tests/test_finite_diff.py::test_differentiate_finite" ], "PASS_TO_PASS": null }
sympy__sympy-56
1.0
{ "code": "diff --git b/sympy/series/formal.py a/sympy/series/formal.py\nindex 8d3dc38b1a..ada591e03d 100644\n--- b/sympy/series/formal.py\n+++ a/sympy/series/formal.py\n@@ -1844,3 +1844,20 @@ def fps(f, x=None, x0=0, dir=1, hyper=True, order=4, rational=True, full=False):\n sympy.series.formal.FormalPowerSeries\n sympy.series.formal.compute_fps\n \"\"\"\n+ f = sympify(f)\n+\n+ if x is None:\n+ free = f.free_symbols\n+ if len(free) == 1:\n+ x = free.pop()\n+ elif not free:\n+ return f\n+ else:\n+ raise NotImplementedError(\"multivariate formal power series\")\n+\n+ result = compute_fps(f, x, x0, dir, hyper, order, rational, full)\n+\n+ if result is None:\n+ return f\n+\n+ return FormalPowerSeries(f, x, x0, dir, result)\n", "test": null }
null
{ "code": "diff --git a/sympy/series/formal.py b/sympy/series/formal.py\nindex ada591e03d..8d3dc38b1a 100644\n--- a/sympy/series/formal.py\n+++ b/sympy/series/formal.py\n@@ -1844,20 +1844,3 @@ def fps(f, x=None, x0=0, dir=1, hyper=True, order=4, rational=True, full=False):\n sympy.series.formal.FormalPowerSeries\n sympy.series.formal.compute_fps\n \"\"\"\n- f = sympify(f)\n-\n- if x is None:\n- free = f.free_symbols\n- if len(free) == 1:\n- x = free.pop()\n- elif not free:\n- return f\n- else:\n- raise NotImplementedError(\"multivariate formal power series\")\n-\n- result = compute_fps(f, x, x0, dir, hyper, order, rational, full)\n-\n- if result is None:\n- return f\n-\n- return FormalPowerSeries(f, x, x0, dir, result)\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/series/formal.py.\nHere is the description for the function:\ndef fps(f, x=None, x0=0, dir=1, hyper=True, order=4, rational=True, full=False):\n \"\"\"\n Generates Formal Power Series of ``f``.\n\n Explanation\n ===========\n\n Returns the formal series expansion of ``f`` around ``x = x0``\n with respect to ``x`` in the form of a ``FormalPowerSeries`` object.\n\n Formal Power Series is represented using an explicit formula\n computed using different algorithms.\n\n See :func:`compute_fps` for the more details regarding the computation\n of formula.\n\n Parameters\n ==========\n\n x : Symbol, optional\n If x is None and ``f`` is univariate, the univariate symbols will be\n supplied, otherwise an error will be raised.\n x0 : number, optional\n Point to perform series expansion about. Default is 0.\n dir : {1, -1, '+', '-'}, optional\n If dir is 1 or '+' the series is calculated from the right and\n for -1 or '-' the series is calculated from the left. For smooth\n functions this flag will not alter the results. Default is 1.\n hyper : {True, False}, optional\n Set hyper to False to skip the hypergeometric algorithm.\n By default it is set to False.\n order : int, optional\n Order of the derivative of ``f``, Default is 4.\n rational : {True, False}, optional\n Set rational to False to skip rational algorithm. By default it is set\n to True.\n full : {True, False}, optional\n Set full to True to increase the range of rational algorithm.\n See :func:`rational_algorithm` for details. By default it is set to\n False.\n\n Examples\n ========\n\n >>> from sympy import fps, ln, atan, sin\n >>> from sympy.abc import x, n\n\n Rational Functions\n\n >>> fps(ln(1 + x)).truncate()\n x - x**2/2 + x**3/3 - x**4/4 + x**5/5 + O(x**6)\n\n >>> fps(atan(x), full=True).truncate()\n x - x**3/3 + x**5/5 + O(x**6)\n\n Symbolic Functions\n\n >>> fps(x**n*sin(x**2), x).truncate(8)\n -x**(n + 6)/6 + x**(n + 2) + O(x**(n + 8))\n\n See Also\n ========\n\n sympy.series.formal.FormalPowerSeries\n sympy.series.formal.compute_fps\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/printing/tests/test_latex.py::test_latex_FormalPowerSeries", "sympy/printing/pretty/tests/test_pretty.py::test_pretty_FormalPowerSeries", "sympy/core/tests/test_args.py::test_sympy__series__formal__FormalPowerSeries", "sympy/core/tests/test_args.py::test_sympy__series__formal__Coeff", "sympy/core/tests/test_args.py::test_sympy__series__formal__FormalPowerSeriesProduct", "sympy/core/tests/test_args.py::test_sympy__series__formal__FormalPowerSeriesCompose", "sympy/core/tests/test_args.py::test_sympy__series__formal__FormalPowerSeriesInverse", "sympy/series/tests/test_formal.py::test_fps", "sympy/series/tests/test_formal.py::test_fps_shift", "sympy/series/tests/test_formal.py::test_fps__Add_expr", "sympy/series/tests/test_formal.py::test_fps__asymptotic", "sympy/series/tests/test_formal.py::test_fps__fractional", "sympy/series/tests/test_formal.py::test_fps__logarithmic_singularity", "sympy/series/tests/test_formal.py::test_fps_symbolic", "sympy/series/tests/test_formal.py::test_fps__slow", "sympy/series/tests/test_formal.py::test_fps__operations", "sympy/series/tests/test_formal.py::test_fps__product", "sympy/series/tests/test_formal.py::test_fps__compose", "sympy/series/tests/test_formal.py::test_fps__inverse" ], "PASS_TO_PASS": null }
sympy__sympy-57
1.0
{ "code": "diff --git b/sympy/simplify/fu.py a/sympy/simplify/fu.py\nindex 43b3624008..bd66c2c161 100644\n--- b/sympy/simplify/fu.py\n+++ a/sympy/simplify/fu.py\n@@ -1648,6 +1648,25 @@ def fu(rv, measure=lambda x: (L(x), x.count_ops())):\n \n .. [1] https://www.sciencedirect.com/science/article/pii/S0895717706001609\n \"\"\"\n+ fRL1 = greedy(RL1, measure)\n+ fRL2 = greedy(RL2, measure)\n+\n+ was = rv\n+ rv = sympify(rv)\n+ if not isinstance(rv, Expr):\n+ return rv.func(*[fu(a, measure=measure) for a in rv.args])\n+ rv = TR1(rv)\n+ if rv.has(tan, cot):\n+ rv1 = fRL1(rv)\n+ if (measure(rv1) < measure(rv)):\n+ rv = rv1\n+ if rv.has(tan, cot):\n+ rv = TR2(rv)\n+ if rv.has(sin, cos):\n+ rv1 = fRL2(rv)\n+ rv2 = TR8(TRmorrie(rv1))\n+ rv = min([was, rv, rv1, rv2], key=measure)\n+ return min(TR2i(rv), rv, key=measure)\n \n \n def process_common_addends(rv, do, key2=None, key1=True):\n", "test": null }
null
{ "code": "diff --git a/sympy/simplify/fu.py b/sympy/simplify/fu.py\nindex bd66c2c161..43b3624008 100644\n--- a/sympy/simplify/fu.py\n+++ b/sympy/simplify/fu.py\n@@ -1648,25 +1648,6 @@ def fu(rv, measure=lambda x: (L(x), x.count_ops())):\n \n .. [1] https://www.sciencedirect.com/science/article/pii/S0895717706001609\n \"\"\"\n- fRL1 = greedy(RL1, measure)\n- fRL2 = greedy(RL2, measure)\n-\n- was = rv\n- rv = sympify(rv)\n- if not isinstance(rv, Expr):\n- return rv.func(*[fu(a, measure=measure) for a in rv.args])\n- rv = TR1(rv)\n- if rv.has(tan, cot):\n- rv1 = fRL1(rv)\n- if (measure(rv1) < measure(rv)):\n- rv = rv1\n- if rv.has(tan, cot):\n- rv = TR2(rv)\n- if rv.has(sin, cos):\n- rv1 = fRL2(rv)\n- rv2 = TR8(TRmorrie(rv1))\n- rv = min([was, rv, rv1, rv2], key=measure)\n- return min(TR2i(rv), rv, key=measure)\n \n \n def process_common_addends(rv, do, key2=None, key1=True):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/simplify/fu.py.\nHere is the description for the function:\ndef fu(rv, measure=lambda x: (L(x), x.count_ops())):\n \"\"\"Attempt to simplify expression by using transformation rules given\n in the algorithm by Fu et al.\n\n :func:`fu` will try to minimize the objective function ``measure``.\n By default this first minimizes the number of trig terms and then minimizes\n the number of total operations.\n\n Examples\n ========\n\n >>> from sympy.simplify.fu import fu\n >>> from sympy import cos, sin, tan, pi, S, sqrt\n >>> from sympy.abc import x, y, a, b\n\n >>> fu(sin(50)**2 + cos(50)**2 + sin(pi/6))\n 3/2\n >>> fu(sqrt(6)*cos(x) + sqrt(2)*sin(x))\n 2*sqrt(2)*sin(x + pi/3)\n\n CTR1 example\n\n >>> eq = sin(x)**4 - cos(y)**2 + sin(y)**2 + 2*cos(x)**2\n >>> fu(eq)\n cos(x)**4 - 2*cos(y)**2 + 2\n\n CTR2 example\n\n >>> fu(S.Half - cos(2*x)/2)\n sin(x)**2\n\n CTR3 example\n\n >>> fu(sin(a)*(cos(b) - sin(b)) + cos(a)*(sin(b) + cos(b)))\n sqrt(2)*sin(a + b + pi/4)\n\n CTR4 example\n\n >>> fu(sqrt(3)*cos(x)/2 + sin(x)/2)\n sin(x + pi/3)\n\n Example 1\n\n >>> fu(1-sin(2*x)**2/4-sin(y)**2-cos(x)**4)\n -cos(x)**2 + cos(y)**2\n\n Example 2\n\n >>> fu(cos(4*pi/9))\n sin(pi/18)\n >>> fu(cos(pi/9)*cos(2*pi/9)*cos(3*pi/9)*cos(4*pi/9))\n 1/16\n\n Example 3\n\n >>> fu(tan(7*pi/18)+tan(5*pi/18)-sqrt(3)*tan(5*pi/18)*tan(7*pi/18))\n -sqrt(3)\n\n Objective function example\n\n >>> fu(sin(x)/cos(x)) # default objective function\n tan(x)\n >>> fu(sin(x)/cos(x), measure=lambda x: -x.count_ops()) # maximize op count\n sin(x)/cos(x)\n\n References\n ==========\n\n .. [1] https://www.sciencedirect.com/science/article/pii/S0895717706001609\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/simplify/tests/test_fu.py::test_fu", "sympy/simplify/tests/test_fu.py::test_objective", "sympy/simplify/tests/test_fu.py::test_hyper_as_trig", "sympy/simplify/tests/test_trigsimp.py::test_issue_2827_trigsimp_methods", "sympy/integrals/tests/test_failing_integrals.py::test_issue_4511" ], "PASS_TO_PASS": null }
sympy__sympy-58
1.0
{ "code": "diff --git b/sympy/utilities/iterables.py a/sympy/utilities/iterables.py\nindex d2687746b7..cc5c1152f0 100644\n--- b/sympy/utilities/iterables.py\n+++ a/sympy/utilities/iterables.py\n@@ -2086,6 +2086,46 @@ def generate_bell(n):\n Vincent Vajnovszki, DMTCS vol 1 issue 12, 2010\n \n \"\"\"\n+ n = as_int(n)\n+ if n < 1:\n+ raise ValueError('n must be a positive integer')\n+ if n == 1:\n+ yield (0,)\n+ elif n == 2:\n+ yield (0, 1)\n+ yield (1, 0)\n+ elif n == 3:\n+ yield from [(0, 1, 2), (0, 2, 1), (2, 0, 1), (2, 1, 0), (1, 2, 0), (1, 0, 2)]\n+ else:\n+ m = n - 1\n+ op = [0] + [-1]*m\n+ l = list(range(n))\n+ while True:\n+ yield tuple(l)\n+ # find biggest element with op\n+ big = None, -1 # idx, value\n+ for i in range(n):\n+ if op[i] and l[i] > big[1]:\n+ big = i, l[i]\n+ i, _ = big\n+ if i is None:\n+ break # there are no ops left\n+ # swap it with neighbor in the indicated direction\n+ j = i + op[i]\n+ l[i], l[j] = l[j], l[i]\n+ op[i], op[j] = op[j], op[i]\n+ # if it landed at the end or if the neighbor in the same\n+ # direction is bigger then turn off op\n+ if j == 0 or j == m or l[j + op[j]] > l[j]:\n+ op[j] = 0\n+ # any element bigger to the left gets +1 op\n+ for i in range(j):\n+ if l[i] > l[j]:\n+ op[i] = 1\n+ # any element bigger to the right gets -1 op\n+ for i in range(j + 1, n):\n+ if l[i] > l[j]:\n+ op[i] = -1\n \n \n def generate_involutions(n):\n", "test": null }
null
{ "code": "diff --git a/sympy/utilities/iterables.py b/sympy/utilities/iterables.py\nindex cc5c1152f0..d2687746b7 100644\n--- a/sympy/utilities/iterables.py\n+++ b/sympy/utilities/iterables.py\n@@ -2086,46 +2086,6 @@ def generate_bell(n):\n Vincent Vajnovszki, DMTCS vol 1 issue 12, 2010\n \n \"\"\"\n- n = as_int(n)\n- if n < 1:\n- raise ValueError('n must be a positive integer')\n- if n == 1:\n- yield (0,)\n- elif n == 2:\n- yield (0, 1)\n- yield (1, 0)\n- elif n == 3:\n- yield from [(0, 1, 2), (0, 2, 1), (2, 0, 1), (2, 1, 0), (1, 2, 0), (1, 0, 2)]\n- else:\n- m = n - 1\n- op = [0] + [-1]*m\n- l = list(range(n))\n- while True:\n- yield tuple(l)\n- # find biggest element with op\n- big = None, -1 # idx, value\n- for i in range(n):\n- if op[i] and l[i] > big[1]:\n- big = i, l[i]\n- i, _ = big\n- if i is None:\n- break # there are no ops left\n- # swap it with neighbor in the indicated direction\n- j = i + op[i]\n- l[i], l[j] = l[j], l[i]\n- op[i], op[j] = op[j], op[i]\n- # if it landed at the end or if the neighbor in the same\n- # direction is bigger then turn off op\n- if j == 0 or j == m or l[j + op[j]] > l[j]:\n- op[j] = 0\n- # any element bigger to the left gets +1 op\n- for i in range(j):\n- if l[i] > l[j]:\n- op[i] = 1\n- # any element bigger to the right gets -1 op\n- for i in range(j + 1, n):\n- if l[i] > l[j]:\n- op[i] = -1\n \n \n def generate_involutions(n):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/utilities/iterables.py.\nHere is the description for the function:\ndef generate_bell(n):\n \"\"\"Return permutations of [0, 1, ..., n - 1] such that each permutation\n differs from the last by the exchange of a single pair of neighbors.\n The ``n!`` permutations are returned as an iterator. In order to obtain\n the next permutation from a random starting permutation, use the\n ``next_trotterjohnson`` method of the Permutation class (which generates\n the same sequence in a different manner).\n\n Examples\n ========\n\n >>> from itertools import permutations\n >>> from sympy.utilities.iterables import generate_bell\n >>> from sympy import zeros, Matrix\n\n This is the sort of permutation used in the ringing of physical bells,\n and does not produce permutations in lexicographical order. Rather, the\n permutations differ from each other by exactly one inversion, and the\n position at which the swapping occurs varies periodically in a simple\n fashion. Consider the first few permutations of 4 elements generated\n by ``permutations`` and ``generate_bell``:\n\n >>> list(permutations(range(4)))[:5]\n [(0, 1, 2, 3), (0, 1, 3, 2), (0, 2, 1, 3), (0, 2, 3, 1), (0, 3, 1, 2)]\n >>> list(generate_bell(4))[:5]\n [(0, 1, 2, 3), (0, 1, 3, 2), (0, 3, 1, 2), (3, 0, 1, 2), (3, 0, 2, 1)]\n\n Notice how the 2nd and 3rd lexicographical permutations have 3 elements\n out of place whereas each \"bell\" permutation always has only two\n elements out of place relative to the previous permutation (and so the\n signature (+/-1) of a permutation is opposite of the signature of the\n previous permutation).\n\n How the position of inversion varies across the elements can be seen\n by tracing out where the largest number appears in the permutations:\n\n >>> m = zeros(4, 24)\n >>> for i, p in enumerate(generate_bell(4)):\n ... m[:, i] = Matrix([j - 3 for j in list(p)]) # make largest zero\n >>> m.print_nonzero('X')\n [XXX XXXXXX XXXXXX XXX]\n [XX XX XXXX XX XXXX XX XX]\n [X XXXX XX XXXX XX XXXX X]\n [ XXXXXX XXXXXX XXXXXX ]\n\n See Also\n ========\n\n sympy.combinatorics.permutations.Permutation.next_trotterjohnson\n\n References\n ==========\n\n .. [1] https://en.wikipedia.org/wiki/Method_ringing\n\n .. [2] https://stackoverflow.com/questions/4856615/recursive-permutation/4857018\n\n .. [3] https://web.archive.org/web/20160313023044/http://programminggeeks.com/bell-algorithm-for-permutation/\n\n .. [4] https://en.wikipedia.org/wiki/Steinhaus%E2%80%93Johnson%E2%80%93Trotter_algorithm\n\n .. [5] Generating involutions, derangements, and relatives by ECO\n Vincent Vajnovszki, DMTCS vol 1 issue 12, 2010\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/utilities/tests/test_iterables.py::test_bell_perm", "sympy/solvers/tests/test_solvers.py::test_det_quick" ], "PASS_TO_PASS": null }
sympy__sympy-59
1.0
{ "code": "diff --git b/sympy/physics/quantum/identitysearch.py a/sympy/physics/quantum/identitysearch.py\nindex 7ffc8a87e2..9a178e9b80 100644\n--- b/sympy/physics/quantum/identitysearch.py\n+++ a/sympy/physics/quantum/identitysearch.py\n@@ -463,6 +463,68 @@ def generate_gate_rules(gate_seq, return_as_muls=False):\n (Y(0), X(0)*Z(0)), (Z(0), Y(0)*X(0))}\n \"\"\"\n \n+ if isinstance(gate_seq, Number):\n+ if return_as_muls:\n+ return {(S.One, S.One)}\n+ else:\n+ return {((), ())}\n+\n+ elif isinstance(gate_seq, Mul):\n+ gate_seq = gate_seq.args\n+\n+ # Each item in queue is a 3-tuple:\n+ # i) first item is the left side of an equality\n+ # ii) second item is the right side of an equality\n+ # iii) third item is the number of operations performed\n+ # The argument, gate_seq, will start on the left side, and\n+ # the right side will be empty, implying the presence of an\n+ # identity.\n+ queue = deque()\n+ # A set of gate rules\n+ rules = set()\n+ # Maximum number of operations to perform\n+ max_ops = len(gate_seq)\n+\n+ def process_new_rule(new_rule, ops):\n+ if new_rule is not None:\n+ new_left, new_right = new_rule\n+\n+ if new_rule not in rules and (new_right, new_left) not in rules:\n+ rules.add(new_rule)\n+ # If haven't reached the max limit on operations\n+ if ops + 1 < max_ops:\n+ queue.append(new_rule + (ops + 1,))\n+\n+ queue.append((gate_seq, (), 0))\n+ rules.add((gate_seq, ()))\n+\n+ while len(queue) > 0:\n+ left, right, ops = queue.popleft()\n+\n+ # Do a LL\n+ new_rule = ll_op(left, right)\n+ process_new_rule(new_rule, ops)\n+ # Do a LR\n+ new_rule = lr_op(left, right)\n+ process_new_rule(new_rule, ops)\n+ # Do a RL\n+ new_rule = rl_op(left, right)\n+ process_new_rule(new_rule, ops)\n+ # Do a RR\n+ new_rule = rr_op(left, right)\n+ process_new_rule(new_rule, ops)\n+\n+ if return_as_muls:\n+ # Convert each rule as tuples into a rule as muls\n+ mul_rules = set()\n+ for rule in rules:\n+ left, right = rule\n+ mul_rules.add((Mul(*left), Mul(*right)))\n+\n+ rules = mul_rules\n+\n+ return rules\n+\n \n def generate_equivalent_ids(gate_seq, return_as_muls=False):\n \"\"\"Returns a set of equivalent gate identities.\n", "test": null }
null
{ "code": "diff --git a/sympy/physics/quantum/identitysearch.py b/sympy/physics/quantum/identitysearch.py\nindex 9a178e9b80..7ffc8a87e2 100644\n--- a/sympy/physics/quantum/identitysearch.py\n+++ b/sympy/physics/quantum/identitysearch.py\n@@ -463,68 +463,6 @@ def generate_gate_rules(gate_seq, return_as_muls=False):\n (Y(0), X(0)*Z(0)), (Z(0), Y(0)*X(0))}\n \"\"\"\n \n- if isinstance(gate_seq, Number):\n- if return_as_muls:\n- return {(S.One, S.One)}\n- else:\n- return {((), ())}\n-\n- elif isinstance(gate_seq, Mul):\n- gate_seq = gate_seq.args\n-\n- # Each item in queue is a 3-tuple:\n- # i) first item is the left side of an equality\n- # ii) second item is the right side of an equality\n- # iii) third item is the number of operations performed\n- # The argument, gate_seq, will start on the left side, and\n- # the right side will be empty, implying the presence of an\n- # identity.\n- queue = deque()\n- # A set of gate rules\n- rules = set()\n- # Maximum number of operations to perform\n- max_ops = len(gate_seq)\n-\n- def process_new_rule(new_rule, ops):\n- if new_rule is not None:\n- new_left, new_right = new_rule\n-\n- if new_rule not in rules and (new_right, new_left) not in rules:\n- rules.add(new_rule)\n- # If haven't reached the max limit on operations\n- if ops + 1 < max_ops:\n- queue.append(new_rule + (ops + 1,))\n-\n- queue.append((gate_seq, (), 0))\n- rules.add((gate_seq, ()))\n-\n- while len(queue) > 0:\n- left, right, ops = queue.popleft()\n-\n- # Do a LL\n- new_rule = ll_op(left, right)\n- process_new_rule(new_rule, ops)\n- # Do a LR\n- new_rule = lr_op(left, right)\n- process_new_rule(new_rule, ops)\n- # Do a RL\n- new_rule = rl_op(left, right)\n- process_new_rule(new_rule, ops)\n- # Do a RR\n- new_rule = rr_op(left, right)\n- process_new_rule(new_rule, ops)\n-\n- if return_as_muls:\n- # Convert each rule as tuples into a rule as muls\n- mul_rules = set()\n- for rule in rules:\n- left, right = rule\n- mul_rules.add((Mul(*left), Mul(*right)))\n-\n- rules = mul_rules\n-\n- return rules\n-\n \n def generate_equivalent_ids(gate_seq, return_as_muls=False):\n \"\"\"Returns a set of equivalent gate identities.\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/physics/quantum/identitysearch.py.\nHere is the description for the function:\ndef generate_gate_rules(gate_seq, return_as_muls=False):\n \"\"\"Returns a set of gate rules. Each gate rules is represented\n as a 2-tuple of tuples or Muls. An empty tuple represents an arbitrary\n scalar value.\n\n This function uses the four operations (LL, LR, RL, RR)\n to generate the gate rules.\n\n A gate rule is an expression such as ABC = D or AB = CD, where\n A, B, C, and D are gates. Each value on either side of the\n equal sign represents a circuit. The four operations allow\n one to find a set of equivalent circuits from a gate identity.\n The letters denoting the operation tell the user what\n activities to perform on each expression. The first letter\n indicates which side of the equal sign to focus on. The\n second letter indicates which gate to focus on given the\n side. Once this information is determined, the inverse\n of the gate is multiplied on both circuits to create a new\n gate rule.\n\n For example, given the identity, ABCD = 1, a LL operation\n means look at the left value and multiply both left sides by the\n inverse of the leftmost gate A. If A is Hermitian, the inverse\n of A is still A. The resulting new rule is BCD = A.\n\n The following is a summary of the four operations. Assume\n that in the examples, all gates are Hermitian.\n\n LL : left circuit, left multiply\n ABCD = E -> AABCD = AE -> BCD = AE\n LR : left circuit, right multiply\n ABCD = E -> ABCDD = ED -> ABC = ED\n RL : right circuit, left multiply\n ABC = ED -> EABC = EED -> EABC = D\n RR : right circuit, right multiply\n AB = CD -> ABD = CDD -> ABD = C\n\n The number of gate rules generated is n*(n+1), where n\n is the number of gates in the sequence (unproven).\n\n Parameters\n ==========\n\n gate_seq : Gate tuple, Mul, or Number\n A variable length tuple or Mul of Gates whose product is equal to\n a scalar matrix\n return_as_muls : bool\n True to return a set of Muls; False to return a set of tuples\n\n Examples\n ========\n\n Find the gate rules of the current circuit using tuples:\n\n >>> from sympy.physics.quantum.identitysearch import generate_gate_rules\n >>> from sympy.physics.quantum.gate import X, Y, Z\n >>> x = X(0); y = Y(0); z = Z(0)\n >>> generate_gate_rules((x, x))\n {((X(0),), (X(0),)), ((X(0), X(0)), ())}\n\n >>> generate_gate_rules((x, y, z))\n {((), (X(0), Z(0), Y(0))), ((), (Y(0), X(0), Z(0))),\n ((), (Z(0), Y(0), X(0))), ((X(0),), (Z(0), Y(0))),\n ((Y(0),), (X(0), Z(0))), ((Z(0),), (Y(0), X(0))),\n ((X(0), Y(0)), (Z(0),)), ((Y(0), Z(0)), (X(0),)),\n ((Z(0), X(0)), (Y(0),)), ((X(0), Y(0), Z(0)), ()),\n ((Y(0), Z(0), X(0)), ()), ((Z(0), X(0), Y(0)), ())}\n\n Find the gate rules of the current circuit using Muls:\n\n >>> generate_gate_rules(x*x, return_as_muls=True)\n {(1, 1)}\n\n >>> generate_gate_rules(x*y*z, return_as_muls=True)\n {(1, X(0)*Z(0)*Y(0)), (1, Y(0)*X(0)*Z(0)),\n (1, Z(0)*Y(0)*X(0)), (X(0)*Y(0), Z(0)),\n (Y(0)*Z(0), X(0)), (Z(0)*X(0), Y(0)),\n (X(0)*Y(0)*Z(0), 1), (Y(0)*Z(0)*X(0), 1),\n (Z(0)*X(0)*Y(0), 1), (X(0), Z(0)*Y(0)),\n (Y(0), X(0)*Z(0)), (Z(0), Y(0)*X(0))}\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/core/tests/test_args.py::test_sympy__physics__quantum__identitysearch__GateIdentity", "sympy/physics/quantum/tests/test_identitysearch.py::test_generate_gate_rules_1", "sympy/physics/quantum/tests/test_identitysearch.py::test_generate_gate_rules_2", "sympy/physics/quantum/tests/test_identitysearch.py::test_generate_equivalent_ids_1", "sympy/physics/quantum/tests/test_identitysearch.py::test_generate_equivalent_ids_2", "sympy/physics/quantum/tests/test_identitysearch.py::test_is_degenerate", "sympy/physics/quantum/tests/test_identitysearch.py::test_bfs_identity_search", "sympy/physics/quantum/tests/test_identitysearch.py::test_bfs_identity_search_xfail" ], "PASS_TO_PASS": null }
sympy__sympy-60
1.0
{ "code": "diff --git b/sympy/tensor/index_methods.py a/sympy/tensor/index_methods.py\nindex a9416893d5..12f707b60b 100644\n--- b/sympy/tensor/index_methods.py\n+++ a/sympy/tensor/index_methods.py\n@@ -394,3 +394,76 @@ def get_contraction_structure(expr):\n ... # treat outermost contactions here\n \n \"\"\"\n+\n+ # We call ourself recursively to inspect sub expressions.\n+\n+ if isinstance(expr, Indexed):\n+ junk, key = _remove_repeated(expr.indices)\n+ return {key or None: {expr}}\n+ elif expr.is_Atom:\n+ return {None: {expr}}\n+ elif expr.is_Mul:\n+ junk, junk, key = _get_indices_Mul(expr, return_dummies=True)\n+ result = {key or None: {expr}}\n+ # recurse on every factor\n+ nested = []\n+ for fac in expr.args:\n+ facd = get_contraction_structure(fac)\n+ if not (None in facd and len(facd) == 1):\n+ nested.append(facd)\n+ if nested:\n+ result[expr] = nested\n+ return result\n+ elif expr.is_Pow or isinstance(expr, exp):\n+ # recurse in base and exp separately. If either has internal\n+ # contractions we must include ourselves as a key in the returned dict\n+ b, e = expr.as_base_exp()\n+ dbase = get_contraction_structure(b)\n+ dexp = get_contraction_structure(e)\n+\n+ dicts = []\n+ for d in dbase, dexp:\n+ if not (None in d and len(d) == 1):\n+ dicts.append(d)\n+ result = {None: {expr}}\n+ if dicts:\n+ result[expr] = dicts\n+ return result\n+ elif expr.is_Add:\n+ # Note: we just collect all terms with identical summation indices, We\n+ # do nothing to identify equivalent terms here, as this would require\n+ # substitutions or pattern matching in expressions of unknown\n+ # complexity.\n+ result = {}\n+ for term in expr.args:\n+ # recurse on every term\n+ d = get_contraction_structure(term)\n+ for key in d:\n+ if key in result:\n+ result[key] |= d[key]\n+ else:\n+ result[key] = d[key]\n+ return result\n+\n+ elif isinstance(expr, Piecewise):\n+ # FIXME: No support for Piecewise yet\n+ return {None: expr}\n+ elif isinstance(expr, Function):\n+ # Collect non-trivial contraction structures in each argument\n+ # We do not report repeated indices in separate arguments as a\n+ # contraction\n+ deeplist = []\n+ for arg in expr.args:\n+ deep = get_contraction_structure(arg)\n+ if not (None in deep and len(deep) == 1):\n+ deeplist.append(deep)\n+ d = {None: {expr}}\n+ if deeplist:\n+ d[expr] = deeplist\n+ return d\n+\n+ # this test is expensive, so it should be at the end\n+ elif not expr.has(Indexed):\n+ return {None: {expr}}\n+ raise NotImplementedError(\n+ \"FIXME: No specialized handling of type %s\" % type(expr))\n", "test": null }
null
{ "code": "diff --git a/sympy/tensor/index_methods.py b/sympy/tensor/index_methods.py\nindex 12f707b60b..a9416893d5 100644\n--- a/sympy/tensor/index_methods.py\n+++ b/sympy/tensor/index_methods.py\n@@ -394,76 +394,3 @@ def get_contraction_structure(expr):\n ... # treat outermost contactions here\n \n \"\"\"\n-\n- # We call ourself recursively to inspect sub expressions.\n-\n- if isinstance(expr, Indexed):\n- junk, key = _remove_repeated(expr.indices)\n- return {key or None: {expr}}\n- elif expr.is_Atom:\n- return {None: {expr}}\n- elif expr.is_Mul:\n- junk, junk, key = _get_indices_Mul(expr, return_dummies=True)\n- result = {key or None: {expr}}\n- # recurse on every factor\n- nested = []\n- for fac in expr.args:\n- facd = get_contraction_structure(fac)\n- if not (None in facd and len(facd) == 1):\n- nested.append(facd)\n- if nested:\n- result[expr] = nested\n- return result\n- elif expr.is_Pow or isinstance(expr, exp):\n- # recurse in base and exp separately. If either has internal\n- # contractions we must include ourselves as a key in the returned dict\n- b, e = expr.as_base_exp()\n- dbase = get_contraction_structure(b)\n- dexp = get_contraction_structure(e)\n-\n- dicts = []\n- for d in dbase, dexp:\n- if not (None in d and len(d) == 1):\n- dicts.append(d)\n- result = {None: {expr}}\n- if dicts:\n- result[expr] = dicts\n- return result\n- elif expr.is_Add:\n- # Note: we just collect all terms with identical summation indices, We\n- # do nothing to identify equivalent terms here, as this would require\n- # substitutions or pattern matching in expressions of unknown\n- # complexity.\n- result = {}\n- for term in expr.args:\n- # recurse on every term\n- d = get_contraction_structure(term)\n- for key in d:\n- if key in result:\n- result[key] |= d[key]\n- else:\n- result[key] = d[key]\n- return result\n-\n- elif isinstance(expr, Piecewise):\n- # FIXME: No support for Piecewise yet\n- return {None: expr}\n- elif isinstance(expr, Function):\n- # Collect non-trivial contraction structures in each argument\n- # We do not report repeated indices in separate arguments as a\n- # contraction\n- deeplist = []\n- for arg in expr.args:\n- deep = get_contraction_structure(arg)\n- if not (None in deep and len(deep) == 1):\n- deeplist.append(deep)\n- d = {None: {expr}}\n- if deeplist:\n- d[expr] = deeplist\n- return d\n-\n- # this test is expensive, so it should be at the end\n- elif not expr.has(Indexed):\n- return {None: {expr}}\n- raise NotImplementedError(\n- \"FIXME: No specialized handling of type %s\" % type(expr))\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/tensor/index_methods.py.\nHere is the description for the function:\ndef get_contraction_structure(expr):\n \"\"\"Determine dummy indices of ``expr`` and describe its structure\n\n By *dummy* we mean indices that are summation indices.\n\n The structure of the expression is determined and described as follows:\n\n 1) A conforming summation of Indexed objects is described with a dict where\n the keys are summation indices and the corresponding values are sets\n containing all terms for which the summation applies. All Add objects\n in the SymPy expression tree are described like this.\n\n 2) For all nodes in the SymPy expression tree that are *not* of type Add, the\n following applies:\n\n If a node discovers contractions in one of its arguments, the node\n itself will be stored as a key in the dict. For that key, the\n corresponding value is a list of dicts, each of which is the result of a\n recursive call to get_contraction_structure(). The list contains only\n dicts for the non-trivial deeper contractions, omitting dicts with None\n as the one and only key.\n\n .. Note:: The presence of expressions among the dictionary keys indicates\n multiple levels of index contractions. A nested dict displays nested\n contractions and may itself contain dicts from a deeper level. In\n practical calculations the summation in the deepest nested level must be\n calculated first so that the outer expression can access the resulting\n indexed object.\n\n Examples\n ========\n\n >>> from sympy.tensor.index_methods import get_contraction_structure\n >>> from sympy import default_sort_key\n >>> from sympy.tensor import IndexedBase, Idx\n >>> x, y, A = map(IndexedBase, ['x', 'y', 'A'])\n >>> i, j, k, l = map(Idx, ['i', 'j', 'k', 'l'])\n >>> get_contraction_structure(x[i]*y[i] + A[j, j])\n {(i,): {x[i]*y[i]}, (j,): {A[j, j]}}\n >>> get_contraction_structure(x[i]*y[j])\n {None: {x[i]*y[j]}}\n\n A multiplication of contracted factors results in nested dicts representing\n the internal contractions.\n\n >>> d = get_contraction_structure(x[i, i]*y[j, j])\n >>> sorted(d.keys(), key=default_sort_key)\n [None, x[i, i]*y[j, j]]\n\n In this case, the product has no contractions:\n\n >>> d[None]\n {x[i, i]*y[j, j]}\n\n Factors are contracted \"first\":\n\n >>> sorted(d[x[i, i]*y[j, j]], key=default_sort_key)\n [{(i,): {x[i, i]}}, {(j,): {y[j, j]}}]\n\n A parenthesized Add object is also returned as a nested dictionary. The\n term containing the parenthesis is a Mul with a contraction among the\n arguments, so it will be found as a key in the result. It stores the\n dictionary resulting from a recursive call on the Add expression.\n\n >>> d = get_contraction_structure(x[i]*(y[i] + A[i, j]*x[j]))\n >>> sorted(d.keys(), key=default_sort_key)\n [(A[i, j]*x[j] + y[i])*x[i], (i,)]\n >>> d[(i,)]\n {(A[i, j]*x[j] + y[i])*x[i]}\n >>> d[x[i]*(A[i, j]*x[j] + y[i])]\n [{None: {y[i]}, (j,): {A[i, j]*x[j]}}]\n\n Powers with contractions in either base or exponent will also be found as\n keys in the dictionary, mapping to a list of results from recursive calls:\n\n >>> d = get_contraction_structure(A[j, j]**A[i, i])\n >>> d[None]\n {A[j, j]**A[i, i]}\n >>> nested_contractions = d[A[j, j]**A[i, i]]\n >>> nested_contractions[0]\n {(j,): {A[j, j]}}\n >>> nested_contractions[1]\n {(i,): {A[i, i]}}\n\n The description of the contraction structure may appear complicated when\n represented with a string in the above examples, but it is easy to iterate\n over:\n\n >>> from sympy import Expr\n >>> for key in d:\n ... if isinstance(key, Expr):\n ... continue\n ... for term in d[key]:\n ... if term in d:\n ... # treat deepest contraction first\n ... pass\n ... # treat outermost contactions here\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/utilities/tests/test_codegen.py::test_loops_c", "sympy/utilities/tests/test_codegen.py::test_dummy_loops_c", "sympy/utilities/tests/test_codegen.py::test_partial_loops_c", "sympy/utilities/tests/test_codegen.py::test_loops", "sympy/utilities/tests/test_codegen.py::test_dummy_loops_f95", "sympy/printing/tests/test_c.py::test_ccode_inline_function", "sympy/utilities/tests/test_codegen.py::test_loops_InOut", "sympy/utilities/tests/test_codegen.py::test_partial_loops_f", "sympy/utilities/tests/test_codegen.py::test_inline_function", "sympy/printing/tests/test_c.py::test_ccode_loops_matrix_vector", "sympy/printing/tests/test_c.py::test_dummy_loops", "sympy/printing/tests/test_c.py::test_ccode_loops_add", "sympy/printing/tests/test_c.py::test_ccode_loops_multiple_contractions", "sympy/printing/tests/test_c.py::test_ccode_loops_addfactor", "sympy/printing/tests/test_c.py::test_ccode_loops_multiple_terms", "sympy/printing/tests/test_fortran.py::test_case", "sympy/printing/tests/test_fortran.py::test_inline_function", "sympy/printing/tests/test_glsl.py::test_glsl_code_inline_function", "sympy/printing/tests/test_fortran.py::test_loops", "sympy/printing/tests/test_glsl.py::test_glsl_code_loops_matrix_vector", "sympy/printing/tests/test_fortran.py::test_dummy_loops", "sympy/printing/tests/test_glsl.py::test_dummy_loops", "sympy/printing/tests/test_glsl.py::test_glsl_code_loops_add", "sympy/printing/tests/test_glsl.py::test_glsl_code_loops_multiple_contractions", "sympy/printing/tests/test_glsl.py::test_glsl_code_loops_addfactor", "sympy/printing/tests/test_glsl.py::test_glsl_code_loops_multiple_terms", "sympy/printing/tests/test_rcode.py::test_rcode_inline_function", "sympy/printing/tests/test_rcode.py::test_rcode_loops_matrix_vector", "sympy/printing/tests/test_rcode.py::test_dummy_loops", "sympy/printing/tests/test_rcode.py::test_rcode_loops_add", "sympy/printing/tests/test_rcode.py::test_rcode_loops_multiple_contractions", "sympy/printing/tests/test_rcode.py::test_rcode_loops_addfactor", "sympy/printing/tests/test_rcode.py::test_rcode_loops_multiple_terms", "sympy/utilities/tests/test_codegen_julia.py::test_jl_loops", "sympy/utilities/tests/test_codegen_octave.py::test_m_loops", "sympy/utilities/tests/test_codegen_julia.py::test_jl_tensor_loops_multiple_contractions", "sympy/utilities/tests/test_codegen_octave.py::test_m_tensor_loops_multiple_contractions", "sympy/printing/tests/test_jscode.py::test_jscode_inline_function", "sympy/printing/tests/test_rust.py::test_dummy_loops", "sympy/printing/tests/test_jscode.py::test_jscode_loops_matrix_vector", "sympy/printing/tests/test_rust.py::test_loops", "sympy/printing/tests/test_jscode.py::test_dummy_loops", "sympy/printing/tests/test_rust.py::test_loops_multiple_contractions", "sympy/printing/tests/test_jscode.py::test_jscode_loops_add", "sympy/printing/tests/test_jscode.py::test_jscode_loops_multiple_contractions", "sympy/printing/tests/test_rust.py::test_loops_addfactor", "sympy/printing/tests/test_jscode.py::test_jscode_loops_addfactor", "sympy/printing/tests/test_rust.py::test_inline_function", "sympy/printing/tests/test_jscode.py::test_jscode_loops_multiple_terms", "sympy/tensor/tests/test_index_methods.py::test_get_contraction_structure_basic", "sympy/tensor/tests/test_index_methods.py::test_get_contraction_structure_complex", "sympy/tensor/tests/test_index_methods.py::test_contraction_structure_simple_Pow", "sympy/tensor/tests/test_index_methods.py::test_contraction_structure_Mul_and_Pow", "sympy/tensor/tests/test_index_methods.py::test_contraction_structure_Add_in_Pow", "sympy/tensor/tests/test_index_methods.py::test_contraction_structure_Pow_in_Pow", "sympy/tensor/tests/test_index_methods.py::test_ufunc_support" ], "PASS_TO_PASS": null }
sympy__sympy-61
1.0
{ "code": "diff --git b/sympy/physics/vector/functions.py a/sympy/physics/vector/functions.py\nindex 9fae22ac84..6775b4b23b 100644\n--- b/sympy/physics/vector/functions.py\n+++ a/sympy/physics/vector/functions.py\n@@ -452,6 +452,81 @@ def get_motion_params(frame, **kwargs):\n \n \"\"\"\n \n+ def _process_vector_differential(vectdiff, condition, variable, ordinate,\n+ frame):\n+ \"\"\"\n+ Helper function for get_motion methods. Finds derivative of vectdiff\n+ wrt variable, and its integral using the specified boundary condition\n+ at value of variable = ordinate.\n+ Returns a tuple of - (derivative, function and integral) wrt vectdiff\n+\n+ \"\"\"\n+\n+ # Make sure boundary condition is independent of 'variable'\n+ if condition != 0:\n+ condition = express(condition, frame, variables=True)\n+ # Special case of vectdiff == 0\n+ if vectdiff == Vector(0):\n+ return (0, 0, condition)\n+ # Express vectdiff completely in condition's frame to give vectdiff1\n+ vectdiff1 = express(vectdiff, frame)\n+ # Find derivative of vectdiff\n+ vectdiff2 = time_derivative(vectdiff, frame)\n+ # Integrate and use boundary condition\n+ vectdiff0 = Vector(0)\n+ lims = (variable, ordinate, variable)\n+ for dim in frame:\n+ function1 = vectdiff1.dot(dim)\n+ abscissa = dim.dot(condition).subs({variable: ordinate})\n+ # Indefinite integral of 'function1' wrt 'variable', using\n+ # the given initial condition (ordinate, abscissa).\n+ vectdiff0 += (integrate(function1, lims) + abscissa) * dim\n+ # Return tuple\n+ return (vectdiff2, vectdiff, vectdiff0)\n+\n+ _check_frame(frame)\n+ # Decide mode of operation based on user's input\n+ if 'acceleration' in kwargs:\n+ mode = 2\n+ elif 'velocity' in kwargs:\n+ mode = 1\n+ else:\n+ mode = 0\n+ # All the possible parameters in kwargs\n+ # Not all are required for every case\n+ # If not specified, set to default values(may or may not be used in\n+ # calculations)\n+ conditions = ['acceleration', 'velocity', 'position',\n+ 'timevalue', 'timevalue1', 'timevalue2']\n+ for i, x in enumerate(conditions):\n+ if x not in kwargs:\n+ if i < 3:\n+ kwargs[x] = Vector(0)\n+ else:\n+ kwargs[x] = S.Zero\n+ elif i < 3:\n+ _check_vector(kwargs[x])\n+ else:\n+ kwargs[x] = sympify(kwargs[x])\n+ if mode == 2:\n+ vel = _process_vector_differential(kwargs['acceleration'],\n+ kwargs['velocity'],\n+ dynamicsymbols._t,\n+ kwargs['timevalue2'], frame)[2]\n+ pos = _process_vector_differential(vel, kwargs['position'],\n+ dynamicsymbols._t,\n+ kwargs['timevalue1'], frame)[2]\n+ return (kwargs['acceleration'], vel, pos)\n+ elif mode == 1:\n+ return _process_vector_differential(kwargs['velocity'],\n+ kwargs['position'],\n+ dynamicsymbols._t,\n+ kwargs['timevalue1'], frame)\n+ else:\n+ vel = time_derivative(kwargs['position'], frame)\n+ acc = time_derivative(vel, frame)\n+ return (acc, vel, kwargs['position'])\n+\n \n def partial_velocity(vel_vecs, gen_speeds, frame):\n \"\"\"Returns a list of partial velocities with respect to the provided\n", "test": null }
null
{ "code": "diff --git a/sympy/physics/vector/functions.py b/sympy/physics/vector/functions.py\nindex 6775b4b23b..9fae22ac84 100644\n--- a/sympy/physics/vector/functions.py\n+++ b/sympy/physics/vector/functions.py\n@@ -452,81 +452,6 @@ def get_motion_params(frame, **kwargs):\n \n \"\"\"\n \n- def _process_vector_differential(vectdiff, condition, variable, ordinate,\n- frame):\n- \"\"\"\n- Helper function for get_motion methods. Finds derivative of vectdiff\n- wrt variable, and its integral using the specified boundary condition\n- at value of variable = ordinate.\n- Returns a tuple of - (derivative, function and integral) wrt vectdiff\n-\n- \"\"\"\n-\n- # Make sure boundary condition is independent of 'variable'\n- if condition != 0:\n- condition = express(condition, frame, variables=True)\n- # Special case of vectdiff == 0\n- if vectdiff == Vector(0):\n- return (0, 0, condition)\n- # Express vectdiff completely in condition's frame to give vectdiff1\n- vectdiff1 = express(vectdiff, frame)\n- # Find derivative of vectdiff\n- vectdiff2 = time_derivative(vectdiff, frame)\n- # Integrate and use boundary condition\n- vectdiff0 = Vector(0)\n- lims = (variable, ordinate, variable)\n- for dim in frame:\n- function1 = vectdiff1.dot(dim)\n- abscissa = dim.dot(condition).subs({variable: ordinate})\n- # Indefinite integral of 'function1' wrt 'variable', using\n- # the given initial condition (ordinate, abscissa).\n- vectdiff0 += (integrate(function1, lims) + abscissa) * dim\n- # Return tuple\n- return (vectdiff2, vectdiff, vectdiff0)\n-\n- _check_frame(frame)\n- # Decide mode of operation based on user's input\n- if 'acceleration' in kwargs:\n- mode = 2\n- elif 'velocity' in kwargs:\n- mode = 1\n- else:\n- mode = 0\n- # All the possible parameters in kwargs\n- # Not all are required for every case\n- # If not specified, set to default values(may or may not be used in\n- # calculations)\n- conditions = ['acceleration', 'velocity', 'position',\n- 'timevalue', 'timevalue1', 'timevalue2']\n- for i, x in enumerate(conditions):\n- if x not in kwargs:\n- if i < 3:\n- kwargs[x] = Vector(0)\n- else:\n- kwargs[x] = S.Zero\n- elif i < 3:\n- _check_vector(kwargs[x])\n- else:\n- kwargs[x] = sympify(kwargs[x])\n- if mode == 2:\n- vel = _process_vector_differential(kwargs['acceleration'],\n- kwargs['velocity'],\n- dynamicsymbols._t,\n- kwargs['timevalue2'], frame)[2]\n- pos = _process_vector_differential(vel, kwargs['position'],\n- dynamicsymbols._t,\n- kwargs['timevalue1'], frame)[2]\n- return (kwargs['acceleration'], vel, pos)\n- elif mode == 1:\n- return _process_vector_differential(kwargs['velocity'],\n- kwargs['position'],\n- dynamicsymbols._t,\n- kwargs['timevalue1'], frame)\n- else:\n- vel = time_derivative(kwargs['position'], frame)\n- acc = time_derivative(vel, frame)\n- return (acc, vel, kwargs['position'])\n-\n \n def partial_velocity(vel_vecs, gen_speeds, frame):\n \"\"\"Returns a list of partial velocities with respect to the provided\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/physics/vector/functions.py.\nHere is the description for the function:\ndef get_motion_params(frame, **kwargs):\n \"\"\"\n Returns the three motion parameters - (acceleration, velocity, and\n position) as vectorial functions of time in the given frame.\n\n If a higher order differential function is provided, the lower order\n functions are used as boundary conditions. For example, given the\n acceleration, the velocity and position parameters are taken as\n boundary conditions.\n\n The values of time at which the boundary conditions are specified\n are taken from timevalue1(for position boundary condition) and\n timevalue2(for velocity boundary condition).\n\n If any of the boundary conditions are not provided, they are taken\n to be zero by default (zero vectors, in case of vectorial inputs). If\n the boundary conditions are also functions of time, they are converted\n to constants by substituting the time values in the dynamicsymbols._t\n time Symbol.\n\n This function can also be used for calculating rotational motion\n parameters. Have a look at the Parameters and Examples for more clarity.\n\n Parameters\n ==========\n\n frame : ReferenceFrame\n The frame to express the motion parameters in\n\n acceleration : Vector\n Acceleration of the object/frame as a function of time\n\n velocity : Vector\n Velocity as function of time or as boundary condition\n of velocity at time = timevalue1\n\n position : Vector\n Velocity as function of time or as boundary condition\n of velocity at time = timevalue1\n\n timevalue1 : sympyfiable\n Value of time for position boundary condition\n\n timevalue2 : sympyfiable\n Value of time for velocity boundary condition\n\n Examples\n ========\n\n >>> from sympy.physics.vector import ReferenceFrame, get_motion_params, dynamicsymbols\n >>> from sympy.physics.vector import init_vprinting\n >>> init_vprinting(pretty_print=False)\n >>> from sympy import symbols\n >>> R = ReferenceFrame('R')\n >>> v1, v2, v3 = dynamicsymbols('v1 v2 v3')\n >>> v = v1*R.x + v2*R.y + v3*R.z\n >>> get_motion_params(R, position = v)\n (v1''*R.x + v2''*R.y + v3''*R.z, v1'*R.x + v2'*R.y + v3'*R.z, v1*R.x + v2*R.y + v3*R.z)\n >>> a, b, c = symbols('a b c')\n >>> v = a*R.x + b*R.y + c*R.z\n >>> get_motion_params(R, velocity = v)\n (0, a*R.x + b*R.y + c*R.z, a*t*R.x + b*t*R.y + c*t*R.z)\n >>> parameters = get_motion_params(R, acceleration = v)\n >>> parameters[1]\n a*t*R.x + b*t*R.y + c*t*R.z\n >>> parameters[2]\n a*t**2/2*R.x + b*t**2/2*R.y + c*t**2/2*R.z\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/physics/vector/tests/test_functions.py::test_get_motion_methods" ], "PASS_TO_PASS": null }
sympy__sympy-62
1.0
{ "code": "diff --git b/sympy/printing/glsl.py a/sympy/printing/glsl.py\nindex 993603d038..92c1aa3f53 100644\n--- b/sympy/printing/glsl.py\n+++ a/sympy/printing/glsl.py\n@@ -538,6 +538,7 @@ def glsl_code(expr,assign_to=None,**settings):\n }\n A[2][0] = sin(x);\n \"\"\"\n+ return GLSLPrinter(settings).doprint(expr,assign_to)\n \n def print_glsl(expr, **settings):\n \"\"\"Prints the GLSL representation of the given expression.\n", "test": null }
null
{ "code": "diff --git a/sympy/printing/glsl.py b/sympy/printing/glsl.py\nindex 92c1aa3f53..993603d038 100644\n--- a/sympy/printing/glsl.py\n+++ b/sympy/printing/glsl.py\n@@ -538,7 +538,6 @@ def glsl_code(expr,assign_to=None,**settings):\n }\n A[2][0] = sin(x);\n \"\"\"\n- return GLSLPrinter(settings).doprint(expr,assign_to)\n \n def print_glsl(expr, **settings):\n \"\"\"Prints the GLSL representation of the given expression.\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/printing/glsl.py.\nHere is the description for the function:\ndef glsl_code(expr,assign_to=None,**settings):\n \"\"\"Converts an expr to a string of GLSL code\n\n Parameters\n ==========\n\n expr : Expr\n A SymPy expression to be converted.\n assign_to : optional\n When given, the argument is used for naming the variable or variables\n to which the expression is assigned. Can be a string, ``Symbol``,\n ``MatrixSymbol`` or ``Indexed`` type object. In cases where ``expr``\n would be printed as an array, a list of string or ``Symbol`` objects\n can also be passed.\n\n This is helpful in case of line-wrapping, or for expressions that\n generate multi-line statements. It can also be used to spread an array-like\n expression into multiple assignments.\n use_operators: bool, optional\n If set to False, then *,/,+,- operators will be replaced with functions\n mul, add, and sub, which must be implemented by the user, e.g. for\n implementing non-standard rings or emulated quad/octal precision.\n [default=True]\n glsl_types: bool, optional\n Set this argument to ``False`` in order to avoid using the ``vec`` and ``mat``\n types. The printer will instead use arrays (or nested arrays).\n [default=True]\n mat_nested: bool, optional\n GLSL version 4.3 and above support nested arrays (arrays of arrays). Set this to ``True``\n to render matrices as nested arrays.\n [default=False]\n mat_separator: str, optional\n By default, matrices are rendered with newlines using this separator,\n making them easier to read, but less compact. By removing the newline\n this option can be used to make them more vertically compact.\n [default=',\\n']\n mat_transpose: bool, optional\n GLSL's matrix multiplication implementation assumes column-major indexing.\n By default, this printer ignores that convention. Setting this option to\n ``True`` transposes all matrix output.\n [default=False]\n array_type: str, optional\n The GLSL array constructor type.\n [default='float']\n precision : integer, optional\n The precision for numbers such as pi [default=15].\n user_functions : dict, optional\n A dictionary where keys are ``FunctionClass`` instances and values are\n their string representations. Alternatively, the dictionary value can\n be a list of tuples i.e. [(argument_test, js_function_string)]. See\n below for examples.\n human : bool, optional\n If True, the result is a single string that may contain some constant\n declarations for the number symbols. If False, the same information is\n returned in a tuple of (symbols_to_declare, not_supported_functions,\n code_text). [default=True].\n contract: bool, optional\n If True, ``Indexed`` instances are assumed to obey tensor contraction\n rules and the corresponding nested loops over indices are generated.\n Setting contract=False will not generate loops, instead the user is\n responsible to provide values for the indices in the code.\n [default=True].\n\n Examples\n ========\n\n >>> from sympy import glsl_code, symbols, Rational, sin, ceiling, Abs\n >>> x, tau = symbols(\"x, tau\")\n >>> glsl_code((2*tau)**Rational(7, 2))\n '8*sqrt(2)*pow(tau, 3.5)'\n >>> glsl_code(sin(x), assign_to=\"float y\")\n 'float y = sin(x);'\n\n Various GLSL types are supported:\n >>> from sympy import Matrix, glsl_code\n >>> glsl_code(Matrix([1,2,3]))\n 'vec3(1, 2, 3)'\n\n >>> glsl_code(Matrix([[1, 2],[3, 4]]))\n 'mat2(1, 2, 3, 4)'\n\n Pass ``mat_transpose = True`` to switch to column-major indexing:\n >>> glsl_code(Matrix([[1, 2],[3, 4]]), mat_transpose = True)\n 'mat2(1, 3, 2, 4)'\n\n By default, larger matrices get collapsed into float arrays:\n >>> print(glsl_code( Matrix([[1,2,3,4,5],[6,7,8,9,10]]) ))\n float[10](\n 1, 2, 3, 4, 5,\n 6, 7, 8, 9, 10\n ) /* a 2x5 matrix */\n\n The type of array constructor used to print GLSL arrays can be controlled\n via the ``array_type`` parameter:\n >>> glsl_code(Matrix([1,2,3,4,5]), array_type='int')\n 'int[5](1, 2, 3, 4, 5)'\n\n Passing a list of strings or ``symbols`` to the ``assign_to`` parameter will yield\n a multi-line assignment for each item in an array-like expression:\n >>> x_struct_members = symbols('x.a x.b x.c x.d')\n >>> print(glsl_code(Matrix([1,2,3,4]), assign_to=x_struct_members))\n x.a = 1;\n x.b = 2;\n x.c = 3;\n x.d = 4;\n\n This could be useful in cases where it's desirable to modify members of a\n GLSL ``Struct``. It could also be used to spread items from an array-like\n expression into various miscellaneous assignments:\n >>> misc_assignments = ('x[0]', 'x[1]', 'float y', 'float z')\n >>> print(glsl_code(Matrix([1,2,3,4]), assign_to=misc_assignments))\n x[0] = 1;\n x[1] = 2;\n float y = 3;\n float z = 4;\n\n Passing ``mat_nested = True`` instead prints out nested float arrays, which are\n supported in GLSL 4.3 and above.\n >>> mat = Matrix([\n ... [ 0, 1, 2],\n ... [ 3, 4, 5],\n ... [ 6, 7, 8],\n ... [ 9, 10, 11],\n ... [12, 13, 14]])\n >>> print(glsl_code( mat, mat_nested = True ))\n float[5][3](\n float[]( 0, 1, 2),\n float[]( 3, 4, 5),\n float[]( 6, 7, 8),\n float[]( 9, 10, 11),\n float[](12, 13, 14)\n )\n\n\n\n Custom printing can be defined for certain types by passing a dictionary of\n \"type\" : \"function\" to the ``user_functions`` kwarg. Alternatively, the\n dictionary value can be a list of tuples i.e. [(argument_test,\n js_function_string)].\n\n >>> custom_functions = {\n ... \"ceiling\": \"CEIL\",\n ... \"Abs\": [(lambda x: not x.is_integer, \"fabs\"),\n ... (lambda x: x.is_integer, \"ABS\")]\n ... }\n >>> glsl_code(Abs(x) + ceiling(x), user_functions=custom_functions)\n 'fabs(x) + CEIL(x)'\n\n If further control is needed, addition, subtraction, multiplication and\n division operators can be replaced with ``add``, ``sub``, and ``mul``\n functions. This is done by passing ``use_operators = False``:\n\n >>> x,y,z = symbols('x,y,z')\n >>> glsl_code(x*(y+z), use_operators = False)\n 'mul(x, add(y, z))'\n >>> glsl_code(x*(y+z*(x-y)**z), use_operators = False)\n 'mul(x, add(y, mul(z, pow(sub(x, y), z))))'\n\n ``Piecewise`` expressions are converted into conditionals. If an\n ``assign_to`` variable is provided an if statement is created, otherwise\n the ternary operator is used. Note that if the ``Piecewise`` lacks a\n default term, represented by ``(expr, True)`` then an error will be thrown.\n This is to prevent generating an expression that may not evaluate to\n anything.\n\n >>> from sympy import Piecewise\n >>> expr = Piecewise((x + 1, x > 0), (x, True))\n >>> print(glsl_code(expr, tau))\n if (x > 0) {\n tau = x + 1;\n }\n else {\n tau = x;\n }\n\n Support for loops is provided through ``Indexed`` types. With\n ``contract=True`` these expressions will be turned into loops, whereas\n ``contract=False`` will just print the assignment expression that should be\n looped over:\n\n >>> from sympy import Eq, IndexedBase, Idx\n >>> len_y = 5\n >>> y = IndexedBase('y', shape=(len_y,))\n >>> t = IndexedBase('t', shape=(len_y,))\n >>> Dy = IndexedBase('Dy', shape=(len_y-1,))\n >>> i = Idx('i', len_y-1)\n >>> e=Eq(Dy[i], (y[i+1]-y[i])/(t[i+1]-t[i]))\n >>> glsl_code(e.rhs, assign_to=e.lhs, contract=False)\n 'Dy[i] = (y[i + 1] - y[i])/(t[i + 1] - t[i]);'\n\n >>> from sympy import Matrix, MatrixSymbol\n >>> mat = Matrix([x**2, Piecewise((x + 1, x > 0), (x, True)), sin(x)])\n >>> A = MatrixSymbol('A', 3, 1)\n >>> print(glsl_code(mat, A))\n A[0][0] = pow(x, 2.0);\n if (x > 0) {\n A[1][0] = x + 1;\n }\n else {\n A[1][0] = x;\n }\n A[2][0] = sin(x);\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/printing/tests/test_glsl.py::test_printmethod", "sympy/printing/tests/test_glsl.py::test_print_without_operators", "sympy/printing/tests/test_glsl.py::test_glsl_code_sqrt", "sympy/printing/tests/test_glsl.py::test_glsl_code_Pow", "sympy/printing/tests/test_glsl.py::test_glsl_code_Relational", "sympy/printing/tests/test_glsl.py::test_glsl_code_constants_mathh", "sympy/printing/tests/test_glsl.py::test_glsl_code_constants_other", "sympy/printing/tests/test_glsl.py::test_glsl_code_Rational", "sympy/printing/tests/test_glsl.py::test_glsl_code_Integer", "sympy/printing/tests/test_glsl.py::test_glsl_code_functions", "sympy/printing/tests/test_glsl.py::test_glsl_code_inline_function", "sympy/printing/tests/test_glsl.py::test_glsl_code_exceptions", "sympy/printing/tests/test_glsl.py::test_glsl_code_boolean", "sympy/printing/tests/test_glsl.py::test_glsl_code_Piecewise", "sympy/printing/tests/test_glsl.py::test_glsl_code_Piecewise_deep", "sympy/printing/tests/test_glsl.py::test_glsl_code_settings", "sympy/printing/tests/test_glsl.py::test_glsl_code_list_tuple_Tuple", "sympy/printing/tests/test_glsl.py::test_glsl_code_loops_matrix_vector", "sympy/printing/tests/test_glsl.py::test_dummy_loops", "sympy/printing/tests/test_glsl.py::test_glsl_code_loops_add", "sympy/printing/tests/test_glsl.py::test_glsl_code_loops_multiple_contractions", "sympy/printing/tests/test_glsl.py::test_glsl_code_loops_addfactor", "sympy/printing/tests/test_glsl.py::test_glsl_code_loops_multiple_terms", "sympy/printing/tests/test_glsl.py::test_Matrix_printing", "sympy/printing/tests/test_glsl.py::test_Matrices_1x7", "sympy/printing/tests/test_glsl.py::test_Matrices_1x7_array_type_int", "sympy/printing/tests/test_glsl.py::test_Tuple_array_type_custom", "sympy/printing/tests/test_glsl.py::test_Matrices_1x7_spread_assign_to_symbols", "sympy/printing/tests/test_glsl.py::test_spread_assign_to_nested_symbols", "sympy/printing/tests/test_glsl.py::test_spread_assign_to_deeply_nested_symbols", "sympy/printing/tests/test_glsl.py::test_matrix_of_tuples_spread_assign_to_symbols", "sympy/printing/tests/test_glsl.py::test_cannot_assign_to_cause_mismatched_length", "sympy/printing/tests/test_glsl.py::test_matrix_4x4_assign", "sympy/printing/tests/test_glsl.py::test_1xN_vecs", "sympy/printing/tests/test_glsl.py::test_MxN_mats", "sympy/printing/tests/test_glsl.py::test_misc_mats" ], "PASS_TO_PASS": null }
sympy__sympy-63
1.0
{ "code": "diff --git b/sympy/integrals/heurisch.py a/sympy/integrals/heurisch.py\nindex 6f1b4ab799..a27e2700af 100644\n--- b/sympy/integrals/heurisch.py\n+++ a/sympy/integrals/heurisch.py\n@@ -376,3 +376,406 @@ def heurisch(f, x, rewrite=False, hints=None, mappings=None, retries=3,\n sympy.integrals.integrals.Integral\n sympy.integrals.heurisch.components\n \"\"\"\n+ f = sympify(f)\n+\n+ # There are some functions that Heurisch cannot currently handle,\n+ # so do not even try.\n+ # Set _try_heurisch=True to skip this check\n+ if _try_heurisch is not True:\n+ if f.has(Abs, re, im, sign, Heaviside, DiracDelta, floor, ceiling, arg):\n+ return\n+\n+ if not f.has_free(x):\n+ return f*x\n+\n+ if not f.is_Add:\n+ indep, f = f.as_independent(x)\n+ else:\n+ indep = S.One\n+\n+ rewritables = {\n+ (sin, cos, cot): tan,\n+ (sinh, cosh, coth): tanh,\n+ }\n+\n+ if rewrite:\n+ for candidates, rule in rewritables.items():\n+ f = f.rewrite(candidates, rule)\n+ else:\n+ for candidates in rewritables.keys():\n+ if f.has(*candidates):\n+ break\n+ else:\n+ rewrite = True\n+\n+ terms = components(f, x)\n+ dcache = DiffCache(x)\n+\n+ if hints is not None:\n+ if not hints:\n+ a = Wild('a', exclude=[x])\n+ b = Wild('b', exclude=[x])\n+ c = Wild('c', exclude=[x])\n+\n+ for g in set(terms): # using copy of terms\n+ if g.is_Function:\n+ if isinstance(g, li):\n+ M = g.args[0].match(a*x**b)\n+\n+ if M is not None:\n+ terms.add( x*(li(M[a]*x**M[b]) - (M[a]*x**M[b])**(-1/M[b])*Ei((M[b]+1)*log(M[a]*x**M[b])/M[b])) )\n+ #terms.add( x*(li(M[a]*x**M[b]) - (x**M[b])**(-1/M[b])*Ei((M[b]+1)*log(M[a]*x**M[b])/M[b])) )\n+ #terms.add( x*(li(M[a]*x**M[b]) - x*Ei((M[b]+1)*log(M[a]*x**M[b])/M[b])) )\n+ #terms.add( li(M[a]*x**M[b]) - Ei((M[b]+1)*log(M[a]*x**M[b])/M[b]) )\n+\n+ elif isinstance(g, exp):\n+ M = g.args[0].match(a*x**2)\n+\n+ if M is not None:\n+ if M[a].is_positive:\n+ terms.add(erfi(sqrt(M[a])*x))\n+ else: # M[a].is_negative or unknown\n+ terms.add(erf(sqrt(-M[a])*x))\n+\n+ M = g.args[0].match(a*x**2 + b*x + c)\n+\n+ if M is not None:\n+ if M[a].is_positive:\n+ terms.add(sqrt(pi/4*(-M[a]))*exp(M[c] - M[b]**2/(4*M[a]))*\n+ erfi(sqrt(M[a])*x + M[b]/(2*sqrt(M[a]))))\n+ elif M[a].is_negative:\n+ terms.add(sqrt(pi/4*(-M[a]))*exp(M[c] - M[b]**2/(4*M[a]))*\n+ erf(sqrt(-M[a])*x - M[b]/(2*sqrt(-M[a]))))\n+\n+ M = g.args[0].match(a*log(x)**2)\n+\n+ if M is not None:\n+ if M[a].is_positive:\n+ terms.add(erfi(sqrt(M[a])*log(x) + 1/(2*sqrt(M[a]))))\n+ if M[a].is_negative:\n+ terms.add(erf(sqrt(-M[a])*log(x) - 1/(2*sqrt(-M[a]))))\n+\n+ elif g.is_Pow:\n+ if g.exp.is_Rational and g.exp.q == 2:\n+ M = g.base.match(a*x**2 + b)\n+\n+ if M is not None and M[b].is_positive:\n+ if M[a].is_positive:\n+ terms.add(asinh(sqrt(M[a]/M[b])*x))\n+ elif M[a].is_negative:\n+ terms.add(asin(sqrt(-M[a]/M[b])*x))\n+\n+ M = g.base.match(a*x**2 - b)\n+\n+ if M is not None and M[b].is_positive:\n+ if M[a].is_positive:\n+ dF = 1/sqrt(M[a]*x**2 - M[b])\n+ F = log(2*sqrt(M[a])*sqrt(M[a]*x**2 - M[b]) + 2*M[a]*x)/sqrt(M[a])\n+ dcache.cache[F] = dF # hack: F.diff(x) doesn't automatically simplify to f\n+ terms.add(F)\n+ elif M[a].is_negative:\n+ terms.add(-M[b]/2*sqrt(-M[a])*\n+ atan(sqrt(-M[a])*x/sqrt(M[a]*x**2 - M[b])))\n+\n+ else:\n+ terms |= set(hints)\n+\n+ for g in set(terms): # using copy of terms\n+ terms |= components(dcache.get_diff(g), x)\n+\n+ # XXX: The commented line below makes heurisch more deterministic wrt\n+ # PYTHONHASHSEED and the iteration order of sets. There are other places\n+ # where sets are iterated over but this one is possibly the most important.\n+ # Theoretically the order here should not matter but different orderings\n+ # can expose potential bugs in the different code paths so potentially it\n+ # is better to keep the non-determinism.\n+ #\n+ # terms = list(ordered(terms))\n+\n+ # TODO: caching is significant factor for why permutations work at all. Change this.\n+ V = _symbols('x', len(terms))\n+\n+\n+ # sort mapping expressions from largest to smallest (last is always x).\n+ mapping = list(reversed(list(zip(*ordered( #\n+ [(a[0].as_independent(x)[1], a) for a in zip(terms, V)])))[1])) #\n+ rev_mapping = {v: k for k, v in mapping} #\n+ if mappings is None: #\n+ # optimizing the number of permutations of mapping #\n+ assert mapping[-1][0] == x # if not, find it and correct this comment\n+ unnecessary_permutations = [mapping.pop(-1)]\n+ # permute types of objects\n+ types = defaultdict(list)\n+ for i in mapping:\n+ e, _ = i\n+ types[type(e)].append(i)\n+ mapping = [types[i] for i in types]\n+ def _iter_mappings():\n+ for i in permutations(mapping):\n+ # make the expression of a given type be ordered\n+ yield [j for i in i for j in ordered(i)]\n+ mappings = _iter_mappings()\n+ else:\n+ unnecessary_permutations = unnecessary_permutations or []\n+\n+ def _substitute(expr):\n+ return expr.subs(mapping)\n+\n+ for mapping in mappings:\n+ mapping = list(mapping)\n+ mapping = mapping + unnecessary_permutations\n+ diffs = [ _substitute(dcache.get_diff(g)) for g in terms ]\n+ denoms = [ g.as_numer_denom()[1] for g in diffs ]\n+ if all(h.is_polynomial(*V) for h in denoms) and _substitute(f).is_rational_function(*V):\n+ denom = reduce(lambda p, q: lcm(p, q, *V), denoms)\n+ break\n+ else:\n+ if not rewrite:\n+ result = heurisch(f, x, rewrite=True, hints=hints,\n+ unnecessary_permutations=unnecessary_permutations)\n+\n+ if result is not None:\n+ return indep*result\n+ return None\n+\n+ numers = [ cancel(denom*g) for g in diffs ]\n+ def _derivation(h):\n+ return Add(*[ d * h.diff(v) for d, v in zip(numers, V) ])\n+\n+ def _deflation(p):\n+ for y in V:\n+ if not p.has(y):\n+ continue\n+\n+ if _derivation(p) is not S.Zero:\n+ c, q = p.as_poly(y).primitive()\n+ return _deflation(c)*gcd(q, q.diff(y)).as_expr()\n+\n+ return p\n+\n+ def _splitter(p):\n+ for y in V:\n+ if not p.has(y):\n+ continue\n+\n+ if _derivation(y) is not S.Zero:\n+ c, q = p.as_poly(y).primitive()\n+\n+ q = q.as_expr()\n+\n+ h = gcd(q, _derivation(q), y)\n+ s = quo(h, gcd(q, q.diff(y), y), y)\n+\n+ c_split = _splitter(c)\n+\n+ if s.as_poly(y).degree() == 0:\n+ return (c_split[0], q * c_split[1])\n+\n+ q_split = _splitter(cancel(q / s))\n+\n+ return (c_split[0]*q_split[0]*s, c_split[1]*q_split[1])\n+\n+ return (S.One, p)\n+\n+ special = {}\n+\n+ for term in terms:\n+ if term.is_Function:\n+ if isinstance(term, tan):\n+ special[1 + _substitute(term)**2] = False\n+ elif isinstance(term, tanh):\n+ special[1 + _substitute(term)] = False\n+ special[1 - _substitute(term)] = False\n+ elif isinstance(term, LambertW):\n+ special[_substitute(term)] = True\n+\n+ F = _substitute(f)\n+\n+ P, Q = F.as_numer_denom()\n+\n+ u_split = _splitter(denom)\n+ v_split = _splitter(Q)\n+\n+ polys = set(list(v_split) + [ u_split[0] ] + list(special.keys()))\n+\n+ s = u_split[0] * Mul(*[ k for k, v in special.items() if v ])\n+ polified = [ p.as_poly(*V) for p in [s, P, Q] ]\n+\n+ if None in polified:\n+ return None\n+\n+ #--- definitions for _integrate\n+ a, b, c = [ p.total_degree() for p in polified ]\n+\n+ poly_denom = (s * v_split[0] * _deflation(v_split[1])).as_expr()\n+\n+ def _exponent(g):\n+ if g.is_Pow:\n+ if g.exp.is_Rational and g.exp.q != 1:\n+ if g.exp.p > 0:\n+ return g.exp.p + g.exp.q - 1\n+ else:\n+ return abs(g.exp.p + g.exp.q)\n+ else:\n+ return 1\n+ elif not g.is_Atom and g.args:\n+ return max(_exponent(h) for h in g.args)\n+ else:\n+ return 1\n+\n+ A, B = _exponent(f), a + max(b, c)\n+\n+ if A > 1 and B > 1:\n+ monoms = tuple(ordered(itermonomials(V, A + B - 1 + degree_offset)))\n+ else:\n+ monoms = tuple(ordered(itermonomials(V, A + B + degree_offset)))\n+\n+ poly_coeffs = _symbols('A', len(monoms))\n+\n+ poly_part = Add(*[ poly_coeffs[i]*monomial\n+ for i, monomial in enumerate(monoms) ])\n+\n+ reducibles = set()\n+\n+ for poly in ordered(polys):\n+ coeff, factors = factor_list(poly, *V)\n+ reducibles.add(coeff)\n+ reducibles.update(fact for fact, mul in factors)\n+\n+ def _integrate(field=None):\n+ atans = set()\n+ pairs = set()\n+\n+ if field == 'Q':\n+ irreducibles = set(reducibles)\n+ else:\n+ setV = set(V)\n+ irreducibles = set()\n+ for poly in ordered(reducibles):\n+ zV = setV & set(iterfreeargs(poly))\n+ for z in ordered(zV):\n+ s = set(root_factors(poly, z, filter=field))\n+ irreducibles |= s\n+ break\n+\n+ log_part, atan_part = [], []\n+\n+ for poly in ordered(irreducibles):\n+ m = collect(poly, I, evaluate=False)\n+ y = m.get(I, S.Zero)\n+ if y:\n+ x = m.get(S.One, S.Zero)\n+ if x.has(I) or y.has(I):\n+ continue # nontrivial x + I*y\n+ pairs.add((x, y))\n+ irreducibles.remove(poly)\n+\n+ while pairs:\n+ x, y = pairs.pop()\n+ if (x, -y) in pairs:\n+ pairs.remove((x, -y))\n+ # Choosing b with no minus sign\n+ if y.could_extract_minus_sign():\n+ y = -y\n+ irreducibles.add(x*x + y*y)\n+ atans.add(atan(x/y))\n+ else:\n+ irreducibles.add(x + I*y)\n+\n+\n+ B = _symbols('B', len(irreducibles))\n+ C = _symbols('C', len(atans))\n+\n+ # Note: the ordering matters here\n+ for poly, b in reversed(list(zip(ordered(irreducibles), B))):\n+ if poly.has(*V):\n+ poly_coeffs.append(b)\n+ log_part.append(b * log(poly))\n+\n+ for poly, c in reversed(list(zip(ordered(atans), C))):\n+ if poly.has(*V):\n+ poly_coeffs.append(c)\n+ atan_part.append(c * poly)\n+\n+ # TODO: Currently it's better to use symbolic expressions here instead\n+ # of rational functions, because it's simpler and FracElement doesn't\n+ # give big speed improvement yet. This is because cancellation is slow\n+ # due to slow polynomial GCD algorithms. If this gets improved then\n+ # revise this code.\n+ candidate = poly_part/poly_denom + Add(*log_part) + Add(*atan_part)\n+ h = F - _derivation(candidate) / denom\n+ raw_numer = h.as_numer_denom()[0]\n+\n+ # Rewrite raw_numer as a polynomial in K[coeffs][V] where K is a field\n+ # that we have to determine. We can't use simply atoms() because log(3),\n+ # sqrt(y) and similar expressions can appear, leading to non-trivial\n+ # domains.\n+ syms = set(poly_coeffs) | set(V)\n+ non_syms = set()\n+\n+ def find_non_syms(expr):\n+ if expr.is_Integer or expr.is_Rational:\n+ pass # ignore trivial numbers\n+ elif expr in syms:\n+ pass # ignore variables\n+ elif not expr.has_free(*syms):\n+ non_syms.add(expr)\n+ elif expr.is_Add or expr.is_Mul or expr.is_Pow:\n+ list(map(find_non_syms, expr.args))\n+ else:\n+ # TODO: Non-polynomial expression. This should have been\n+ # filtered out at an earlier stage.\n+ raise PolynomialError\n+\n+ try:\n+ find_non_syms(raw_numer)\n+ except PolynomialError:\n+ return None\n+ else:\n+ ground, _ = construct_domain(non_syms, field=True)\n+\n+ coeff_ring = PolyRing(poly_coeffs, ground)\n+ ring = PolyRing(V, coeff_ring)\n+ try:\n+ numer = ring.from_expr(raw_numer)\n+ except ValueError:\n+ raise PolynomialError\n+ solution = solve_lin_sys(numer.coeffs(), coeff_ring, _raw=False)\n+\n+ if solution is None:\n+ return None\n+ else:\n+ return candidate.xreplace(solution).xreplace(\n+ dict(zip(poly_coeffs, [S.Zero]*len(poly_coeffs))))\n+\n+ if all(isinstance(_, Symbol) for _ in V):\n+ more_free = F.free_symbols - set(V)\n+ else:\n+ Fd = F.as_dummy()\n+ more_free = Fd.xreplace(dict(zip(V, (Dummy() for _ in V)))\n+ ).free_symbols & Fd.free_symbols\n+ if not more_free:\n+ # all free generators are identified in V\n+ solution = _integrate('Q')\n+\n+ if solution is None:\n+ solution = _integrate()\n+ else:\n+ solution = _integrate()\n+\n+ if solution is not None:\n+ antideriv = solution.subs(rev_mapping)\n+ antideriv = cancel(antideriv).expand()\n+\n+ if antideriv.is_Add:\n+ antideriv = antideriv.as_independent(x)[1]\n+\n+ return indep*antideriv\n+ else:\n+ if retries >= 0:\n+ result = heurisch(f, x, mappings=mappings, rewrite=rewrite, hints=hints, retries=retries - 1, unnecessary_permutations=unnecessary_permutations)\n+\n+ if result is not None:\n+ return indep*result\n+\n+ return None\n", "test": null }
null
{ "code": "diff --git a/sympy/integrals/heurisch.py b/sympy/integrals/heurisch.py\nindex a27e2700af..6f1b4ab799 100644\n--- a/sympy/integrals/heurisch.py\n+++ b/sympy/integrals/heurisch.py\n@@ -376,406 +376,3 @@ def heurisch(f, x, rewrite=False, hints=None, mappings=None, retries=3,\n sympy.integrals.integrals.Integral\n sympy.integrals.heurisch.components\n \"\"\"\n- f = sympify(f)\n-\n- # There are some functions that Heurisch cannot currently handle,\n- # so do not even try.\n- # Set _try_heurisch=True to skip this check\n- if _try_heurisch is not True:\n- if f.has(Abs, re, im, sign, Heaviside, DiracDelta, floor, ceiling, arg):\n- return\n-\n- if not f.has_free(x):\n- return f*x\n-\n- if not f.is_Add:\n- indep, f = f.as_independent(x)\n- else:\n- indep = S.One\n-\n- rewritables = {\n- (sin, cos, cot): tan,\n- (sinh, cosh, coth): tanh,\n- }\n-\n- if rewrite:\n- for candidates, rule in rewritables.items():\n- f = f.rewrite(candidates, rule)\n- else:\n- for candidates in rewritables.keys():\n- if f.has(*candidates):\n- break\n- else:\n- rewrite = True\n-\n- terms = components(f, x)\n- dcache = DiffCache(x)\n-\n- if hints is not None:\n- if not hints:\n- a = Wild('a', exclude=[x])\n- b = Wild('b', exclude=[x])\n- c = Wild('c', exclude=[x])\n-\n- for g in set(terms): # using copy of terms\n- if g.is_Function:\n- if isinstance(g, li):\n- M = g.args[0].match(a*x**b)\n-\n- if M is not None:\n- terms.add( x*(li(M[a]*x**M[b]) - (M[a]*x**M[b])**(-1/M[b])*Ei((M[b]+1)*log(M[a]*x**M[b])/M[b])) )\n- #terms.add( x*(li(M[a]*x**M[b]) - (x**M[b])**(-1/M[b])*Ei((M[b]+1)*log(M[a]*x**M[b])/M[b])) )\n- #terms.add( x*(li(M[a]*x**M[b]) - x*Ei((M[b]+1)*log(M[a]*x**M[b])/M[b])) )\n- #terms.add( li(M[a]*x**M[b]) - Ei((M[b]+1)*log(M[a]*x**M[b])/M[b]) )\n-\n- elif isinstance(g, exp):\n- M = g.args[0].match(a*x**2)\n-\n- if M is not None:\n- if M[a].is_positive:\n- terms.add(erfi(sqrt(M[a])*x))\n- else: # M[a].is_negative or unknown\n- terms.add(erf(sqrt(-M[a])*x))\n-\n- M = g.args[0].match(a*x**2 + b*x + c)\n-\n- if M is not None:\n- if M[a].is_positive:\n- terms.add(sqrt(pi/4*(-M[a]))*exp(M[c] - M[b]**2/(4*M[a]))*\n- erfi(sqrt(M[a])*x + M[b]/(2*sqrt(M[a]))))\n- elif M[a].is_negative:\n- terms.add(sqrt(pi/4*(-M[a]))*exp(M[c] - M[b]**2/(4*M[a]))*\n- erf(sqrt(-M[a])*x - M[b]/(2*sqrt(-M[a]))))\n-\n- M = g.args[0].match(a*log(x)**2)\n-\n- if M is not None:\n- if M[a].is_positive:\n- terms.add(erfi(sqrt(M[a])*log(x) + 1/(2*sqrt(M[a]))))\n- if M[a].is_negative:\n- terms.add(erf(sqrt(-M[a])*log(x) - 1/(2*sqrt(-M[a]))))\n-\n- elif g.is_Pow:\n- if g.exp.is_Rational and g.exp.q == 2:\n- M = g.base.match(a*x**2 + b)\n-\n- if M is not None and M[b].is_positive:\n- if M[a].is_positive:\n- terms.add(asinh(sqrt(M[a]/M[b])*x))\n- elif M[a].is_negative:\n- terms.add(asin(sqrt(-M[a]/M[b])*x))\n-\n- M = g.base.match(a*x**2 - b)\n-\n- if M is not None and M[b].is_positive:\n- if M[a].is_positive:\n- dF = 1/sqrt(M[a]*x**2 - M[b])\n- F = log(2*sqrt(M[a])*sqrt(M[a]*x**2 - M[b]) + 2*M[a]*x)/sqrt(M[a])\n- dcache.cache[F] = dF # hack: F.diff(x) doesn't automatically simplify to f\n- terms.add(F)\n- elif M[a].is_negative:\n- terms.add(-M[b]/2*sqrt(-M[a])*\n- atan(sqrt(-M[a])*x/sqrt(M[a]*x**2 - M[b])))\n-\n- else:\n- terms |= set(hints)\n-\n- for g in set(terms): # using copy of terms\n- terms |= components(dcache.get_diff(g), x)\n-\n- # XXX: The commented line below makes heurisch more deterministic wrt\n- # PYTHONHASHSEED and the iteration order of sets. There are other places\n- # where sets are iterated over but this one is possibly the most important.\n- # Theoretically the order here should not matter but different orderings\n- # can expose potential bugs in the different code paths so potentially it\n- # is better to keep the non-determinism.\n- #\n- # terms = list(ordered(terms))\n-\n- # TODO: caching is significant factor for why permutations work at all. Change this.\n- V = _symbols('x', len(terms))\n-\n-\n- # sort mapping expressions from largest to smallest (last is always x).\n- mapping = list(reversed(list(zip(*ordered( #\n- [(a[0].as_independent(x)[1], a) for a in zip(terms, V)])))[1])) #\n- rev_mapping = {v: k for k, v in mapping} #\n- if mappings is None: #\n- # optimizing the number of permutations of mapping #\n- assert mapping[-1][0] == x # if not, find it and correct this comment\n- unnecessary_permutations = [mapping.pop(-1)]\n- # permute types of objects\n- types = defaultdict(list)\n- for i in mapping:\n- e, _ = i\n- types[type(e)].append(i)\n- mapping = [types[i] for i in types]\n- def _iter_mappings():\n- for i in permutations(mapping):\n- # make the expression of a given type be ordered\n- yield [j for i in i for j in ordered(i)]\n- mappings = _iter_mappings()\n- else:\n- unnecessary_permutations = unnecessary_permutations or []\n-\n- def _substitute(expr):\n- return expr.subs(mapping)\n-\n- for mapping in mappings:\n- mapping = list(mapping)\n- mapping = mapping + unnecessary_permutations\n- diffs = [ _substitute(dcache.get_diff(g)) for g in terms ]\n- denoms = [ g.as_numer_denom()[1] for g in diffs ]\n- if all(h.is_polynomial(*V) for h in denoms) and _substitute(f).is_rational_function(*V):\n- denom = reduce(lambda p, q: lcm(p, q, *V), denoms)\n- break\n- else:\n- if not rewrite:\n- result = heurisch(f, x, rewrite=True, hints=hints,\n- unnecessary_permutations=unnecessary_permutations)\n-\n- if result is not None:\n- return indep*result\n- return None\n-\n- numers = [ cancel(denom*g) for g in diffs ]\n- def _derivation(h):\n- return Add(*[ d * h.diff(v) for d, v in zip(numers, V) ])\n-\n- def _deflation(p):\n- for y in V:\n- if not p.has(y):\n- continue\n-\n- if _derivation(p) is not S.Zero:\n- c, q = p.as_poly(y).primitive()\n- return _deflation(c)*gcd(q, q.diff(y)).as_expr()\n-\n- return p\n-\n- def _splitter(p):\n- for y in V:\n- if not p.has(y):\n- continue\n-\n- if _derivation(y) is not S.Zero:\n- c, q = p.as_poly(y).primitive()\n-\n- q = q.as_expr()\n-\n- h = gcd(q, _derivation(q), y)\n- s = quo(h, gcd(q, q.diff(y), y), y)\n-\n- c_split = _splitter(c)\n-\n- if s.as_poly(y).degree() == 0:\n- return (c_split[0], q * c_split[1])\n-\n- q_split = _splitter(cancel(q / s))\n-\n- return (c_split[0]*q_split[0]*s, c_split[1]*q_split[1])\n-\n- return (S.One, p)\n-\n- special = {}\n-\n- for term in terms:\n- if term.is_Function:\n- if isinstance(term, tan):\n- special[1 + _substitute(term)**2] = False\n- elif isinstance(term, tanh):\n- special[1 + _substitute(term)] = False\n- special[1 - _substitute(term)] = False\n- elif isinstance(term, LambertW):\n- special[_substitute(term)] = True\n-\n- F = _substitute(f)\n-\n- P, Q = F.as_numer_denom()\n-\n- u_split = _splitter(denom)\n- v_split = _splitter(Q)\n-\n- polys = set(list(v_split) + [ u_split[0] ] + list(special.keys()))\n-\n- s = u_split[0] * Mul(*[ k for k, v in special.items() if v ])\n- polified = [ p.as_poly(*V) for p in [s, P, Q] ]\n-\n- if None in polified:\n- return None\n-\n- #--- definitions for _integrate\n- a, b, c = [ p.total_degree() for p in polified ]\n-\n- poly_denom = (s * v_split[0] * _deflation(v_split[1])).as_expr()\n-\n- def _exponent(g):\n- if g.is_Pow:\n- if g.exp.is_Rational and g.exp.q != 1:\n- if g.exp.p > 0:\n- return g.exp.p + g.exp.q - 1\n- else:\n- return abs(g.exp.p + g.exp.q)\n- else:\n- return 1\n- elif not g.is_Atom and g.args:\n- return max(_exponent(h) for h in g.args)\n- else:\n- return 1\n-\n- A, B = _exponent(f), a + max(b, c)\n-\n- if A > 1 and B > 1:\n- monoms = tuple(ordered(itermonomials(V, A + B - 1 + degree_offset)))\n- else:\n- monoms = tuple(ordered(itermonomials(V, A + B + degree_offset)))\n-\n- poly_coeffs = _symbols('A', len(monoms))\n-\n- poly_part = Add(*[ poly_coeffs[i]*monomial\n- for i, monomial in enumerate(monoms) ])\n-\n- reducibles = set()\n-\n- for poly in ordered(polys):\n- coeff, factors = factor_list(poly, *V)\n- reducibles.add(coeff)\n- reducibles.update(fact for fact, mul in factors)\n-\n- def _integrate(field=None):\n- atans = set()\n- pairs = set()\n-\n- if field == 'Q':\n- irreducibles = set(reducibles)\n- else:\n- setV = set(V)\n- irreducibles = set()\n- for poly in ordered(reducibles):\n- zV = setV & set(iterfreeargs(poly))\n- for z in ordered(zV):\n- s = set(root_factors(poly, z, filter=field))\n- irreducibles |= s\n- break\n-\n- log_part, atan_part = [], []\n-\n- for poly in ordered(irreducibles):\n- m = collect(poly, I, evaluate=False)\n- y = m.get(I, S.Zero)\n- if y:\n- x = m.get(S.One, S.Zero)\n- if x.has(I) or y.has(I):\n- continue # nontrivial x + I*y\n- pairs.add((x, y))\n- irreducibles.remove(poly)\n-\n- while pairs:\n- x, y = pairs.pop()\n- if (x, -y) in pairs:\n- pairs.remove((x, -y))\n- # Choosing b with no minus sign\n- if y.could_extract_minus_sign():\n- y = -y\n- irreducibles.add(x*x + y*y)\n- atans.add(atan(x/y))\n- else:\n- irreducibles.add(x + I*y)\n-\n-\n- B = _symbols('B', len(irreducibles))\n- C = _symbols('C', len(atans))\n-\n- # Note: the ordering matters here\n- for poly, b in reversed(list(zip(ordered(irreducibles), B))):\n- if poly.has(*V):\n- poly_coeffs.append(b)\n- log_part.append(b * log(poly))\n-\n- for poly, c in reversed(list(zip(ordered(atans), C))):\n- if poly.has(*V):\n- poly_coeffs.append(c)\n- atan_part.append(c * poly)\n-\n- # TODO: Currently it's better to use symbolic expressions here instead\n- # of rational functions, because it's simpler and FracElement doesn't\n- # give big speed improvement yet. This is because cancellation is slow\n- # due to slow polynomial GCD algorithms. If this gets improved then\n- # revise this code.\n- candidate = poly_part/poly_denom + Add(*log_part) + Add(*atan_part)\n- h = F - _derivation(candidate) / denom\n- raw_numer = h.as_numer_denom()[0]\n-\n- # Rewrite raw_numer as a polynomial in K[coeffs][V] where K is a field\n- # that we have to determine. We can't use simply atoms() because log(3),\n- # sqrt(y) and similar expressions can appear, leading to non-trivial\n- # domains.\n- syms = set(poly_coeffs) | set(V)\n- non_syms = set()\n-\n- def find_non_syms(expr):\n- if expr.is_Integer or expr.is_Rational:\n- pass # ignore trivial numbers\n- elif expr in syms:\n- pass # ignore variables\n- elif not expr.has_free(*syms):\n- non_syms.add(expr)\n- elif expr.is_Add or expr.is_Mul or expr.is_Pow:\n- list(map(find_non_syms, expr.args))\n- else:\n- # TODO: Non-polynomial expression. This should have been\n- # filtered out at an earlier stage.\n- raise PolynomialError\n-\n- try:\n- find_non_syms(raw_numer)\n- except PolynomialError:\n- return None\n- else:\n- ground, _ = construct_domain(non_syms, field=True)\n-\n- coeff_ring = PolyRing(poly_coeffs, ground)\n- ring = PolyRing(V, coeff_ring)\n- try:\n- numer = ring.from_expr(raw_numer)\n- except ValueError:\n- raise PolynomialError\n- solution = solve_lin_sys(numer.coeffs(), coeff_ring, _raw=False)\n-\n- if solution is None:\n- return None\n- else:\n- return candidate.xreplace(solution).xreplace(\n- dict(zip(poly_coeffs, [S.Zero]*len(poly_coeffs))))\n-\n- if all(isinstance(_, Symbol) for _ in V):\n- more_free = F.free_symbols - set(V)\n- else:\n- Fd = F.as_dummy()\n- more_free = Fd.xreplace(dict(zip(V, (Dummy() for _ in V)))\n- ).free_symbols & Fd.free_symbols\n- if not more_free:\n- # all free generators are identified in V\n- solution = _integrate('Q')\n-\n- if solution is None:\n- solution = _integrate()\n- else:\n- solution = _integrate()\n-\n- if solution is not None:\n- antideriv = solution.subs(rev_mapping)\n- antideriv = cancel(antideriv).expand()\n-\n- if antideriv.is_Add:\n- antideriv = antideriv.as_independent(x)[1]\n-\n- return indep*antideriv\n- else:\n- if retries >= 0:\n- result = heurisch(f, x, mappings=mappings, rewrite=rewrite, hints=hints, retries=retries - 1, unnecessary_permutations=unnecessary_permutations)\n-\n- if result is not None:\n- return indep*result\n-\n- return None\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/integrals/heurisch.py.\nHere is the description for the function:\ndef heurisch(f, x, rewrite=False, hints=None, mappings=None, retries=3,\n degree_offset=0, unnecessary_permutations=None,\n _try_heurisch=None):\n \"\"\"\n Compute indefinite integral using heuristic Risch algorithm.\n\n Explanation\n ===========\n\n This is a heuristic approach to indefinite integration in finite\n terms using the extended heuristic (parallel) Risch algorithm, based\n on Manuel Bronstein's \"Poor Man's Integrator\".\n\n The algorithm supports various classes of functions including\n transcendental elementary or special functions like Airy,\n Bessel, Whittaker and Lambert.\n\n Note that this algorithm is not a decision procedure. If it isn't\n able to compute the antiderivative for a given function, then this is\n not a proof that such a functions does not exist. One should use\n recursive Risch algorithm in such case. It's an open question if\n this algorithm can be made a full decision procedure.\n\n This is an internal integrator procedure. You should use top level\n 'integrate' function in most cases, as this procedure needs some\n preprocessing steps and otherwise may fail.\n\n Specification\n =============\n\n heurisch(f, x, rewrite=False, hints=None)\n\n where\n f : expression\n x : symbol\n\n rewrite -> force rewrite 'f' in terms of 'tan' and 'tanh'\n hints -> a list of functions that may appear in anti-derivate\n\n - hints = None --> no suggestions at all\n - hints = [ ] --> try to figure out\n - hints = [f1, ..., fn] --> we know better\n\n Examples\n ========\n\n >>> from sympy import tan\n >>> from sympy.integrals.heurisch import heurisch\n >>> from sympy.abc import x, y\n\n >>> heurisch(y*tan(x), x)\n y*log(tan(x)**2 + 1)/2\n\n See Manuel Bronstein's \"Poor Man's Integrator\":\n\n References\n ==========\n\n .. [1] https://www-sop.inria.fr/cafe/Manuel.Bronstein/pmint/index.html\n\n For more information on the implemented algorithm refer to:\n\n .. [2] K. Geddes, L. Stefanus, On the Risch-Norman Integration\n Method and its Implementation in Maple, Proceedings of\n ISSAC'89, ACM Press, 212-217.\n\n .. [3] J. H. Davenport, On the Parallel Risch Algorithm (I),\n Proceedings of EUROCAM'82, LNCS 144, Springer, 144-157.\n\n .. [4] J. H. Davenport, On the Parallel Risch Algorithm (III):\n Use of Tangents, SIGSAM Bulletin 16 (1982), 3-6.\n\n .. [5] J. H. Davenport, B. M. Trager, On the Parallel Risch\n Algorithm (II), ACM Transactions on Mathematical\n Software 11 (1985), 356-362.\n\n See Also\n ========\n\n sympy.integrals.integrals.Integral.doit\n sympy.integrals.integrals.Integral\n sympy.integrals.heurisch.components\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/stats/tests/test_continuous_rv.py::test_single_normal", "sympy/integrals/tests/test_integrals.py::test_issue_3664", "sympy/integrals/tests/test_integrals.py::test_issue_3686", "sympy/integrals/tests/test_integrals.py::test_transcendental_functions", "sympy/printing/tests/test_latex.py::test_latex_FourierSeries", "sympy/integrals/tests/test_integrals.py::test_log_polylog", "sympy/integrals/tests/test_integrals.py::test_issue_8623", "sympy/integrals/tests/test_integrals.py::test_issue_9569", "sympy/integrals/tests/test_integrals.py::test_issue_13733", "sympy/printing/pretty/tests/test_pretty.py::test_pretty_FourierSeries", "sympy/integrals/tests/test_integrals.py::test_issue_13749", "sympy/integrals/tests/test_integrals.py::test_issue_18133", "sympy/core/tests/test_evalf.py::test_issue_4806", "sympy/integrals/tests/test_integrals.py::test_issue_21741", "sympy/integrals/tests/test_integrals.py::test_integrate_functions", "sympy/integrals/tests/test_integrals.py::test_integrate_derivatives", "sympy/integrals/tests/test_integrals.py::test_issue_4052", "sympy/core/tests/test_args.py::test_sympy__series__fourier__FourierSeries", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_11045", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_12557", "sympy/integrals/tests/test_heurisch.py::test_issue_10680", "sympy/integrals/tests/test_integrals.py::test_double_previously_failing_integrals", "sympy/stats/tests/test_continuous_rv.py::test_cdf", "sympy/integrals/tests/test_risch.py::test_integrate_hyperexponential", "sympy/integrals/tests/test_heurisch.py::test_issue_21166", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_Beam", "sympy/integrals/tests/test_heurisch.py::test_heurisch_polynomials", "sympy/integrals/tests/test_heurisch.py::test_heurisch_fractions", "sympy/integrals/tests/test_heurisch.py::test_heurisch_log", "sympy/integrals/tests/test_heurisch.py::test_heurisch_exp", "sympy/integrals/tests/test_heurisch.py::test_heurisch_trigonometric", "sympy/integrals/tests/test_heurisch.py::test_heurisch_hyperbolic", "sympy/integrals/tests/test_heurisch.py::test_heurisch_mixed", "sympy/integrals/tests/test_heurisch.py::test_heurisch_radicals", "sympy/integrals/tests/test_heurisch.py::test_heurisch_special", "sympy/integrals/tests/test_heurisch.py::test_heurisch_symbolic_coeffs", "sympy/integrals/tests/test_heurisch.py::test_heurisch_symbolic_coeffs_1130", "sympy/integrals/tests/test_heurisch.py::test_heurisch_hacking", "sympy/integrals/tests/test_heurisch.py::test_heurisch_function", "sympy/integrals/tests/test_heurisch.py::test_heurisch_wrapper", "sympy/integrals/tests/test_heurisch.py::test_issue_3609", "sympy/integrals/tests/test_heurisch.py::test_pmint_rat", "sympy/integrals/tests/test_heurisch.py::test_pmint_trig", "sympy/integrals/tests/test_heurisch.py::test_pmint_logexp", "sympy/integrals/tests/test_heurisch.py::test_pmint_erf", "sympy/integrals/tests/test_heurisch.py::test_pmint_LambertW", "sympy/integrals/tests/test_heurisch.py::test_pmint_besselj", "sympy/integrals/tests/test_heurisch.py::test_pmint_WrightOmega", "sympy/integrals/tests/test_heurisch.py::test_RR", "sympy/integrals/tests/test_heurisch.py::test_issue_22527", "sympy/integrals/tests/test_heurisch.py::test_heurisch_complex_erf_issue_26338", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_variable_moment", "sympy/integrals/tests/test_heurisch.py::test_issue_15498", "sympy/stats/tests/test_continuous_rv.py::test_ContinuousRV", "sympy/integrals/tests/test_heurisch.py::test_heurisch_issue_26922", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_composite_beam", "sympy/integrals/tests/test_integrals.py::test_integrate_returns_piecewise", "sympy/integrals/tests/test_integrals.py::test_integrate_max_min", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_apply_support", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_apply_rotation_hinge", "sympy/integrals/tests/test_integrals.py::test_issue_4884", "sympy/integrals/tests/test_integrals.py::test_issue_18153", "sympy/integrals/tests/test_integrals.py::test_trig_nonelementary_integrals", "sympy/integrals/tests/test_integrals.py::test_issue_4403", "sympy/integrals/tests/test_integrals.py::test_issue_4403_2", "sympy/integrals/tests/test_integrals.py::test_issue_4100", "sympy/integrals/tests/test_integrals.py::test_issue_5167", "sympy/functions/special/tests/test_error_functions.py::test_fresnel", "sympy/integrals/tests/test_integrals.py::test_issue_4890", "sympy/integrals/tests/test_integrals.py::test_issue_4551", "sympy/integrals/tests/test_integrals.py::test_issue_4376", "sympy/integrals/tests/test_integrals.py::test_issue_4517", "sympy/integrals/tests/test_integrals.py::test_issue_4527", "sympy/integrals/tests/test_integrals.py::test_issue_3940", "sympy/physics/control/tests/test_lti.py::test_StateSpace_dsolve", "sympy/holonomic/tests/test_holonomic.py::test_to_expr", "sympy/integrals/tests/test_integrals.py::test_issue_5178", "sympy/integrals/tests/test_integrals.py::test_atom_bug", "sympy/solvers/ode/tests/test_systems.py::test_sysode_linear_neq_order1_type2", "sympy/holonomic/tests/test_holonomic.py::test_integrate", "sympy/integrals/tests/test_integrals.py::test_limit_bug", "sympy/integrals/tests/test_integrals.py::test_issue_4703", "sympy/integrals/tests/test_integrals.py::test_issue_1888", "sympy/integrals/tests/test_integrals.py::test_issue_3558", "sympy/integrals/tests/test_integrals.py::test_issue_4422", "sympy/integrals/tests/test_integrals.py::test_issue_4493", "sympy/integrals/tests/test_integrals.py::test_issue_4737", "sympy/stats/tests/test_joint_rv.py::test_GeneralizedMultivariateLogGammaDistribution", "sympy/integrals/tests/test_integrals.py::test_issue_4487", "sympy/integrals/tests/test_integrals.py::test_issue_4400", "sympy/physics/vector/tests/test_functions.py::test_get_motion_methods", "sympy/series/tests/test_fourier.py::test_FourierSeries", "sympy/series/tests/test_fourier.py::test_FourierSeries_2", "sympy/stats/tests/test_continuous_rv.py::test_unevaluated", "sympy/series/tests/test_fourier.py::test_sawtooth_wave", "sympy/series/tests/test_fourier.py::test_FourierSeries__operations", "sympy/series/tests/test_fourier.py::test_FourierSeries__neg", "sympy/solvers/tests/test_pde.py::test_pde_1st_linear_constant_coeff", "sympy/series/tests/test_fourier.py::test_FourierSeries__add__sub", "sympy/integrals/tests/test_failing_integrals.py::test_issue_4511", "sympy/integrals/tests/test_failing_integrals.py::test_integrate_DiracDelta_no_meijerg", "sympy/integrals/tests/test_integrals.py::test_issue_4326", "sympy/integrals/tests/test_failing_integrals.py::test_issue_15925b", "sympy/solvers/ode/tests/test_single.py::test_2nd_nonlinear_autonomous_conserved_integral", "sympy/stats/tests/test_continuous_rv.py::test_precomputed_cdf", "sympy/vector/tests/test_integrals.py::test_parametric_lineintegrals", "sympy/integrals/tests/test_integrals.py::test_issue_4234", "sympy/integrals/tests/test_integrals.py::test_issue_4492", "sympy/geometry/tests/test_curve.py::test_length", "sympy/integrals/tests/test_integrals.py::test_issue_2708", "sympy/utilities/tests/test_wester.py::test_T12", "sympy/integrals/tests/test_integrals.py::test_issue_2884", "sympy/utilities/tests/test_wester.py::test_U6", "sympy/integrals/tests/test_manual.py::test_issue_3796", "sympy/integrals/tests/test_integrals.py::test_issue_8901", "sympy/vector/tests/test_integrals.py::test_vector_integrate", "sympy/integrals/tests/test_integrals.py::test_issue_11742", "sympy/utilities/tests/test_wester.py::test_V4", "sympy/integrals/tests/test_integrals.py::test_issue_11856", "sympy/utilities/tests/test_wester.py::test_V7", "sympy/utilities/tests/test_wester.py::test_V10", "sympy/integrals/tests/test_integrals.py::test_issue_4968", "sympy/utilities/tests/test_wester.py::test_V11", "sympy/integrals/tests/test_integrals.py::test_issue_12645", "sympy/utilities/tests/test_wester.py::test_V12", "sympy/utilities/tests/test_wester.py::test_V15", "sympy/integrals/tests/test_integrals.py::test_issue_14078", "sympy/integrals/tests/test_integrals.py::test_issue_14064", "sympy/utilities/tests/test_wester.py::test_W21", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_deflection", "sympy/solvers/ode/tests/test_systems.py::test_higher_order_to_first_order", "sympy/integrals/tests/test_integrals.py::test_issue_14144", "sympy/integrals/tests/test_integrals.py::test_issue_14375", "sympy/integrals/tests/test_meijerint.py::test_fresnel", "sympy/integrals/tests/test_integrals.py::test_issue_14437", "sympy/integrals/tests/test_integrals.py::test_issue_14470", "sympy/integrals/tests/test_integrals.py::test_issue_14782", "sympy/utilities/tests/test_wester.py::test_X21", "sympy/integrals/tests/test_integrals.py::test_issue_12081", "sympy/integrals/tests/test_meijerint.py::test_issue_10211", "sympy/integrals/tests/test_integrals.py::test_issue_15124", "sympy/integrals/tests/test_meijerint.py::test_issue_11806", "sympy/integrals/tests/test_integrals.py::test_issue_4514", "sympy/integrals/tests/test_integrals.py::test_issue_15431", "sympy/integrals/tests/test_integrals.py::test_issue_15640_log_substitutions", "sympy/integrals/tests/test_integrals.py::test_issue_15509", "sympy/integrals/tests/test_transforms.py::test_issue_7181", "sympy/integrals/tests/test_integrals.py::test_integrate_with_complex_constants", "sympy/integrals/tests/test_transforms.py::test_issue_12591", "sympy/integrals/tests/test_integrals.py::test_issue_14241", "sympy/integrals/tests/test_integrals.py::test_issue_13112", "sympy/integrals/tests/test_integrals.py::test_issue_14709b", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_Beam3D", "sympy/integrals/tests/test_integrals.py::test_issue_8614", "sympy/integrals/tests/test_integrals.py::test_li_integral", "sympy/integrals/tests/test_integrals.py::test_issue_17473", "sympy/integrals/tests/test_integrals.py::test_issue_17671", "sympy/integrals/tests/test_integrals.py::test_issue_2975", "sympy/integrals/tests/test_integrals.py::test_issue_4231", "sympy/integrals/tests/test_integrals.py::test_issue_21034", "sympy/solvers/ode/tests/test_single.py::test_1st_linear", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_cross_section", "sympy/solvers/ode/tests/test_single.py::test_almost_linear", "sympy/solvers/ode/tests/test_systems.py::test_second_order_to_first_order_slow4", "sympy/integrals/tests/test_integrals.py::test_issue_4187", "sympy/integrals/tests/test_integrals.py::test_issue_5547", "sympy/integrals/tests/test_integrals.py::test_issue_21831", "sympy/integrals/tests/test_integrals.py::test_issue_23718", "sympy/integrals/tests/test_integrals.py::test_issue_23566", "sympy/integrals/tests/test_integrals.py::test_pr_23583", "sympy/integrals/tests/test_integrals.py::test_issue_7264", "sympy/integrals/tests/test_integrals.py::test_issue_11254a", "sympy/integrals/tests/test_integrals.py::test_issue_11254b", "sympy/integrals/tests/test_integrals.py::test_issue_11254d", "sympy/integrals/tests/test_integrals.py::test_issue_22863", "sympy/integrals/tests/test_integrals.py::test_issue_9723", "sympy/integrals/tests/test_integrals.py::test_exp_substitution", "sympy/integrals/tests/test_integrals.py::test_hyperbolic", "sympy/integrals/tests/test_integrals.py::test_nested_pow", "sympy/integrals/tests/test_integrals.py::test_sqrt_quadratic", "sympy/integrals/tests/test_integrals.py::test_mul_pow_derivative", "sympy/integrals/tests/test_integrals.py::test_issue_23942", "sympy/integrals/tests/test_integrals.py::test_old_issues", "sympy/integrals/tests/test_integrals.py::test_integral_issue_26566", "sympy/solvers/ode/tests/test_systems.py::test_nonlinear_2eq_order1", "sympy/series/tests/test_limits.py::test_issue_23596" ], "PASS_TO_PASS": null }
sympy__sympy-64
1.0
{ "code": "diff --git b/sympy/integrals/integrals.py a/sympy/integrals/integrals.py\nindex 4c986637a7..3017c9ba31 100644\n--- b/sympy/integrals/integrals.py\n+++ a/sympy/integrals/integrals.py\n@@ -1560,6 +1560,23 @@ def integrate(*args, meijerg=None, conds='piecewise', risch=None, heurisch=None,\n Integral, Integral.doit\n \n \"\"\"\n+ doit_flags = {\n+ 'deep': False,\n+ 'meijerg': meijerg,\n+ 'conds': conds,\n+ 'risch': risch,\n+ 'heurisch': heurisch,\n+ 'manual': manual\n+ }\n+\n+ integral = Integral(*args, **kwargs)\n+\n+ if isinstance(integral, Integral):\n+ return integral.doit(**doit_flags)\n+ else:\n+ new_args = [a.doit(**doit_flags) if isinstance(a, Integral) else a\n+ for a in integral.args]\n+ return integral.func(*new_args)\n \n def line_integrate(field, curve, vars):\n \"\"\"line_integrate(field, Curve, variables)\n", "test": null }
null
{ "code": "diff --git a/sympy/integrals/integrals.py b/sympy/integrals/integrals.py\nindex 3017c9ba31..4c986637a7 100644\n--- a/sympy/integrals/integrals.py\n+++ b/sympy/integrals/integrals.py\n@@ -1560,23 +1560,6 @@ def integrate(*args, meijerg=None, conds='piecewise', risch=None, heurisch=None,\n Integral, Integral.doit\n \n \"\"\"\n- doit_flags = {\n- 'deep': False,\n- 'meijerg': meijerg,\n- 'conds': conds,\n- 'risch': risch,\n- 'heurisch': heurisch,\n- 'manual': manual\n- }\n-\n- integral = Integral(*args, **kwargs)\n-\n- if isinstance(integral, Integral):\n- return integral.doit(**doit_flags)\n- else:\n- new_args = [a.doit(**doit_flags) if isinstance(a, Integral) else a\n- for a in integral.args]\n- return integral.func(*new_args)\n \n def line_integrate(field, curve, vars):\n \"\"\"line_integrate(field, Curve, variables)\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/integrals/integrals.py.\nHere is the description for the function:\ndef integrate(*args, meijerg=None, conds='piecewise', risch=None, heurisch=None, manual=None, **kwargs):\n \"\"\"integrate(f, var, ...)\n\n .. deprecated:: 1.6\n\n Using ``integrate()`` with :class:`~.Poly` is deprecated. Use\n :meth:`.Poly.integrate` instead. See :ref:`deprecated-integrate-poly`.\n\n Explanation\n ===========\n\n Compute definite or indefinite integral of one or more variables\n using Risch-Norman algorithm and table lookup. This procedure is\n able to handle elementary algebraic and transcendental functions\n and also a huge class of special functions, including Airy,\n Bessel, Whittaker and Lambert.\n\n var can be:\n\n - a symbol -- indefinite integration\n - a tuple (symbol, a) -- indefinite integration with result\n given with ``a`` replacing ``symbol``\n - a tuple (symbol, a, b) -- definite integration\n\n Several variables can be specified, in which case the result is\n multiple integration. (If var is omitted and the integrand is\n univariate, the indefinite integral in that variable will be performed.)\n\n Indefinite integrals are returned without terms that are independent\n of the integration variables. (see examples)\n\n Definite improper integrals often entail delicate convergence\n conditions. Pass conds='piecewise', 'separate' or 'none' to have\n these returned, respectively, as a Piecewise function, as a separate\n result (i.e. result will be a tuple), or not at all (default is\n 'piecewise').\n\n **Strategy**\n\n SymPy uses various approaches to definite integration. One method is to\n find an antiderivative for the integrand, and then use the fundamental\n theorem of calculus. Various functions are implemented to integrate\n polynomial, rational and trigonometric functions, and integrands\n containing DiracDelta terms.\n\n SymPy also implements the part of the Risch algorithm, which is a decision\n procedure for integrating elementary functions, i.e., the algorithm can\n either find an elementary antiderivative, or prove that one does not\n exist. There is also a (very successful, albeit somewhat slow) general\n implementation of the heuristic Risch algorithm. This algorithm will\n eventually be phased out as more of the full Risch algorithm is\n implemented. See the docstring of Integral._eval_integral() for more\n details on computing the antiderivative using algebraic methods.\n\n The option risch=True can be used to use only the (full) Risch algorithm.\n This is useful if you want to know if an elementary function has an\n elementary antiderivative. If the indefinite Integral returned by this\n function is an instance of NonElementaryIntegral, that means that the\n Risch algorithm has proven that integral to be non-elementary. Note that\n by default, additional methods (such as the Meijer G method outlined\n below) are tried on these integrals, as they may be expressible in terms\n of special functions, so if you only care about elementary answers, use\n risch=True. Also note that an unevaluated Integral returned by this\n function is not necessarily a NonElementaryIntegral, even with risch=True,\n as it may just be an indication that the particular part of the Risch\n algorithm needed to integrate that function is not yet implemented.\n\n Another family of strategies comes from re-writing the integrand in\n terms of so-called Meijer G-functions. Indefinite integrals of a\n single G-function can always be computed, and the definite integral\n of a product of two G-functions can be computed from zero to\n infinity. Various strategies are implemented to rewrite integrands\n as G-functions, and use this information to compute integrals (see\n the ``meijerint`` module).\n\n The option manual=True can be used to use only an algorithm that tries\n to mimic integration by hand. This algorithm does not handle as many\n integrands as the other algorithms implemented but may return results in\n a more familiar form. The ``manualintegrate`` module has functions that\n return the steps used (see the module docstring for more information).\n\n In general, the algebraic methods work best for computing\n antiderivatives of (possibly complicated) combinations of elementary\n functions. The G-function methods work best for computing definite\n integrals from zero to infinity of moderately complicated\n combinations of special functions, or indefinite integrals of very\n simple combinations of special functions.\n\n The strategy employed by the integration code is as follows:\n\n - If computing a definite integral, and both limits are real,\n and at least one limit is +- oo, try the G-function method of\n definite integration first.\n\n - Try to find an antiderivative, using all available methods, ordered\n by performance (that is try fastest method first, slowest last; in\n particular polynomial integration is tried first, Meijer\n G-functions second to last, and heuristic Risch last).\n\n - If still not successful, try G-functions irrespective of the\n limits.\n\n The option meijerg=True, False, None can be used to, respectively:\n always use G-function methods and no others, never use G-function\n methods, or use all available methods (in order as described above).\n It defaults to None.\n\n Examples\n ========\n\n >>> from sympy import integrate, log, exp, oo\n >>> from sympy.abc import a, x, y\n\n >>> integrate(x*y, x)\n x**2*y/2\n\n >>> integrate(log(x), x)\n x*log(x) - x\n\n >>> integrate(log(x), (x, 1, a))\n a*log(a) - a + 1\n\n >>> integrate(x)\n x**2/2\n\n Terms that are independent of x are dropped by indefinite integration:\n\n >>> from sympy import sqrt\n >>> integrate(sqrt(1 + x), (x, 0, x))\n 2*(x + 1)**(3/2)/3 - 2/3\n >>> integrate(sqrt(1 + x), x)\n 2*(x + 1)**(3/2)/3\n\n >>> integrate(x*y)\n Traceback (most recent call last):\n ...\n ValueError: specify integration variables to integrate x*y\n\n Note that ``integrate(x)`` syntax is meant only for convenience\n in interactive sessions and should be avoided in library code.\n\n >>> integrate(x**a*exp(-x), (x, 0, oo)) # same as conds='piecewise'\n Piecewise((gamma(a + 1), re(a) > -1),\n (Integral(x**a*exp(-x), (x, 0, oo)), True))\n\n >>> integrate(x**a*exp(-x), (x, 0, oo), conds='none')\n gamma(a + 1)\n\n >>> integrate(x**a*exp(-x), (x, 0, oo), conds='separate')\n (gamma(a + 1), re(a) > -1)\n\n See Also\n ========\n\n Integral, Integral.doit\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/integrals/tests/test_integrals.py::test_poly_deprecated", "sympy/integrals/tests/test_integrals.py::test_improper_integral", "sympy/integrals/tests/test_integrals.py::test_basics", "sympy/integrals/tests/test_integrals.py::test_diff_wrt", "sympy/printing/tests/test_latex.py::test_latex_FourierSeries", "sympy/series/tests/test_limits.py::test_basic4", "sympy/printing/tests/test_latex.py::test_latex_FormalPowerSeries", "sympy/stats/tests/test_continuous_rv.py::test_single_normal", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise1", "sympy/integrals/tests/test_integrals.py::test_integration", "sympy/integrals/tests/test_integrals.py::test_multiple_integration", "sympy/simplify/tests/test_simplify.py::test_simplify_expr", "sympy/integrals/tests/test_integrals.py::test_issue_3532", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_integrate1", "sympy/integrals/tests/test_integrals.py::test_issue_3560", "sympy/core/tests/test_expr.py::test_as_leading_term_deriv_integral", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_integrate1b", "sympy/integrals/tests/test_integrals.py::test_issue_18038", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_integrate2", "sympy/functions/elementary/tests/test_piecewise.py::test_meijer_bypass", "sympy/integrals/tests/test_integrals.py::test_integrate_poly", "sympy/integrals/tests/test_integrals.py::test_integrate_poly_definite", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_integrate3_inequality_conditions", "sympy/integrals/tests/test_integrals.py::test_integrate_omit_var", "sympy/integrals/tests/test_integrals.py::test_integrate_poly_accurately", "sympy/printing/pretty/tests/test_pretty.py::test_pretty_FourierSeries", "sympy/printing/pretty/tests/test_pretty.py::test_pretty_FormalPowerSeries", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_integrate5_independent_conditions", "sympy/integrals/tests/test_integrals.py::test_issue_3635", "sympy/integrals/tests/test_integrals.py::test_integrate_linearterm_pow", "sympy/core/tests/test_expr.py::test_integrate", "sympy/integrals/tests/test_integrals.py::test_issue_3618", "sympy/integrals/tests/test_integrals.py::test_issue_3623", "sympy/matrices/tests/test_commonmatrix.py::test_integrate", "sympy/integrals/tests/test_integrals.py::test_issue_3664", "sympy/core/tests/test_evalf.py::test_issue_4806", "sympy/integrals/tests/test_integrals.py::test_issue_3686", "sympy/integrals/tests/test_integrals.py::test_integrate_units", "sympy/integrals/tests/test_integrals.py::test_transcendental_functions", "sympy/integrals/tests/test_integrals.py::test_log_polylog", "sympy/integrals/tests/test_integrals.py::test_issue_3740", "sympy/integrals/tests/test_integrals.py::test_issue_3788", "sympy/integrals/tests/test_integrals.py::test_issue_3952", "sympy/integrals/tests/test_integrals.py::test_issue_4516", "sympy/integrals/tests/test_integrals.py::test_issue_7450", "sympy/integrals/tests/test_integrals.py::test_issue_8623", "sympy/core/tests/test_args.py::test_sympy__series__fourier__FourierSeries", "sympy/integrals/tests/test_integrals.py::test_issue_9569", "sympy/core/tests/test_args.py::test_sympy__series__formal__FormalPowerSeries", "sympy/integrals/tests/test_integrals.py::test_issue_13733", "sympy/core/tests/test_sympify.py::test_evaluate_false", "sympy/integrals/tests/test_integrals.py::test_issue_13749", "sympy/integrals/tests/test_integrals.py::test_issue_18133", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_fold", "sympy/integrals/tests/test_integrals.py::test_issue_21741", "sympy/core/tests/test_args.py::test_sympy__vector__integrals__ParametricIntegral", "sympy/integrals/tests/test_integrals.py::test_matrices", "sympy/integrals/tests/test_integrals.py::test_integrate_functions", "sympy/series/tests/test_series.py::test_issue_5223", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_interval", "sympy/integrals/tests/test_integrals.py::test_integrate_derivatives", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_12587", "sympy/series/tests/test_series.py::test_issue_6350", "sympy/series/tests/test_series.py::test_issue_11313", "sympy/physics/units/tests/test_quantities.py::test_units", "sympy/stats/tests/test_rv.py::test_H", "sympy/solvers/ode/tests/test_ode.py::test_dsolve_all_hint", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_11045", "sympy/functions/elementary/tests/test_piecewise.py::test_holes", "sympy/integrals/tests/test_integrals.py::test_issue_4052", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_11922", "sympy/integrals/tests/test_integrals.py::test_evalf_issue_939", "sympy/integrals/tests/test_risch.py::test_integrate_hyperexponential", "sympy/stats/tests/test_rv.py::test_dependence", "sympy/integrals/tests/test_heurisch.py::test_issue_10680", "sympy/integrals/tests/test_integrals.py::test_double_previously_failing_integrals", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_5227", "sympy/integrals/tests/test_heurisch.py::test_issue_21166", "sympy/integrals/tests/test_integrals.py::test_integrate_SingularityFunction", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_10137", "sympy/integrals/tests/test_risch.py::test_integrate_hyperexponential_returns_piecewise", "sympy/functions/elementary/tests/test_piecewise.py::test_stackoverflow_43852159", "sympy/integrals/tests/test_integrals.py::test_integrate_DiracDelta", "sympy/integrals/tests/test_risch.py::test_issue_13947", "sympy/integrals/tests/test_integrals.py::test_integrate_returns_piecewise", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_Beam", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_12557", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_6900", "sympy/integrals/tests/test_integrals.py::test_integrate_max_min", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_insufficient_bconditions", "sympy/integrals/tests/test_integrals.py::test_integrate_Abs_sign", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_4313", "sympy/integrals/tests/test_integrals.py::test_subs5", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_statically_indeterminate", "sympy/simplify/tests/test_simplify.py::test_besselsimp", "sympy/stats/tests/test_continuous_rv.py::test_cdf", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_beam_units", "sympy/functions/elementary/tests/test_piecewise.py::test_containment", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_with_DiracDelta", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_variable_moment", "sympy/integrals/tests/test_risch.py::test_risch_integrate", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_8919", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_composite_beam", "sympy/integrals/tests/test_risch.py::test_risch_integrate_float", "sympy/matrices/tests/test_matrices.py::test_issue_3749", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_point_cflexure", "sympy/functions/elementary/tests/test_piecewise.py::test_unevaluated_integrals", "sympy/integrals/tests/test_integrals.py::test_issue_4665", "sympy/integrals/tests/test_risch.py::test_NonElementaryIntegral", "sympy/simplify/tests/test_trigsimp.py::test_issue_5948", "sympy/solvers/ode/tests/test_systems.py::test__classify_linear_system", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_apply_support", "sympy/integrals/tests/test_integrals.py::test_doit_integrals", "sympy/integrals/tests/test_risch.py::test_xtothex", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_14052", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_apply_rotation_hinge", "sympy/integrals/tests/test_integrals.py::test_issue_4884", "sympy/integrals/tests/test_risch.py::test_issue_23948", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_apply_sliding_hinge", "sympy/integrals/tests/test_integrals.py::test_issue_18153", "sympy/stats/tests/test_continuous_rv.py::test_ContinuousRV", "sympy/simplify/tests/test_trigsimp.py::test_trigsimp_issues", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_shear_force", "sympy/integrals/tests/test_integrals.py::test_series", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_bmoment", "sympy/stats/tests/test_continuous_rv.py::test_beta", "sympy/utilities/tests/test_wester.py::test_J17", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_deflection", "sympy/integrals/tests/test_integrals.py::test_trig_nonelementary_integrals", "sympy/integrals/tests/test_integrals.py::test_issue_4403", "sympy/core/tests/test_expr.py::test_issue_11877", "sympy/stats/tests/test_rv.py::test_normality", "sympy/matrices/tests/test_matrices.py::test_integrate", "sympy/stats/tests/test_continuous_rv.py::test_betaprime", "sympy/integrals/tests/test_integrals.py::test_issue_4403_2", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_solve_for_ild_reactions", "sympy/stats/tests/test_continuous_rv.py::test_BoundedPareto", "sympy/integrals/tests/test_integrals.py::test_issue_4100", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_solve_for_ild_shear", "sympy/integrals/tests/test_integrals.py::test_issue_5167", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_solve_for_ild_moment", "sympy/integrals/tests/test_integrals.py::test_issue_4890", "sympy/integrals/tests/test_integrals.py::test_issue_4551", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_ild_with_rotation_hinge", "sympy/algebras/tests/test_quaternion.py::test_quaternion_functions", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_ild_with_sliding_hinge", "sympy/integrals/tests/test_integrals.py::test_issue_4376", "sympy/series/tests/test_formal.py::test_rational_algorithm", "sympy/integrals/tests/test_integrals.py::test_issue_4517", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_Beam3D", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_parabolic_loads", "sympy/integrals/tests/test_integrals.py::test_issue_4527", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_cross_section", "sympy/integrals/tests/test_integrals.py::test_issue_4199", "sympy/functions/combinatorial/tests/test_comb_numbers.py::test_nD_derangements", "sympy/integrals/tests/test_integrals.py::test_issue_3940", "sympy/matrices/tests/test_matrixbase.py::test_issue_3749", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_shear_force_Beam3D", "sympy/integrals/tests/test_integrals.py::test_issue_5413", "sympy/stats/tests/test_continuous_rv.py::test_Lomax", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_bending_moment_Beam3D", "sympy/series/tests/test_formal.py::test_fps", "sympy/integrals/tests/test_integrals.py::test_issue_4892a", "sympy/stats/tests/test_continuous_rv.py::test_maxwell", "sympy/integrals/tests/test_integrals.py::test_issue_4892b", "sympy/integrals/tests/test_integrals.py::test_issue_5178", "sympy/stats/tests/test_continuous_rv.py::test_nakagami", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_deflection_Beam3D", "sympy/integrals/tests/test_integrals.py::test_integrate_series", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_torsion_Beam3D", "sympy/functions/special/tests/test_error_functions.py::test_fresnel", "sympy/integrals/tests/test_integrals.py::test_limit_bug", "sympy/integrals/tests/test_integrals.py::test_issue_4703", "sympy/series/tests/test_formal.py::test_fps__Add_expr", "sympy/integrals/tests/test_meijerint.py::test_recursive", "sympy/integrals/tests/test_integrals.py::test_issue_1888", "sympy/integrals/tests/test_meijerint.py::test_bessel", "sympy/matrices/tests/test_matrixbase.py::test_integrate", "sympy/integrals/tests/test_integrals.py::test_issue_3558", "sympy/integrals/tests/test_integrals.py::test_issue_4422", "sympy/solvers/ode/tests/test_single.py::test_linear_coefficients", "sympy/solvers/ode/tests/test_systems.py::test_sysode_linear_neq_order1_type2", "sympy/series/tests/test_formal.py::test_fps__asymptotic", "sympy/integrals/tests/test_integrals.py::test_issue_4493", "sympy/physics/control/tests/test_lti.py::test_StateSpace_dsolve", "sympy/integrals/tests/test_integrals.py::test_issue_4737", "sympy/stats/tests/test_joint_rv.py::test_Normal", "sympy/holonomic/tests/test_holonomic.py::test_to_expr", "sympy/integrals/tests/test_meijerint.py::test_branch_bug", "sympy/integrals/tests/test_integrals.py::test_issue_4992", "sympy/stats/tests/test_joint_rv.py::test_MultivariateTDist", "sympy/integrals/tests/test_integrals.py::test_issue_4487", "sympy/stats/tests/test_continuous_rv.py::test_PowerFunction", "sympy/holonomic/tests/test_holonomic.py::test_integrate", "sympy/integrals/tests/test_meijerint.py::test_linear_subs", "sympy/integrals/tests/test_meijerint.py::test_messy", "sympy/stats/tests/test_joint_rv.py::test_GeneralizedMultivariateLogGammaDistribution", "sympy/integrals/tests/test_integrals.py::test_issue_4215", "sympy/solvers/ode/tests/test_systems.py::test_sysode_linear_neq_order1_type3", "sympy/solvers/ode/tests/test_ode.py::test_solve_ics", "sympy/stats/tests/test_joint_rv.py::test_MultivariateBeta", "sympy/integrals/tests/test_integrals.py::test_issue_4400", "sympy/integrals/tests/test_transforms.py::test_undefined_function", "sympy/stats/tests/test_continuous_rv.py::test_reciprocal", "sympy/integrals/tests/test_integrals.py::test_issue_6253", "sympy/integrals/tests/test_meijerint.py::test_issue_6122", "sympy/stats/tests/test_continuous_rv.py::test_trapezoidal", "sympy/integrals/tests/test_meijerint.py::test_issue_6252", "sympy/integrals/tests/test_integrals.py::test_issue_4153", "sympy/integrals/tests/test_meijerint.py::test_issue_6348", "sympy/integrals/tests/test_transforms.py::test_mellin_transform", "sympy/integrals/tests/test_meijerint.py::test_fresnel", "sympy/stats/tests/test_continuous_rv.py::test_uniform", "sympy/integrals/tests/test_integrals.py::test_issue_4326", "sympy/solvers/ode/tests/test_systems.py::test_sysode_linear_neq_order1_type5_type6", "sympy/integrals/tests/test_transforms.py::test_mellin_transform2", "sympy/integrals/tests/test_integrals.py::test_powers", "sympy/integrals/tests/test_integrals.py::test_manual_option", "sympy/integrals/tests/test_transforms.py::test_fourier_transform", "sympy/stats/tests/test_joint_rv.py::test_JointRV", "sympy/holonomic/tests/test_holonomic.py::test_extended_domain_in_expr_to_holonomic", "sympy/integrals/tests/test_transforms.py::test_sine_transform", "sympy/integrals/tests/test_transforms.py::test_cosine_transform", "sympy/integrals/tests/test_integrals.py::test_meijerg_option", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_7370", "sympy/solvers/ode/tests/test_systems.py::test_higher_order_to_first_order", "sympy/integrals/tests/test_transforms.py::test_hankel_transform", "sympy/integrals/tests/test_integrals.py::test_risch_option", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_20360", "sympy/stats/tests/test_continuous_rv.py::test_weibull", "sympy/integrals/tests/test_transforms.py::test_issue_7181", "sympy/integrals/tests/test_rationaltools.py::test_issue_5981", "sympy/integrals/tests/test_rationaltools.py::test_issue_10488", "sympy/integrals/tests/test_rationaltools.py::test_issues_8246_12050_13501_14080", "sympy/integrals/tests/test_rationaltools.py::test_issue_6308", "sympy/solvers/ode/tests/test_single.py::test_2nd_2F1_hypergeometric_integral", "sympy/integrals/tests/test_rationaltools.py::test_issue_5907", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_22533", "sympy/integrals/tests/test_transforms.py::test_issue_12591", "sympy/integrals/tests/test_integrals.py::test_issue_6828", "sympy/stats/tests/test_continuous_rv.py::test_weibull_numeric", "sympy/integrals/tests/test_integrals.py::test_issue_4803", "sympy/physics/quantum/tests/test_density.py::test_represent", "sympy/stats/tests/test_continuous_rv.py::test_unevaluated", "sympy/series/tests/test_formal.py::test_fps__logarithmic_singularity", "sympy/integrals/tests/test_integrals.py::test_issue_4234", "sympy/series/tests/test_formal.py::test_fps_symbolic", "sympy/matrices/tests/test_immutable.py::test_integrate", "sympy/integrals/tests/test_integrals.py::test_issue_4492", "sympy/integrals/tests/test_integrals.py::test_issue_2708", "sympy/integrals/tests/test_meijerint.py::test_issue_10211", "sympy/integrals/tests/test_meijerint.py::test_issue_11806", "sympy/integrals/tests/test_integrals.py::test_issue_2884", "sympy/physics/vector/tests/test_functions.py::test_get_motion_methods", "sympy/integrals/tests/test_meijerint.py::test_issue_10681", "sympy/integrals/tests/test_meijerint.py::test_issue_13536", "sympy/integrals/tests/test_meijerint.py::test_issue_6462", "sympy/integrals/tests/test_meijerint.py::test_indefinite_1_bug", "sympy/integrals/tests/test_integrals.py::test_issue_8368i", "sympy/series/tests/test_fourier.py::test_FourierSeries", "sympy/physics/quantum/tests/test_state.py::test_wavefunction", "sympy/integrals/tests/test_meijerint.py::test_pr_23583", "sympy/integrals/tests/test_meijerint.py::test_integrate_function_of_square_over_negatives", "sympy/integrals/tests/test_integrals.py::test_issue_8901", "sympy/series/tests/test_fourier.py::test_FourierSeries_2", "sympy/series/tests/test_fourier.py::test_square_wave", "sympy/integrals/tests/test_meijerint.py::test_issue_25949", "sympy/series/tests/test_fourier.py::test_sawtooth_wave", "sympy/integrals/tests/test_integrals.py::test_issue_10567", "sympy/series/tests/test_fourier.py::test_FourierSeries__operations", "sympy/series/tests/test_fourier.py::test_FourierSeries__neg", "sympy/series/tests/test_fourier.py::test_FourierSeries__add__sub", "sympy/series/tests/test_formal.py::test_fps__operations", "sympy/solvers/ode/tests/test_lie_group.py::test_heuristic1", "sympy/vector/tests/test_field_functions.py::test_scalar_potential", "sympy/integrals/tests/test_integrals.py::test_issue_11742", "sympy/integrals/tests/test_integrals.py::test_issue_11856", "sympy/vector/tests/test_field_functions.py::test_scalar_potential_difference", "sympy/physics/vector/tests/test_fieldfunctions.py::test_scalar_potential", "sympy/integrals/tests/test_integrals.py::test_issue_4950", "sympy/physics/vector/tests/test_fieldfunctions.py::test_scalar_potential_difference", "sympy/integrals/tests/test_integrals.py::test_issue_4968", "sympy/integrals/tests/test_heurisch.py::test_issue_22527", "sympy/solvers/tests/test_pde.py::test_pde_1st_linear_constant_coeff", "sympy/integrals/tests/test_heurisch.py::test_heurisch_complex_erf_issue_26338", "sympy/integrals/tests/test_heurisch.py::test_issue_15498", "sympy/integrals/tests/test_integrals.py::test_singularities", "sympy/integrals/tests/test_heurisch.py::test_heurisch_issue_26922", "sympy/integrals/tests/test_integrals.py::test_issue_12645", "sympy/concrete/tests/test_guess.py::test_guess_generating_function", "sympy/solvers/tests/test_pde.py::test_pdsolve_all", "sympy/integrals/tests/test_integrals.py::test_issue_12677", "sympy/solvers/ode/tests/test_lie_group.py::test_heuristic_function_sum", "sympy/integrals/tests/test_integrals.py::test_issue_14078", "sympy/solvers/tests/test_pde.py::test_pdsolve_variable_coeff", "sympy/stats/tests/test_compound_rv.py::test_normal_CompoundDist", "sympy/matrices/tests/test_matrices.py::test_issue_23276", "sympy/integrals/tests/test_integrals.py::test_issue_14064", "sympy/vector/tests/test_printing.py::test_issue_23058", "sympy/stats/tests/test_continuous_rv.py::test_precomputed_cdf", "sympy/integrals/tests/test_integrals.py::test_issue_14027", "sympy/geometry/tests/test_curve.py::test_length", "sympy/integrals/tests/test_integrals.py::test_issue_8170", "sympy/physics/tests/test_qho_1d.py::test_norm", "sympy/physics/tests/test_qho_1d.py::test_orthogonality", "sympy/physics/tests/test_hydrogen.py::test_norm", "sympy/integrals/tests/test_integrals.py::test_issue_8440_14040", "sympy/solvers/ode/tests/test_lie_group.py::test_heuristic_abaco2_similar", "sympy/integrals/tests/test_failing_integrals.py::test_issue_4212_real", "sympy/integrals/tests/test_failing_integrals.py::test_issue_4511", "sympy/integrals/tests/test_failing_integrals.py::test_integrate_DiracDelta_no_meijerg", "sympy/stats/tests/test_continuous_rv.py::test_issue_13324", "sympy/integrals/tests/test_integrals.py::test_issue_14096", "sympy/integrals/tests/test_trigonometry.py::test_trigintegrate_odd", "sympy/integrals/tests/test_failing_integrals.py::test_issue_15925b", "sympy/integrals/tests/test_trigonometry.py::test_trigintegrate_even", "sympy/integrals/tests/test_trigonometry.py::test_trigintegrate_mixed", "sympy/integrals/tests/test_integrals.py::test_issue_14144", "sympy/physics/tests/test_pring.py::test_norm", "sympy/physics/tests/test_pring.py::test_orthogonality", "sympy/integrals/tests/test_integrals.py::test_issue_14375", "sympy/integrals/tests/test_integrals.py::test_issue_14437", "sympy/vector/tests/test_integrals.py::test_parametric_lineintegrals", "sympy/integrals/tests/test_integrals.py::test_issue_14470", "sympy/vector/tests/test_integrals.py::test_parametric_surfaceintegrals", "sympy/integrals/tests/test_integrals.py::test_issue_14877", "sympy/integrals/tests/test_integrals.py::test_issue_14782", "sympy/vector/tests/test_integrals.py::test_parametric_volumeintegrals", "sympy/vector/tests/test_integrals.py::test_vector_integrate", "sympy/integrals/tests/test_integrals.py::test_issue_12081", "sympy/physics/quantum/tests/test_cartesian.py::test_x", "sympy/solvers/ode/tests/test_single.py::test_nth_linear_constant_coeff_var_of_parameters", "sympy/physics/quantum/tests/test_cartesian.py::test_p", "sympy/integrals/tests/test_integrals.py::test_issue_15285", "sympy/integrals/tests/test_integrals.py::test_issue_15432", "sympy/integrals/tests/test_integrals.py::test_issue_15124", "sympy/integrals/tests/test_integrals.py::test_issue_15218", "sympy/solvers/ode/tests/test_systems.py::test_second_order_to_first_order_2", "sympy/matrices/tests/test_matrixbase.py::test_issue_23276", "sympy/geometry/tests/test_polygon.py::test_second_moment_of_area", "sympy/integrals/tests/test_integrals.py::test_issue_15292", "sympy/solvers/ode/tests/test_lie_group.py::test_user_infinitesimals", "sympy/integrals/tests/test_integrals.py::test_issue_4514", "sympy/integrals/tests/test_lineintegrals.py::test_lineintegral", "sympy/integrals/tests/test_manual.py::test_issue_3796", "sympy/integrals/tests/test_integrals.py::test_issue_15457", "sympy/solvers/ode/tests/test_systems.py::test_second_order_to_first_order_slow4", "sympy/integrals/tests/test_integrals.py::test_issue_15431", "sympy/integrals/tests/test_integrals.py::test_issue_15640_log_substitutions", "sympy/integrals/tests/test_manual.py::test_manual_true", "sympy/integrals/tests/test_integrals.py::test_issue_15509", "sympy/integrals/tests/test_singularityfunctions.py::test_singularityintegrate", "sympy/solvers/ode/tests/test_systems.py::test_component_division", "sympy/stats/tests/test_continuous_rv.py::test_ContinuousDistributionHandmade", "sympy/integrals/tests/test_integrals.py::test_issue_4311_fast", "sympy/integrals/tests/test_integrals.py::test_integrate_with_complex_constants", "sympy/integrals/tests/test_integrals.py::test_issue_14241", "sympy/integrals/tests/test_integrals.py::test_issue_13112", "sympy/solvers/ode/tests/test_systems.py::test_linodesolve", "sympy/integrals/tests/test_integrals.py::test_issue_14709b", "sympy/integrals/tests/test_deltafunctions.py::test_deltaintegrate", "sympy/integrals/tests/test_integrals.py::test_issue_8614", "sympy/stats/tests/test_compound_rv.py::test_bernoulli_CompoundDist", "sympy/solvers/ode/tests/test_systems.py::test_neq_order1_type4_slow3", "sympy/integrals/tests/test_integrals.py::test_issue_17473", "sympy/integrals/tests/test_integrals.py::test_issue_17671", "sympy/integrals/tests/test_integrals.py::test_issue_2975", "sympy/integrals/tests/test_integrals.py::test_issue_7827", "sympy/utilities/tests/test_wester.py::test_T12", "sympy/integrals/tests/test_integrals.py::test_issue_4231", "sympy/integrals/tests/test_integrals.py::test_issue_17841", "sympy/stats/tests/test_compound_rv.py::test_Compound_Distribution", "sympy/integrals/tests/test_integrals.py::test_issue_21034", "sympy/utilities/tests/test_wester.py::test_U6", "sympy/integrals/tests/test_integrals.py::test_issue_4187", "sympy/solvers/ode/tests/test_systems.py::test_second_order_type2_slow1", "sympy/integrals/tests/test_integrals.py::test_issue_5547", "sympy/solvers/ode/tests/test_ode.py::test_issue_13060", "sympy/integrals/tests/test_integrals.py::test_issue_15810", "sympy/sandbox/tests/test_indexed_integrals.py::test_indexed_integrals", "sympy/utilities/tests/test_wester.py::test_V1", "sympy/integrals/tests/test_integrals.py::test_issue_21024", "sympy/utilities/tests/test_wester.py::test_V2", "sympy/integrals/tests/test_integrals.py::test_issue_21721", "sympy/integrals/tests/test_integrals.py::test_issue_21831", "sympy/utilities/tests/test_wester.py::test_V3", "sympy/solvers/ode/tests/test_single.py::test_Bernoulli", "sympy/integrals/tests/test_integrals.py::test_issue_18527", "sympy/solvers/ode/tests/test_systems.py::test_linear_2eq_order1", "sympy/utilities/tests/test_wester.py::test_V4", "sympy/integrals/tests/test_integrals.py::test_issue_23718", "sympy/utilities/tests/test_wester.py::test_V7", "sympy/integrals/tests/test_integrals.py::test_issue_23566", "sympy/utilities/tests/test_wester.py::test_V10", "sympy/integrals/tests/test_integrals.py::test_pr_23583", "sympy/utilities/tests/test_wester.py::test_V11", "sympy/integrals/tests/test_integrals.py::test_issue_7264", "sympy/utilities/tests/test_wester.py::test_V12", "sympy/integrals/tests/test_integrals.py::test_issue_11254a", "sympy/utilities/tests/test_wester.py::test_V15", "sympy/utilities/tests/test_wester.py::test_W7", "sympy/integrals/tests/test_integrals.py::test_issue_11254b", "sympy/utilities/tests/test_wester.py::test_W12", "sympy/integrals/tests/test_integrals.py::test_issue_11254d", "sympy/utilities/tests/test_wester.py::test_W14", "sympy/integrals/tests/test_integrals.py::test_issue_22863", "sympy/integrals/tests/test_integrals.py::test_issue_9723", "sympy/solvers/ode/tests/test_systems.py::test_nonlinear_2eq_order1", "sympy/utilities/tests/test_wester.py::test_W16", "sympy/utilities/tests/test_wester.py::test_W17", "sympy/solvers/ode/tests/test_single.py::test_1st_linear", "sympy/integrals/tests/test_integrals.py::test_issue_23704", "sympy/utilities/tests/test_wester.py::test_W18", "sympy/integrals/tests/test_integrals.py::test_exp_substitution", "sympy/utilities/tests/test_wester.py::test_W21", "sympy/integrals/tests/test_integrals.py::test_hyperbolic", "sympy/utilities/tests/test_wester.py::test_W22", "sympy/integrals/tests/test_integrals.py::test_nested_pow", "sympy/utilities/tests/test_wester.py::test_W23b", "sympy/integrals/tests/test_integrals.py::test_sqrt_quadratic", "sympy/utilities/tests/test_wester.py::test_W26", "sympy/integrals/tests/test_integrals.py::test_mul_pow_derivative", "sympy/utilities/tests/test_wester.py::test_W27", "sympy/stats/tests/test_stochastic_process.py::test_GammaProcess_numeric", "sympy/integrals/tests/test_integrals.py::test_issue_20782", "sympy/integrals/tests/test_integrals.py::test_issue_20781", "sympy/integrals/tests/test_integrals.py::test_issue_23942", "sympy/solvers/ode/tests/test_single.py::test_almost_linear", "sympy/integrals/tests/test_integrals.py::test_issue_25886", "sympy/integrals/tests/test_integrals.py::test_old_issues", "sympy/integrals/tests/test_integrals.py::test_integral_issue_26566", "sympy/utilities/tests/test_wester.py::test_X21", "sympy/utilities/tests/test_wester.py::test_Y4", "sympy/utilities/tests/test_wester.py::test_Y9", "sympy/utilities/tests/test_wester.py::test_Y10", "sympy/series/tests/test_limits.py::test_issue_21721", "sympy/series/tests/test_limits.py::test_issue_23596" ], "PASS_TO_PASS": null }
sympy__sympy-65
1.0
{ "code": "diff --git b/sympy/integrals/intpoly.py a/sympy/integrals/intpoly.py\nindex ba14b0139a..38fd071183 100644\n--- b/sympy/integrals/intpoly.py\n+++ a/sympy/integrals/intpoly.py\n@@ -624,6 +624,43 @@ def integration_reduction_dynamic(facets, index, a, b, expr, degree, dims,\n x0, monomial_values, 3)\n 25/2\n \"\"\"\n+ value = S.Zero\n+ m = len(facets)\n+\n+ if expr == S.Zero:\n+ return expr\n+\n+ if len(dims) == 2:\n+ if not expr.is_number:\n+ _, x_degree, y_degree, _ = monomial_values[monom_index]\n+ x_index = monom_index - max_index + \\\n+ x_index - 2 if x_degree > 0 else 0\n+ y_index = monom_index - 1 if y_degree > 0 else 0\n+ x_value, y_value =\\\n+ monomial_values[x_index][3], monomial_values[y_index][3]\n+\n+ value += x_degree * x_value * x0[0] + y_degree * y_value * x0[1]\n+\n+ value += left_integral2D(m, index, facets, x0, expr, dims)\n+ else:\n+ # For 3D use case the max_index contains the z_degree of the term\n+ z_index = max_index\n+ if not expr.is_number:\n+ x_degree, y_degree, z_degree = y_index,\\\n+ z_index - x_index - y_index, x_index\n+ x_value = monomial_values[z_index - 1][y_index - 1][x_index][7]\\\n+ if x_degree > 0 else 0\n+ y_value = monomial_values[z_index - 1][y_index][x_index][7]\\\n+ if y_degree > 0 else 0\n+ z_value = monomial_values[z_index - 1][y_index][x_index - 1][7]\\\n+ if z_degree > 0 else 0\n+\n+ value += x_degree * x_value * x0[0] + y_degree * y_value * x0[1] \\\n+ + z_degree * z_value * x0[2]\n+\n+ value += left_integral3D(facets, index, expr,\n+ vertices, hp_param, degree)\n+ return value / (len(dims) + degree - 1)\n \n \n def left_integral3D(facets, index, expr, vertices, hp_param, degree):\n", "test": null }
null
{ "code": "diff --git a/sympy/integrals/intpoly.py b/sympy/integrals/intpoly.py\nindex 38fd071183..ba14b0139a 100644\n--- a/sympy/integrals/intpoly.py\n+++ b/sympy/integrals/intpoly.py\n@@ -624,43 +624,6 @@ def integration_reduction_dynamic(facets, index, a, b, expr, degree, dims,\n x0, monomial_values, 3)\n 25/2\n \"\"\"\n- value = S.Zero\n- m = len(facets)\n-\n- if expr == S.Zero:\n- return expr\n-\n- if len(dims) == 2:\n- if not expr.is_number:\n- _, x_degree, y_degree, _ = monomial_values[monom_index]\n- x_index = monom_index - max_index + \\\n- x_index - 2 if x_degree > 0 else 0\n- y_index = monom_index - 1 if y_degree > 0 else 0\n- x_value, y_value =\\\n- monomial_values[x_index][3], monomial_values[y_index][3]\n-\n- value += x_degree * x_value * x0[0] + y_degree * y_value * x0[1]\n-\n- value += left_integral2D(m, index, facets, x0, expr, dims)\n- else:\n- # For 3D use case the max_index contains the z_degree of the term\n- z_index = max_index\n- if not expr.is_number:\n- x_degree, y_degree, z_degree = y_index,\\\n- z_index - x_index - y_index, x_index\n- x_value = monomial_values[z_index - 1][y_index - 1][x_index][7]\\\n- if x_degree > 0 else 0\n- y_value = monomial_values[z_index - 1][y_index][x_index][7]\\\n- if y_degree > 0 else 0\n- z_value = monomial_values[z_index - 1][y_index][x_index - 1][7]\\\n- if z_degree > 0 else 0\n-\n- value += x_degree * x_value * x0[0] + y_degree * y_value * x0[1] \\\n- + z_degree * z_value * x0[2]\n-\n- value += left_integral3D(facets, index, expr,\n- vertices, hp_param, degree)\n- return value / (len(dims) + degree - 1)\n \n \n def left_integral3D(facets, index, expr, vertices, hp_param, degree):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/integrals/intpoly.py.\nHere is the description for the function:\ndef integration_reduction_dynamic(facets, index, a, b, expr, degree, dims,\n x_index, y_index, max_index, x0,\n monomial_values, monom_index, vertices=None,\n hp_param=None):\n \"\"\"The same integration_reduction function which uses a dynamic\n programming approach to compute terms by using the values of the integral\n of previously computed terms.\n\n Parameters\n ==========\n\n facets :\n Facets of the Polytope.\n index :\n Index of facet to find intersections with.(Used in left_integral()).\n a, b :\n Hyperplane parameters.\n expr :\n Input monomial.\n degree :\n Total degree of ``expr``.\n dims :\n Tuple denoting axes variables.\n x_index :\n Exponent of 'x' in ``expr``.\n y_index :\n Exponent of 'y' in ``expr``.\n max_index :\n Maximum exponent of any monomial in ``monomial_values``.\n x0 :\n First point on ``facets[index]``.\n monomial_values :\n List of monomial values constituting the polynomial.\n monom_index :\n Index of monomial whose integration is being found.\n vertices : optional\n Coordinates of vertices constituting the 3-Polytope.\n hp_param : optional\n Hyperplane Parameter of the face of the facets[index].\n\n Examples\n ========\n\n >>> from sympy.abc import x, y\n >>> from sympy.integrals.intpoly import (integration_reduction_dynamic, \\\n hyperplane_parameters)\n >>> from sympy import Point, Polygon\n >>> triangle = Polygon(Point(0, 3), Point(5, 3), Point(1, 1))\n >>> facets = triangle.sides\n >>> a, b = hyperplane_parameters(triangle)[0]\n >>> x0 = facets[0].points[0]\n >>> monomial_values = [[0, 0, 0, 0], [1, 0, 0, 5],\\\n [y, 0, 1, 15], [x, 1, 0, None]]\n >>> integration_reduction_dynamic(facets, 0, a, b, x, 1, (x, y), 1, 0, 1,\\\n x0, monomial_values, 3)\n 25/2\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/integrals/tests/test_intpoly.py::test_max_degree", "sympy/integrals/tests/test_intpoly.py::test_main_integrate3d", "sympy/integrals/tests/test_intpoly.py::test_main_integrate", "sympy/integrals/tests/test_intpoly.py::test_integration_reduction_dynamic" ], "PASS_TO_PASS": null }
sympy__sympy-66
1.0
{ "code": "diff --git b/sympy/geometry/util.py a/sympy/geometry/util.py\nindex ae7adc4d1e..1d8fb77550 100644\n--- b/sympy/geometry/util.py\n+++ a/sympy/geometry/util.py\n@@ -692,3 +692,40 @@ def intersection(*entities, pairwise=False, **kwargs):\n [Segment2D(Point2D(0, 0), Point2D(1, 0))]\n \n \"\"\"\n+ if len(entities) <= 1:\n+ return []\n+\n+ entities = list(entities)\n+ prec = None\n+ for i, e in enumerate(entities):\n+ if not isinstance(e, GeometryEntity):\n+ # entities may be an immutable tuple\n+ e = Point(e)\n+ # convert to exact Rationals\n+ d = {}\n+ for f in e.atoms(Float):\n+ prec = f._prec if prec is None else min(f._prec, prec)\n+ d.setdefault(f, nsimplify(f, rational=True))\n+ entities[i] = e.xreplace(d)\n+\n+ if not pairwise:\n+ # find the intersection common to all objects\n+ res = entities[0].intersection(entities[1])\n+ for entity in entities[2:]:\n+ newres = []\n+ for x in res:\n+ newres.extend(x.intersection(entity))\n+ res = newres\n+ else:\n+ # find all pairwise intersections\n+ ans = []\n+ for j in range(len(entities)):\n+ for k in range(j + 1, len(entities)):\n+ ans.extend(intersection(entities[j], entities[k]))\n+ res = list(ordered(set(ans)))\n+\n+ # convert back to Floats\n+ if prec is not None:\n+ p = prec_to_dps(prec)\n+ res = [i.n(p) for i in res]\n+ return res\n", "test": null }
null
{ "code": "diff --git a/sympy/geometry/util.py b/sympy/geometry/util.py\nindex 1d8fb77550..ae7adc4d1e 100644\n--- a/sympy/geometry/util.py\n+++ b/sympy/geometry/util.py\n@@ -692,40 +692,3 @@ def intersection(*entities, pairwise=False, **kwargs):\n [Segment2D(Point2D(0, 0), Point2D(1, 0))]\n \n \"\"\"\n- if len(entities) <= 1:\n- return []\n-\n- entities = list(entities)\n- prec = None\n- for i, e in enumerate(entities):\n- if not isinstance(e, GeometryEntity):\n- # entities may be an immutable tuple\n- e = Point(e)\n- # convert to exact Rationals\n- d = {}\n- for f in e.atoms(Float):\n- prec = f._prec if prec is None else min(f._prec, prec)\n- d.setdefault(f, nsimplify(f, rational=True))\n- entities[i] = e.xreplace(d)\n-\n- if not pairwise:\n- # find the intersection common to all objects\n- res = entities[0].intersection(entities[1])\n- for entity in entities[2:]:\n- newres = []\n- for x in res:\n- newres.extend(x.intersection(entity))\n- res = newres\n- else:\n- # find all pairwise intersections\n- ans = []\n- for j in range(len(entities)):\n- for k in range(j + 1, len(entities)):\n- ans.extend(intersection(entities[j], entities[k]))\n- res = list(ordered(set(ans)))\n-\n- # convert back to Floats\n- if prec is not None:\n- p = prec_to_dps(prec)\n- res = [i.n(p) for i in res]\n- return res\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/geometry/util.py.\nHere is the description for the function:\ndef intersection(*entities, pairwise=False, **kwargs):\n \"\"\"The intersection of a collection of GeometryEntity instances.\n\n Parameters\n ==========\n entities : sequence of GeometryEntity\n pairwise (keyword argument) : Can be either True or False\n\n Returns\n =======\n intersection : list of GeometryEntity\n\n Raises\n ======\n NotImplementedError\n When unable to calculate intersection.\n\n Notes\n =====\n The intersection of any geometrical entity with itself should return\n a list with one item: the entity in question.\n An intersection requires two or more entities. If only a single\n entity is given then the function will return an empty list.\n It is possible for `intersection` to miss intersections that one\n knows exists because the required quantities were not fully\n simplified internally.\n Reals should be converted to Rationals, e.g. Rational(str(real_num))\n or else failures due to floating point issues may result.\n\n Case 1: When the keyword argument 'pairwise' is False (default value):\n In this case, the function returns a list of intersections common to\n all entities.\n\n Case 2: When the keyword argument 'pairwise' is True:\n In this case, the functions returns a list intersections that occur\n between any pair of entities.\n\n See Also\n ========\n\n sympy.geometry.entity.GeometryEntity.intersection\n\n Examples\n ========\n\n >>> from sympy import Ray, Circle, intersection\n >>> c = Circle((0, 1), 1)\n >>> intersection(c, c.center)\n []\n >>> right = Ray((0, 0), (1, 0))\n >>> up = Ray((0, 0), (0, 1))\n >>> intersection(c, right, up)\n [Point2D(0, 0)]\n >>> intersection(c, right, up, pairwise=True)\n [Point2D(0, 0), Point2D(0, 2)]\n >>> left = Ray((1, 0), (0, 0))\n >>> intersection(right, left)\n [Segment2D(Point2D(0, 0), Point2D(1, 0))]\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/geometry/tests/test_line.py::test_intersection_2d", "sympy/geometry/tests/test_line.py::test_intersection_3d", "sympy/geometry/tests/test_line.py::test_bisectors", "sympy/physics/optics/tests/test_utils.py::test_refraction_angle", "sympy/geometry/tests/test_util.py::test_intersection", "sympy/polys/numberfields/tests/test_minpoly.py::test_issue_13230" ], "PASS_TO_PASS": null }
sympy__sympy-67
1.0
{ "code": "diff --git b/sympy/printing/jscode.py a/sympy/printing/jscode.py\nindex f8ae249805..753eb3291d 100644\n--- b/sympy/printing/jscode.py\n+++ a/sympy/printing/jscode.py\n@@ -321,6 +321,8 @@ def jscode(expr, assign_to=None, **settings):\n A[2] = Math.sin(x);\n \"\"\"\n \n+ return JavascriptCodePrinter(settings).doprint(expr, assign_to)\n+\n \n def print_jscode(expr, **settings):\n \"\"\"Prints the Javascript representation of the given expression.\n", "test": null }
null
{ "code": "diff --git a/sympy/printing/jscode.py b/sympy/printing/jscode.py\nindex 753eb3291d..f8ae249805 100644\n--- a/sympy/printing/jscode.py\n+++ b/sympy/printing/jscode.py\n@@ -321,8 +321,6 @@ def jscode(expr, assign_to=None, **settings):\n A[2] = Math.sin(x);\n \"\"\"\n \n- return JavascriptCodePrinter(settings).doprint(expr, assign_to)\n-\n \n def print_jscode(expr, **settings):\n \"\"\"Prints the Javascript representation of the given expression.\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/printing/jscode.py.\nHere is the description for the function:\ndef jscode(expr, assign_to=None, **settings):\n \"\"\"Converts an expr to a string of javascript code\n\n Parameters\n ==========\n\n expr : Expr\n A SymPy expression to be converted.\n assign_to : optional\n When given, the argument is used as the name of the variable to which\n the expression is assigned. Can be a string, ``Symbol``,\n ``MatrixSymbol``, or ``Indexed`` type. This is helpful in case of\n line-wrapping, or for expressions that generate multi-line statements.\n precision : integer, optional\n The precision for numbers such as pi [default=15].\n user_functions : dict, optional\n A dictionary where keys are ``FunctionClass`` instances and values are\n their string representations. Alternatively, the dictionary value can\n be a list of tuples i.e. [(argument_test, js_function_string)]. See\n below for examples.\n human : bool, optional\n If True, the result is a single string that may contain some constant\n declarations for the number symbols. If False, the same information is\n returned in a tuple of (symbols_to_declare, not_supported_functions,\n code_text). [default=True].\n contract: bool, optional\n If True, ``Indexed`` instances are assumed to obey tensor contraction\n rules and the corresponding nested loops over indices are generated.\n Setting contract=False will not generate loops, instead the user is\n responsible to provide values for the indices in the code.\n [default=True].\n\n Examples\n ========\n\n >>> from sympy import jscode, symbols, Rational, sin, ceiling, Abs\n >>> x, tau = symbols(\"x, tau\")\n >>> jscode((2*tau)**Rational(7, 2))\n '8*Math.sqrt(2)*Math.pow(tau, 7/2)'\n >>> jscode(sin(x), assign_to=\"s\")\n 's = Math.sin(x);'\n\n Custom printing can be defined for certain types by passing a dictionary of\n \"type\" : \"function\" to the ``user_functions`` kwarg. Alternatively, the\n dictionary value can be a list of tuples i.e. [(argument_test,\n js_function_string)].\n\n >>> custom_functions = {\n ... \"ceiling\": \"CEIL\",\n ... \"Abs\": [(lambda x: not x.is_integer, \"fabs\"),\n ... (lambda x: x.is_integer, \"ABS\")]\n ... }\n >>> jscode(Abs(x) + ceiling(x), user_functions=custom_functions)\n 'fabs(x) + CEIL(x)'\n\n ``Piecewise`` expressions are converted into conditionals. If an\n ``assign_to`` variable is provided an if statement is created, otherwise\n the ternary operator is used. Note that if the ``Piecewise`` lacks a\n default term, represented by ``(expr, True)`` then an error will be thrown.\n This is to prevent generating an expression that may not evaluate to\n anything.\n\n >>> from sympy import Piecewise\n >>> expr = Piecewise((x + 1, x > 0), (x, True))\n >>> print(jscode(expr, tau))\n if (x > 0) {\n tau = x + 1;\n }\n else {\n tau = x;\n }\n\n Support for loops is provided through ``Indexed`` types. With\n ``contract=True`` these expressions will be turned into loops, whereas\n ``contract=False`` will just print the assignment expression that should be\n looped over:\n\n >>> from sympy import Eq, IndexedBase, Idx\n >>> len_y = 5\n >>> y = IndexedBase('y', shape=(len_y,))\n >>> t = IndexedBase('t', shape=(len_y,))\n >>> Dy = IndexedBase('Dy', shape=(len_y-1,))\n >>> i = Idx('i', len_y-1)\n >>> e=Eq(Dy[i], (y[i+1]-y[i])/(t[i+1]-t[i]))\n >>> jscode(e.rhs, assign_to=e.lhs, contract=False)\n 'Dy[i] = (y[i + 1] - y[i])/(t[i + 1] - t[i]);'\n\n Matrices are also supported, but a ``MatrixSymbol`` of the same dimensions\n must be provided to ``assign_to``. Note that any expression that can be\n generated normally can also exist inside a Matrix:\n\n >>> from sympy import Matrix, MatrixSymbol\n >>> mat = Matrix([x**2, Piecewise((x + 1, x > 0), (x, True)), sin(x)])\n >>> A = MatrixSymbol('A', 3, 1)\n >>> print(jscode(mat, A))\n A[0] = Math.pow(x, 2);\n if (x > 0) {\n A[1] = x + 1;\n }\n else {\n A[1] = x;\n }\n A[2] = Math.sin(x);\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/printing/tests/test_jscode.py::test_printmethod", "sympy/printing/tests/test_jscode.py::test_jscode_sqrt", "sympy/printing/tests/test_jscode.py::test_jscode_Pow", "sympy/printing/tests/test_jscode.py::test_jscode_constants_mathh", "sympy/printing/tests/test_jscode.py::test_jscode_constants_other", "sympy/printing/tests/test_jscode.py::test_jscode_Rational", "sympy/printing/tests/test_jscode.py::test_Relational", "sympy/printing/tests/test_jscode.py::test_Mod", "sympy/printing/tests/test_jscode.py::test_jscode_Integer", "sympy/printing/tests/test_jscode.py::test_jscode_functions", "sympy/printing/tests/test_jscode.py::test_jscode_inline_function", "sympy/printing/tests/test_jscode.py::test_jscode_exceptions", "sympy/printing/tests/test_jscode.py::test_jscode_boolean", "sympy/printing/tests/test_jscode.py::test_jscode_Piecewise", "sympy/printing/tests/test_jscode.py::test_jscode_Piecewise_deep", "sympy/printing/tests/test_jscode.py::test_jscode_settings", "sympy/printing/tests/test_jscode.py::test_jscode_loops_matrix_vector", "sympy/printing/tests/test_jscode.py::test_dummy_loops", "sympy/printing/tests/test_jscode.py::test_jscode_loops_add", "sympy/printing/tests/test_jscode.py::test_jscode_loops_multiple_contractions", "sympy/printing/tests/test_jscode.py::test_jscode_loops_addfactor", "sympy/printing/tests/test_jscode.py::test_jscode_loops_multiple_terms", "sympy/printing/tests/test_jscode.py::test_Matrix_printing", "sympy/printing/tests/test_jscode.py::test_MatrixElement_printing" ], "PASS_TO_PASS": null }
sympy__sympy-68
1.0
{ "code": "diff --git b/sympy/utilities/iterables.py a/sympy/utilities/iterables.py\nindex cdcb8e7b7c..cc5c1152f0 100644\n--- b/sympy/utilities/iterables.py\n+++ a/sympy/utilities/iterables.py\n@@ -2904,6 +2904,35 @@ def kbins(l, k, ordered=None):\n partitions, multiset_partitions\n \n \"\"\"\n+ if ordered is None:\n+ yield from sequence_partitions(l, k)\n+ elif ordered == 11:\n+ for pl in multiset_permutations(l):\n+ pl = list(pl)\n+ yield from sequence_partitions(pl, k)\n+ elif ordered == 00:\n+ yield from multiset_partitions(l, k)\n+ elif ordered == 10:\n+ for p in multiset_partitions(l, k):\n+ for perm in permutations(p):\n+ yield list(perm)\n+ elif ordered == 1:\n+ for kgot, p in partitions(len(l), k, size=True):\n+ if kgot != k:\n+ continue\n+ for li in multiset_permutations(l):\n+ rv = []\n+ i = j = 0\n+ li = list(li)\n+ for size, multiplicity in sorted(p.items()):\n+ for m in range(multiplicity):\n+ j = i + size\n+ rv.append(li[i: j])\n+ i = j\n+ yield rv\n+ else:\n+ raise ValueError(\n+ 'ordered must be one of 00, 01, 10 or 11, not %s' % ordered)\n \n \n def permute_signs(t):\n", "test": null }
null
{ "code": "diff --git a/sympy/utilities/iterables.py b/sympy/utilities/iterables.py\nindex cc5c1152f0..cdcb8e7b7c 100644\n--- a/sympy/utilities/iterables.py\n+++ b/sympy/utilities/iterables.py\n@@ -2904,35 +2904,6 @@ def kbins(l, k, ordered=None):\n partitions, multiset_partitions\n \n \"\"\"\n- if ordered is None:\n- yield from sequence_partitions(l, k)\n- elif ordered == 11:\n- for pl in multiset_permutations(l):\n- pl = list(pl)\n- yield from sequence_partitions(pl, k)\n- elif ordered == 00:\n- yield from multiset_partitions(l, k)\n- elif ordered == 10:\n- for p in multiset_partitions(l, k):\n- for perm in permutations(p):\n- yield list(perm)\n- elif ordered == 1:\n- for kgot, p in partitions(len(l), k, size=True):\n- if kgot != k:\n- continue\n- for li in multiset_permutations(l):\n- rv = []\n- i = j = 0\n- li = list(li)\n- for size, multiplicity in sorted(p.items()):\n- for m in range(multiplicity):\n- j = i + size\n- rv.append(li[i: j])\n- i = j\n- yield rv\n- else:\n- raise ValueError(\n- 'ordered must be one of 00, 01, 10 or 11, not %s' % ordered)\n \n \n def permute_signs(t):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/utilities/iterables.py.\nHere is the description for the function:\ndef kbins(l, k, ordered=None):\n \"\"\"\n Return sequence ``l`` partitioned into ``k`` bins.\n\n Examples\n ========\n\n The default is to give the items in the same order, but grouped\n into k partitions without any reordering:\n\n >>> from sympy.utilities.iterables import kbins\n >>> for p in kbins(list(range(5)), 2):\n ... print(p)\n ...\n [[0], [1, 2, 3, 4]]\n [[0, 1], [2, 3, 4]]\n [[0, 1, 2], [3, 4]]\n [[0, 1, 2, 3], [4]]\n\n The ``ordered`` flag is either None (to give the simple partition\n of the elements) or is a 2 digit integer indicating whether the order of\n the bins and the order of the items in the bins matters. Given::\n\n A = [[0], [1, 2]]\n B = [[1, 2], [0]]\n C = [[2, 1], [0]]\n D = [[0], [2, 1]]\n\n the following values for ``ordered`` have the shown meanings::\n\n 00 means A == B == C == D\n 01 means A == B\n 10 means A == D\n 11 means A == A\n\n >>> for ordered_flag in [None, 0, 1, 10, 11]:\n ... print('ordered = %s' % ordered_flag)\n ... for p in kbins(list(range(3)), 2, ordered=ordered_flag):\n ... print(' %s' % p)\n ...\n ordered = None\n [[0], [1, 2]]\n [[0, 1], [2]]\n ordered = 0\n [[0, 1], [2]]\n [[0, 2], [1]]\n [[0], [1, 2]]\n ordered = 1\n [[0], [1, 2]]\n [[0], [2, 1]]\n [[1], [0, 2]]\n [[1], [2, 0]]\n [[2], [0, 1]]\n [[2], [1, 0]]\n ordered = 10\n [[0, 1], [2]]\n [[2], [0, 1]]\n [[0, 2], [1]]\n [[1], [0, 2]]\n [[0], [1, 2]]\n [[1, 2], [0]]\n ordered = 11\n [[0], [1, 2]]\n [[0, 1], [2]]\n [[0], [2, 1]]\n [[0, 2], [1]]\n [[1], [0, 2]]\n [[1, 0], [2]]\n [[1], [2, 0]]\n [[1, 2], [0]]\n [[2], [0, 1]]\n [[2, 0], [1]]\n [[2], [1, 0]]\n [[2, 1], [0]]\n\n See Also\n ========\n\n partitions, multiset_partitions\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/utilities/tests/test_iterables.py::test_kbins", "sympy/unify/tests/test_sympy.py::test_unify_commutative", "sympy/unify/tests/test_sympy.py::test_unify_iter", "sympy/unify/tests/test_sympy.py::test_hard_match", "sympy/unify/tests/test_sympy.py::test_FiniteSet_commutivity", "sympy/unify/tests/test_sympy.py::test_FiniteSet_complex", "sympy/unify/tests/test_sympy.py::test_and", "sympy/unify/tests/test_sympy.py::test_Union", "sympy/unify/tests/test_sympy.py::test_commutative_in_commutative", "sympy/unify/tests/test_unify.py::test_ops", "sympy/unify/tests/test_rewrite.py::test_moderate", "sympy/unify/tests/test_unify.py::test_associative", "sympy/unify/tests/test_rewrite.py::test_sincos", "sympy/unify/tests/test_rewrite.py::test_Exprs_ok", "sympy/unify/tests/test_rewrite.py::test_condition_multiple", "sympy/unify/tests/test_unify.py::test_commutative", "sympy/unify/tests/test_unify.py::test_allcombinations", "sympy/unify/tests/test_unify.py::test_commutativity", "sympy/unify/tests/test_rewrite.py::test_assumptions", "sympy/unify/tests/test_unify.py::test_CondVariable" ], "PASS_TO_PASS": null }
sympy__sympy-69
1.0
{ "code": "diff --git b/sympy/matrices/expressions/kronecker.py a/sympy/matrices/expressions/kronecker.py\nindex 344594c5d7..1dd175cb0d 100644\n--- b/sympy/matrices/expressions/kronecker.py\n+++ a/sympy/matrices/expressions/kronecker.py\n@@ -75,6 +75,12 @@ def kronecker_product(*matrices):\n KroneckerProduct\n \n \"\"\"\n+ if not matrices:\n+ raise TypeError(\"Empty Kronecker product is undefined\")\n+ if len(matrices) == 1:\n+ return matrices[0]\n+ else:\n+ return KroneckerProduct(*matrices).doit()\n \n \n class KroneckerProduct(MatrixExpr):\n", "test": null }
null
{ "code": "diff --git a/sympy/matrices/expressions/kronecker.py b/sympy/matrices/expressions/kronecker.py\nindex 1dd175cb0d..344594c5d7 100644\n--- a/sympy/matrices/expressions/kronecker.py\n+++ b/sympy/matrices/expressions/kronecker.py\n@@ -75,12 +75,6 @@ def kronecker_product(*matrices):\n KroneckerProduct\n \n \"\"\"\n- if not matrices:\n- raise TypeError(\"Empty Kronecker product is undefined\")\n- if len(matrices) == 1:\n- return matrices[0]\n- else:\n- return KroneckerProduct(*matrices).doit()\n \n \n class KroneckerProduct(MatrixExpr):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/matrices/expressions/kronecker.py.\nHere is the description for the function:\ndef kronecker_product(*matrices):\n \"\"\"\n The Kronecker product of two or more arguments.\n\n This computes the explicit Kronecker product for subclasses of\n ``MatrixBase`` i.e. explicit matrices. Otherwise, a symbolic\n ``KroneckerProduct`` object is returned.\n\n\n Examples\n ========\n\n For ``MatrixSymbol`` arguments a ``KroneckerProduct`` object is returned.\n Elements of this matrix can be obtained by indexing, or for MatrixSymbols\n with known dimension the explicit matrix can be obtained with\n ``.as_explicit()``\n\n >>> from sympy import kronecker_product, MatrixSymbol\n >>> A = MatrixSymbol('A', 2, 2)\n >>> B = MatrixSymbol('B', 2, 2)\n >>> kronecker_product(A)\n A\n >>> kronecker_product(A, B)\n KroneckerProduct(A, B)\n >>> kronecker_product(A, B)[0, 1]\n A[0, 0]*B[0, 1]\n >>> kronecker_product(A, B).as_explicit()\n Matrix([\n [A[0, 0]*B[0, 0], A[0, 0]*B[0, 1], A[0, 1]*B[0, 0], A[0, 1]*B[0, 1]],\n [A[0, 0]*B[1, 0], A[0, 0]*B[1, 1], A[0, 1]*B[1, 0], A[0, 1]*B[1, 1]],\n [A[1, 0]*B[0, 0], A[1, 0]*B[0, 1], A[1, 1]*B[0, 0], A[1, 1]*B[0, 1]],\n [A[1, 0]*B[1, 0], A[1, 0]*B[1, 1], A[1, 1]*B[1, 0], A[1, 1]*B[1, 1]]])\n\n For explicit matrices the Kronecker product is returned as a Matrix\n\n >>> from sympy import Matrix, kronecker_product\n >>> sigma_x = Matrix([\n ... [0, 1],\n ... [1, 0]])\n ...\n >>> Isigma_y = Matrix([\n ... [0, 1],\n ... [-1, 0]])\n ...\n >>> kronecker_product(sigma_x, Isigma_y)\n Matrix([\n [ 0, 0, 0, 1],\n [ 0, 0, -1, 0],\n [ 0, 1, 0, 0],\n [-1, 0, 0, 0]])\n\n See Also\n ========\n KroneckerProduct\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/matrices/expressions/tests/test_kronecker.py::test_tensor_product_adjoint", "sympy/matrices/expressions/tests/test_kronecker.py::test_tensor_product_conjugate", "sympy/matrices/expressions/tests/test_kronecker.py::test_tensor_product_transpose", "sympy/matrices/expressions/tests/test_kronecker.py::test_KroneckerProduct_is_associative", "sympy/matrices/expressions/tests/test_kronecker.py::test_KroneckerProduct_is_bilinear", "sympy/matrices/expressions/tests/test_kronecker.py::test_KroneckerProduct_determinant", "sympy/matrices/expressions/tests/test_kronecker.py::test_KroneckerProduct_trace", "sympy/matrices/expressions/tests/test_kronecker.py::test_KroneckerProduct_extracts_commutative_part", "sympy/matrices/expressions/tests/test_kronecker.py::test_KroneckerProduct_inverse", "sympy/matrices/expressions/tests/test_kronecker.py::test_KroneckerProduct_combine_add", "sympy/matrices/expressions/tests/test_kronecker.py::test_KroneckerProduct_combine_mul" ], "PASS_TO_PASS": null }
sympy__sympy-70
1.0
{ "code": "diff --git b/sympy/utilities/lambdify.py a/sympy/utilities/lambdify.py\nindex 48830b4c0d..a84d1a1c26 100644\n--- b/sympy/utilities/lambdify.py\n+++ a/sympy/utilities/lambdify.py\n@@ -759,6 +759,178 @@ def _lambdifygenerated(x):\n argument is not provided, ``lambdify`` creates functions using the NumPy\n and SciPy namespaces.\n \"\"\"\n+ from sympy.core.symbol import Symbol\n+ from sympy.core.expr import Expr\n+\n+ # If the user hasn't specified any modules, use what is available.\n+ if modules is None:\n+ try:\n+ _import(\"scipy\")\n+ except ImportError:\n+ try:\n+ _import(\"numpy\")\n+ except ImportError:\n+ # Use either numpy (if available) or python.math where possible.\n+ # XXX: This leads to different behaviour on different systems and\n+ # might be the reason for irreproducible errors.\n+ modules = [\"math\", \"mpmath\", \"sympy\"]\n+ else:\n+ modules = [\"numpy\"]\n+ else:\n+ modules = [\"numpy\", \"scipy\"]\n+\n+ # Get the needed namespaces.\n+ namespaces = []\n+ # First find any function implementations\n+ if use_imps:\n+ namespaces.append(_imp_namespace(expr))\n+ # Check for dict before iterating\n+ if isinstance(modules, (dict, str)) or not hasattr(modules, '__iter__'):\n+ namespaces.append(modules)\n+ else:\n+ # consistency check\n+ if _module_present('numexpr', modules) and len(modules) > 1:\n+ raise TypeError(\"numexpr must be the only item in 'modules'\")\n+ namespaces += list(modules)\n+ # fill namespace with first having highest priority\n+ namespace = {}\n+ for m in namespaces[::-1]:\n+ buf = _get_namespace(m)\n+ namespace.update(buf)\n+\n+ if hasattr(expr, \"atoms\"):\n+ #Try if you can extract symbols from the expression.\n+ #Move on if expr.atoms in not implemented.\n+ syms = expr.atoms(Symbol)\n+ for term in syms:\n+ namespace.update({str(term): term})\n+\n+ if printer is None:\n+ if _module_present('mpmath', namespaces):\n+ from sympy.printing.pycode import MpmathPrinter as Printer # type: ignore\n+ elif _module_present('scipy', namespaces):\n+ from sympy.printing.numpy import SciPyPrinter as Printer # type: ignore\n+ elif _module_present('numpy', namespaces):\n+ from sympy.printing.numpy import NumPyPrinter as Printer # type: ignore\n+ elif _module_present('cupy', namespaces):\n+ from sympy.printing.numpy import CuPyPrinter as Printer # type: ignore\n+ elif _module_present('jax', namespaces):\n+ from sympy.printing.numpy import JaxPrinter as Printer # type: ignore\n+ elif _module_present('numexpr', namespaces):\n+ from sympy.printing.lambdarepr import NumExprPrinter as Printer # type: ignore\n+ elif _module_present('tensorflow', namespaces):\n+ from sympy.printing.tensorflow import TensorflowPrinter as Printer # type: ignore\n+ elif _module_present('sympy', namespaces):\n+ from sympy.printing.pycode import SymPyPrinter as Printer # type: ignore\n+ else:\n+ from sympy.printing.pycode import PythonCodePrinter as Printer # type: ignore\n+ user_functions = {}\n+ for m in namespaces[::-1]:\n+ if isinstance(m, dict):\n+ for k in m:\n+ user_functions[k] = k\n+ printer = Printer({'fully_qualified_modules': False, 'inline': True,\n+ 'allow_unknown_functions': True,\n+ 'user_functions': user_functions})\n+\n+ if isinstance(args, set):\n+ sympy_deprecation_warning(\n+ \"\"\"\n+Passing the function arguments to lambdify() as a set is deprecated. This\n+leads to unpredictable results since sets are unordered. Instead, use a list\n+or tuple for the function arguments.\n+ \"\"\",\n+ deprecated_since_version=\"1.6.3\",\n+ active_deprecations_target=\"deprecated-lambdify-arguments-set\",\n+ )\n+\n+ # Get the names of the args, for creating a docstring\n+ iterable_args = (args,) if isinstance(args, Expr) else args\n+ names = []\n+\n+ # Grab the callers frame, for getting the names by inspection (if needed)\n+ callers_local_vars = inspect.currentframe().f_back.f_locals.items() # type: ignore\n+ for n, var in enumerate(iterable_args):\n+ if hasattr(var, 'name'):\n+ names.append(var.name)\n+ else:\n+ # It's an iterable. Try to get name by inspection of calling frame.\n+ name_list = [var_name for var_name, var_val in callers_local_vars\n+ if var_val is var]\n+ if len(name_list) == 1:\n+ names.append(name_list[0])\n+ else:\n+ # Cannot infer name with certainty. arg_# will have to do.\n+ names.append('arg_' + str(n))\n+\n+ # Create the function definition code and execute it\n+ funcname = '_lambdifygenerated'\n+ if _module_present('tensorflow', namespaces):\n+ funcprinter = _TensorflowEvaluatorPrinter(printer, dummify)\n+ else:\n+ funcprinter = _EvaluatorPrinter(printer, dummify)\n+\n+ if cse == True:\n+ from sympy.simplify.cse_main import cse as _cse\n+ cses, _expr = _cse(expr, list=False)\n+ elif callable(cse):\n+ cses, _expr = cse(expr)\n+ else:\n+ cses, _expr = (), expr\n+ funcstr = funcprinter.doprint(funcname, iterable_args, _expr, cses=cses)\n+\n+ # Collect the module imports from the code printers.\n+ imp_mod_lines = []\n+ for mod, keys in (getattr(printer, 'module_imports', None) or {}).items():\n+ for k in keys:\n+ if k not in namespace:\n+ ln = \"from %s import %s\" % (mod, k)\n+ try:\n+ exec(ln, {}, namespace)\n+ except ImportError:\n+ # Tensorflow 2.0 has issues with importing a specific\n+ # function from its submodule.\n+ # https://github.com/tensorflow/tensorflow/issues/33022\n+ ln = \"%s = %s.%s\" % (k, mod, k)\n+ exec(ln, {}, namespace)\n+ imp_mod_lines.append(ln)\n+\n+ # Provide lambda expression with builtins, and compatible implementation of range\n+ namespace.update({'builtins':builtins, 'range':range})\n+\n+ funclocals = {}\n+ global _lambdify_generated_counter\n+ filename = '<lambdifygenerated-%s>' % _lambdify_generated_counter\n+ _lambdify_generated_counter += 1\n+ c = compile(funcstr, filename, 'exec')\n+ exec(c, namespace, funclocals)\n+ # mtime has to be None or else linecache.checkcache will remove it\n+ linecache.cache[filename] = (len(funcstr), None, funcstr.splitlines(True), filename) # type: ignore\n+\n+ func = funclocals[funcname]\n+\n+ # Apply the docstring\n+ sig = \"func({})\".format(\", \".join(str(i) for i in names))\n+ sig = textwrap.fill(sig, subsequent_indent=' '*8)\n+ if _too_large_for_docstring(expr, docstring_limit):\n+ expr_str = \"EXPRESSION REDACTED DUE TO LENGTH, (see lambdify's `docstring_limit`)\"\n+ src_str = \"SOURCE CODE REDACTED DUE TO LENGTH, (see lambdify's `docstring_limit`)\"\n+ else:\n+ expr_str = str(expr)\n+ if len(expr_str) > 78:\n+ expr_str = textwrap.wrap(expr_str, 75)[0] + '...'\n+ src_str = funcstr\n+ func.__doc__ = (\n+ \"Created with lambdify. Signature:\\n\\n\"\n+ \"{sig}\\n\\n\"\n+ \"Expression:\\n\\n\"\n+ \"{expr}\\n\\n\"\n+ \"Source code:\\n\\n\"\n+ \"{src}\\n\\n\"\n+ \"Imported modules:\\n\\n\"\n+ \"{imp_mods}\"\n+ ).format(sig=sig, expr=expr_str, src=src_str, imp_mods='\\n'.join(imp_mod_lines))\n+ return func\n \n def _module_present(modname, modlist):\n if modname in modlist:\n", "test": null }
null
{ "code": "diff --git a/sympy/utilities/lambdify.py b/sympy/utilities/lambdify.py\nindex a84d1a1c26..48830b4c0d 100644\n--- a/sympy/utilities/lambdify.py\n+++ b/sympy/utilities/lambdify.py\n@@ -759,178 +759,6 @@ def _lambdifygenerated(x):\n argument is not provided, ``lambdify`` creates functions using the NumPy\n and SciPy namespaces.\n \"\"\"\n- from sympy.core.symbol import Symbol\n- from sympy.core.expr import Expr\n-\n- # If the user hasn't specified any modules, use what is available.\n- if modules is None:\n- try:\n- _import(\"scipy\")\n- except ImportError:\n- try:\n- _import(\"numpy\")\n- except ImportError:\n- # Use either numpy (if available) or python.math where possible.\n- # XXX: This leads to different behaviour on different systems and\n- # might be the reason for irreproducible errors.\n- modules = [\"math\", \"mpmath\", \"sympy\"]\n- else:\n- modules = [\"numpy\"]\n- else:\n- modules = [\"numpy\", \"scipy\"]\n-\n- # Get the needed namespaces.\n- namespaces = []\n- # First find any function implementations\n- if use_imps:\n- namespaces.append(_imp_namespace(expr))\n- # Check for dict before iterating\n- if isinstance(modules, (dict, str)) or not hasattr(modules, '__iter__'):\n- namespaces.append(modules)\n- else:\n- # consistency check\n- if _module_present('numexpr', modules) and len(modules) > 1:\n- raise TypeError(\"numexpr must be the only item in 'modules'\")\n- namespaces += list(modules)\n- # fill namespace with first having highest priority\n- namespace = {}\n- for m in namespaces[::-1]:\n- buf = _get_namespace(m)\n- namespace.update(buf)\n-\n- if hasattr(expr, \"atoms\"):\n- #Try if you can extract symbols from the expression.\n- #Move on if expr.atoms in not implemented.\n- syms = expr.atoms(Symbol)\n- for term in syms:\n- namespace.update({str(term): term})\n-\n- if printer is None:\n- if _module_present('mpmath', namespaces):\n- from sympy.printing.pycode import MpmathPrinter as Printer # type: ignore\n- elif _module_present('scipy', namespaces):\n- from sympy.printing.numpy import SciPyPrinter as Printer # type: ignore\n- elif _module_present('numpy', namespaces):\n- from sympy.printing.numpy import NumPyPrinter as Printer # type: ignore\n- elif _module_present('cupy', namespaces):\n- from sympy.printing.numpy import CuPyPrinter as Printer # type: ignore\n- elif _module_present('jax', namespaces):\n- from sympy.printing.numpy import JaxPrinter as Printer # type: ignore\n- elif _module_present('numexpr', namespaces):\n- from sympy.printing.lambdarepr import NumExprPrinter as Printer # type: ignore\n- elif _module_present('tensorflow', namespaces):\n- from sympy.printing.tensorflow import TensorflowPrinter as Printer # type: ignore\n- elif _module_present('sympy', namespaces):\n- from sympy.printing.pycode import SymPyPrinter as Printer # type: ignore\n- else:\n- from sympy.printing.pycode import PythonCodePrinter as Printer # type: ignore\n- user_functions = {}\n- for m in namespaces[::-1]:\n- if isinstance(m, dict):\n- for k in m:\n- user_functions[k] = k\n- printer = Printer({'fully_qualified_modules': False, 'inline': True,\n- 'allow_unknown_functions': True,\n- 'user_functions': user_functions})\n-\n- if isinstance(args, set):\n- sympy_deprecation_warning(\n- \"\"\"\n-Passing the function arguments to lambdify() as a set is deprecated. This\n-leads to unpredictable results since sets are unordered. Instead, use a list\n-or tuple for the function arguments.\n- \"\"\",\n- deprecated_since_version=\"1.6.3\",\n- active_deprecations_target=\"deprecated-lambdify-arguments-set\",\n- )\n-\n- # Get the names of the args, for creating a docstring\n- iterable_args = (args,) if isinstance(args, Expr) else args\n- names = []\n-\n- # Grab the callers frame, for getting the names by inspection (if needed)\n- callers_local_vars = inspect.currentframe().f_back.f_locals.items() # type: ignore\n- for n, var in enumerate(iterable_args):\n- if hasattr(var, 'name'):\n- names.append(var.name)\n- else:\n- # It's an iterable. Try to get name by inspection of calling frame.\n- name_list = [var_name for var_name, var_val in callers_local_vars\n- if var_val is var]\n- if len(name_list) == 1:\n- names.append(name_list[0])\n- else:\n- # Cannot infer name with certainty. arg_# will have to do.\n- names.append('arg_' + str(n))\n-\n- # Create the function definition code and execute it\n- funcname = '_lambdifygenerated'\n- if _module_present('tensorflow', namespaces):\n- funcprinter = _TensorflowEvaluatorPrinter(printer, dummify)\n- else:\n- funcprinter = _EvaluatorPrinter(printer, dummify)\n-\n- if cse == True:\n- from sympy.simplify.cse_main import cse as _cse\n- cses, _expr = _cse(expr, list=False)\n- elif callable(cse):\n- cses, _expr = cse(expr)\n- else:\n- cses, _expr = (), expr\n- funcstr = funcprinter.doprint(funcname, iterable_args, _expr, cses=cses)\n-\n- # Collect the module imports from the code printers.\n- imp_mod_lines = []\n- for mod, keys in (getattr(printer, 'module_imports', None) or {}).items():\n- for k in keys:\n- if k not in namespace:\n- ln = \"from %s import %s\" % (mod, k)\n- try:\n- exec(ln, {}, namespace)\n- except ImportError:\n- # Tensorflow 2.0 has issues with importing a specific\n- # function from its submodule.\n- # https://github.com/tensorflow/tensorflow/issues/33022\n- ln = \"%s = %s.%s\" % (k, mod, k)\n- exec(ln, {}, namespace)\n- imp_mod_lines.append(ln)\n-\n- # Provide lambda expression with builtins, and compatible implementation of range\n- namespace.update({'builtins':builtins, 'range':range})\n-\n- funclocals = {}\n- global _lambdify_generated_counter\n- filename = '<lambdifygenerated-%s>' % _lambdify_generated_counter\n- _lambdify_generated_counter += 1\n- c = compile(funcstr, filename, 'exec')\n- exec(c, namespace, funclocals)\n- # mtime has to be None or else linecache.checkcache will remove it\n- linecache.cache[filename] = (len(funcstr), None, funcstr.splitlines(True), filename) # type: ignore\n-\n- func = funclocals[funcname]\n-\n- # Apply the docstring\n- sig = \"func({})\".format(\", \".join(str(i) for i in names))\n- sig = textwrap.fill(sig, subsequent_indent=' '*8)\n- if _too_large_for_docstring(expr, docstring_limit):\n- expr_str = \"EXPRESSION REDACTED DUE TO LENGTH, (see lambdify's `docstring_limit`)\"\n- src_str = \"SOURCE CODE REDACTED DUE TO LENGTH, (see lambdify's `docstring_limit`)\"\n- else:\n- expr_str = str(expr)\n- if len(expr_str) > 78:\n- expr_str = textwrap.wrap(expr_str, 75)[0] + '...'\n- src_str = funcstr\n- func.__doc__ = (\n- \"Created with lambdify. Signature:\\n\\n\"\n- \"{sig}\\n\\n\"\n- \"Expression:\\n\\n\"\n- \"{expr}\\n\\n\"\n- \"Source code:\\n\\n\"\n- \"{src}\\n\\n\"\n- \"Imported modules:\\n\\n\"\n- \"{imp_mods}\"\n- ).format(sig=sig, expr=expr_str, src=src_str, imp_mods='\\n'.join(imp_mod_lines))\n- return func\n \n def _module_present(modname, modlist):\n if modname in modlist:\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/utilities/lambdify.py.\nHere is the description for the function:\ndef lambdify(args, expr, modules=None, printer=None, use_imps=True,\n dummify=False, cse=False, docstring_limit=1000):\n \"\"\"Convert a SymPy expression into a function that allows for fast\n numeric evaluation.\n\n .. warning::\n This function uses ``exec``, and thus should not be used on\n unsanitized input.\n\n .. deprecated:: 1.7\n Passing a set for the *args* parameter is deprecated as sets are\n unordered. Use an ordered iterable such as a list or tuple.\n\n Explanation\n ===========\n\n For example, to convert the SymPy expression ``sin(x) + cos(x)`` to an\n equivalent NumPy function that numerically evaluates it:\n\n >>> from sympy import sin, cos, symbols, lambdify\n >>> import numpy as np\n >>> x = symbols('x')\n >>> expr = sin(x) + cos(x)\n >>> expr\n sin(x) + cos(x)\n >>> f = lambdify(x, expr, 'numpy')\n >>> a = np.array([1, 2])\n >>> f(a)\n [1.38177329 0.49315059]\n\n The primary purpose of this function is to provide a bridge from SymPy\n expressions to numerical libraries such as NumPy, SciPy, NumExpr, mpmath,\n and tensorflow. In general, SymPy functions do not work with objects from\n other libraries, such as NumPy arrays, and functions from numeric\n libraries like NumPy or mpmath do not work on SymPy expressions.\n ``lambdify`` bridges the two by converting a SymPy expression to an\n equivalent numeric function.\n\n The basic workflow with ``lambdify`` is to first create a SymPy expression\n representing whatever mathematical function you wish to evaluate. This\n should be done using only SymPy functions and expressions. Then, use\n ``lambdify`` to convert this to an equivalent function for numerical\n evaluation. For instance, above we created ``expr`` using the SymPy symbol\n ``x`` and SymPy functions ``sin`` and ``cos``, then converted it to an\n equivalent NumPy function ``f``, and called it on a NumPy array ``a``.\n\n Parameters\n ==========\n\n args : List[Symbol]\n A variable or a list of variables whose nesting represents the\n nesting of the arguments that will be passed to the function.\n\n Variables can be symbols, undefined functions, or matrix symbols.\n\n >>> from sympy import Eq\n >>> from sympy.abc import x, y, z\n\n The list of variables should match the structure of how the\n arguments will be passed to the function. Simply enclose the\n parameters as they will be passed in a list.\n\n To call a function like ``f(x)`` then ``[x]``\n should be the first argument to ``lambdify``; for this\n case a single ``x`` can also be used:\n\n >>> f = lambdify(x, x + 1)\n >>> f(1)\n 2\n >>> f = lambdify([x], x + 1)\n >>> f(1)\n 2\n\n To call a function like ``f(x, y)`` then ``[x, y]`` will\n be the first argument of the ``lambdify``:\n\n >>> f = lambdify([x, y], x + y)\n >>> f(1, 1)\n 2\n\n To call a function with a single 3-element tuple like\n ``f((x, y, z))`` then ``[(x, y, z)]`` will be the first\n argument of the ``lambdify``:\n\n >>> f = lambdify([(x, y, z)], Eq(z**2, x**2 + y**2))\n >>> f((3, 4, 5))\n True\n\n If two args will be passed and the first is a scalar but\n the second is a tuple with two arguments then the items\n in the list should match that structure:\n\n >>> f = lambdify([x, (y, z)], x + y + z)\n >>> f(1, (2, 3))\n 6\n\n expr : Expr\n An expression, list of expressions, or matrix to be evaluated.\n\n Lists may be nested.\n If the expression is a list, the output will also be a list.\n\n >>> f = lambdify(x, [x, [x + 1, x + 2]])\n >>> f(1)\n [1, [2, 3]]\n\n If it is a matrix, an array will be returned (for the NumPy module).\n\n >>> from sympy import Matrix\n >>> f = lambdify(x, Matrix([x, x + 1]))\n >>> f(1)\n [[1]\n [2]]\n\n Note that the argument order here (variables then expression) is used\n to emulate the Python ``lambda`` keyword. ``lambdify(x, expr)`` works\n (roughly) like ``lambda x: expr``\n (see :ref:`lambdify-how-it-works` below).\n\n modules : str, optional\n Specifies the numeric library to use.\n\n If not specified, *modules* defaults to:\n\n - ``[\"scipy\", \"numpy\"]`` if SciPy is installed\n - ``[\"numpy\"]`` if only NumPy is installed\n - ``[\"math\", \"mpmath\", \"sympy\"]`` if neither is installed.\n\n That is, SymPy functions are replaced as far as possible by\n either ``scipy`` or ``numpy`` functions if available, and Python's\n standard library ``math``, or ``mpmath`` functions otherwise.\n\n *modules* can be one of the following types:\n\n - The strings ``\"math\"``, ``\"mpmath\"``, ``\"numpy\"``, ``\"numexpr\"``,\n ``\"scipy\"``, ``\"sympy\"``, or ``\"tensorflow\"`` or ``\"jax\"``. This uses the\n corresponding printer and namespace mapping for that module.\n - A module (e.g., ``math``). This uses the global namespace of the\n module. If the module is one of the above known modules, it will\n also use the corresponding printer and namespace mapping\n (i.e., ``modules=numpy`` is equivalent to ``modules=\"numpy\"``).\n - A dictionary that maps names of SymPy functions to arbitrary\n functions\n (e.g., ``{'sin': custom_sin}``).\n - A list that contains a mix of the arguments above, with higher\n priority given to entries appearing first\n (e.g., to use the NumPy module but override the ``sin`` function\n with a custom version, you can use\n ``[{'sin': custom_sin}, 'numpy']``).\n\n dummify : bool, optional\n Whether or not the variables in the provided expression that are not\n valid Python identifiers are substituted with dummy symbols.\n\n This allows for undefined functions like ``Function('f')(t)`` to be\n supplied as arguments. By default, the variables are only dummified\n if they are not valid Python identifiers.\n\n Set ``dummify=True`` to replace all arguments with dummy symbols\n (if ``args`` is not a string) - for example, to ensure that the\n arguments do not redefine any built-in names.\n\n cse : bool, or callable, optional\n Large expressions can be computed more efficiently when\n common subexpressions are identified and precomputed before\n being used multiple time. Finding the subexpressions will make\n creation of the 'lambdify' function slower, however.\n\n When ``True``, ``sympy.simplify.cse`` is used, otherwise (the default)\n the user may pass a function matching the ``cse`` signature.\n\n docstring_limit : int or None\n When lambdifying large expressions, a significant proportion of the time\n spent inside ``lambdify`` is spent producing a string representation of\n the expression for use in the automatically generated docstring of the\n returned function. For expressions containing hundreds or more nodes the\n resulting docstring often becomes so long and dense that it is difficult\n to read. To reduce the runtime of lambdify, the rendering of the full\n expression inside the docstring can be disabled.\n\n When ``None``, the full expression is rendered in the docstring. When\n ``0`` or a negative ``int``, an ellipsis is rendering in the docstring\n instead of the expression. When a strictly positive ``int``, if the\n number of nodes in the expression exceeds ``docstring_limit`` an\n ellipsis is rendered in the docstring, otherwise a string representation\n of the expression is rendered as normal. The default is ``1000``.\n\n Examples\n ========\n\n >>> from sympy.utilities.lambdify import implemented_function\n >>> from sympy import sqrt, sin, Matrix\n >>> from sympy import Function\n >>> from sympy.abc import w, x, y, z\n\n >>> f = lambdify(x, x**2)\n >>> f(2)\n 4\n >>> f = lambdify((x, y, z), [z, y, x])\n >>> f(1,2,3)\n [3, 2, 1]\n >>> f = lambdify(x, sqrt(x))\n >>> f(4)\n 2.0\n >>> f = lambdify((x, y), sin(x*y)**2)\n >>> f(0, 5)\n 0.0\n >>> row = lambdify((x, y), Matrix((x, x + y)).T, modules='sympy')\n >>> row(1, 2)\n Matrix([[1, 3]])\n\n ``lambdify`` can be used to translate SymPy expressions into mpmath\n functions. This may be preferable to using ``evalf`` (which uses mpmath on\n the backend) in some cases.\n\n >>> f = lambdify(x, sin(x), 'mpmath')\n >>> f(1)\n 0.8414709848078965\n\n Tuple arguments are handled and the lambdified function should\n be called with the same type of arguments as were used to create\n the function:\n\n >>> f = lambdify((x, (y, z)), x + y)\n >>> f(1, (2, 4))\n 3\n\n The ``flatten`` function can be used to always work with flattened\n arguments:\n\n >>> from sympy.utilities.iterables import flatten\n >>> args = w, (x, (y, z))\n >>> vals = 1, (2, (3, 4))\n >>> f = lambdify(flatten(args), w + x + y + z)\n >>> f(*flatten(vals))\n 10\n\n Functions present in ``expr`` can also carry their own numerical\n implementations, in a callable attached to the ``_imp_`` attribute. This\n can be used with undefined functions using the ``implemented_function``\n factory:\n\n >>> f = implemented_function(Function('f'), lambda x: x+1)\n >>> func = lambdify(x, f(x))\n >>> func(4)\n 5\n\n ``lambdify`` always prefers ``_imp_`` implementations to implementations\n in other namespaces, unless the ``use_imps`` input parameter is False.\n\n Usage with Tensorflow:\n\n >>> import tensorflow as tf\n >>> from sympy import Max, sin, lambdify\n >>> from sympy.abc import x\n\n >>> f = Max(x, sin(x))\n >>> func = lambdify(x, f, 'tensorflow')\n\n After tensorflow v2, eager execution is enabled by default.\n If you want to get the compatible result across tensorflow v1 and v2\n as same as this tutorial, run this line.\n\n >>> tf.compat.v1.enable_eager_execution()\n\n If you have eager execution enabled, you can get the result out\n immediately as you can use numpy.\n\n If you pass tensorflow objects, you may get an ``EagerTensor``\n object instead of value.\n\n >>> result = func(tf.constant(1.0))\n >>> print(result)\n tf.Tensor(1.0, shape=(), dtype=float32)\n >>> print(result.__class__)\n <class 'tensorflow.python.framework.ops.EagerTensor'>\n\n You can use ``.numpy()`` to get the numpy value of the tensor.\n\n >>> result.numpy()\n 1.0\n\n >>> var = tf.Variable(2.0)\n >>> result = func(var) # also works for tf.Variable and tf.Placeholder\n >>> result.numpy()\n 2.0\n\n And it works with any shape array.\n\n >>> tensor = tf.constant([[1.0, 2.0], [3.0, 4.0]])\n >>> result = func(tensor)\n >>> result.numpy()\n [[1. 2.]\n [3. 4.]]\n\n Notes\n =====\n\n - For functions involving large array calculations, numexpr can provide a\n significant speedup over numpy. Please note that the available functions\n for numexpr are more limited than numpy but can be expanded with\n ``implemented_function`` and user defined subclasses of Function. If\n specified, numexpr may be the only option in modules. The official list\n of numexpr functions can be found at:\n https://numexpr.readthedocs.io/en/latest/user_guide.html#supported-functions\n\n - In the above examples, the generated functions can accept scalar\n values or numpy arrays as arguments. However, in some cases\n the generated function relies on the input being a numpy array:\n\n >>> import numpy\n >>> from sympy import Piecewise\n >>> from sympy.testing.pytest import ignore_warnings\n >>> f = lambdify(x, Piecewise((x, x <= 1), (1/x, x > 1)), \"numpy\")\n\n >>> with ignore_warnings(RuntimeWarning):\n ... f(numpy.array([-1, 0, 1, 2]))\n [-1. 0. 1. 0.5]\n\n >>> f(0)\n Traceback (most recent call last):\n ...\n ZeroDivisionError: division by zero\n\n In such cases, the input should be wrapped in a numpy array:\n\n >>> with ignore_warnings(RuntimeWarning):\n ... float(f(numpy.array([0])))\n 0.0\n\n Or if numpy functionality is not required another module can be used:\n\n >>> f = lambdify(x, Piecewise((x, x <= 1), (1/x, x > 1)), \"math\")\n >>> f(0)\n 0\n\n .. _lambdify-how-it-works:\n\n How it works\n ============\n\n When using this function, it helps a great deal to have an idea of what it\n is doing. At its core, lambdify is nothing more than a namespace\n translation, on top of a special printer that makes some corner cases work\n properly.\n\n To understand lambdify, first we must properly understand how Python\n namespaces work. Say we had two files. One called ``sin_cos_sympy.py``,\n with\n\n .. code:: python\n\n # sin_cos_sympy.py\n\n from sympy.functions.elementary.trigonometric import (cos, sin)\n\n def sin_cos(x):\n return sin(x) + cos(x)\n\n\n and one called ``sin_cos_numpy.py`` with\n\n .. code:: python\n\n # sin_cos_numpy.py\n\n from numpy import sin, cos\n\n def sin_cos(x):\n return sin(x) + cos(x)\n\n The two files define an identical function ``sin_cos``. However, in the\n first file, ``sin`` and ``cos`` are defined as the SymPy ``sin`` and\n ``cos``. In the second, they are defined as the NumPy versions.\n\n If we were to import the first file and use the ``sin_cos`` function, we\n would get something like\n\n >>> from sin_cos_sympy import sin_cos # doctest: +SKIP\n >>> sin_cos(1) # doctest: +SKIP\n cos(1) + sin(1)\n\n On the other hand, if we imported ``sin_cos`` from the second file, we\n would get\n\n >>> from sin_cos_numpy import sin_cos # doctest: +SKIP\n >>> sin_cos(1) # doctest: +SKIP\n 1.38177329068\n\n In the first case we got a symbolic output, because it used the symbolic\n ``sin`` and ``cos`` functions from SymPy. In the second, we got a numeric\n result, because ``sin_cos`` used the numeric ``sin`` and ``cos`` functions\n from NumPy. But notice that the versions of ``sin`` and ``cos`` that were\n used was not inherent to the ``sin_cos`` function definition. Both\n ``sin_cos`` definitions are exactly the same. Rather, it was based on the\n names defined at the module where the ``sin_cos`` function was defined.\n\n The key point here is that when function in Python references a name that\n is not defined in the function, that name is looked up in the \"global\"\n namespace of the module where that function is defined.\n\n Now, in Python, we can emulate this behavior without actually writing a\n file to disk using the ``exec`` function. ``exec`` takes a string\n containing a block of Python code, and a dictionary that should contain\n the global variables of the module. It then executes the code \"in\" that\n dictionary, as if it were the module globals. The following is equivalent\n to the ``sin_cos`` defined in ``sin_cos_sympy.py``:\n\n >>> import sympy\n >>> module_dictionary = {'sin': sympy.sin, 'cos': sympy.cos}\n >>> exec('''\n ... def sin_cos(x):\n ... return sin(x) + cos(x)\n ... ''', module_dictionary)\n >>> sin_cos = module_dictionary['sin_cos']\n >>> sin_cos(1)\n cos(1) + sin(1)\n\n and similarly with ``sin_cos_numpy``:\n\n >>> import numpy\n >>> module_dictionary = {'sin': numpy.sin, 'cos': numpy.cos}\n >>> exec('''\n ... def sin_cos(x):\n ... return sin(x) + cos(x)\n ... ''', module_dictionary)\n >>> sin_cos = module_dictionary['sin_cos']\n >>> sin_cos(1)\n 1.38177329068\n\n So now we can get an idea of how ``lambdify`` works. The name \"lambdify\"\n comes from the fact that we can think of something like ``lambdify(x,\n sin(x) + cos(x), 'numpy')`` as ``lambda x: sin(x) + cos(x)``, where\n ``sin`` and ``cos`` come from the ``numpy`` namespace. This is also why\n the symbols argument is first in ``lambdify``, as opposed to most SymPy\n functions where it comes after the expression: to better mimic the\n ``lambda`` keyword.\n\n ``lambdify`` takes the input expression (like ``sin(x) + cos(x)``) and\n\n 1. Converts it to a string\n 2. Creates a module globals dictionary based on the modules that are\n passed in (by default, it uses the NumPy module)\n 3. Creates the string ``\"def func({vars}): return {expr}\"``, where ``{vars}`` is the\n list of variables separated by commas, and ``{expr}`` is the string\n created in step 1., then ``exec``s that string with the module globals\n namespace and returns ``func``.\n\n In fact, functions returned by ``lambdify`` support inspection. So you can\n see exactly how they are defined by using ``inspect.getsource``, or ``??`` if you\n are using IPython or the Jupyter notebook.\n\n >>> f = lambdify(x, sin(x) + cos(x))\n >>> import inspect\n >>> print(inspect.getsource(f))\n def _lambdifygenerated(x):\n return sin(x) + cos(x)\n\n This shows us the source code of the function, but not the namespace it\n was defined in. We can inspect that by looking at the ``__globals__``\n attribute of ``f``:\n\n >>> f.__globals__['sin']\n <ufunc 'sin'>\n >>> f.__globals__['cos']\n <ufunc 'cos'>\n >>> f.__globals__['sin'] is numpy.sin\n True\n\n This shows us that ``sin`` and ``cos`` in the namespace of ``f`` will be\n ``numpy.sin`` and ``numpy.cos``.\n\n Note that there are some convenience layers in each of these steps, but at\n the core, this is how ``lambdify`` works. Step 1 is done using the\n ``LambdaPrinter`` printers defined in the printing module (see\n :mod:`sympy.printing.lambdarepr`). This allows different SymPy expressions\n to define how they should be converted to a string for different modules.\n You can change which printer ``lambdify`` uses by passing a custom printer\n in to the ``printer`` argument.\n\n Step 2 is augmented by certain translations. There are default\n translations for each module, but you can provide your own by passing a\n list to the ``modules`` argument. For instance,\n\n >>> def mysin(x):\n ... print('taking the sin of', x)\n ... return numpy.sin(x)\n ...\n >>> f = lambdify(x, sin(x), [{'sin': mysin}, 'numpy'])\n >>> f(1)\n taking the sin of 1\n 0.8414709848078965\n\n The globals dictionary is generated from the list by merging the\n dictionary ``{'sin': mysin}`` and the module dictionary for NumPy. The\n merging is done so that earlier items take precedence, which is why\n ``mysin`` is used above instead of ``numpy.sin``.\n\n If you want to modify the way ``lambdify`` works for a given function, it\n is usually easiest to do so by modifying the globals dictionary as such.\n In more complicated cases, it may be necessary to create and pass in a\n custom printer.\n\n Finally, step 3 is augmented with certain convenience operations, such as\n the addition of a docstring.\n\n Understanding how ``lambdify`` works can make it easier to avoid certain\n gotchas when using it. For instance, a common mistake is to create a\n lambdified function for one module (say, NumPy), and pass it objects from\n another (say, a SymPy expression).\n\n For instance, say we create\n\n >>> from sympy.abc import x\n >>> f = lambdify(x, x + 1, 'numpy')\n\n Now if we pass in a NumPy array, we get that array plus 1\n\n >>> import numpy\n >>> a = numpy.array([1, 2])\n >>> f(a)\n [2 3]\n\n But what happens if you make the mistake of passing in a SymPy expression\n instead of a NumPy array:\n\n >>> f(x + 1)\n x + 2\n\n This worked, but it was only by accident. Now take a different lambdified\n function:\n\n >>> from sympy import sin\n >>> g = lambdify(x, x + sin(x), 'numpy')\n\n This works as expected on NumPy arrays:\n\n >>> g(a)\n [1.84147098 2.90929743]\n\n But if we try to pass in a SymPy expression, it fails\n\n >>> g(x + 1)\n Traceback (most recent call last):\n ...\n TypeError: loop of ufunc does not support argument 0 of type Add which has\n no callable sin method\n\n Now, let's look at what happened. The reason this fails is that ``g``\n calls ``numpy.sin`` on the input expression, and ``numpy.sin`` does not\n know how to operate on a SymPy object. **As a general rule, NumPy\n functions do not know how to operate on SymPy expressions, and SymPy\n functions do not know how to operate on NumPy arrays. This is why lambdify\n exists: to provide a bridge between SymPy and NumPy.**\n\n However, why is it that ``f`` did work? That's because ``f`` does not call\n any functions, it only adds 1. So the resulting function that is created,\n ``def _lambdifygenerated(x): return x + 1`` does not depend on the globals\n namespace it is defined in. Thus it works, but only by accident. A future\n version of ``lambdify`` may remove this behavior.\n\n Be aware that certain implementation details described here may change in\n future versions of SymPy. The API of passing in custom modules and\n printers will not change, but the details of how a lambda function is\n created may change. However, the basic idea will remain the same, and\n understanding it will be helpful to understanding the behavior of\n lambdify.\n\n **In general: you should create lambdified functions for one module (say,\n NumPy), and only pass it input types that are compatible with that module\n (say, NumPy arrays).** Remember that by default, if the ``module``\n argument is not provided, ``lambdify`` creates functions using the NumPy\n and SciPy namespaces.\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/physics/biomechanics/tests/test_curve.py::TestTendonForceLengthDeGroote2016::test_lambdify", "sympy/physics/biomechanics/tests/test_curve.py::TestTendonForceLengthInverseDeGroote2016::test_lambdify", "sympy/utilities/tests/test_lambdify.py::test_no_args", "sympy/utilities/tests/test_lambdify.py::test_single_arg", "sympy/utilities/tests/test_lambdify.py::test_list_args", "sympy/utilities/tests/test_lambdify.py::test_nested_args", "sympy/utilities/tests/test_lambdify.py::test_str_args", "sympy/utilities/tests/test_lambdify.py::test_own_namespace_1", "sympy/physics/biomechanics/tests/test_curve.py::TestFiberForceLengthPassiveDeGroote2016::test_lambdify", "sympy/utilities/tests/test_lambdify.py::test_own_namespace_2", "sympy/utilities/tests/test_lambdify.py::test_own_module", "sympy/utilities/tests/test_lambdify.py::test_atoms", "sympy/utilities/tests/test_lambdify.py::test_sympy_lambda", "sympy/utilities/tests/test_lambdify.py::test_math_lambda", "sympy/utilities/tests/test_lambdify.py::test_mpmath_lambda", "sympy/utilities/tests/test_lambdify.py::test_number_precision", "sympy/utilities/tests/test_lambdify.py::test_mpmath_precision", "sympy/utilities/tests/test_lambdify.py::test_empty_modules", "sympy/physics/biomechanics/tests/test_curve.py::TestFiberForceLengthPassiveInverseDeGroote2016::test_lambdify", "sympy/utilities/tests/test_lambdify.py::test_exponentiation", "sympy/utilities/tests/test_lambdify.py::test_sqrt", "sympy/core/tests/test_evalf.py::test_evalf_sum", "sympy/utilities/tests/test_lambdify.py::test_trig", "sympy/core/tests/test_evalf.py::test_evalf_divergent_series", "sympy/utilities/tests/test_lambdify.py::test_integral", "sympy/utilities/tests/test_lambdify.py::test_double_integral", "sympy/utilities/tests/test_lambdify.py::test_spherical_bessel", "sympy/utilities/tests/test_lambdify.py::test_vector_simple", "sympy/utilities/tests/test_lambdify.py::test_vector_discontinuous", "sympy/utilities/tests/test_lambdify.py::test_trig_symbolic", "sympy/physics/biomechanics/tests/test_curve.py::TestFiberForceLengthActiveDeGroote2016::test_lambdify", "sympy/utilities/tests/test_lambdify.py::test_trig_float", "sympy/utilities/tests/test_lambdify.py::test_docs", "sympy/utilities/tests/test_lambdify.py::test_math", "sympy/utilities/tests/test_lambdify.py::test_sin", "sympy/utilities/tests/test_lambdify.py::test_matrix", "sympy/utilities/tests/test_lambdify.py::test_issue9474", "sympy/physics/biomechanics/tests/test_curve.py::TestFiberForceVelocityDeGroote2016::test_lambdify", "sympy/utilities/tests/test_lambdify.py::test_sym_single_arg", "sympy/utilities/tests/test_lambdify.py::test_sym_list_args", "sympy/utilities/tests/test_lambdify.py::test_sym_integral", "sympy/physics/biomechanics/tests/test_curve.py::TestFiberForceVelocityInverseDeGroote2016::test_lambdify", "sympy/utilities/tests/test_lambdify.py::test_namespace_order", "sympy/utilities/tests/test_lambdify.py::test_imps", "sympy/utilities/tests/test_lambdify.py::test_lambdify_imps", "sympy/utilities/tests/test_lambdify.py::test_dummification", "sympy/utilities/tests/test_lambdify.py::test_lambdify__arguments_with_invalid_python_identifiers", "sympy/utilities/tests/test_lambdify.py::test_curly_matrix_symbol", "sympy/utilities/tests/test_lambdify.py::test_python_keywords", "sympy/utilities/tests/test_lambdify.py::test_lambdify_docstring", "sympy/utilities/tests/test_lambdify.py::test_special_printers", "sympy/utilities/tests/test_lambdify.py::test_true_false", "sympy/utilities/tests/test_lambdify.py::test_issue_2790", "sympy/utilities/tests/test_lambdify.py::test_ITE", "sympy/utilities/tests/test_lambdify.py::test_Min_Max", "sympy/utilities/tests/test_lambdify.py::test_Idx", "sympy/utilities/tests/test_lambdify.py::test_issue_12173", "sympy/utilities/tests/test_lambdify.py::test_sinc_mpmath", "sympy/utilities/tests/test_lambdify.py::test_lambdify_dummy_arg", "sympy/utilities/tests/test_lambdify.py::test_lambdify_mixed_symbol_dummy_args", "sympy/utilities/tests/test_lambdify.py::test_lambdify_inspect", "sympy/utilities/tests/test_lambdify.py::test_issue_14941", "sympy/utilities/tests/test_lambdify.py::test_lambdify_Derivative_arg_issue_16468", "sympy/utilities/tests/test_lambdify.py::test_lambdify_Derivative_zeta", "sympy/utilities/tests/test_lambdify.py::test_lambdify_Derivative_custom_printer", "sympy/utilities/tests/test_lambdify.py::test_lambdify_derivative_and_functions_as_arguments", "sympy/utilities/tests/test_lambdify.py::test_imag_real", "sympy/utilities/tests/test_lambdify.py::test_single_e", "sympy/utilities/tests/test_lambdify.py::test_beta_math", "sympy/utilities/tests/test_lambdify.py::test_lambdify_cse", "sympy/utilities/tests/test_lambdify.py::test_issue_25288", "sympy/utilities/tests/test_lambdify.py::test_deprecated_set", "sympy/utilities/tests/test_lambdify.py::test_23536_lambdify_cse_dummy", "sympy/utilities/tests/test_lambdify.py::test_lambdify_docstring_size_limit_simple_symbol", "sympy/utilities/tests/test_lambdify.py::test_lambdify_docstring_size_limit_nested_expr", "sympy/utilities/tests/test_lambdify.py::test_lambdify_docstring_size_limit_matrix", "sympy/utilities/tests/test_lambdify.py::test_lambdify_empty_tuple", "sympy/concrete/tests/test_sums_products.py::test_evalf_fast_series", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_lambdify", "sympy/concrete/tests/test_sums_products.py::test_evalf_fast_series_issue_4021", "sympy/utilities/tests/test_lambdify.py::test_Piecewise", "sympy/concrete/tests/test_sums_products.py::test_evalf_slow_series", "sympy/functions/combinatorial/tests/test_comb_numbers.py::test_bell", "sympy/concrete/tests/test_sums_products.py::test_telescopic_sums", "sympy/functions/combinatorial/tests/test_comb_factorials.py::test_rf_lambdify_mpmath", "sympy/solvers/tests/test_numeric.py::test_nsolve_denominator", "sympy/solvers/tests/test_numeric.py::test_nsolve", "sympy/solvers/tests/test_numeric.py::test_issue_6408", "sympy/solvers/tests/test_numeric.py::test_issue_6408_integral", "sympy/solvers/tests/test_numeric.py::test_increased_dps", "sympy/solvers/tests/test_numeric.py::test_nsolve_precision", "sympy/solvers/tests/test_numeric.py::test_nsolve_complex", "sympy/printing/tests/test_lambdarepr.py::test_sum__1", "sympy/printing/tests/test_lambdarepr.py::test_sum__2", "sympy/solvers/tests/test_numeric.py::test_nsolve_dict_kwarg", "sympy/printing/tests/test_lambdarepr.py::test_multiple_sums", "sympy/solvers/tests/test_numeric.py::test_nsolve_rational", "sympy/solvers/tests/test_numeric.py::test_issue_14950", "sympy/utilities/tests/test_wester.py::test_R17", "sympy/polys/numberfields/tests/test_utilities.py::test_isolate", "sympy/stats/tests/test_discrete_rv.py::test_precomputed_characteristic_functions", "sympy/physics/mechanics/tests/test_jointsmethod.py::test_four_bar_linkage_with_manual_constraints", "sympy/polys/numberfields/tests/test_galoisgroups.py::test__galois_group_degree_4_root_approx", "sympy/polys/numberfields/tests/test_galoisgroups.py::test__galois_group_degree_5_hybrid", "sympy/stats/tests/test_joint_rv.py::test_NegativeMultinomial", "sympy/plotting/tests/test_textplot.py::test_axes_alignment", "sympy/plotting/tests/test_textplot.py::test_singularity", "sympy/plotting/tests/test_textplot.py::test_sinc", "sympy/plotting/tests/test_textplot.py::test_imaginary", "sympy/physics/mechanics/tests/test_kane5.py::test_kane_rolling_disc_lu", "sympy/physics/mechanics/tests/test_kane5.py::test_kane_rolling_disc_kdes_callable", "sympy/solvers/tests/test_solvers.py::test_issue_7547" ], "PASS_TO_PASS": null }
sympy__sympy-71
1.0
{ "code": "diff --git b/sympy/crypto/crypto.py a/sympy/crypto/crypto.py\nindex 3b6ff09e3c..62c50072ca 100644\n--- b/sympy/crypto/crypto.py\n+++ a/sympy/crypto/crypto.py\n@@ -2499,6 +2499,45 @@ def lfsr_connection_polynomial(s):\n Jan 1969.\n \n \"\"\"\n+ # Initialization:\n+ p = s[0].modulus()\n+ x = Symbol(\"x\")\n+ C = 1*x**0\n+ B = 1*x**0\n+ m = 1\n+ b = 1*x**0\n+ L = 0\n+ N = 0\n+ while N < len(s):\n+ if L > 0:\n+ dC = Poly(C).degree()\n+ r = min(L + 1, dC + 1)\n+ coeffsC = [C.subs(x, 0)] + [C.coeff(x**i)\n+ for i in range(1, dC + 1)]\n+ d = (int(s[N]) + sum(coeffsC[i]*int(s[N - i])\n+ for i in range(1, r))) % p\n+ if L == 0:\n+ d = int(s[N])*x**0\n+ if d == 0:\n+ m += 1\n+ N += 1\n+ if d > 0:\n+ if 2*L > N:\n+ C = (C - d*((b**(p - 2)) % p)*x**m*B).expand()\n+ m += 1\n+ N += 1\n+ else:\n+ T = C\n+ C = (C - d*((b**(p - 2)) % p)*x**m*B).expand()\n+ L = N + 1 - L\n+ m = 1\n+ b = d\n+ B = T\n+ N += 1\n+ dC = Poly(C).degree()\n+ coeffsC = [C.subs(x, 0)] + [C.coeff(x**i) for i in range(1, dC + 1)]\n+ return sum(coeffsC[i] % p*x**i for i in range(dC + 1)\n+ if coeffsC[i] is not None)\n \n \n #################### ElGamal #############################\n", "test": null }
null
{ "code": "diff --git a/sympy/crypto/crypto.py b/sympy/crypto/crypto.py\nindex 62c50072ca..3b6ff09e3c 100644\n--- a/sympy/crypto/crypto.py\n+++ b/sympy/crypto/crypto.py\n@@ -2499,45 +2499,6 @@ def lfsr_connection_polynomial(s):\n Jan 1969.\n \n \"\"\"\n- # Initialization:\n- p = s[0].modulus()\n- x = Symbol(\"x\")\n- C = 1*x**0\n- B = 1*x**0\n- m = 1\n- b = 1*x**0\n- L = 0\n- N = 0\n- while N < len(s):\n- if L > 0:\n- dC = Poly(C).degree()\n- r = min(L + 1, dC + 1)\n- coeffsC = [C.subs(x, 0)] + [C.coeff(x**i)\n- for i in range(1, dC + 1)]\n- d = (int(s[N]) + sum(coeffsC[i]*int(s[N - i])\n- for i in range(1, r))) % p\n- if L == 0:\n- d = int(s[N])*x**0\n- if d == 0:\n- m += 1\n- N += 1\n- if d > 0:\n- if 2*L > N:\n- C = (C - d*((b**(p - 2)) % p)*x**m*B).expand()\n- m += 1\n- N += 1\n- else:\n- T = C\n- C = (C - d*((b**(p - 2)) % p)*x**m*B).expand()\n- L = N + 1 - L\n- m = 1\n- b = d\n- B = T\n- N += 1\n- dC = Poly(C).degree()\n- coeffsC = [C.subs(x, 0)] + [C.coeff(x**i) for i in range(1, dC + 1)]\n- return sum(coeffsC[i] % p*x**i for i in range(dC + 1)\n- if coeffsC[i] is not None)\n \n \n #################### ElGamal #############################\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/crypto/crypto.py.\nHere is the description for the function:\ndef lfsr_connection_polynomial(s):\n \"\"\"\n This function computes the LFSR connection polynomial.\n\n Parameters\n ==========\n\n s\n A sequence of elements of even length, with entries in a finite\n field.\n\n Returns\n =======\n\n C(x)\n The connection polynomial of a minimal LFSR yielding s.\n\n This implements the algorithm in section 3 of J. L. Massey's\n article [M]_.\n\n Examples\n ========\n\n >>> from sympy.crypto.crypto import (\n ... lfsr_sequence, lfsr_connection_polynomial)\n >>> from sympy.polys.domains import FF\n >>> F = FF(2)\n >>> fill = [F(1), F(1), F(0), F(1)]\n >>> key = [F(1), F(0), F(0), F(1)]\n >>> s = lfsr_sequence(key, fill, 20)\n >>> lfsr_connection_polynomial(s)\n x**4 + x + 1\n >>> fill = [F(1), F(0), F(0), F(1)]\n >>> key = [F(1), F(1), F(0), F(1)]\n >>> s = lfsr_sequence(key, fill, 20)\n >>> lfsr_connection_polynomial(s)\n x**3 + 1\n >>> fill = [F(1), F(0), F(1)]\n >>> key = [F(1), F(1), F(0)]\n >>> s = lfsr_sequence(key, fill, 20)\n >>> lfsr_connection_polynomial(s)\n x**3 + x**2 + 1\n >>> fill = [F(1), F(0), F(1)]\n >>> key = [F(1), F(0), F(1)]\n >>> s = lfsr_sequence(key, fill, 20)\n >>> lfsr_connection_polynomial(s)\n x**3 + x + 1\n\n References\n ==========\n\n .. [M] James L. Massey, \"Shift-Register Synthesis and BCH Decoding.\"\n IEEE Trans. on Information Theory, vol. 15(1), pp. 122-127,\n Jan 1969.\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/crypto/tests/test_crypto.py::test_lfsr_connection_polynomial" ], "PASS_TO_PASS": null }
sympy__sympy-72
1.0
{ "code": "diff --git b/sympy/utilities/iterables.py a/sympy/utilities/iterables.py\nindex bec4b20f1e..cc5c1152f0 100644\n--- b/sympy/utilities/iterables.py\n+++ a/sympy/utilities/iterables.py\n@@ -1511,6 +1511,87 @@ def multiset_partitions(multiset, m=None):\n sympy.functions.combinatorial.numbers.nT\n \n \"\"\"\n+ # This function looks at the supplied input and dispatches to\n+ # several special-case routines as they apply.\n+ if isinstance(multiset, int):\n+ n = multiset\n+ if m and m > n:\n+ return\n+ multiset = list(range(n))\n+ if m == 1:\n+ yield [multiset[:]]\n+ return\n+\n+ # If m is not None, it can sometimes be faster to use\n+ # MultisetPartitionTraverser.enum_range() even for inputs\n+ # which are sets. Since the _set_partitions code is quite\n+ # fast, this is only advantageous when the overall set\n+ # partitions outnumber those with the desired number of parts\n+ # by a large factor. (At least 60.) Such a switch is not\n+ # currently implemented.\n+ for nc, q in _set_partitions(n):\n+ if m is None or nc == m:\n+ rv = [[] for i in range(nc)]\n+ for i in range(n):\n+ rv[q[i]].append(multiset[i])\n+ yield rv\n+ return\n+\n+ if len(multiset) == 1 and isinstance(multiset, str):\n+ multiset = [multiset]\n+\n+ if not has_variety(multiset):\n+ # Only one component, repeated n times. The resulting\n+ # partitions correspond to partitions of integer n.\n+ n = len(multiset)\n+ if m and m > n:\n+ return\n+ if m == 1:\n+ yield [multiset[:]]\n+ return\n+ x = multiset[:1]\n+ for size, p in partitions(n, m, size=True):\n+ if m is None or size == m:\n+ rv = []\n+ for k in sorted(p):\n+ rv.extend([x*k]*p[k])\n+ yield rv\n+ else:\n+ from sympy.core.sorting import ordered\n+ multiset = list(ordered(multiset))\n+ n = len(multiset)\n+ if m and m > n:\n+ return\n+ if m == 1:\n+ yield [multiset[:]]\n+ return\n+\n+ # Split the information of the multiset into two lists -\n+ # one of the elements themselves, and one (of the same length)\n+ # giving the number of repeats for the corresponding element.\n+ elements, multiplicities = zip(*group(multiset, False))\n+\n+ if len(elements) < len(multiset):\n+ # General case - multiset with more than one distinct element\n+ # and at least one element repeated more than once.\n+ if m:\n+ mpt = MultisetPartitionTraverser()\n+ for state in mpt.enum_range(multiplicities, m-1, m):\n+ yield list_visitor(state, elements)\n+ else:\n+ for state in multiset_partitions_taocp(multiplicities):\n+ yield list_visitor(state, elements)\n+ else:\n+ # Set partitions case - no repeated elements. Pretty much\n+ # same as int argument case above, with same possible, but\n+ # currently unimplemented optimization for some cases when\n+ # m is not None\n+ for nc, q in _set_partitions(n):\n+ if m is None or nc == m:\n+ rv = [[] for i in range(nc)]\n+ for i in range(n):\n+ rv[q[i]].append(i)\n+ yield [[multiset[j] for j in i] for i in rv]\n \n \n def partitions(n, m=None, k=None, size=False):\n", "test": null }
null
{ "code": "diff --git a/sympy/utilities/iterables.py b/sympy/utilities/iterables.py\nindex cc5c1152f0..bec4b20f1e 100644\n--- a/sympy/utilities/iterables.py\n+++ b/sympy/utilities/iterables.py\n@@ -1511,87 +1511,6 @@ def multiset_partitions(multiset, m=None):\n sympy.functions.combinatorial.numbers.nT\n \n \"\"\"\n- # This function looks at the supplied input and dispatches to\n- # several special-case routines as they apply.\n- if isinstance(multiset, int):\n- n = multiset\n- if m and m > n:\n- return\n- multiset = list(range(n))\n- if m == 1:\n- yield [multiset[:]]\n- return\n-\n- # If m is not None, it can sometimes be faster to use\n- # MultisetPartitionTraverser.enum_range() even for inputs\n- # which are sets. Since the _set_partitions code is quite\n- # fast, this is only advantageous when the overall set\n- # partitions outnumber those with the desired number of parts\n- # by a large factor. (At least 60.) Such a switch is not\n- # currently implemented.\n- for nc, q in _set_partitions(n):\n- if m is None or nc == m:\n- rv = [[] for i in range(nc)]\n- for i in range(n):\n- rv[q[i]].append(multiset[i])\n- yield rv\n- return\n-\n- if len(multiset) == 1 and isinstance(multiset, str):\n- multiset = [multiset]\n-\n- if not has_variety(multiset):\n- # Only one component, repeated n times. The resulting\n- # partitions correspond to partitions of integer n.\n- n = len(multiset)\n- if m and m > n:\n- return\n- if m == 1:\n- yield [multiset[:]]\n- return\n- x = multiset[:1]\n- for size, p in partitions(n, m, size=True):\n- if m is None or size == m:\n- rv = []\n- for k in sorted(p):\n- rv.extend([x*k]*p[k])\n- yield rv\n- else:\n- from sympy.core.sorting import ordered\n- multiset = list(ordered(multiset))\n- n = len(multiset)\n- if m and m > n:\n- return\n- if m == 1:\n- yield [multiset[:]]\n- return\n-\n- # Split the information of the multiset into two lists -\n- # one of the elements themselves, and one (of the same length)\n- # giving the number of repeats for the corresponding element.\n- elements, multiplicities = zip(*group(multiset, False))\n-\n- if len(elements) < len(multiset):\n- # General case - multiset with more than one distinct element\n- # and at least one element repeated more than once.\n- if m:\n- mpt = MultisetPartitionTraverser()\n- for state in mpt.enum_range(multiplicities, m-1, m):\n- yield list_visitor(state, elements)\n- else:\n- for state in multiset_partitions_taocp(multiplicities):\n- yield list_visitor(state, elements)\n- else:\n- # Set partitions case - no repeated elements. Pretty much\n- # same as int argument case above, with same possible, but\n- # currently unimplemented optimization for some cases when\n- # m is not None\n- for nc, q in _set_partitions(n):\n- if m is None or nc == m:\n- rv = [[] for i in range(nc)]\n- for i in range(n):\n- rv[q[i]].append(i)\n- yield [[multiset[j] for j in i] for i in rv]\n \n \n def partitions(n, m=None, k=None, size=False):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/utilities/iterables.py.\nHere is the description for the function:\ndef multiset_partitions(multiset, m=None):\n \"\"\"\n Return unique partitions of the given multiset (in list form).\n If ``m`` is None, all multisets will be returned, otherwise only\n partitions with ``m`` parts will be returned.\n\n If ``multiset`` is an integer, a range [0, 1, ..., multiset - 1]\n will be supplied.\n\n Examples\n ========\n\n >>> from sympy.utilities.iterables import multiset_partitions\n >>> list(multiset_partitions([1, 2, 3, 4], 2))\n [[[1, 2, 3], [4]], [[1, 2, 4], [3]], [[1, 2], [3, 4]],\n [[1, 3, 4], [2]], [[1, 3], [2, 4]], [[1, 4], [2, 3]],\n [[1], [2, 3, 4]]]\n >>> list(multiset_partitions([1, 2, 3, 4], 1))\n [[[1, 2, 3, 4]]]\n\n Only unique partitions are returned and these will be returned in a\n canonical order regardless of the order of the input:\n\n >>> a = [1, 2, 2, 1]\n >>> ans = list(multiset_partitions(a, 2))\n >>> a.sort()\n >>> list(multiset_partitions(a, 2)) == ans\n True\n >>> a = range(3, 1, -1)\n >>> (list(multiset_partitions(a)) ==\n ... list(multiset_partitions(sorted(a))))\n True\n\n If m is omitted then all partitions will be returned:\n\n >>> list(multiset_partitions([1, 1, 2]))\n [[[1, 1, 2]], [[1, 1], [2]], [[1, 2], [1]], [[1], [1], [2]]]\n >>> list(multiset_partitions([1]*3))\n [[[1, 1, 1]], [[1], [1, 1]], [[1], [1], [1]]]\n\n Counting\n ========\n\n The number of partitions of a set is given by the bell number:\n\n >>> from sympy import bell\n >>> len(list(multiset_partitions(5))) == bell(5) == 52\n True\n\n The number of partitions of length k from a set of size n is given by the\n Stirling Number of the 2nd kind:\n\n >>> from sympy.functions.combinatorial.numbers import stirling\n >>> stirling(5, 2) == len(list(multiset_partitions(5, 2))) == 15\n True\n\n These comments on counting apply to *sets*, not multisets.\n\n Notes\n =====\n\n When all the elements are the same in the multiset, the order\n of the returned partitions is determined by the ``partitions``\n routine. If one is counting partitions then it is better to use\n the ``nT`` function.\n\n See Also\n ========\n\n partitions\n sympy.combinatorics.partitions.Partition\n sympy.combinatorics.partitions.IntegerPartition\n sympy.functions.combinatorial.numbers.nT\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/stats/tests/test_continuous_rv.py::test_single_normal", "sympy/utilities/tests/test_iterables.py::test_multiset_partitions", "sympy/utilities/tests/test_iterables.py::test_kbins", "sympy/integrals/tests/test_integrals.py::test_issue_18133", "sympy/functions/combinatorial/tests/test_comb_numbers.py::test_nC_nP_nT", "sympy/integrals/tests/test_meijerint.py::test_recursive", "sympy/integrals/tests/test_meijerint.py::test_bessel", "sympy/integrals/tests/test_transforms.py::test_mellin_transform2", "sympy/integrals/tests/test_transforms.py::test_fourier_transform", "sympy/stats/tests/test_compound_rv.py::test_normal_CompoundDist", "sympy/stats/tests/test_continuous_rv.py::test_random_parameters", "sympy/stats/tests/test_continuous_rv.py::test_conjugate_priors", "sympy/stats/tests/test_continuous_rv.py::test_precomputed_cdf", "sympy/stats/tests/test_symbolic_probability.py::test_literal_probability", "sympy/stats/tests/test_compound_rv.py::test_Compound_Distribution", "sympy/integrals/tests/test_transforms.py::test_cosine_transform", "sympy/integrals/tests/test_integrals.py::test_issue_14078" ], "PASS_TO_PASS": null }
sympy__sympy-73
1.0
{ "code": "diff --git b/sympy/utilities/enumerative.py a/sympy/utilities/enumerative.py\nindex dfad9f68b6..dcdabf064a 100644\n--- b/sympy/utilities/enumerative.py\n+++ a/sympy/utilities/enumerative.py\n@@ -209,6 +209,90 @@ def multiset_partitions_taocp(multiplicities):\n \n \"\"\"\n \n+ # Important variables.\n+ # m is the number of components, i.e., number of distinct elements\n+ m = len(multiplicities)\n+ # n is the cardinality, total number of elements whether or not distinct\n+ n = sum(multiplicities)\n+\n+ # The main data structure, f segments pstack into parts. See\n+ # list_visitor() for example code indicating how this internal\n+ # state corresponds to a partition.\n+\n+ # Note: allocation of space for stack is conservative. Knuth's\n+ # exercise 7.2.1.5.68 gives some indication of how to tighten this\n+ # bound, but this is not implemented.\n+ pstack = [PartComponent() for i in range(n * m + 1)]\n+ f = [0] * (n + 1)\n+\n+ # Step M1 in Knuth (Initialize)\n+ # Initial state - entire multiset in one part.\n+ for j in range(m):\n+ ps = pstack[j]\n+ ps.c = j\n+ ps.u = multiplicities[j]\n+ ps.v = multiplicities[j]\n+\n+ # Other variables\n+ f[0] = 0\n+ a = 0\n+ lpart = 0\n+ f[1] = m\n+ b = m # in general, current stack frame is from a to b - 1\n+\n+ while True:\n+ while True:\n+ # Step M2 (Subtract v from u)\n+ k = b\n+ x = False\n+ for j in range(a, b):\n+ pstack[k].u = pstack[j].u - pstack[j].v\n+ if pstack[k].u == 0:\n+ x = True\n+ elif not x:\n+ pstack[k].c = pstack[j].c\n+ pstack[k].v = min(pstack[j].v, pstack[k].u)\n+ x = pstack[k].u < pstack[j].v\n+ k = k + 1\n+ else: # x is True\n+ pstack[k].c = pstack[j].c\n+ pstack[k].v = pstack[k].u\n+ k = k + 1\n+ # Note: x is True iff v has changed\n+\n+ # Step M3 (Push if nonzero.)\n+ if k > b:\n+ a = b\n+ b = k\n+ lpart = lpart + 1\n+ f[lpart + 1] = b\n+ # Return to M2\n+ else:\n+ break # Continue to M4\n+\n+ # M4 Visit a partition\n+ state = [f, lpart, pstack]\n+ yield state\n+\n+ # M5 (Decrease v)\n+ while True:\n+ j = b-1\n+ while (pstack[j].v == 0):\n+ j = j - 1\n+ if j == a and pstack[j].v == 1:\n+ # M6 (Backtrack)\n+ if lpart == 0:\n+ return\n+ lpart = lpart - 1\n+ b = a\n+ a = f[lpart]\n+ # Return to M5\n+ else:\n+ pstack[j].v = pstack[j].v - 1\n+ for k in range(j + 1, b):\n+ pstack[k].v = pstack[k].u\n+ break # GOTO M2\n+\n # --------------- Visitor functions for multiset partitions ---------------\n # A visitor takes the partition state generated by\n # multiset_partitions_taocp or other enumerator, and produces useful\n", "test": null }
null
{ "code": "diff --git a/sympy/utilities/enumerative.py b/sympy/utilities/enumerative.py\nindex dcdabf064a..dfad9f68b6 100644\n--- a/sympy/utilities/enumerative.py\n+++ b/sympy/utilities/enumerative.py\n@@ -209,90 +209,6 @@ def multiset_partitions_taocp(multiplicities):\n \n \"\"\"\n \n- # Important variables.\n- # m is the number of components, i.e., number of distinct elements\n- m = len(multiplicities)\n- # n is the cardinality, total number of elements whether or not distinct\n- n = sum(multiplicities)\n-\n- # The main data structure, f segments pstack into parts. See\n- # list_visitor() for example code indicating how this internal\n- # state corresponds to a partition.\n-\n- # Note: allocation of space for stack is conservative. Knuth's\n- # exercise 7.2.1.5.68 gives some indication of how to tighten this\n- # bound, but this is not implemented.\n- pstack = [PartComponent() for i in range(n * m + 1)]\n- f = [0] * (n + 1)\n-\n- # Step M1 in Knuth (Initialize)\n- # Initial state - entire multiset in one part.\n- for j in range(m):\n- ps = pstack[j]\n- ps.c = j\n- ps.u = multiplicities[j]\n- ps.v = multiplicities[j]\n-\n- # Other variables\n- f[0] = 0\n- a = 0\n- lpart = 0\n- f[1] = m\n- b = m # in general, current stack frame is from a to b - 1\n-\n- while True:\n- while True:\n- # Step M2 (Subtract v from u)\n- k = b\n- x = False\n- for j in range(a, b):\n- pstack[k].u = pstack[j].u - pstack[j].v\n- if pstack[k].u == 0:\n- x = True\n- elif not x:\n- pstack[k].c = pstack[j].c\n- pstack[k].v = min(pstack[j].v, pstack[k].u)\n- x = pstack[k].u < pstack[j].v\n- k = k + 1\n- else: # x is True\n- pstack[k].c = pstack[j].c\n- pstack[k].v = pstack[k].u\n- k = k + 1\n- # Note: x is True iff v has changed\n-\n- # Step M3 (Push if nonzero.)\n- if k > b:\n- a = b\n- b = k\n- lpart = lpart + 1\n- f[lpart + 1] = b\n- # Return to M2\n- else:\n- break # Continue to M4\n-\n- # M4 Visit a partition\n- state = [f, lpart, pstack]\n- yield state\n-\n- # M5 (Decrease v)\n- while True:\n- j = b-1\n- while (pstack[j].v == 0):\n- j = j - 1\n- if j == a and pstack[j].v == 1:\n- # M6 (Backtrack)\n- if lpart == 0:\n- return\n- lpart = lpart - 1\n- b = a\n- a = f[lpart]\n- # Return to M5\n- else:\n- pstack[j].v = pstack[j].v - 1\n- for k in range(j + 1, b):\n- pstack[k].v = pstack[k].u\n- break # GOTO M2\n-\n # --------------- Visitor functions for multiset partitions ---------------\n # A visitor takes the partition state generated by\n # multiset_partitions_taocp or other enumerator, and produces useful\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/utilities/enumerative.py.\nHere is the description for the function:\ndef multiset_partitions_taocp(multiplicities):\n \"\"\"Enumerates partitions of a multiset.\n\n Parameters\n ==========\n\n multiplicities\n list of integer multiplicities of the components of the multiset.\n\n Yields\n ======\n\n state\n Internal data structure which encodes a particular partition.\n This output is then usually processed by a visitor function\n which combines the information from this data structure with\n the components themselves to produce an actual partition.\n\n Unless they wish to create their own visitor function, users will\n have little need to look inside this data structure. But, for\n reference, it is a 3-element list with components:\n\n f\n is a frame array, which is used to divide pstack into parts.\n\n lpart\n points to the base of the topmost part.\n\n pstack\n is an array of PartComponent objects.\n\n The ``state`` output offers a peek into the internal data\n structures of the enumeration function. The client should\n treat this as read-only; any modification of the data\n structure will cause unpredictable (and almost certainly\n incorrect) results. Also, the components of ``state`` are\n modified in place at each iteration. Hence, the visitor must\n be called at each loop iteration. Accumulating the ``state``\n instances and processing them later will not work.\n\n Examples\n ========\n\n >>> from sympy.utilities.enumerative import list_visitor\n >>> from sympy.utilities.enumerative import multiset_partitions_taocp\n >>> # variables components and multiplicities represent the multiset 'abb'\n >>> components = 'ab'\n >>> multiplicities = [1, 2]\n >>> states = multiset_partitions_taocp(multiplicities)\n >>> list(list_visitor(state, components) for state in states)\n [[['a', 'b', 'b']],\n [['a', 'b'], ['b']],\n [['a'], ['b', 'b']],\n [['a'], ['b'], ['b']]]\n\n See Also\n ========\n\n sympy.utilities.iterables.multiset_partitions: Takes a multiset\n as input and directly yields multiset partitions. It\n dispatches to a number of functions, including this one, for\n implementation. Most users will find it more convenient to\n use than multiset_partitions_taocp.\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/utilities/tests/test_iterables.py::test_multiset_partitions", "sympy/functions/combinatorial/tests/test_comb_numbers.py::test_nC_nP_nT", "sympy/utilities/tests/test_enumerative.py::test_multiset_partitions_taocp", "sympy/utilities/tests/test_enumerative.py::test_multiset_partitions_versions", "sympy/utilities/tests/test_enumerative.py::test_subrange", "sympy/utilities/tests/test_enumerative.py::test_subrange_large" ], "PASS_TO_PASS": null }
sympy__sympy-74
1.0
{ "code": "diff --git b/sympy/codegen/algorithms.py a/sympy/codegen/algorithms.py\nindex a868950fb5..f4890eb8c2 100644\n--- b/sympy/codegen/algorithms.py\n+++ a/sympy/codegen/algorithms.py\n@@ -72,6 +72,45 @@ def newtons_method(expr, wrt, atol=1e-12, delta=None, *, rtol=4e-16, debug=False\n \n \"\"\"\n \n+ if delta is None:\n+ delta = Dummy()\n+ Wrapper = Scope\n+ name_d = 'delta'\n+ else:\n+ Wrapper = lambda x: x\n+ name_d = delta.name\n+\n+ delta_expr = delta_fn(expr, wrt)\n+ if cse:\n+ from sympy.simplify.cse_main import cse\n+ cses, (red,) = cse([delta_expr.factor()])\n+ whl_bdy = [Assignment(dum, sub_e) for dum, sub_e in cses]\n+ whl_bdy += [Assignment(delta, red)]\n+ else:\n+ whl_bdy = [Assignment(delta, delta_expr)]\n+ if handle_nan is not None:\n+ whl_bdy += [While(isnan(delta), CodeBlock(handle_nan, break_))]\n+ whl_bdy += [AddAugmentedAssignment(wrt, delta)]\n+ if bounds is not None:\n+ whl_bdy += [Assignment(wrt, Min(Max(wrt, bounds[0]), bounds[1]))]\n+ if debug:\n+ prnt = Print([wrt, delta], r\"{}=%12.5g {}=%12.5g\\n\".format(wrt.name, name_d))\n+ whl_bdy += [prnt]\n+ req = Gt(Abs(delta), atol + rtol*Abs(wrt))\n+ declars = [Declaration(Variable(delta, type=real, value=oo))]\n+ if itermax is not None:\n+ counter = counter or Dummy(integer=True)\n+ v_counter = Variable.deduced(counter, 0)\n+ declars.append(Declaration(v_counter))\n+ whl_bdy.append(AddAugmentedAssignment(counter, 1))\n+ req = And(req, Lt(counter, itermax))\n+ whl = While(req, CodeBlock(*whl_bdy))\n+ blck = declars\n+ if debug:\n+ blck.append(Print([wrt], r\"{}=%12.5g\\n\".format(wrt.name)))\n+ blck += [whl]\n+ return Wrapper(CodeBlock(*blck))\n+\n \n def _symbol_of(arg):\n if isinstance(arg, Declaration):\n", "test": null }
null
{ "code": "diff --git a/sympy/codegen/algorithms.py b/sympy/codegen/algorithms.py\nindex f4890eb8c2..a868950fb5 100644\n--- a/sympy/codegen/algorithms.py\n+++ b/sympy/codegen/algorithms.py\n@@ -72,45 +72,6 @@ def newtons_method(expr, wrt, atol=1e-12, delta=None, *, rtol=4e-16, debug=False\n \n \"\"\"\n \n- if delta is None:\n- delta = Dummy()\n- Wrapper = Scope\n- name_d = 'delta'\n- else:\n- Wrapper = lambda x: x\n- name_d = delta.name\n-\n- delta_expr = delta_fn(expr, wrt)\n- if cse:\n- from sympy.simplify.cse_main import cse\n- cses, (red,) = cse([delta_expr.factor()])\n- whl_bdy = [Assignment(dum, sub_e) for dum, sub_e in cses]\n- whl_bdy += [Assignment(delta, red)]\n- else:\n- whl_bdy = [Assignment(delta, delta_expr)]\n- if handle_nan is not None:\n- whl_bdy += [While(isnan(delta), CodeBlock(handle_nan, break_))]\n- whl_bdy += [AddAugmentedAssignment(wrt, delta)]\n- if bounds is not None:\n- whl_bdy += [Assignment(wrt, Min(Max(wrt, bounds[0]), bounds[1]))]\n- if debug:\n- prnt = Print([wrt, delta], r\"{}=%12.5g {}=%12.5g\\n\".format(wrt.name, name_d))\n- whl_bdy += [prnt]\n- req = Gt(Abs(delta), atol + rtol*Abs(wrt))\n- declars = [Declaration(Variable(delta, type=real, value=oo))]\n- if itermax is not None:\n- counter = counter or Dummy(integer=True)\n- v_counter = Variable.deduced(counter, 0)\n- declars.append(Declaration(v_counter))\n- whl_bdy.append(AddAugmentedAssignment(counter, 1))\n- req = And(req, Lt(counter, itermax))\n- whl = While(req, CodeBlock(*whl_bdy))\n- blck = declars\n- if debug:\n- blck.append(Print([wrt], r\"{}=%12.5g\\n\".format(wrt.name)))\n- blck += [whl]\n- return Wrapper(CodeBlock(*blck))\n-\n \n def _symbol_of(arg):\n if isinstance(arg, Declaration):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/codegen/algorithms.py.\nHere is the description for the function:\ndef newtons_method(expr, wrt, atol=1e-12, delta=None, *, rtol=4e-16, debug=False,\n itermax=None, counter=None, delta_fn=lambda e, x: -e/e.diff(x),\n cse=False, handle_nan=None,\n bounds=None):\n \"\"\" Generates an AST for Newton-Raphson method (a root-finding algorithm).\n\n Explanation\n ===========\n\n Returns an abstract syntax tree (AST) based on ``sympy.codegen.ast`` for Netwon's\n method of root-finding.\n\n Parameters\n ==========\n\n expr : expression\n wrt : Symbol\n With respect to, i.e. what is the variable.\n atol : number or expression\n Absolute tolerance (stopping criterion)\n rtol : number or expression\n Relative tolerance (stopping criterion)\n delta : Symbol\n Will be a ``Dummy`` if ``None``.\n debug : bool\n Whether to print convergence information during iterations\n itermax : number or expr\n Maximum number of iterations.\n counter : Symbol\n Will be a ``Dummy`` if ``None``.\n delta_fn: Callable[[Expr, Symbol], Expr]\n computes the step, default is newtons method. For e.g. Halley's method\n use delta_fn=lambda e, x: -2*e*e.diff(x)/(2*e.diff(x)**2 - e*e.diff(x, 2))\n cse: bool\n Perform common sub-expression elimination on delta expression\n handle_nan: Token\n How to handle occurrence of not-a-number (NaN).\n bounds: Optional[tuple[Expr, Expr]]\n Perform optimization within bounds\n\n Examples\n ========\n\n >>> from sympy import symbols, cos\n >>> from sympy.codegen.ast import Assignment\n >>> from sympy.codegen.algorithms import newtons_method\n >>> x, dx, atol = symbols('x dx atol')\n >>> expr = cos(x) - x**3\n >>> algo = newtons_method(expr, x, atol=atol, delta=dx)\n >>> algo.has(Assignment(dx, -expr/expr.diff(x)))\n True\n\n References\n ==========\n\n .. [1] https://en.wikipedia.org/wiki/Newton%27s_method\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/codegen/tests/test_algorithms.py::test_newtons_method", "sympy/codegen/tests/test_algorithms.py::test_newtons_method_function__pycode", "sympy/codegen/tests/test_algorithms.py::test_newtons_method_function__rtol_cse_nan" ], "PASS_TO_PASS": null }
sympy__sympy-75
1.0
{ "code": "diff --git b/sympy/utilities/iterables.py a/sympy/utilities/iterables.py\nindex 377ae16aeb..cc5c1152f0 100644\n--- b/sympy/utilities/iterables.py\n+++ a/sympy/utilities/iterables.py\n@@ -1653,6 +1653,77 @@ def partitions(n, m=None, k=None, size=False):\n sympy.combinatorics.partitions.IntegerPartition\n \n \"\"\"\n+ if (n <= 0 or\n+ m is not None and m < 1 or\n+ k is not None and k < 1 or\n+ m and k and m*k < n):\n+ # the empty set is the only way to handle these inputs\n+ # and returning {} to represent it is consistent with\n+ # the counting convention, e.g. nT(0) == 1.\n+ if size:\n+ yield 0, {}\n+ else:\n+ yield {}\n+ return\n+\n+ if m is None:\n+ m = n\n+ else:\n+ m = min(m, n)\n+ k = min(k or n, n)\n+\n+ n, m, k = as_int(n), as_int(m), as_int(k)\n+ q, r = divmod(n, k)\n+ ms = {k: q}\n+ keys = [k] # ms.keys(), from largest to smallest\n+ if r:\n+ ms[r] = 1\n+ keys.append(r)\n+ room = m - q - bool(r)\n+ if size:\n+ yield sum(ms.values()), ms.copy()\n+ else:\n+ yield ms.copy()\n+\n+ while keys != [1]:\n+ # Reuse any 1's.\n+ if keys[-1] == 1:\n+ del keys[-1]\n+ reuse = ms.pop(1)\n+ room += reuse\n+ else:\n+ reuse = 0\n+\n+ while 1:\n+ # Let i be the smallest key larger than 1. Reuse one\n+ # instance of i.\n+ i = keys[-1]\n+ newcount = ms[i] = ms[i] - 1\n+ reuse += i\n+ if newcount == 0:\n+ del keys[-1], ms[i]\n+ room += 1\n+\n+ # Break the remainder into pieces of size i-1.\n+ i -= 1\n+ q, r = divmod(reuse, i)\n+ need = q + bool(r)\n+ if need > room:\n+ if not keys:\n+ return\n+ continue\n+\n+ ms[i] = q\n+ keys.append(i)\n+ if r:\n+ ms[r] = 1\n+ keys.append(r)\n+ break\n+ room -= need\n+ if size:\n+ yield sum(ms.values()), ms.copy()\n+ else:\n+ yield ms.copy()\n \n \n def ordered_partitions(n, m=None, sort=True):\n", "test": null }
null
{ "code": "diff --git a/sympy/utilities/iterables.py b/sympy/utilities/iterables.py\nindex cc5c1152f0..377ae16aeb 100644\n--- a/sympy/utilities/iterables.py\n+++ b/sympy/utilities/iterables.py\n@@ -1653,77 +1653,6 @@ def partitions(n, m=None, k=None, size=False):\n sympy.combinatorics.partitions.IntegerPartition\n \n \"\"\"\n- if (n <= 0 or\n- m is not None and m < 1 or\n- k is not None and k < 1 or\n- m and k and m*k < n):\n- # the empty set is the only way to handle these inputs\n- # and returning {} to represent it is consistent with\n- # the counting convention, e.g. nT(0) == 1.\n- if size:\n- yield 0, {}\n- else:\n- yield {}\n- return\n-\n- if m is None:\n- m = n\n- else:\n- m = min(m, n)\n- k = min(k or n, n)\n-\n- n, m, k = as_int(n), as_int(m), as_int(k)\n- q, r = divmod(n, k)\n- ms = {k: q}\n- keys = [k] # ms.keys(), from largest to smallest\n- if r:\n- ms[r] = 1\n- keys.append(r)\n- room = m - q - bool(r)\n- if size:\n- yield sum(ms.values()), ms.copy()\n- else:\n- yield ms.copy()\n-\n- while keys != [1]:\n- # Reuse any 1's.\n- if keys[-1] == 1:\n- del keys[-1]\n- reuse = ms.pop(1)\n- room += reuse\n- else:\n- reuse = 0\n-\n- while 1:\n- # Let i be the smallest key larger than 1. Reuse one\n- # instance of i.\n- i = keys[-1]\n- newcount = ms[i] = ms[i] - 1\n- reuse += i\n- if newcount == 0:\n- del keys[-1], ms[i]\n- room += 1\n-\n- # Break the remainder into pieces of size i-1.\n- i -= 1\n- q, r = divmod(reuse, i)\n- need = q + bool(r)\n- if need > room:\n- if not keys:\n- return\n- continue\n-\n- ms[i] = q\n- keys.append(i)\n- if r:\n- ms[r] = 1\n- keys.append(r)\n- break\n- room -= need\n- if size:\n- yield sum(ms.values()), ms.copy()\n- else:\n- yield ms.copy()\n \n \n def ordered_partitions(n, m=None, sort=True):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/utilities/iterables.py.\nHere is the description for the function:\ndef partitions(n, m=None, k=None, size=False):\n \"\"\"Generate all partitions of positive integer, n.\n\n Each partition is represented as a dictionary, mapping an integer\n to the number of copies of that integer in the partition. For example,\n the first partition of 4 returned is {4: 1}, \"4: one of them\".\n\n Parameters\n ==========\n n : int\n m : int, optional\n limits number of parts in partition (mnemonic: m, maximum parts)\n k : int, optional\n limits the numbers that are kept in the partition (mnemonic: k, keys)\n size : bool, default: False\n If ``True``, (M, P) is returned where M is the sum of the\n multiplicities and P is the generated partition.\n If ``False``, only the generated partition is returned.\n\n Examples\n ========\n\n >>> from sympy.utilities.iterables import partitions\n\n The numbers appearing in the partition (the key of the returned dict)\n are limited with k:\n\n >>> for p in partitions(6, k=2): # doctest: +SKIP\n ... print(p)\n {2: 3}\n {1: 2, 2: 2}\n {1: 4, 2: 1}\n {1: 6}\n\n The maximum number of parts in the partition (the sum of the values in\n the returned dict) are limited with m (default value, None, gives\n partitions from 1 through n):\n\n >>> for p in partitions(6, m=2): # doctest: +SKIP\n ... print(p)\n ...\n {6: 1}\n {1: 1, 5: 1}\n {2: 1, 4: 1}\n {3: 2}\n\n References\n ==========\n\n .. [1] modified from Tim Peter's version to allow for k and m values:\n https://code.activestate.com/recipes/218332-generator-for-integer-partitions/\n\n See Also\n ========\n\n sympy.combinatorics.partitions.Partition\n sympy.combinatorics.partitions.IntegerPartition\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/utilities/tests/test_wester.py::test_F6", "sympy/utilities/tests/test_iterables.py::test_multiset_partitions", "sympy/utilities/tests/test_iterables.py::test_partitions", "sympy/utilities/tests/test_iterables.py::test_uniq", "sympy/utilities/tests/test_iterables.py::test_kbins", "sympy/functions/combinatorial/tests/test_comb_numbers.py::test_nC_nP_nT", "sympy/functions/combinatorial/tests/test_comb_numbers.py::test_nD_derangements", "sympy/combinatorics/tests/test_partitions.py::test_integer_partition", "sympy/integrals/tests/test_integrals.py::test_issue_14078" ], "PASS_TO_PASS": null }
sympy__sympy-76
1.0
{ "code": "diff --git b/sympy/solvers/pde.py a/sympy/solvers/pde.py\nindex 0b0e963767..de76d6f964 100644\n--- b/sympy/solvers/pde.py\n+++ a/sympy/solvers/pde.py\n@@ -162,6 +162,38 @@ def pdsolve(eq, func=None, hint='default', dict=False, solvefun=None, **kwargs):\n \n \"\"\"\n \n+ if not solvefun:\n+ solvefun = Function('F')\n+\n+ # See the docstring of _desolve for more details.\n+ hints = _desolve(eq, func=func, hint=hint, simplify=True,\n+ type='pde', **kwargs)\n+ eq = hints.pop('eq', False)\n+ all_ = hints.pop('all', False)\n+\n+ if all_:\n+ # TODO : 'best' hint should be implemented when adequate\n+ # number of hints are added.\n+ pdedict = {}\n+ failed_hints = {}\n+ gethints = classify_pde(eq, dict=True)\n+ pdedict.update({'order': gethints['order'],\n+ 'default': gethints['default']})\n+ for hint in hints:\n+ try:\n+ rv = _helper_simplify(eq, hint, hints[hint]['func'],\n+ hints[hint]['order'], hints[hint][hint], solvefun)\n+ except NotImplementedError as detail:\n+ failed_hints[hint] = detail\n+ else:\n+ pdedict[hint] = rv\n+ pdedict.update(failed_hints)\n+ return pdedict\n+\n+ else:\n+ return _helper_simplify(eq, hints['hint'], hints['func'],\n+ hints['order'], hints[hints['hint']], solvefun)\n+\n \n def _helper_simplify(eq, hint, func, order, match, solvefun):\n \"\"\"Helper function of pdsolve that calls the respective\n", "test": null }
null
{ "code": "diff --git a/sympy/solvers/pde.py b/sympy/solvers/pde.py\nindex de76d6f964..0b0e963767 100644\n--- a/sympy/solvers/pde.py\n+++ b/sympy/solvers/pde.py\n@@ -162,38 +162,6 @@ def pdsolve(eq, func=None, hint='default', dict=False, solvefun=None, **kwargs):\n \n \"\"\"\n \n- if not solvefun:\n- solvefun = Function('F')\n-\n- # See the docstring of _desolve for more details.\n- hints = _desolve(eq, func=func, hint=hint, simplify=True,\n- type='pde', **kwargs)\n- eq = hints.pop('eq', False)\n- all_ = hints.pop('all', False)\n-\n- if all_:\n- # TODO : 'best' hint should be implemented when adequate\n- # number of hints are added.\n- pdedict = {}\n- failed_hints = {}\n- gethints = classify_pde(eq, dict=True)\n- pdedict.update({'order': gethints['order'],\n- 'default': gethints['default']})\n- for hint in hints:\n- try:\n- rv = _helper_simplify(eq, hint, hints[hint]['func'],\n- hints[hint]['order'], hints[hint][hint], solvefun)\n- except NotImplementedError as detail:\n- failed_hints[hint] = detail\n- else:\n- pdedict[hint] = rv\n- pdedict.update(failed_hints)\n- return pdedict\n-\n- else:\n- return _helper_simplify(eq, hints['hint'], hints['func'],\n- hints['order'], hints[hints['hint']], solvefun)\n-\n \n def _helper_simplify(eq, hint, func, order, match, solvefun):\n \"\"\"Helper function of pdsolve that calls the respective\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/solvers/pde.py.\nHere is the description for the function:\ndef pdsolve(eq, func=None, hint='default', dict=False, solvefun=None, **kwargs):\n \"\"\"\n Solves any (supported) kind of partial differential equation.\n\n **Usage**\n\n pdsolve(eq, f(x,y), hint) -> Solve partial differential equation\n eq for function f(x,y), using method hint.\n\n **Details**\n\n ``eq`` can be any supported partial differential equation (see\n the pde docstring for supported methods). This can either\n be an Equality, or an expression, which is assumed to be\n equal to 0.\n\n ``f(x,y)`` is a function of two variables whose derivatives in that\n variable make up the partial differential equation. In many\n cases it is not necessary to provide this; it will be autodetected\n (and an error raised if it could not be detected).\n\n ``hint`` is the solving method that you want pdsolve to use. Use\n classify_pde(eq, f(x,y)) to get all of the possible hints for\n a PDE. The default hint, 'default', will use whatever hint\n is returned first by classify_pde(). See Hints below for\n more options that you can use for hint.\n\n ``solvefun`` is the convention used for arbitrary functions returned\n by the PDE solver. If not set by the user, it is set by default\n to be F.\n\n **Hints**\n\n Aside from the various solving methods, there are also some\n meta-hints that you can pass to pdsolve():\n\n \"default\":\n This uses whatever hint is returned first by\n classify_pde(). This is the default argument to\n pdsolve().\n\n \"all\":\n To make pdsolve apply all relevant classification hints,\n use pdsolve(PDE, func, hint=\"all\"). This will return a\n dictionary of hint:solution terms. If a hint causes\n pdsolve to raise the NotImplementedError, value of that\n hint's key will be the exception object raised. The\n dictionary will also include some special keys:\n\n - order: The order of the PDE. See also ode_order() in\n deutils.py\n - default: The solution that would be returned by\n default. This is the one produced by the hint that\n appears first in the tuple returned by classify_pde().\n\n \"all_Integral\":\n This is the same as \"all\", except if a hint also has a\n corresponding \"_Integral\" hint, it only returns the\n \"_Integral\" hint. This is useful if \"all\" causes\n pdsolve() to hang because of a difficult or impossible\n integral. This meta-hint will also be much faster than\n \"all\", because integrate() is an expensive routine.\n\n See also the classify_pde() docstring for more info on hints,\n and the pde docstring for a list of all supported hints.\n\n **Tips**\n - You can declare the derivative of an unknown function this way:\n\n >>> from sympy import Function, Derivative\n >>> from sympy.abc import x, y # x and y are the independent variables\n >>> f = Function(\"f\")(x, y) # f is a function of x and y\n >>> # fx will be the partial derivative of f with respect to x\n >>> fx = Derivative(f, x)\n >>> # fy will be the partial derivative of f with respect to y\n >>> fy = Derivative(f, y)\n\n - See test_pde.py for many tests, which serves also as a set of\n examples for how to use pdsolve().\n - pdsolve always returns an Equality class (except for the case\n when the hint is \"all\" or \"all_Integral\"). Note that it is not possible\n to get an explicit solution for f(x, y) as in the case of ODE's\n - Do help(pde.pde_hintname) to get help more information on a\n specific hint\n\n\n Examples\n ========\n\n >>> from sympy.solvers.pde import pdsolve\n >>> from sympy import Function, Eq\n >>> from sympy.abc import x, y\n >>> f = Function('f')\n >>> u = f(x, y)\n >>> ux = u.diff(x)\n >>> uy = u.diff(y)\n >>> eq = Eq(1 + (2*(ux/u)) + (3*(uy/u)), 0)\n >>> pdsolve(eq)\n Eq(f(x, y), F(3*x - 2*y)*exp(-2*x/13 - 3*y/13))\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/solvers/ode/tests/test_ode.py::test_dsolve_all_hint", "sympy/solvers/tests/test_pde.py::test_checkpdesol", "sympy/solvers/tests/test_pde.py::test_solvefun", "sympy/solvers/tests/test_pde.py::test_pde_1st_linear_constant_coeff_homogeneous", "sympy/solvers/tests/test_pde.py::test_pde_1st_linear_constant_coeff", "sympy/solvers/tests/test_pde.py::test_pdsolve_all", "sympy/solvers/tests/test_pde.py::test_pdsolve_variable_coeff", "sympy/solvers/ode/tests/test_lie_group.py::test_user_infinitesimals" ], "PASS_TO_PASS": null }
sympy__sympy-77
1.0
{ "code": "diff --git b/sympy/calculus/util.py a/sympy/calculus/util.py\nindex a051fd8f27..f0863259b2 100644\n--- b/sympy/calculus/util.py\n+++ a/sympy/calculus/util.py\n@@ -465,6 +465,137 @@ def periodicity(f, symbol, check=False):\n pi\n >>> periodicity(exp(x), x)\n \"\"\"\n+ if symbol.kind is not NumberKind:\n+ raise NotImplementedError(\"Cannot use symbol of kind %s\" % symbol.kind)\n+ temp = Dummy('x', real=True)\n+ f = f.subs(symbol, temp)\n+ symbol = temp\n+\n+ def _check(orig_f, period):\n+ '''Return the checked period or raise an error.'''\n+ new_f = orig_f.subs(symbol, symbol + period)\n+ if new_f.equals(orig_f):\n+ return period\n+ else:\n+ raise NotImplementedError(filldedent('''\n+ The period of the given function cannot be verified.\n+ When `%s` was replaced with `%s + %s` in `%s`, the result\n+ was `%s` which was not recognized as being the same as\n+ the original function.\n+ So either the period was wrong or the two forms were\n+ not recognized as being equal.\n+ Set check=False to obtain the value.''' %\n+ (symbol, symbol, period, orig_f, new_f)))\n+\n+ orig_f = f\n+ period = None\n+\n+ if isinstance(f, Relational):\n+ f = f.lhs - f.rhs\n+\n+ f = f.simplify()\n+\n+ if symbol not in f.free_symbols:\n+ return S.Zero\n+\n+ if isinstance(f, TrigonometricFunction):\n+ try:\n+ period = f.period(symbol)\n+ except NotImplementedError:\n+ pass\n+\n+ if isinstance(f, Abs):\n+ arg = f.args[0]\n+ if isinstance(arg, (sec, csc, cos)):\n+ # all but tan and cot might have a\n+ # a period that is half as large\n+ # so recast as sin\n+ arg = sin(arg.args[0])\n+ period = periodicity(arg, symbol)\n+ if period is not None and isinstance(arg, sin):\n+ # the argument of Abs was a trigonometric other than\n+ # cot or tan; test to see if the half-period\n+ # is valid. Abs(arg) has behaviour equivalent to\n+ # orig_f, so use that for test:\n+ orig_f = Abs(arg)\n+ try:\n+ return _check(orig_f, period/2)\n+ except NotImplementedError as err:\n+ if check:\n+ raise NotImplementedError(err)\n+ # else let new orig_f and period be\n+ # checked below\n+\n+ if isinstance(f, exp) or (f.is_Pow and f.base == S.Exp1):\n+ f = Pow(S.Exp1, expand_mul(f.exp))\n+ if im(f) != 0:\n+ period_real = periodicity(re(f), symbol)\n+ period_imag = periodicity(im(f), symbol)\n+ if period_real is not None and period_imag is not None:\n+ period = lcim([period_real, period_imag])\n+\n+ if f.is_Pow and f.base != S.Exp1:\n+ base, expo = f.args\n+ base_has_sym = base.has(symbol)\n+ expo_has_sym = expo.has(symbol)\n+\n+ if base_has_sym and not expo_has_sym:\n+ period = periodicity(base, symbol)\n+\n+ elif expo_has_sym and not base_has_sym:\n+ period = periodicity(expo, symbol)\n+\n+ else:\n+ period = _periodicity(f.args, symbol)\n+\n+ elif f.is_Mul:\n+ coeff, g = f.as_independent(symbol, as_Add=False)\n+ if isinstance(g, TrigonometricFunction) or not equal_valued(coeff, 1):\n+ period = periodicity(g, symbol)\n+ else:\n+ period = _periodicity(g.args, symbol)\n+\n+ elif f.is_Add:\n+ k, g = f.as_independent(symbol)\n+ if k is not S.Zero:\n+ return periodicity(g, symbol)\n+\n+ period = _periodicity(g.args, symbol)\n+\n+ elif isinstance(f, Mod):\n+ a, n = f.args\n+\n+ if a == symbol:\n+ period = n\n+ elif isinstance(a, TrigonometricFunction):\n+ period = periodicity(a, symbol)\n+ #check if 'f' is linear in 'symbol'\n+ elif (a.is_polynomial(symbol) and degree(a, symbol) == 1 and\n+ symbol not in n.free_symbols):\n+ period = Abs(n / a.diff(symbol))\n+\n+ elif isinstance(f, Piecewise):\n+ pass # not handling Piecewise yet as the return type is not favorable\n+\n+ elif period is None:\n+ from sympy.solvers.decompogen import compogen, decompogen\n+ g_s = decompogen(f, symbol)\n+ num_of_gs = len(g_s)\n+ if num_of_gs > 1:\n+ for index, g in enumerate(reversed(g_s)):\n+ start_index = num_of_gs - 1 - index\n+ g = compogen(g_s[start_index:], symbol)\n+ if g not in (orig_f, f): # Fix for issue 12620\n+ period = periodicity(g, symbol)\n+ if period is not None:\n+ break\n+\n+ if period is not None:\n+ if check:\n+ return _check(orig_f, period)\n+ return period\n+\n+ return None\n \n \n def _periodicity(args, symbol):\n", "test": null }
null
{ "code": "diff --git a/sympy/calculus/util.py b/sympy/calculus/util.py\nindex f0863259b2..a051fd8f27 100644\n--- a/sympy/calculus/util.py\n+++ b/sympy/calculus/util.py\n@@ -465,137 +465,6 @@ def periodicity(f, symbol, check=False):\n pi\n >>> periodicity(exp(x), x)\n \"\"\"\n- if symbol.kind is not NumberKind:\n- raise NotImplementedError(\"Cannot use symbol of kind %s\" % symbol.kind)\n- temp = Dummy('x', real=True)\n- f = f.subs(symbol, temp)\n- symbol = temp\n-\n- def _check(orig_f, period):\n- '''Return the checked period or raise an error.'''\n- new_f = orig_f.subs(symbol, symbol + period)\n- if new_f.equals(orig_f):\n- return period\n- else:\n- raise NotImplementedError(filldedent('''\n- The period of the given function cannot be verified.\n- When `%s` was replaced with `%s + %s` in `%s`, the result\n- was `%s` which was not recognized as being the same as\n- the original function.\n- So either the period was wrong or the two forms were\n- not recognized as being equal.\n- Set check=False to obtain the value.''' %\n- (symbol, symbol, period, orig_f, new_f)))\n-\n- orig_f = f\n- period = None\n-\n- if isinstance(f, Relational):\n- f = f.lhs - f.rhs\n-\n- f = f.simplify()\n-\n- if symbol not in f.free_symbols:\n- return S.Zero\n-\n- if isinstance(f, TrigonometricFunction):\n- try:\n- period = f.period(symbol)\n- except NotImplementedError:\n- pass\n-\n- if isinstance(f, Abs):\n- arg = f.args[0]\n- if isinstance(arg, (sec, csc, cos)):\n- # all but tan and cot might have a\n- # a period that is half as large\n- # so recast as sin\n- arg = sin(arg.args[0])\n- period = periodicity(arg, symbol)\n- if period is not None and isinstance(arg, sin):\n- # the argument of Abs was a trigonometric other than\n- # cot or tan; test to see if the half-period\n- # is valid. Abs(arg) has behaviour equivalent to\n- # orig_f, so use that for test:\n- orig_f = Abs(arg)\n- try:\n- return _check(orig_f, period/2)\n- except NotImplementedError as err:\n- if check:\n- raise NotImplementedError(err)\n- # else let new orig_f and period be\n- # checked below\n-\n- if isinstance(f, exp) or (f.is_Pow and f.base == S.Exp1):\n- f = Pow(S.Exp1, expand_mul(f.exp))\n- if im(f) != 0:\n- period_real = periodicity(re(f), symbol)\n- period_imag = periodicity(im(f), symbol)\n- if period_real is not None and period_imag is not None:\n- period = lcim([period_real, period_imag])\n-\n- if f.is_Pow and f.base != S.Exp1:\n- base, expo = f.args\n- base_has_sym = base.has(symbol)\n- expo_has_sym = expo.has(symbol)\n-\n- if base_has_sym and not expo_has_sym:\n- period = periodicity(base, symbol)\n-\n- elif expo_has_sym and not base_has_sym:\n- period = periodicity(expo, symbol)\n-\n- else:\n- period = _periodicity(f.args, symbol)\n-\n- elif f.is_Mul:\n- coeff, g = f.as_independent(symbol, as_Add=False)\n- if isinstance(g, TrigonometricFunction) or not equal_valued(coeff, 1):\n- period = periodicity(g, symbol)\n- else:\n- period = _periodicity(g.args, symbol)\n-\n- elif f.is_Add:\n- k, g = f.as_independent(symbol)\n- if k is not S.Zero:\n- return periodicity(g, symbol)\n-\n- period = _periodicity(g.args, symbol)\n-\n- elif isinstance(f, Mod):\n- a, n = f.args\n-\n- if a == symbol:\n- period = n\n- elif isinstance(a, TrigonometricFunction):\n- period = periodicity(a, symbol)\n- #check if 'f' is linear in 'symbol'\n- elif (a.is_polynomial(symbol) and degree(a, symbol) == 1 and\n- symbol not in n.free_symbols):\n- period = Abs(n / a.diff(symbol))\n-\n- elif isinstance(f, Piecewise):\n- pass # not handling Piecewise yet as the return type is not favorable\n-\n- elif period is None:\n- from sympy.solvers.decompogen import compogen, decompogen\n- g_s = decompogen(f, symbol)\n- num_of_gs = len(g_s)\n- if num_of_gs > 1:\n- for index, g in enumerate(reversed(g_s)):\n- start_index = num_of_gs - 1 - index\n- g = compogen(g_s[start_index:], symbol)\n- if g not in (orig_f, f): # Fix for issue 12620\n- period = periodicity(g, symbol)\n- if period is not None:\n- break\n-\n- if period is not None:\n- if check:\n- return _check(orig_f, period)\n- return period\n-\n- return None\n \n \n def _periodicity(args, symbol):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/calculus/util.py.\nHere is the description for the function:\ndef periodicity(f, symbol, check=False):\n \"\"\"\n Tests the given function for periodicity in the given symbol.\n\n Parameters\n ==========\n\n f : :py:class:`~.Expr`\n The concerned function.\n symbol : :py:class:`~.Symbol`\n The variable for which the period is to be determined.\n check : bool, optional\n The flag to verify whether the value being returned is a period or not.\n\n Returns\n =======\n\n period\n The period of the function is returned.\n ``None`` is returned when the function is aperiodic or has a complex period.\n The value of $0$ is returned as the period of a constant function.\n\n Raises\n ======\n\n NotImplementedError\n The value of the period computed cannot be verified.\n\n\n Notes\n =====\n\n Currently, we do not support functions with a complex period.\n The period of functions having complex periodic values such\n as ``exp``, ``sinh`` is evaluated to ``None``.\n\n The value returned might not be the \"fundamental\" period of the given\n function i.e. it may not be the smallest periodic value of the function.\n\n The verification of the period through the ``check`` flag is not reliable\n due to internal simplification of the given expression. Hence, it is set\n to ``False`` by default.\n\n Examples\n ========\n >>> from sympy import periodicity, Symbol, sin, cos, tan, exp\n >>> x = Symbol('x')\n >>> f = sin(x) + sin(2*x) + sin(3*x)\n >>> periodicity(f, x)\n 2*pi\n >>> periodicity(sin(x)*cos(x), x)\n pi\n >>> periodicity(exp(tan(2*x) - 1), x)\n pi/2\n >>> periodicity(sin(4*x)**cos(2*x), x)\n pi\n >>> periodicity(exp(x), x)\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise1", "sympy/integrals/tests/test_integrals.py::test_constructor", "sympy/core/tests/test_relational.py::test_univariate_relational_as_set", "sympy/series/tests/test_limits.py::test_piecewise", "sympy/simplify/tests/test_cse.py::test_issue_7840", "sympy/series/tests/test_limits.py::test_piecewise2", "sympy/sets/tests/test_sets.py::test_Union_as_relational", "sympy/sets/tests/test_sets.py::test_image_piecewise", "sympy/logic/tests/test_boolalg.py::test_bool_as_set", "sympy/logic/tests/test_boolalg.py::test_issue_8777", "sympy/logic/tests/test_boolalg.py::test_issue_8975", "sympy/sets/tests/test_sets.py::test_issue_14336", "sympy/core/tests/test_relational.py::test_issue_18188", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_fold_piecewise_in_cond", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_fold_piecewise_in_cond_2", "sympy/geometry/tests/test_line.py::test_basic_properties_2d", "sympy/functions/elementary/tests/test_piecewise.py::test_as_expr_set_pairs", "sympy/solvers/tests/test_inequalities.py::test_reduce_rational_inequalities_real_relational", "sympy/solvers/tests/test_inequalities.py::test_reduce_inequalities_general", "sympy/solvers/tests/test_inequalities.py::test_reduce_inequalities_errors", "sympy/simplify/tests/test_simplify.py::test_Piecewise", "sympy/solvers/tests/test_inequalities.py::test_solve_univariate_inequality", "sympy/solvers/tests/test_inequalities.py::test_trig_inequalities", "sympy/solvers/tests/test_inequalities.py::test_issue_8974", "sympy/solvers/tests/test_inequalities.py::test_issue_10198", "sympy/solvers/tests/test_inequalities.py::test_issue_10047", "sympy/functions/elementary/tests/test_piecewise.py::test__intervals", "sympy/solvers/tests/test_inequalities.py::test_issue_10268", "sympy/functions/elementary/tests/test_piecewise.py::test_containment", "sympy/solvers/tests/test_inequalities.py::test_integer_domain_relational_isolve", "sympy/solvers/tests/test_inequalities.py::test_issue_10671_12466", "sympy/solvers/tests/test_inequalities.py::test__solve_inequality", "sympy/functions/elementary/tests/test_piecewise.py::test_unevaluated_integrals", "sympy/solvers/tests/test_inequalities.py::test_issue_25697", "sympy/stats/tests/test_continuous_rv.py::test_beta", "sympy/solvers/tests/test_inequalities.py::test_issue_25738", "sympy/functions/elementary/tests/test_piecewise.py::test_conditions_as_alternate_booleans", "sympy/solvers/tests/test_inequalities.py::test_issue_25983", "sympy/stats/tests/test_continuous_rv.py::test_betaprime", "sympy/functions/elementary/tests/test_piecewise.py::test_Piecewise_rewrite_as_ITE", "sympy/stats/tests/test_continuous_rv.py::test_BoundedPareto", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_14052", "sympy/stats/tests/test_continuous_rv.py::test_dagum", "sympy/calculus/tests/test_util.py::test_function_range", "sympy/calculus/tests/test_util.py::test_continuous_domain", "sympy/calculus/tests/test_util.py::test_not_empty_in", "sympy/calculus/tests/test_util.py::test_periodicity", "sympy/calculus/tests/test_util.py::test_periodicity_check", "sympy/calculus/tests/test_util.py::test_is_convex", "sympy/calculus/tests/test_util.py::test_stationary_points", "sympy/stats/tests/test_continuous_rv.py::test_Lomax", "sympy/calculus/tests/test_util.py::test_maximum", "sympy/calculus/tests/test_util.py::test_minimum", "sympy/calculus/tests/test_util.py::test_issue_19869", "sympy/calculus/tests/test_util.py::test_issue_16469", "sympy/calculus/tests/test_util.py::test_issue_18747", "sympy/calculus/tests/test_util.py::test_issue_25942", "sympy/integrals/tests/test_integrals.py::test_integrate_max_min", "sympy/stats/tests/test_continuous_rv.py::test_nakagami", "sympy/utilities/tests/test_wester.py::test_M30", "sympy/utilities/tests/test_wester.py::test_M31", "sympy/stats/tests/test_continuous_rv.py::test_pareto_numeric", "sympy/utilities/tests/test_wester.py::test_N9", "sympy/utilities/tests/test_wester.py::test_N10", "sympy/utilities/tests/test_wester.py::test_N11", "sympy/utilities/tests/test_wester.py::test_N12", "sympy/utilities/tests/test_wester.py::test_N13", "sympy/utilities/tests/test_wester.py::test_N15", "sympy/stats/tests/test_continuous_rv.py::test_PowerFunction", "sympy/utilities/tests/test_wester.py::test_N16", "sympy/stats/tests/test_continuous_rv.py::test_trapezoidal", "sympy/stats/tests/test_stochastic_process.py::test_DiscreteMarkovChain", "sympy/calculus/tests/test_singularities.py::test_is_increasing", "sympy/stats/tests/test_stochastic_process.py::test_ContinuousMarkovChain", "sympy/calculus/tests/test_singularities.py::test_is_strictly_increasing", "sympy/stats/tests/test_continuous_rv.py::test_uniform", "sympy/calculus/tests/test_singularities.py::test_is_decreasing", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_16715", "sympy/calculus/tests/test_singularities.py::test_is_strictly_decreasing", "sympy/stats/tests/test_stochastic_process.py::test_PoissonProcess", "sympy/calculus/tests/test_singularities.py::test_issue_23401", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_20360", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise__eval_is_meromorphic", "sympy/integrals/tests/test_meijerint.py::test_messy", "sympy/concrete/tests/test_sums_products.py::test_issue_15852", "sympy/codegen/tests/test_approximations.py::test_SumApprox_monotone_terms", "sympy/solvers/tests/test_simplex.py::test_lp", "sympy/stats/tests/test_symbolic_probability.py::test_literal_probability", "sympy/integrals/tests/test_failing_integrals.py::test_issue_15925b", "sympy/solvers/tests/test_simplex.py::test_simplex", "sympy/solvers/tests/test_simplex.py::test_lpmin_lpmax", "sympy/solvers/tests/test_simplex.py::test_linprog", "sympy/concrete/tests/test_sums_products.py::test_issue_17165", "sympy/utilities/tests/test_wester.py::test_U13", "sympy/solvers/tests/test_solvers.py::test_solve_inequalities", "sympy/vector/tests/test_integrals.py::test_parametric_surfaceintegrals", "sympy/stats/tests/test_continuous_rv.py::test_FiniteSet_prob", "sympy/stats/tests/test_continuous_rv.py::test_prob_neq", "sympy/stats/tests/test_continuous_rv.py::test_ContinuousDistributionHandmade", "sympy/integrals/tests/test_integrals.py::test_issue_4492", "sympy/concrete/tests/test_sums_products.py::test_process_limits", "sympy/solvers/tests/test_solvers.py::test_issue_17638", "sympy/solvers/tests/test_solvers.py::test_issue_17650", "sympy/solvers/tests/test_solveset.py::test_solve_abs", "sympy/solvers/tests/test_solveset.py::test_issue_9565", "sympy/solvers/tests/test_solveset.py::test_issue_10069", "sympy/solvers/tests/test_solveset.py::test_piecewise_solveset", "sympy/solvers/tests/test_solveset.py::test_solveset", "sympy/solvers/tests/test_solveset.py::test_conditionset", "sympy/solvers/tests/test_solveset.py::test_solvify", "sympy/solvers/tests/test_solveset.py::test_solvify_piecewise", "sympy/solvers/tests/test_solveset.py::test_abs_invert_solvify", "sympy/solvers/tests/test_solveset.py::test_solve_decomposition", "sympy/solvers/tests/test_solveset.py::test_integer_domain_relational", "sympy/solvers/tests/test_solveset.py::test_issue_8715", "sympy/solvers/tests/test_solveset.py::test_issue_10477", "sympy/solvers/tests/test_solveset.py::test_issue_10671", "sympy/solvers/tests/test_solveset.py::test_issue_11064", "sympy/solvers/tests/test_solveset.py::test_issue_12478", "sympy/solvers/tests/test_solveset.py::test_issue_12429", "sympy/solvers/tests/test_solveset.py::test_solveset_arg", "sympy/solvers/tests/test_solveset.py::test_issue_14223", "sympy/solvers/tests/test_solveset.py::test_issue_10158", "sympy/solvers/tests/test_solveset.py::test_issue_18359", "sympy/solvers/tests/test_solveset.py::test_issue_17565", "sympy/solvers/tests/test_solveset.py::test_issue_21890" ], "PASS_TO_PASS": null }
sympy__sympy-78
1.0
{ "code": "diff --git b/sympy/functions/elementary/piecewise.py a/sympy/functions/elementary/piecewise.py\nindex 5319e1ef8b..1881726641 100644\n--- b/sympy/functions/elementary/piecewise.py\n+++ a/sympy/functions/elementary/piecewise.py\n@@ -1484,3 +1484,33 @@ def piecewise_exclusive(expr, *, skip_nan=False, deep=True):\n Piecewise\n piecewise_fold\n \"\"\"\n+\n+ def make_exclusive(*pwargs):\n+\n+ cumcond = false\n+ newargs = []\n+\n+ # Handle the first n-1 cases\n+ for expr_i, cond_i in pwargs[:-1]:\n+ cancond = And(cond_i, Not(cumcond)).simplify()\n+ cumcond = Or(cond_i, cumcond).simplify()\n+ newargs.append((expr_i, cancond))\n+\n+ # For the nth case defer simplification of cumcond\n+ expr_n, cond_n = pwargs[-1]\n+ cancond_n = And(cond_n, Not(cumcond)).simplify()\n+ newargs.append((expr_n, cancond_n))\n+\n+ if not skip_nan:\n+ cumcond = Or(cond_n, cumcond).simplify()\n+ if cumcond is not true:\n+ newargs.append((Undefined, Not(cumcond).simplify()))\n+\n+ return Piecewise(*newargs, evaluate=False)\n+\n+ if deep:\n+ return expr.replace(Piecewise, make_exclusive)\n+ elif isinstance(expr, Piecewise):\n+ return make_exclusive(*expr.args)\n+ else:\n+ return expr\n", "test": null }
null
{ "code": "diff --git a/sympy/functions/elementary/piecewise.py b/sympy/functions/elementary/piecewise.py\nindex 1881726641..5319e1ef8b 100644\n--- a/sympy/functions/elementary/piecewise.py\n+++ b/sympy/functions/elementary/piecewise.py\n@@ -1484,33 +1484,3 @@ def piecewise_exclusive(expr, *, skip_nan=False, deep=True):\n Piecewise\n piecewise_fold\n \"\"\"\n-\n- def make_exclusive(*pwargs):\n-\n- cumcond = false\n- newargs = []\n-\n- # Handle the first n-1 cases\n- for expr_i, cond_i in pwargs[:-1]:\n- cancond = And(cond_i, Not(cumcond)).simplify()\n- cumcond = Or(cond_i, cumcond).simplify()\n- newargs.append((expr_i, cancond))\n-\n- # For the nth case defer simplification of cumcond\n- expr_n, cond_n = pwargs[-1]\n- cancond_n = And(cond_n, Not(cumcond)).simplify()\n- newargs.append((expr_n, cancond_n))\n-\n- if not skip_nan:\n- cumcond = Or(cond_n, cumcond).simplify()\n- if cumcond is not true:\n- newargs.append((Undefined, Not(cumcond).simplify()))\n-\n- return Piecewise(*newargs, evaluate=False)\n-\n- if deep:\n- return expr.replace(Piecewise, make_exclusive)\n- elif isinstance(expr, Piecewise):\n- return make_exclusive(*expr.args)\n- else:\n- return expr\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/functions/elementary/piecewise.py.\nHere is the description for the function:\ndef piecewise_exclusive(expr, *, skip_nan=False, deep=True):\n \"\"\"\n Rewrite :class:`Piecewise` with mutually exclusive conditions.\n\n Explanation\n ===========\n\n SymPy represents the conditions of a :class:`Piecewise` in an\n \"if-elif\"-fashion, allowing more than one condition to be simultaneously\n True. The interpretation is that the first condition that is True is the\n case that holds. While this is a useful representation computationally it\n is not how a piecewise formula is typically shown in a mathematical text.\n The :func:`piecewise_exclusive` function can be used to rewrite any\n :class:`Piecewise` with more typical mutually exclusive conditions.\n\n Note that further manipulation of the resulting :class:`Piecewise`, e.g.\n simplifying it, will most likely make it non-exclusive. Hence, this is\n primarily a function to be used in conjunction with printing the Piecewise\n or if one would like to reorder the expression-condition pairs.\n\n If it is not possible to determine that all possibilities are covered by\n the different cases of the :class:`Piecewise` then a final\n :class:`~sympy.core.numbers.NaN` case will be included explicitly. This\n can be prevented by passing ``skip_nan=True``.\n\n Examples\n ========\n\n >>> from sympy import piecewise_exclusive, Symbol, Piecewise, S\n >>> x = Symbol('x', real=True)\n >>> p = Piecewise((0, x < 0), (S.Half, x <= 0), (1, True))\n >>> piecewise_exclusive(p)\n Piecewise((0, x < 0), (1/2, Eq(x, 0)), (1, x > 0))\n >>> piecewise_exclusive(Piecewise((2, x > 1)))\n Piecewise((2, x > 1), (nan, x <= 1))\n >>> piecewise_exclusive(Piecewise((2, x > 1)), skip_nan=True)\n Piecewise((2, x > 1))\n\n Parameters\n ==========\n\n expr: a SymPy expression.\n Any :class:`Piecewise` in the expression will be rewritten.\n skip_nan: ``bool`` (default ``False``)\n If ``skip_nan`` is set to ``True`` then a final\n :class:`~sympy.core.numbers.NaN` case will not be included.\n deep: ``bool`` (default ``True``)\n If ``deep`` is ``True`` then :func:`piecewise_exclusive` will rewrite\n any :class:`Piecewise` subexpressions in ``expr`` rather than just\n rewriting ``expr`` itself.\n\n Returns\n =======\n\n An expression equivalent to ``expr`` but where all :class:`Piecewise` have\n been rewritten with mutually exclusive conditions.\n\n See Also\n ========\n\n Piecewise\n piecewise_fold\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_exclusive" ], "PASS_TO_PASS": null }
sympy__sympy-79
1.0
{ "code": "diff --git b/sympy/plotting/plot.py a/sympy/plotting/plot.py\nindex 6127fd1dc7..63da0440da 100644\n--- b/sympy/plotting/plot.py\n+++ a/sympy/plotting/plot.py\n@@ -394,6 +394,30 @@ def plot(*args, show=True, **kwargs):\n Plot, LineOver1DRangeSeries\n \n \"\"\"\n+ args = _plot_sympify(args)\n+ plot_expr = _check_arguments(args, 1, 1, **kwargs)\n+ params = kwargs.get(\"params\", None)\n+ free = set()\n+ for p in plot_expr:\n+ if not isinstance(p[1][0], str):\n+ free |= {p[1][0]}\n+ else:\n+ free |= {Symbol(p[1][0])}\n+ if params:\n+ free = free.difference(params.keys())\n+ x = free.pop() if free else Symbol(\"x\")\n+ kwargs.setdefault('xlabel', x)\n+ kwargs.setdefault('ylabel', Function('f')(x))\n+\n+ labels = kwargs.pop(\"label\", [])\n+ rendering_kw = kwargs.pop(\"rendering_kw\", None)\n+ series = _build_line_series(*plot_expr, **kwargs)\n+ _set_labels(series, labels, rendering_kw)\n+\n+ plots = plot_factory(*series, **kwargs)\n+ if show:\n+ plots.show()\n+ return plots\n \n \n def plot_parametric(*args, show=True, **kwargs):\n", "test": null }
null
{ "code": "diff --git a/sympy/plotting/plot.py b/sympy/plotting/plot.py\nindex 63da0440da..6127fd1dc7 100644\n--- a/sympy/plotting/plot.py\n+++ b/sympy/plotting/plot.py\n@@ -394,30 +394,6 @@ def plot(*args, show=True, **kwargs):\n Plot, LineOver1DRangeSeries\n \n \"\"\"\n- args = _plot_sympify(args)\n- plot_expr = _check_arguments(args, 1, 1, **kwargs)\n- params = kwargs.get(\"params\", None)\n- free = set()\n- for p in plot_expr:\n- if not isinstance(p[1][0], str):\n- free |= {p[1][0]}\n- else:\n- free |= {Symbol(p[1][0])}\n- if params:\n- free = free.difference(params.keys())\n- x = free.pop() if free else Symbol(\"x\")\n- kwargs.setdefault('xlabel', x)\n- kwargs.setdefault('ylabel', Function('f')(x))\n-\n- labels = kwargs.pop(\"label\", [])\n- rendering_kw = kwargs.pop(\"rendering_kw\", None)\n- series = _build_line_series(*plot_expr, **kwargs)\n- _set_labels(series, labels, rendering_kw)\n-\n- plots = plot_factory(*series, **kwargs)\n- if show:\n- plots.show()\n- return plots\n \n \n def plot_parametric(*args, show=True, **kwargs):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/plotting/plot.py.\nHere is the description for the function:\ndef plot(*args, show=True, **kwargs):\n \"\"\"Plots a function of a single variable as a curve.\n\n Parameters\n ==========\n\n args :\n The first argument is the expression representing the function\n of single variable to be plotted.\n\n The last argument is a 3-tuple denoting the range of the free\n variable. e.g. ``(x, 0, 5)``\n\n Typical usage examples are in the following:\n\n - Plotting a single expression with a single range.\n ``plot(expr, range, **kwargs)``\n - Plotting a single expression with the default range (-10, 10).\n ``plot(expr, **kwargs)``\n - Plotting multiple expressions with a single range.\n ``plot(expr1, expr2, ..., range, **kwargs)``\n - Plotting multiple expressions with multiple ranges.\n ``plot((expr1, range1), (expr2, range2), ..., **kwargs)``\n\n It is best practice to specify range explicitly because default\n range may change in the future if a more advanced default range\n detection algorithm is implemented.\n\n show : bool, optional\n The default value is set to ``True``. Set show to ``False`` and\n the function will not display the plot. The returned instance of\n the ``Plot`` class can then be used to save or display the plot\n by calling the ``save()`` and ``show()`` methods respectively.\n\n line_color : string, or float, or function, optional\n Specifies the color for the plot.\n See ``Plot`` to see how to set color for the plots.\n Note that by setting ``line_color``, it would be applied simultaneously\n to all the series.\n\n title : str, optional\n Title of the plot. It is set to the latex representation of\n the expression, if the plot has only one expression.\n\n label : str, optional\n The label of the expression in the plot. It will be used when\n called with ``legend``. Default is the name of the expression.\n e.g. ``sin(x)``\n\n xlabel : str or expression, optional\n Label for the x-axis.\n\n ylabel : str or expression, optional\n Label for the y-axis.\n\n xscale : 'linear' or 'log', optional\n Sets the scaling of the x-axis.\n\n yscale : 'linear' or 'log', optional\n Sets the scaling of the y-axis.\n\n axis_center : (float, float), optional\n Tuple of two floats denoting the coordinates of the center or\n {'center', 'auto'}\n\n xlim : (float, float), optional\n Denotes the x-axis limits, ``(min, max)```.\n\n ylim : (float, float), optional\n Denotes the y-axis limits, ``(min, max)```.\n\n annotations : list, optional\n A list of dictionaries specifying the type of annotation\n required. The keys in the dictionary should be equivalent\n to the arguments of the :external:mod:`matplotlib`'s\n :external:meth:`~matplotlib.axes.Axes.annotate` method.\n\n markers : list, optional\n A list of dictionaries specifying the type the markers required.\n The keys in the dictionary should be equivalent to the arguments\n of the :external:mod:`matplotlib`'s :external:func:`~matplotlib.pyplot.plot()` function\n along with the marker related keyworded arguments.\n\n rectangles : list, optional\n A list of dictionaries specifying the dimensions of the\n rectangles to be plotted. The keys in the dictionary should be\n equivalent to the arguments of the :external:mod:`matplotlib`'s\n :external:class:`~matplotlib.patches.Rectangle` class.\n\n fill : dict, optional\n A dictionary specifying the type of color filling required in\n the plot. The keys in the dictionary should be equivalent to the\n arguments of the :external:mod:`matplotlib`'s\n :external:meth:`~matplotlib.axes.Axes.fill_between` method.\n\n adaptive : bool, optional\n The default value is set to ``True``. Set adaptive to ``False``\n and specify ``n`` if uniform sampling is required.\n\n The plotting uses an adaptive algorithm which samples\n recursively to accurately plot. The adaptive algorithm uses a\n random point near the midpoint of two points that has to be\n further sampled. Hence the same plots can appear slightly\n different.\n\n depth : int, optional\n Recursion depth of the adaptive algorithm. A depth of value\n `n` samples a maximum of `2^{n}` points.\n\n If the ``adaptive`` flag is set to ``False``, this will be\n ignored.\n\n n : int, optional\n Used when the ``adaptive`` is set to ``False``. The function\n is uniformly sampled at ``n`` number of points. If the ``adaptive``\n flag is set to ``True``, this will be ignored.\n This keyword argument replaces ``nb_of_points``, which should be\n considered deprecated.\n\n size : (float, float), optional\n A tuple in the form (width, height) in inches to specify the size of\n the overall figure. The default value is set to ``None``, meaning\n the size will be set by the default backend.\n\n Examples\n ========\n\n .. plot::\n :context: close-figs\n :format: doctest\n :include-source: True\n\n >>> from sympy import symbols\n >>> from sympy.plotting import plot\n >>> x = symbols('x')\n\n Single Plot\n\n .. plot::\n :context: close-figs\n :format: doctest\n :include-source: True\n\n >>> plot(x**2, (x, -5, 5))\n Plot object containing:\n [0]: cartesian line: x**2 for x over (-5.0, 5.0)\n\n Multiple plots with single range.\n\n .. plot::\n :context: close-figs\n :format: doctest\n :include-source: True\n\n >>> plot(x, x**2, x**3, (x, -5, 5))\n Plot object containing:\n [0]: cartesian line: x for x over (-5.0, 5.0)\n [1]: cartesian line: x**2 for x over (-5.0, 5.0)\n [2]: cartesian line: x**3 for x over (-5.0, 5.0)\n\n Multiple plots with different ranges.\n\n .. plot::\n :context: close-figs\n :format: doctest\n :include-source: True\n\n >>> plot((x**2, (x, -6, 6)), (x, (x, -5, 5)))\n Plot object containing:\n [0]: cartesian line: x**2 for x over (-6.0, 6.0)\n [1]: cartesian line: x for x over (-5.0, 5.0)\n\n No adaptive sampling.\n\n .. plot::\n :context: close-figs\n :format: doctest\n :include-source: True\n\n >>> plot(x**2, adaptive=False, n=400)\n Plot object containing:\n [0]: cartesian line: x**2 for x over (-10.0, 10.0)\n\n See Also\n ========\n\n Plot, LineOver1DRangeSeries\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/plotting/tests/test_plot.py::test_basic_plotting_backend", "sympy/plotting/tests/test_plot.py::test_custom_coloring" ], "PASS_TO_PASS": null }
sympy__sympy-80
1.0
{ "code": "diff --git b/sympy/ntheory/factor_.py a/sympy/ntheory/factor_.py\nindex e83287e9f8..b3baeeee47 100644\n--- b/sympy/ntheory/factor_.py\n+++ a/sympy/ntheory/factor_.py\n@@ -852,6 +852,30 @@ def pollard_pm1(n, B=10, a=2, retries=0, seed=1234):\n .. [3] https://www.cs.toronto.edu/~yuvalf/Factorization.pdf\n \"\"\"\n \n+ n = int(n)\n+ if n < 4 or B < 3:\n+ raise ValueError('pollard_pm1 should receive n > 3 and B > 2')\n+ randint = _randint(seed + B)\n+\n+ # computing a**lcm(1,2,3,..B) % n for B > 2\n+ # it looks weird, but it's right: primes run [2, B]\n+ # and the answer's not right until the loop is done.\n+ for i in range(retries + 1):\n+ aM = a\n+ for p in sieve.primerange(2, B + 1):\n+ e = int(math.log(B, p))\n+ aM = pow(aM, pow(p, e), n)\n+ g = gcd(aM - 1, n)\n+ if 1 < g < n:\n+ return int(g)\n+\n+ # get a new a:\n+ # since the exponent, lcm(1..B), is even, if we allow 'a' to be 'n-1'\n+ # then (n - 1)**even % n will be 1 which will give a g of 0 and 1 will\n+ # give a zero, too, so we set the range as [2, n-2]. Some references\n+ # say 'a' should be coprime to n, but either will detect factors.\n+ a = randint(2, n - 2)\n+\n \n def _trial(factors, n, candidates, verbose=False):\n \"\"\"\n", "test": null }
null
{ "code": "diff --git a/sympy/ntheory/factor_.py b/sympy/ntheory/factor_.py\nindex b3baeeee47..e83287e9f8 100644\n--- a/sympy/ntheory/factor_.py\n+++ b/sympy/ntheory/factor_.py\n@@ -852,30 +852,6 @@ def pollard_pm1(n, B=10, a=2, retries=0, seed=1234):\n .. [3] https://www.cs.toronto.edu/~yuvalf/Factorization.pdf\n \"\"\"\n \n- n = int(n)\n- if n < 4 or B < 3:\n- raise ValueError('pollard_pm1 should receive n > 3 and B > 2')\n- randint = _randint(seed + B)\n-\n- # computing a**lcm(1,2,3,..B) % n for B > 2\n- # it looks weird, but it's right: primes run [2, B]\n- # and the answer's not right until the loop is done.\n- for i in range(retries + 1):\n- aM = a\n- for p in sieve.primerange(2, B + 1):\n- e = int(math.log(B, p))\n- aM = pow(aM, pow(p, e), n)\n- g = gcd(aM - 1, n)\n- if 1 < g < n:\n- return int(g)\n-\n- # get a new a:\n- # since the exponent, lcm(1..B), is even, if we allow 'a' to be 'n-1'\n- # then (n - 1)**even % n will be 1 which will give a g of 0 and 1 will\n- # give a zero, too, so we set the range as [2, n-2]. Some references\n- # say 'a' should be coprime to n, but either will detect factors.\n- a = randint(2, n - 2)\n-\n \n def _trial(factors, n, candidates, verbose=False):\n \"\"\"\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/ntheory/factor_.py.\nHere is the description for the function:\ndef pollard_pm1(n, B=10, a=2, retries=0, seed=1234):\n \"\"\"\n Use Pollard's p-1 method to try to extract a nontrivial factor\n of ``n``. Either a divisor (perhaps composite) or ``None`` is returned.\n\n The value of ``a`` is the base that is used in the test gcd(a**M - 1, n).\n The default is 2. If ``retries`` > 0 then if no factor is found after the\n first attempt, a new ``a`` will be generated randomly (using the ``seed``)\n and the process repeated.\n\n Note: the value of M is lcm(1..B) = reduce(ilcm, range(2, B + 1)).\n\n A search is made for factors next to even numbers having a power smoothness\n less than ``B``. Choosing a larger B increases the likelihood of finding a\n larger factor but takes longer. Whether a factor of n is found or not\n depends on ``a`` and the power smoothness of the even number just less than\n the factor p (hence the name p - 1).\n\n Although some discussion of what constitutes a good ``a`` some\n descriptions are hard to interpret. At the modular.math site referenced\n below it is stated that if gcd(a**M - 1, n) = N then a**M % q**r is 1\n for every prime power divisor of N. But consider the following:\n\n >>> from sympy.ntheory.factor_ import smoothness_p, pollard_pm1\n >>> n=257*1009\n >>> smoothness_p(n)\n (-1, [(257, (1, 2, 256)), (1009, (1, 7, 16))])\n\n So we should (and can) find a root with B=16:\n\n >>> pollard_pm1(n, B=16, a=3)\n 1009\n\n If we attempt to increase B to 256 we find that it does not work:\n\n >>> pollard_pm1(n, B=256)\n >>>\n\n But if the value of ``a`` is changed we find that only multiples of\n 257 work, e.g.:\n\n >>> pollard_pm1(n, B=256, a=257)\n 1009\n\n Checking different ``a`` values shows that all the ones that did not\n work had a gcd value not equal to ``n`` but equal to one of the\n factors:\n\n >>> from sympy import ilcm, igcd, factorint, Pow\n >>> M = 1\n >>> for i in range(2, 256):\n ... M = ilcm(M, i)\n ...\n >>> set([igcd(pow(a, M, n) - 1, n) for a in range(2, 256) if\n ... igcd(pow(a, M, n) - 1, n) != n])\n {1009}\n\n But does aM % d for every divisor of n give 1?\n\n >>> aM = pow(255, M, n)\n >>> [(d, aM%Pow(*d.args)) for d in factorint(n, visual=True).args]\n [(257**1, 1), (1009**1, 1)]\n\n No, only one of them. So perhaps the principle is that a root will\n be found for a given value of B provided that:\n\n 1) the power smoothness of the p - 1 value next to the root\n does not exceed B\n 2) a**M % p != 1 for any of the divisors of n.\n\n By trying more than one ``a`` it is possible that one of them\n will yield a factor.\n\n Examples\n ========\n\n With the default smoothness bound, this number cannot be cracked:\n\n >>> from sympy.ntheory import pollard_pm1\n >>> pollard_pm1(21477639576571)\n\n Increasing the smoothness bound helps:\n\n >>> pollard_pm1(21477639576571, B=2000)\n 4410317\n\n Looking at the smoothness of the factors of this number we find:\n\n >>> from sympy.ntheory.factor_ import smoothness_p, factorint\n >>> print(smoothness_p(21477639576571, visual=1))\n p**i=4410317**1 has p-1 B=1787, B-pow=1787\n p**i=4869863**1 has p-1 B=2434931, B-pow=2434931\n\n The B and B-pow are the same for the p - 1 factorizations of the divisors\n because those factorizations had a very large prime factor:\n\n >>> factorint(4410317 - 1)\n {2: 2, 617: 1, 1787: 1}\n >>> factorint(4869863-1)\n {2: 1, 2434931: 1}\n\n Note that until B reaches the B-pow value of 1787, the number is not cracked;\n\n >>> pollard_pm1(21477639576571, B=1786)\n >>> pollard_pm1(21477639576571, B=1787)\n 4410317\n\n The B value has to do with the factors of the number next to the divisor,\n not the divisors themselves. A worst case scenario is that the number next\n to the factor p has a large prime divisisor or is a perfect power. If these\n conditions apply then the power-smoothness will be about p/2 or p. The more\n realistic is that there will be a large prime factor next to p requiring\n a B value on the order of p/2. Although primes may have been searched for\n up to this level, the p/2 is a factor of p - 1, something that we do not\n know. The modular.math reference below states that 15% of numbers in the\n range of 10**15 to 15**15 + 10**4 are 10**6 power smooth so a B of 10**6\n will fail 85% of the time in that range. From 10**8 to 10**8 + 10**3 the\n percentages are nearly reversed...but in that range the simple trial\n division is quite fast.\n\n References\n ==========\n\n .. [1] Richard Crandall & Carl Pomerance (2005), \"Prime Numbers:\n A Computational Perspective\", Springer, 2nd edition, 236-238\n .. [2] https://web.archive.org/web/20150716201437/http://modular.math.washington.edu/edu/2007/spring/ent/ent-html/node81.html\n .. [3] https://www.cs.toronto.edu/~yuvalf/Factorization.pdf\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/crypto/tests/test_crypto.py::test_elgamal_private_key", "sympy/crypto/tests/test_crypto.py::test_dh_private_key", "sympy/crypto/tests/test_crypto.py::test_dh_public_key", "sympy/crypto/tests/test_crypto.py::test_dh_shared_key", "sympy/ntheory/tests/test_factor_.py::test_smoothness_and_smoothness_p", "sympy/ntheory/tests/test_residue.py::test_residue", "sympy/ntheory/tests/test_hypothesis.py::test_tau_hypothesis", "sympy/ntheory/tests/test_hypothesis.py::test_totient_hypothesis" ], "PASS_TO_PASS": null }
sympy__sympy-81
1.0
{ "code": "diff --git b/sympy/simplify/powsimp.py a/sympy/simplify/powsimp.py\nindex 296694c1f0..51baa56c97 100644\n--- b/sympy/simplify/powsimp.py\n+++ a/sympy/simplify/powsimp.py\n@@ -100,6 +100,394 @@ def powsimp(expr, deep=False, combine='all', force=False, measure=count_ops):\n x*y*sqrt(x*sqrt(y))\n \n \"\"\"\n+ def recurse(arg, **kwargs):\n+ _deep = kwargs.get('deep', deep)\n+ _combine = kwargs.get('combine', combine)\n+ _force = kwargs.get('force', force)\n+ _measure = kwargs.get('measure', measure)\n+ return powsimp(arg, _deep, _combine, _force, _measure)\n+\n+ expr = sympify(expr)\n+\n+ if (not isinstance(expr, Basic) or isinstance(expr, MatrixSymbol) or (\n+ expr.is_Atom or expr in (exp_polar(0), exp_polar(1)))):\n+ return expr\n+\n+ if deep or expr.is_Add or expr.is_Mul and _y not in expr.args:\n+ expr = expr.func(*[recurse(w) for w in expr.args])\n+\n+ if expr.is_Pow:\n+ return recurse(expr*_y, deep=False)/_y\n+\n+ if not expr.is_Mul:\n+ return expr\n+\n+ # handle the Mul\n+ if combine in ('exp', 'all'):\n+ # Collect base/exp data, while maintaining order in the\n+ # non-commutative parts of the product\n+ c_powers = defaultdict(list)\n+ nc_part = []\n+ newexpr = []\n+ coeff = S.One\n+ for term in expr.args:\n+ if term.is_Rational:\n+ coeff *= term\n+ continue\n+ if term.is_Pow:\n+ term = _denest_pow(term)\n+ if term.is_commutative:\n+ b, e = term.as_base_exp()\n+ if deep:\n+ b, e = [recurse(i) for i in [b, e]]\n+ if b.is_Pow or isinstance(b, exp):\n+ # don't let smthg like sqrt(x**a) split into x**a, 1/2\n+ # or else it will be joined as x**(a/2) later\n+ b, e = b**e, S.One\n+ c_powers[b].append(e)\n+ else:\n+ # This is the logic that combines exponents for equal,\n+ # but non-commutative bases: A**x*A**y == A**(x+y).\n+ if nc_part:\n+ b1, e1 = nc_part[-1].as_base_exp()\n+ b2, e2 = term.as_base_exp()\n+ if (b1 == b2 and\n+ e1.is_commutative and e2.is_commutative):\n+ nc_part[-1] = Pow(b1, Add(e1, e2))\n+ continue\n+ nc_part.append(term)\n+\n+ # add up exponents of common bases\n+ for b, e in ordered(iter(c_powers.items())):\n+ # allow 2**x/4 -> 2**(x - 2); don't do this when b and e are\n+ # Numbers since autoevaluation will undo it, e.g.\n+ # 2**(1/3)/4 -> 2**(1/3 - 2) -> 2**(1/3)/4\n+ if (b and b.is_Rational and not all(ei.is_Number for ei in e) and \\\n+ coeff is not S.One and\n+ b not in (S.One, S.NegativeOne)):\n+ m = multiplicity(abs(b), abs(coeff))\n+ if m:\n+ e.append(m)\n+ coeff /= b**m\n+ c_powers[b] = Add(*e)\n+ if coeff is not S.One:\n+ if coeff in c_powers:\n+ c_powers[coeff] += S.One\n+ else:\n+ c_powers[coeff] = S.One\n+\n+ # convert to plain dictionary\n+ c_powers = dict(c_powers)\n+\n+ # check for base and inverted base pairs\n+ be = list(c_powers.items())\n+ skip = set() # skip if we already saw them\n+ for b, e in be:\n+ if b in skip:\n+ continue\n+ bpos = b.is_positive or b.is_polar\n+ if bpos:\n+ binv = 1/b\n+ if b != binv and binv in c_powers:\n+ if b.as_numer_denom()[0] is S.One:\n+ c_powers.pop(b)\n+ c_powers[binv] -= e\n+ else:\n+ skip.add(binv)\n+ e = c_powers.pop(binv)\n+ c_powers[b] -= e\n+\n+ # check for base and negated base pairs\n+ be = list(c_powers.items())\n+ _n = S.NegativeOne\n+ for b, e in be:\n+ if (b.is_Symbol or b.is_Add) and -b in c_powers and b in c_powers:\n+ if (b.is_positive is not None or e.is_integer):\n+ if e.is_integer or b.is_negative:\n+ c_powers[-b] += c_powers.pop(b)\n+ else: # (-b).is_positive so use its e\n+ e = c_powers.pop(-b)\n+ c_powers[b] += e\n+ if _n in c_powers:\n+ c_powers[_n] += e\n+ else:\n+ c_powers[_n] = e\n+\n+ # filter c_powers and convert to a list\n+ c_powers = [(b, e) for b, e in c_powers.items() if e]\n+\n+ # ==============================================================\n+ # check for Mul bases of Rational powers that can be combined with\n+ # separated bases, e.g. x*sqrt(x*y)*sqrt(x*sqrt(x*y)) ->\n+ # (x*sqrt(x*y))**(3/2)\n+ # ---------------- helper functions\n+\n+ def ratq(x):\n+ '''Return Rational part of x's exponent as it appears in the bkey.\n+ '''\n+ return bkey(x)[0][1]\n+\n+ def bkey(b, e=None):\n+ '''Return (b**s, c.q), c.p where e -> c*s. If e is not given then\n+ it will be taken by using as_base_exp() on the input b.\n+ e.g.\n+ x**3/2 -> (x, 2), 3\n+ x**y -> (x**y, 1), 1\n+ x**(2*y/3) -> (x**y, 3), 2\n+ exp(x/2) -> (exp(a), 2), 1\n+\n+ '''\n+ if e is not None: # coming from c_powers or from below\n+ if e.is_Integer:\n+ return (b, S.One), e\n+ elif e.is_Rational:\n+ return (b, Integer(e.q)), Integer(e.p)\n+ else:\n+ c, m = e.as_coeff_Mul(rational=True)\n+ if c is not S.One:\n+ if m.is_integer:\n+ return (b, Integer(c.q)), m*Integer(c.p)\n+ return (b**m, Integer(c.q)), Integer(c.p)\n+ else:\n+ return (b**e, S.One), S.One\n+ else:\n+ return bkey(*b.as_base_exp())\n+\n+ def update(b):\n+ '''Decide what to do with base, b. If its exponent is now an\n+ integer multiple of the Rational denominator, then remove it\n+ and put the factors of its base in the common_b dictionary or\n+ update the existing bases if necessary. If it has been zeroed\n+ out, simply remove the base.\n+ '''\n+ newe, r = divmod(common_b[b], b[1])\n+ if not r:\n+ common_b.pop(b)\n+ if newe:\n+ for m in Mul.make_args(b[0]**newe):\n+ b, e = bkey(m)\n+ if b not in common_b:\n+ common_b[b] = 0\n+ common_b[b] += e\n+ if b[1] != 1:\n+ bases.append(b)\n+ # ---------------- end of helper functions\n+\n+ # assemble a dictionary of the factors having a Rational power\n+ common_b = {}\n+ done = []\n+ bases = []\n+ for b, e in c_powers:\n+ b, e = bkey(b, e)\n+ if b in common_b:\n+ common_b[b] = common_b[b] + e\n+ else:\n+ common_b[b] = e\n+ if b[1] != 1 and b[0].is_Mul:\n+ bases.append(b)\n+ bases.sort(key=default_sort_key) # this makes tie-breaking canonical\n+ bases.sort(key=measure, reverse=True) # handle longest first\n+ for base in bases:\n+ if base not in common_b: # it may have been removed already\n+ continue\n+ b, exponent = base\n+ last = False # True when no factor of base is a radical\n+ qlcm = 1 # the lcm of the radical denominators\n+ while True:\n+ bstart = b\n+ qstart = qlcm\n+\n+ bb = [] # list of factors\n+ ee = [] # (factor's expo. and it's current value in common_b)\n+ for bi in Mul.make_args(b):\n+ bib, bie = bkey(bi)\n+ if bib not in common_b or common_b[bib] < bie:\n+ ee = bb = [] # failed\n+ break\n+ ee.append([bie, common_b[bib]])\n+ bb.append(bib)\n+ if ee:\n+ # find the number of integral extractions possible\n+ # e.g. [(1, 2), (2, 2)] -> min(2/1, 2/2) -> 1\n+ min1 = ee[0][1]//ee[0][0]\n+ for i in range(1, len(ee)):\n+ rat = ee[i][1]//ee[i][0]\n+ if rat < 1:\n+ break\n+ min1 = min(min1, rat)\n+ else:\n+ # update base factor counts\n+ # e.g. if ee = [(2, 5), (3, 6)] then min1 = 2\n+ # and the new base counts will be 5-2*2 and 6-2*3\n+ for i in range(len(bb)):\n+ common_b[bb[i]] -= min1*ee[i][0]\n+ update(bb[i])\n+ # update the count of the base\n+ # e.g. x**2*y*sqrt(x*sqrt(y)) the count of x*sqrt(y)\n+ # will increase by 4 to give bkey (x*sqrt(y), 2, 5)\n+ common_b[base] += min1*qstart*exponent\n+ if (last # no more radicals in base\n+ or len(common_b) == 1 # nothing left to join with\n+ or all(k[1] == 1 for k in common_b) # no rad's in common_b\n+ ):\n+ break\n+ # see what we can exponentiate base by to remove any radicals\n+ # so we know what to search for\n+ # e.g. if base were x**(1/2)*y**(1/3) then we should\n+ # exponentiate by 6 and look for powers of x and y in the ratio\n+ # of 2 to 3\n+ qlcm = lcm([ratq(bi) for bi in Mul.make_args(bstart)])\n+ if qlcm == 1:\n+ break # we are done\n+ b = bstart**qlcm\n+ qlcm *= qstart\n+ if all(ratq(bi) == 1 for bi in Mul.make_args(b)):\n+ last = True # we are going to be done after this next pass\n+ # this base no longer can find anything to join with and\n+ # since it was longer than any other we are done with it\n+ b, q = base\n+ done.append((b, common_b.pop(base)*Rational(1, q)))\n+\n+ # update c_powers and get ready to continue with powsimp\n+ c_powers = done\n+ # there may be terms still in common_b that were bases that were\n+ # identified as needing processing, so remove those, too\n+ for (b, q), e in common_b.items():\n+ if (b.is_Pow or isinstance(b, exp)) and \\\n+ q is not S.One and not b.exp.is_Rational:\n+ b, be = b.as_base_exp()\n+ b = b**(be/q)\n+ else:\n+ b = root(b, q)\n+ c_powers.append((b, e))\n+ check = len(c_powers)\n+ c_powers = dict(c_powers)\n+ assert len(c_powers) == check # there should have been no duplicates\n+ # ==============================================================\n+\n+ # rebuild the expression\n+ newexpr = expr.func(*(newexpr + [Pow(b, e) for b, e in c_powers.items()]))\n+ if combine == 'exp':\n+ return expr.func(newexpr, expr.func(*nc_part))\n+ else:\n+ return recurse(expr.func(*nc_part), combine='base') * \\\n+ recurse(newexpr, combine='base')\n+\n+ elif combine == 'base':\n+\n+ # Build c_powers and nc_part. These must both be lists not\n+ # dicts because exp's are not combined.\n+ c_powers = []\n+ nc_part = []\n+ for term in expr.args:\n+ if term.is_commutative:\n+ c_powers.append(list(term.as_base_exp()))\n+ else:\n+ nc_part.append(term)\n+\n+ # Pull out numerical coefficients from exponent if assumptions allow\n+ # e.g., 2**(2*x) => 4**x\n+ for i in range(len(c_powers)):\n+ b, e = c_powers[i]\n+ if not (all(x.is_nonnegative for x in b.as_numer_denom()) or e.is_integer or force or b.is_polar):\n+ continue\n+ exp_c, exp_t = e.as_coeff_Mul(rational=True)\n+ if exp_c is not S.One and exp_t is not S.One:\n+ c_powers[i] = [Pow(b, exp_c), exp_t]\n+\n+ # Combine bases whenever they have the same exponent and\n+ # assumptions allow\n+ # first gather the potential bases under the common exponent\n+ c_exp = defaultdict(list)\n+ for b, e in c_powers:\n+ if deep:\n+ e = recurse(e)\n+ if e.is_Add and (b.is_positive or e.is_integer):\n+ e = factor_terms(e)\n+ if _coeff_isneg(e):\n+ e = -e\n+ b = 1/b\n+ c_exp[e].append(b)\n+ del c_powers\n+\n+ # Merge back in the results of the above to form a new product\n+ c_powers = defaultdict(list)\n+ for e in c_exp:\n+ bases = c_exp[e]\n+\n+ # calculate the new base for e\n+\n+ if len(bases) == 1:\n+ new_base = bases[0]\n+ elif e.is_integer or force:\n+ new_base = expr.func(*bases)\n+ else:\n+ # see which ones can be joined\n+ unk = []\n+ nonneg = []\n+ neg = []\n+ for bi in bases:\n+ if bi.is_negative:\n+ neg.append(bi)\n+ elif bi.is_nonnegative:\n+ nonneg.append(bi)\n+ elif bi.is_polar:\n+ nonneg.append(\n+ bi) # polar can be treated like non-negative\n+ else:\n+ unk.append(bi)\n+ if len(unk) == 1 and not neg or len(neg) == 1 and not unk:\n+ # a single neg or a single unk can join the rest\n+ nonneg.extend(unk + neg)\n+ unk = neg = []\n+ elif neg:\n+ # their negative signs cancel in groups of 2*q if we know\n+ # that e = p/q else we have to treat them as unknown\n+ israt = False\n+ if e.is_Rational:\n+ israt = True\n+ else:\n+ p, d = e.as_numer_denom()\n+ if p.is_integer and d.is_integer:\n+ israt = True\n+ if israt:\n+ neg = [-w for w in neg]\n+ unk.extend([S.NegativeOne]*len(neg))\n+ else:\n+ unk.extend(neg)\n+ neg = []\n+ del israt\n+\n+ # these shouldn't be joined\n+ for b in unk:\n+ c_powers[b].append(e)\n+ # here is a new joined base\n+ new_base = expr.func(*(nonneg + neg))\n+ # if there are positive parts they will just get separated\n+ # again unless some change is made\n+\n+ def _terms(e):\n+ # return the number of terms of this expression\n+ # when multiplied out -- assuming no joining of terms\n+ if e.is_Add:\n+ return sum(_terms(ai) for ai in e.args)\n+ if e.is_Mul:\n+ return prod([_terms(mi) for mi in e.args])\n+ return 1\n+ xnew_base = expand_mul(new_base, deep=False)\n+ if len(Add.make_args(xnew_base)) < _terms(new_base):\n+ new_base = factor_terms(xnew_base)\n+\n+ c_powers[new_base].append(e)\n+\n+ # break out the powers from c_powers now\n+ c_part = [Pow(b, ei) for b, e in c_powers.items() for ei in e]\n+\n+ # we're done\n+ return expr.func(*(c_part + nc_part))\n+\n+ else:\n+ raise ValueError(\"combine must be one of ('all', 'exp', 'base').\")\n \n \n def powdenest(eq, force=False, polar=False):\n", "test": null }
null
{ "code": "diff --git a/sympy/simplify/powsimp.py b/sympy/simplify/powsimp.py\nindex 51baa56c97..296694c1f0 100644\n--- a/sympy/simplify/powsimp.py\n+++ b/sympy/simplify/powsimp.py\n@@ -100,394 +100,6 @@ def powsimp(expr, deep=False, combine='all', force=False, measure=count_ops):\n x*y*sqrt(x*sqrt(y))\n \n \"\"\"\n- def recurse(arg, **kwargs):\n- _deep = kwargs.get('deep', deep)\n- _combine = kwargs.get('combine', combine)\n- _force = kwargs.get('force', force)\n- _measure = kwargs.get('measure', measure)\n- return powsimp(arg, _deep, _combine, _force, _measure)\n-\n- expr = sympify(expr)\n-\n- if (not isinstance(expr, Basic) or isinstance(expr, MatrixSymbol) or (\n- expr.is_Atom or expr in (exp_polar(0), exp_polar(1)))):\n- return expr\n-\n- if deep or expr.is_Add or expr.is_Mul and _y not in expr.args:\n- expr = expr.func(*[recurse(w) for w in expr.args])\n-\n- if expr.is_Pow:\n- return recurse(expr*_y, deep=False)/_y\n-\n- if not expr.is_Mul:\n- return expr\n-\n- # handle the Mul\n- if combine in ('exp', 'all'):\n- # Collect base/exp data, while maintaining order in the\n- # non-commutative parts of the product\n- c_powers = defaultdict(list)\n- nc_part = []\n- newexpr = []\n- coeff = S.One\n- for term in expr.args:\n- if term.is_Rational:\n- coeff *= term\n- continue\n- if term.is_Pow:\n- term = _denest_pow(term)\n- if term.is_commutative:\n- b, e = term.as_base_exp()\n- if deep:\n- b, e = [recurse(i) for i in [b, e]]\n- if b.is_Pow or isinstance(b, exp):\n- # don't let smthg like sqrt(x**a) split into x**a, 1/2\n- # or else it will be joined as x**(a/2) later\n- b, e = b**e, S.One\n- c_powers[b].append(e)\n- else:\n- # This is the logic that combines exponents for equal,\n- # but non-commutative bases: A**x*A**y == A**(x+y).\n- if nc_part:\n- b1, e1 = nc_part[-1].as_base_exp()\n- b2, e2 = term.as_base_exp()\n- if (b1 == b2 and\n- e1.is_commutative and e2.is_commutative):\n- nc_part[-1] = Pow(b1, Add(e1, e2))\n- continue\n- nc_part.append(term)\n-\n- # add up exponents of common bases\n- for b, e in ordered(iter(c_powers.items())):\n- # allow 2**x/4 -> 2**(x - 2); don't do this when b and e are\n- # Numbers since autoevaluation will undo it, e.g.\n- # 2**(1/3)/4 -> 2**(1/3 - 2) -> 2**(1/3)/4\n- if (b and b.is_Rational and not all(ei.is_Number for ei in e) and \\\n- coeff is not S.One and\n- b not in (S.One, S.NegativeOne)):\n- m = multiplicity(abs(b), abs(coeff))\n- if m:\n- e.append(m)\n- coeff /= b**m\n- c_powers[b] = Add(*e)\n- if coeff is not S.One:\n- if coeff in c_powers:\n- c_powers[coeff] += S.One\n- else:\n- c_powers[coeff] = S.One\n-\n- # convert to plain dictionary\n- c_powers = dict(c_powers)\n-\n- # check for base and inverted base pairs\n- be = list(c_powers.items())\n- skip = set() # skip if we already saw them\n- for b, e in be:\n- if b in skip:\n- continue\n- bpos = b.is_positive or b.is_polar\n- if bpos:\n- binv = 1/b\n- if b != binv and binv in c_powers:\n- if b.as_numer_denom()[0] is S.One:\n- c_powers.pop(b)\n- c_powers[binv] -= e\n- else:\n- skip.add(binv)\n- e = c_powers.pop(binv)\n- c_powers[b] -= e\n-\n- # check for base and negated base pairs\n- be = list(c_powers.items())\n- _n = S.NegativeOne\n- for b, e in be:\n- if (b.is_Symbol or b.is_Add) and -b in c_powers and b in c_powers:\n- if (b.is_positive is not None or e.is_integer):\n- if e.is_integer or b.is_negative:\n- c_powers[-b] += c_powers.pop(b)\n- else: # (-b).is_positive so use its e\n- e = c_powers.pop(-b)\n- c_powers[b] += e\n- if _n in c_powers:\n- c_powers[_n] += e\n- else:\n- c_powers[_n] = e\n-\n- # filter c_powers and convert to a list\n- c_powers = [(b, e) for b, e in c_powers.items() if e]\n-\n- # ==============================================================\n- # check for Mul bases of Rational powers that can be combined with\n- # separated bases, e.g. x*sqrt(x*y)*sqrt(x*sqrt(x*y)) ->\n- # (x*sqrt(x*y))**(3/2)\n- # ---------------- helper functions\n-\n- def ratq(x):\n- '''Return Rational part of x's exponent as it appears in the bkey.\n- '''\n- return bkey(x)[0][1]\n-\n- def bkey(b, e=None):\n- '''Return (b**s, c.q), c.p where e -> c*s. If e is not given then\n- it will be taken by using as_base_exp() on the input b.\n- e.g.\n- x**3/2 -> (x, 2), 3\n- x**y -> (x**y, 1), 1\n- x**(2*y/3) -> (x**y, 3), 2\n- exp(x/2) -> (exp(a), 2), 1\n-\n- '''\n- if e is not None: # coming from c_powers or from below\n- if e.is_Integer:\n- return (b, S.One), e\n- elif e.is_Rational:\n- return (b, Integer(e.q)), Integer(e.p)\n- else:\n- c, m = e.as_coeff_Mul(rational=True)\n- if c is not S.One:\n- if m.is_integer:\n- return (b, Integer(c.q)), m*Integer(c.p)\n- return (b**m, Integer(c.q)), Integer(c.p)\n- else:\n- return (b**e, S.One), S.One\n- else:\n- return bkey(*b.as_base_exp())\n-\n- def update(b):\n- '''Decide what to do with base, b. If its exponent is now an\n- integer multiple of the Rational denominator, then remove it\n- and put the factors of its base in the common_b dictionary or\n- update the existing bases if necessary. If it has been zeroed\n- out, simply remove the base.\n- '''\n- newe, r = divmod(common_b[b], b[1])\n- if not r:\n- common_b.pop(b)\n- if newe:\n- for m in Mul.make_args(b[0]**newe):\n- b, e = bkey(m)\n- if b not in common_b:\n- common_b[b] = 0\n- common_b[b] += e\n- if b[1] != 1:\n- bases.append(b)\n- # ---------------- end of helper functions\n-\n- # assemble a dictionary of the factors having a Rational power\n- common_b = {}\n- done = []\n- bases = []\n- for b, e in c_powers:\n- b, e = bkey(b, e)\n- if b in common_b:\n- common_b[b] = common_b[b] + e\n- else:\n- common_b[b] = e\n- if b[1] != 1 and b[0].is_Mul:\n- bases.append(b)\n- bases.sort(key=default_sort_key) # this makes tie-breaking canonical\n- bases.sort(key=measure, reverse=True) # handle longest first\n- for base in bases:\n- if base not in common_b: # it may have been removed already\n- continue\n- b, exponent = base\n- last = False # True when no factor of base is a radical\n- qlcm = 1 # the lcm of the radical denominators\n- while True:\n- bstart = b\n- qstart = qlcm\n-\n- bb = [] # list of factors\n- ee = [] # (factor's expo. and it's current value in common_b)\n- for bi in Mul.make_args(b):\n- bib, bie = bkey(bi)\n- if bib not in common_b or common_b[bib] < bie:\n- ee = bb = [] # failed\n- break\n- ee.append([bie, common_b[bib]])\n- bb.append(bib)\n- if ee:\n- # find the number of integral extractions possible\n- # e.g. [(1, 2), (2, 2)] -> min(2/1, 2/2) -> 1\n- min1 = ee[0][1]//ee[0][0]\n- for i in range(1, len(ee)):\n- rat = ee[i][1]//ee[i][0]\n- if rat < 1:\n- break\n- min1 = min(min1, rat)\n- else:\n- # update base factor counts\n- # e.g. if ee = [(2, 5), (3, 6)] then min1 = 2\n- # and the new base counts will be 5-2*2 and 6-2*3\n- for i in range(len(bb)):\n- common_b[bb[i]] -= min1*ee[i][0]\n- update(bb[i])\n- # update the count of the base\n- # e.g. x**2*y*sqrt(x*sqrt(y)) the count of x*sqrt(y)\n- # will increase by 4 to give bkey (x*sqrt(y), 2, 5)\n- common_b[base] += min1*qstart*exponent\n- if (last # no more radicals in base\n- or len(common_b) == 1 # nothing left to join with\n- or all(k[1] == 1 for k in common_b) # no rad's in common_b\n- ):\n- break\n- # see what we can exponentiate base by to remove any radicals\n- # so we know what to search for\n- # e.g. if base were x**(1/2)*y**(1/3) then we should\n- # exponentiate by 6 and look for powers of x and y in the ratio\n- # of 2 to 3\n- qlcm = lcm([ratq(bi) for bi in Mul.make_args(bstart)])\n- if qlcm == 1:\n- break # we are done\n- b = bstart**qlcm\n- qlcm *= qstart\n- if all(ratq(bi) == 1 for bi in Mul.make_args(b)):\n- last = True # we are going to be done after this next pass\n- # this base no longer can find anything to join with and\n- # since it was longer than any other we are done with it\n- b, q = base\n- done.append((b, common_b.pop(base)*Rational(1, q)))\n-\n- # update c_powers and get ready to continue with powsimp\n- c_powers = done\n- # there may be terms still in common_b that were bases that were\n- # identified as needing processing, so remove those, too\n- for (b, q), e in common_b.items():\n- if (b.is_Pow or isinstance(b, exp)) and \\\n- q is not S.One and not b.exp.is_Rational:\n- b, be = b.as_base_exp()\n- b = b**(be/q)\n- else:\n- b = root(b, q)\n- c_powers.append((b, e))\n- check = len(c_powers)\n- c_powers = dict(c_powers)\n- assert len(c_powers) == check # there should have been no duplicates\n- # ==============================================================\n-\n- # rebuild the expression\n- newexpr = expr.func(*(newexpr + [Pow(b, e) for b, e in c_powers.items()]))\n- if combine == 'exp':\n- return expr.func(newexpr, expr.func(*nc_part))\n- else:\n- return recurse(expr.func(*nc_part), combine='base') * \\\n- recurse(newexpr, combine='base')\n-\n- elif combine == 'base':\n-\n- # Build c_powers and nc_part. These must both be lists not\n- # dicts because exp's are not combined.\n- c_powers = []\n- nc_part = []\n- for term in expr.args:\n- if term.is_commutative:\n- c_powers.append(list(term.as_base_exp()))\n- else:\n- nc_part.append(term)\n-\n- # Pull out numerical coefficients from exponent if assumptions allow\n- # e.g., 2**(2*x) => 4**x\n- for i in range(len(c_powers)):\n- b, e = c_powers[i]\n- if not (all(x.is_nonnegative for x in b.as_numer_denom()) or e.is_integer or force or b.is_polar):\n- continue\n- exp_c, exp_t = e.as_coeff_Mul(rational=True)\n- if exp_c is not S.One and exp_t is not S.One:\n- c_powers[i] = [Pow(b, exp_c), exp_t]\n-\n- # Combine bases whenever they have the same exponent and\n- # assumptions allow\n- # first gather the potential bases under the common exponent\n- c_exp = defaultdict(list)\n- for b, e in c_powers:\n- if deep:\n- e = recurse(e)\n- if e.is_Add and (b.is_positive or e.is_integer):\n- e = factor_terms(e)\n- if _coeff_isneg(e):\n- e = -e\n- b = 1/b\n- c_exp[e].append(b)\n- del c_powers\n-\n- # Merge back in the results of the above to form a new product\n- c_powers = defaultdict(list)\n- for e in c_exp:\n- bases = c_exp[e]\n-\n- # calculate the new base for e\n-\n- if len(bases) == 1:\n- new_base = bases[0]\n- elif e.is_integer or force:\n- new_base = expr.func(*bases)\n- else:\n- # see which ones can be joined\n- unk = []\n- nonneg = []\n- neg = []\n- for bi in bases:\n- if bi.is_negative:\n- neg.append(bi)\n- elif bi.is_nonnegative:\n- nonneg.append(bi)\n- elif bi.is_polar:\n- nonneg.append(\n- bi) # polar can be treated like non-negative\n- else:\n- unk.append(bi)\n- if len(unk) == 1 and not neg or len(neg) == 1 and not unk:\n- # a single neg or a single unk can join the rest\n- nonneg.extend(unk + neg)\n- unk = neg = []\n- elif neg:\n- # their negative signs cancel in groups of 2*q if we know\n- # that e = p/q else we have to treat them as unknown\n- israt = False\n- if e.is_Rational:\n- israt = True\n- else:\n- p, d = e.as_numer_denom()\n- if p.is_integer and d.is_integer:\n- israt = True\n- if israt:\n- neg = [-w for w in neg]\n- unk.extend([S.NegativeOne]*len(neg))\n- else:\n- unk.extend(neg)\n- neg = []\n- del israt\n-\n- # these shouldn't be joined\n- for b in unk:\n- c_powers[b].append(e)\n- # here is a new joined base\n- new_base = expr.func(*(nonneg + neg))\n- # if there are positive parts they will just get separated\n- # again unless some change is made\n-\n- def _terms(e):\n- # return the number of terms of this expression\n- # when multiplied out -- assuming no joining of terms\n- if e.is_Add:\n- return sum(_terms(ai) for ai in e.args)\n- if e.is_Mul:\n- return prod([_terms(mi) for mi in e.args])\n- return 1\n- xnew_base = expand_mul(new_base, deep=False)\n- if len(Add.make_args(xnew_base)) < _terms(new_base):\n- new_base = factor_terms(xnew_base)\n-\n- c_powers[new_base].append(e)\n-\n- # break out the powers from c_powers now\n- c_part = [Pow(b, ei) for b, e in c_powers.items() for ei in e]\n-\n- # we're done\n- return expr.func(*(c_part + nc_part))\n-\n- else:\n- raise ValueError(\"combine must be one of ('all', 'exp', 'base').\")\n \n \n def powdenest(eq, force=False, polar=False):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/simplify/powsimp.py.\nHere is the description for the function:\ndef powsimp(expr, deep=False, combine='all', force=False, measure=count_ops):\n \"\"\"\n Reduce expression by combining powers with similar bases and exponents.\n\n Explanation\n ===========\n\n If ``deep`` is ``True`` then powsimp() will also simplify arguments of\n functions. By default ``deep`` is set to ``False``.\n\n If ``force`` is ``True`` then bases will be combined without checking for\n assumptions, e.g. sqrt(x)*sqrt(y) -> sqrt(x*y) which is not true\n if x and y are both negative.\n\n You can make powsimp() only combine bases or only combine exponents by\n changing combine='base' or combine='exp'. By default, combine='all',\n which does both. combine='base' will only combine::\n\n a a a 2x x\n x * y => (x*y) as well as things like 2 => 4\n\n and combine='exp' will only combine\n ::\n\n a b (a + b)\n x * x => x\n\n combine='exp' will strictly only combine exponents in the way that used\n to be automatic. Also use deep=True if you need the old behavior.\n\n When combine='all', 'exp' is evaluated first. Consider the first\n example below for when there could be an ambiguity relating to this.\n This is done so things like the second example can be completely\n combined. If you want 'base' combined first, do something like\n powsimp(powsimp(expr, combine='base'), combine='exp').\n\n Examples\n ========\n\n >>> from sympy import powsimp, exp, log, symbols\n >>> from sympy.abc import x, y, z, n\n >>> powsimp(x**y*x**z*y**z, combine='all')\n x**(y + z)*y**z\n >>> powsimp(x**y*x**z*y**z, combine='exp')\n x**(y + z)*y**z\n >>> powsimp(x**y*x**z*y**z, combine='base', force=True)\n x**y*(x*y)**z\n\n >>> powsimp(x**z*x**y*n**z*n**y, combine='all', force=True)\n (n*x)**(y + z)\n >>> powsimp(x**z*x**y*n**z*n**y, combine='exp')\n n**(y + z)*x**(y + z)\n >>> powsimp(x**z*x**y*n**z*n**y, combine='base', force=True)\n (n*x)**y*(n*x)**z\n\n >>> x, y = symbols('x y', positive=True)\n >>> powsimp(log(exp(x)*exp(y)))\n log(exp(x)*exp(y))\n >>> powsimp(log(exp(x)*exp(y)), deep=True)\n x + y\n\n Radicals with Mul bases will be combined if combine='exp'\n\n >>> from sympy import sqrt\n >>> x, y = symbols('x y')\n\n Two radicals are automatically joined through Mul:\n\n >>> a=sqrt(x*sqrt(y))\n >>> a*a**3 == a**4\n True\n\n But if an integer power of that radical has been\n autoexpanded then Mul does not join the resulting factors:\n\n >>> a**4 # auto expands to a Mul, no longer a Pow\n x**2*y\n >>> _*a # so Mul doesn't combine them\n x**2*y*sqrt(x*sqrt(y))\n >>> powsimp(_) # but powsimp will\n (x*sqrt(y))**(5/2)\n >>> powsimp(x*y*a) # but won't when doing so would violate assumptions\n x*y*sqrt(x*sqrt(y))\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/matrices/tests/test_matrixbase.py::test_is_anti_symmetric", "sympy/polys/matrices/tests/test_rref.py::test_Matrix_rref[EX_1-A35-A_rref35-den35]", "sympy/utilities/tests/test_wester.py::test_C17", "sympy/integrals/tests/test_integrals.py::test_improper_integral", "sympy/utilities/tests/test_wester.py::test_C18", "sympy/matrices/tests/test_matrices.py::test_multiplication_inf_zero", "sympy/matrices/tests/test_matrixbase.py::test_is_hermitian", "sympy/series/tests/test_limits.py::test_basic1", "sympy/matrices/tests/test_matrices.py::test_power", "sympy/integrals/tests/test_integrals.py::test_constructor", "sympy/printing/tests/test_latex.py::test_latex_basic", "sympy/series/tests/test_limits.py::test_basic2", "sympy/utilities/tests/test_wester.py::test_G18", "sympy/matrices/tests/test_matrixbase.py::test_limit", "sympy/printing/pretty/tests/test_pretty.py::test_pretty_ordering", "sympy/solvers/tests/test_solvers.py::test_guess_poly", "sympy/core/tests/test_arit.py::test_bug1", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise1", "sympy/stats/tests/test_continuous_rv.py::test_single_normal", "sympy/series/tests/test_order.py::test_caching_bug", "sympy/series/tests/test_nseries.py::test_simple_1", "sympy/series/tests/test_limits.py::test_basic3", "sympy/simplify/tests/test_simplify.py::test_issue_7263", "sympy/concrete/tests/test_sums_products.py::test_karr_proposition_2a", "sympy/matrices/tests/test_matrices.py::test_issue_17247_expression_blowup_1", "sympy/utilities/tests/test_wester.py::test_G20", "sympy/functions/elementary/tests/test_hyperbolic.py::test_sinh_series", "sympy/printing/tests/test_str.py::test_Add", "sympy/core/tests/test_expr.py::test_series_expansion_for_uniform_order", "sympy/integrals/tests/test_integrals.py::test_issue_3532", "sympy/series/tests/test_order.py::test_free_symbols", "sympy/series/tests/test_nseries.py::test_mul_0", "sympy/core/tests/test_expr.py::test_leadterm", "sympy/concrete/tests/test_sums_products.py::test_arithmetic_sums", "sympy/series/tests/test_order.py::test_simple_1", "sympy/solvers/tests/test_solvers.py::test_guess_poly_cv", "sympy/simplify/tests/test_simplify.py::test_factorial_simplify", "sympy/series/tests/test_limits.py::test_basic4", "sympy/printing/tests/test_latex.py::test_latex_functions", "sympy/functions/elementary/tests/test_hyperbolic.py::test_cosh_series", "sympy/simplify/tests/test_simplify.py::test_simplify_expr", "sympy/matrices/tests/test_matrices.py::test_issue_17247_expression_blowup_2", "sympy/utilities/tests/test_wester.py::test_H1", "sympy/stats/tests/test_continuous_rv.py::test_conditional_1d", "sympy/assumptions/tests/test_query.py::test_sqrt_2", "sympy/core/tests/test_subs.py::test_mul", "sympy/simplify/tests/test_simplify.py::test_issue_3557", "sympy/core/tests/test_relational.py::test_univariate_relational_as_set", "sympy/physics/mechanics/tests/test_pathway.py::TestLinearPathway::test_3D_pathway_extension_velocity", "sympy/series/tests/test_order.py::test_simple_2", "sympy/series/tests/test_nseries.py::test_mul_1", "sympy/core/tests/test_subs.py::test_subs_constants", "sympy/utilities/tests/test_wester.py::test_H2", "sympy/core/tests/test_evalf.py::test_evalf_integer_parts", "sympy/functions/elementary/tests/test_hyperbolic.py::test_tanh_series", "sympy/logic/tests/test_boolalg.py::test_simplification_boolalg", "sympy/assumptions/tests/test_query.py::test_pi", "sympy/core/tests/test_subs.py::test_subs_commutative", "sympy/concrete/tests/test_sums_products.py::test_geometric_sums", "sympy/simplify/tests/test_simplify.py::test_simplify_other", "sympy/printing/pretty/tests/test_pretty.py::test_pretty_Feedback", "sympy/physics/biomechanics/tests/test_musculotendon.py::TestTendonForceExplicit::test_state_vars[MusculotendonDeGroote2016-curve0]", "sympy/solvers/tests/test_solvers.py::test_guess_rational_cv", "sympy/core/tests/test_subs.py::test_subs_noncommutative", "sympy/physics/biomechanics/tests/test_musculotendon.py::TestTendonForceExplicit::test_input_vars[MusculotendonDeGroote2016-curve0]", "sympy/simplify/tests/test_simplify.py::test_simplify_complex", "sympy/series/tests/test_nseries.py::test_pow_0", "sympy/core/tests/test_expr.py::test_as_leading_term", "sympy/core/tests/test_evalf.py::test_evalf_sum", "sympy/series/tests/test_limits.py::test_log", "sympy/series/tests/test_order.py::test_simple_3", "sympy/integrals/tests/test_integrals.py::test_issue_3686", "sympy/printing/pretty/tests/test_pretty.py::test_pretty_order", "sympy/concrete/tests/test_sums_products.py::test_harmonic_sums", "sympy/simplify/tests/test_cse.py::test_ignore_order_terms", "sympy/core/tests/test_subs.py::test_subs_basic_funcs", "sympy/printing/tests/test_latex.py::test_latex_FormalPowerSeries", "sympy/matrices/tests/test_matrixbase.py::test_power", "sympy/assumptions/tests/test_query.py::test_E", "sympy/functions/elementary/tests/test_hyperbolic.py::test_coth_series", "sympy/simplify/tests/test_simplify.py::test_simplify_ratio", "sympy/physics/biomechanics/tests/test_musculotendon.py::TestTendonForceExplicit::test_constants[MusculotendonDeGroote2016-curve0]", "sympy/stats/tests/test_continuous_rv.py::test_multiple_normal", "sympy/series/tests/test_nseries.py::test_pow_1", "sympy/series/tests/test_limits.py::test_piecewise", "sympy/simplify/tests/test_cse.py::test_issue_7840", "sympy/series/tests/test_order.py::test_simple_4", "sympy/core/tests/test_evalf.py::test_evalf_divergent_series", "sympy/simplify/tests/test_simplify.py::test_simplify_measure", "sympy/matrices/tests/test_matrixbase.py::test_issue_17247_expression_blowup_1", "sympy/utilities/tests/test_wester.py::test_H12", "sympy/printing/tests/test_str.py::test_Order", "sympy/series/tests/test_nseries.py::test_geometric_1", "sympy/series/tests/test_order.py::test_simple_5", "sympy/simplify/tests/test_simplify.py::test_simplify_rational", "sympy/core/tests/test_relational.py::test_simplify_relational", "sympy/core/tests/test_function.py::test_function__eval_nseries", "sympy/physics/biomechanics/tests/test_musculotendon.py::TestTendonForceExplicit::test_M[MusculotendonDeGroote2016-curve0]", "sympy/core/tests/test_relational.py::test_equals", "sympy/functions/elementary/tests/test_hyperbolic.py::test_csch_series", "sympy/series/tests/test_order.py::test_simple_6", "sympy/core/tests/test_evalf.py::test_evalf_product", "sympy/core/tests/test_expr.py::test_leadterm2", "sympy/concrete/tests/test_sums_products.py::test_composite_sums", "sympy/utilities/tests/test_lambdify.py::test_sym_integral", "sympy/physics/mechanics/tests/test_pathway.py::TestObstacleSetPathway::test_2D_pathway_length", "sympy/core/tests/test_subs.py::test_subs_mixed", "sympy/assumptions/tests/test_query.py::test_GoldenRatio", "sympy/series/tests/test_nseries.py::test_sqrt_1", "sympy/physics/mechanics/tests/test_pathway.py::TestObstacleSetPathway::test_2D_pathway_extension_velocity", "sympy/simplify/tests/test_simplify.py::test_simplify_issue_1308", "sympy/physics/mechanics/tests/test_pathway.py::TestObstacleSetPathway::test_2D_pathway_to_loads", "sympy/physics/biomechanics/tests/test_musculotendon.py::TestTendonForceExplicit::test_F[MusculotendonDeGroote2016-curve0]", "sympy/solvers/tests/test_solvers.py::test_guess_transcendental", "sympy/utilities/tests/test_wester.py::test_H15", "sympy/simplify/tests/test_simplify.py::test_issue_5652", "sympy/series/tests/test_nseries.py::test_exp_1", "sympy/core/tests/test_function.py::test_subs_in_derivative", "sympy/series/tests/test_order.py::test_simple_7", "sympy/matrices/tests/test_matrixbase.py::test_issue_17247_expression_blowup_2", "sympy/series/tests/test_limits.py::test_piecewise2", "sympy/matrices/tests/test_commonmatrix.py::test_is_anti_symmetric", "sympy/core/tests/test_relational.py::test_issue_18188", "sympy/integrals/tests/test_integrals.py::test_transcendental_functions", "sympy/matrices/tests/test_commonmatrix.py::test_diagonal_symmetrical", "sympy/stats/tests/test_continuous_rv.py::test_symbolic", "sympy/matrices/tests/test_commonmatrix.py::test_is_hermitian", "sympy/simplify/tests/test_simplify.py::test_simplify_fail1", "sympy/logic/tests/test_boolalg.py::test_bool_as_set", "sympy/core/tests/test_subs.py::test_issue_5284", "sympy/assumptions/tests/test_query.py::test_TribonacciConstant", "sympy/functions/elementary/tests/test_hyperbolic.py::test_sech_series", "sympy/series/tests/test_nseries.py::test_exp_sqrt_1", "sympy/core/tests/test_expr.py::test_leadterm3", "sympy/series/tests/test_order.py::test_simple_8", "sympy/core/tests/test_relational.py::test_nothing_happens_to_Eq_condition_during_simplify", "sympy/logic/tests/test_boolalg.py::test_issue_8777", "sympy/printing/tests/test_mathml.py::test_print_polylog", "sympy/matrices/tests/test_matrices.py::test_issue_17247_expression_blowup_9", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_end_vectors[axis6-position_16-position_26-vector_16-vector_26]", "sympy/core/tests/test_function.py::test_nfloat", "sympy/printing/tests/test_str.py::test_Sum", "sympy/core/tests/test_subs.py::test_issue_5651", "sympy/physics/biomechanics/tests/test_musculotendon.py::TestTendonForceExplicit::test_rhs[MusculotendonDeGroote2016-curve0]", "sympy/functions/elementary/tests/test_trigonometric.py::test_sin_series", "sympy/logic/tests/test_boolalg.py::test_issue_8975", "sympy/concrete/tests/test_sums_products.py::test_hypergeometric_sums", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_end_vectors[axis7-position_17-position_27-vector_17-vector_27]", "sympy/series/tests/test_nseries.py::test_power_x_x1", "sympy/printing/pretty/tests/test_pretty.py::test_pretty_FormalPowerSeries", "sympy/stats/tests/test_continuous_rv.py::test_cdf", "sympy/core/tests/test_subs.py::test_issue_6419_6421", "sympy/printing/tests/test_str.py::test_Feedback_str", "sympy/core/tests/test_numbers.py::test_issue_13890", "sympy/functions/elementary/tests/test_hyperbolic.py::test_asinh_leading_term", "sympy/core/tests/test_function.py::test_issue_7231", "sympy/core/tests/test_relational.py::test_issue_15847", "sympy/core/tests/test_expr.py::test_as_leading_term2", "sympy/solvers/tests/test_solvers.py::test_solve_args", "sympy/sets/tests/test_sets.py::test_image_interval", "sympy/concrete/tests/test_sums_products.py::test_other_sums", "sympy/series/tests/test_order.py::test_as_expr_variables", "sympy/functions/elementary/tests/test_hyperbolic.py::test_asinh_series", "sympy/series/tests/test_nseries.py::test_power_x_x2", "sympy/core/tests/test_evalf.py::test_evalf_mul", "sympy/series/tests/test_limits.py::test_basic5", "sympy/series/tests/test_nseries.py::test_log_singular1", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_length[pA_vec5-pB_vec5-factor5]", "sympy/series/tests/test_order.py::test_contains_1", "sympy/matrices/tests/test_commonmatrix.py::test_simplify", "sympy/core/tests/test_subs.py::test_issue_6923", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_length[pA_vec6-pB_vec6-factor6]", "sympy/logic/tests/test_boolalg.py::test_relational_simplification", "sympy/series/tests/test_order.py::test_contains_2", "sympy/sets/tests/test_sets.py::test_image_piecewise", "sympy/integrals/tests/test_integrals.py::test_log_polylog", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_end_vectors[axis8-position_18-position_28-vector_18-vector_28]", "sympy/core/tests/test_subs.py::test_issue_5217", "sympy/core/tests/test_expr.py::test_as_leading_term3", "sympy/functions/elementary/tests/test_hyperbolic.py::test_asinh_nseries", "sympy/logic/tests/test_boolalg.py::test_issue_8373", "sympy/solvers/tests/test_solvers.py::test_solve_polynomial1", "sympy/core/tests/test_relational.py::test_polynomial_relation_simplification", "sympy/series/tests/test_limits.py::test_issue_3885", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_to_loads[pA_vec0-pB_vec0-pA_vec_expected0-pB_vec_expected0-pO_vec_expected0]", "sympy/series/tests/test_order.py::test_contains_3", "sympy/core/tests/test_expr.py::test_as_leading_term4", "sympy/series/tests/test_nseries.py::test_log_power1", "sympy/matrices/tests/test_commonmatrix.py::test_limit", "sympy/printing/pretty/tests/test_pretty.py::test_pretty_geometry", "sympy/concrete/tests/test_sums_products.py::test_evalf_fast_series", "sympy/series/tests/test_nseries.py::test_log_series", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_end_vectors[axis10-position_110-position_210-vector_110-vector_210]", "sympy/series/tests/test_order.py::test_contains_4", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_to_loads[pA_vec1-pB_vec1-pA_vec_expected1-pB_vec_expected1-pO_vec_expected1]", "sympy/core/tests/test_relational.py::test_multivariate_linear_function_simplification", "sympy/matrices/tests/test_determinant.py::test_permanent", "sympy/logic/tests/test_boolalg.py::test_issue_7950", "sympy/integrals/tests/test_integrals.py::test_issue_7450", "sympy/stats/tests/test_continuous_rv.py::test_ContinuousRV", "sympy/series/tests/test_limits.py::test_Limit", "sympy/solvers/tests/test_solveset.py::test_invert_trig_hyp_real", "sympy/printing/tests/test_latex.py::test_Feedback_printing", "sympy/series/tests/test_nseries.py::test_log3", "sympy/core/tests/test_evalf.py::test_issue_11151", "sympy/solvers/tests/test_solvers.py::test_solve_polynomial_cv_1a", "sympy/core/tests/test_function.py::test_Derivative_as_finite_difference", "sympy/matrices/tests/test_matrixbase.py::test_issue_17247_expression_blowup_9", "sympy/sets/tests/test_sets.py::test_issue_10113", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_22917", "sympy/core/tests/test_expr.py::test_as_leading_term_stub", "sympy/series/tests/test_nseries.py::test_series1", "sympy/functions/elementary/tests/test_hyperbolic.py::test_acosh_leading_term", "sympy/core/tests/test_args.py::test_sympy__functions__special__zeta_functions__polylog", "sympy/concrete/tests/test_sums_products.py::test_evalf_fast_series_issue_4021", "sympy/core/tests/test_arit.py::test_float_int_round", "sympy/matrices/tests/test_matrices.py::test_issue_17247_expression_blowup_14", "sympy/solvers/tests/test_solvers.py::test_solve_polynomial_cv_1b", "sympy/series/tests/test_order.py::test_contains", "sympy/series/tests/test_limits.py::test_floor", "sympy/functions/elementary/tests/test_trigonometric.py::test_cos_series", "sympy/physics/mechanics/tests/test_wrapping_geometry.py::TestWrappingCylinder::test_geodesic_end_vectors[axis11-position_111-position_211-vector_111-vector_211]", "sympy/core/tests/test_expr.py::test_as_leading_term_deriv_integral", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_simplify", "sympy/series/tests/test_nseries.py::test_seriesbug1", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_to_loads[pA_vec2-pB_vec2-pA_vec_expected2-pB_vec_expected2-pO_vec_expected2]", "sympy/series/tests/test_limits.py::test_floor_requires_robust_assumptions", "sympy/concrete/tests/test_sums_products.py::test_evalf_slow_series", "sympy/matrices/tests/test_matrices.py::test_issue_17247_expression_blowup_15", "sympy/sets/tests/test_sets.py::test_finiteset_simplify", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_solve", "sympy/series/tests/test_nseries.py::test_series2x", "sympy/series/tests/test_limits.py::test_ceiling", "sympy/printing/pretty/tests/test_pretty.py::test_print_expint_polylog_symbolic_order", "sympy/series/tests/test_order.py::test_add_1", "sympy/simplify/tests/test_simplify.py::test_nthroot1", "sympy/series/tests/test_nseries.py::test_bug2", "sympy/stats/tests/test_continuous_rv.py::test_beta", "sympy/functions/elementary/tests/test_hyperbolic.py::test_acosh_series", "sympy/matrices/tests/test_matrixbase.py::test_issue_17247_expression_blowup_14", "sympy/core/tests/test_arit.py::test_issue_21034", "sympy/sets/tests/test_sets.py::test_issue_14336", "sympy/series/tests/test_limits.py::test_ceiling_requires_robust_assumptions", "sympy/core/tests/test_function.py::test_issue_10503", "sympy/core/tests/test_args.py::test_sympy__physics__control__lti__Feedback", "sympy/concrete/tests/test_sums_products.py::test_euler_maclaurin", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_to_loads[pA_vec3-pB_vec3-pA_vec_expected3-pB_vec_expected3-pO_vec_expected3]", "sympy/series/tests/test_order.py::test_ln_args", "sympy/solvers/tests/test_solvers.py::test_solve_polynomial_cv_2", "sympy/integrals/tests/test_integrals.py::test_issue_9569", "sympy/functions/elementary/tests/test_trigonometric.py::test_tan", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_fold", "sympy/core/tests/test_expr.py::test_replace", "sympy/series/tests/test_limits.py::test_frac", "sympy/matrices/tests/test_matrixbase.py::test_issue_17247_expression_blowup_15", "sympy/functions/elementary/tests/test_hyperbolic.py::test_acosh_nseries", "sympy/matrices/tests/test_matrices.py::test_issue_17247_expression_blowup_16", "sympy/printing/pretty/tests/test_pretty.py::test_print_polylog_long_order_issue_25309", "sympy/core/tests/test_function.py::test_issue_17382", "sympy/series/tests/test_order.py::test_multivar_0", "sympy/stats/tests/test_continuous_rv.py::test_BoundedPareto", "sympy/sets/tests/test_fancysets.py::test_ComplexRegion_union", "sympy/simplify/tests/test_simplify.py::test_separatevars", "sympy/matrices/tests/test_matrixbase.py::test_issue_17247_expression_blowup_16", "sympy/series/tests/test_limits.py::test_issue_14355", "sympy/solvers/tests/test_solvers.py::test_quintics_1", "sympy/series/tests/test_nseries.py::test_exp", "sympy/core/tests/test_expr.py::test_action_verbs", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_fold_piecewise_in_cond", "sympy/series/tests/test_nseries.py::test_exp2", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_to_loads[pA_vec4-pB_vec4-pA_vec_expected4-pB_vec_expected4-pO_vec_expected4]", "sympy/series/tests/test_order.py::test_multivar_0a", "sympy/functions/elementary/tests/test_trigonometric.py::test_tan_series", "sympy/stats/tests/test_continuous_rv.py::test_chi_squared", "sympy/concrete/tests/test_sums_products.py::test_simple_products", "sympy/matrices/tests/test_matrices.py::test_issue_17247_expression_blowup_17", "sympy/concrete/tests/test_sums_products.py::test_rational_products", "sympy/core/tests/test_expr.py::test_eval_interval", "sympy/solvers/tests/test_solveset.py::test_issue_17479", "sympy/functions/elementary/tests/test_hyperbolic.py::test_asech", "sympy/matrices/tests/test_matrixbase.py::test_issue_17247_expression_blowup_17", "sympy/concrete/tests/test_sums_products.py::test_wallis_product", "sympy/series/tests/test_nseries.py::test_bug3", "sympy/logic/tests/test_boolalg.py::test_issue_16803", "sympy/simplify/tests/test_simplify.py::test_hypersimp", "sympy/functions/elementary/tests/test_piecewise.py::test_doit", "sympy/series/tests/test_order.py::test_multivar_1", "sympy/solvers/tests/test_solvers.py::test_quintics_2", "sympy/functions/elementary/tests/test_hyperbolic.py::test_asech_leading_term", "sympy/stats/tests/test_continuous_rv.py::test_exgaussian", "sympy/matrices/tests/test_matrices.py::test_issue_17247_expression_blowup_19", "sympy/solvers/diophantine/tests/test_diophantine.py::test_quadratic_parabolic_case", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_to_loads[pA_vec5-pB_vec5-pA_vec_expected5-pB_vec_expected5-pO_vec_expected5]", "sympy/concrete/tests/test_sums_products.py::test_telescopic_sums", "sympy/series/tests/test_order.py::test_multivar_2", "sympy/functions/elementary/tests/test_exponential.py::test_exp_rewrite", "sympy/matrices/tests/test_matrixbase.py::test_issue_17247_expression_blowup_19", "sympy/core/tests/test_args.py::test_sympy__series__formal__FormalPowerSeries", "sympy/series/tests/test_limits.py::test_atan", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_exclusive", "sympy/solvers/diophantine/tests/test_diophantine.py::test_quadratic_perfect_square", "sympy/core/tests/test_assumptions.py::test_ask_shuffle", "sympy/series/tests/test_nseries.py::test_generalexponent", "sympy/solvers/tests/test_solveset.py::test_issue_21047", "sympy/simplify/tests/test_simplify.py::test_extract_minus_sign", "sympy/concrete/tests/test_sums_products.py::test_Sum_doit", "sympy/core/tests/test_expr.py::test_eval_interval_zoo", "sympy/series/tests/test_order.py::test_multivar_mul_1", "sympy/matrices/tests/test_matrices.py::test_issue_17247_expression_blowup_20", "sympy/solvers/tests/test_solvers.py::test_solve_rational", "sympy/solvers/diophantine/tests/test_diophantine.py::test_quadratic_non_perfect_square", "sympy/functions/elementary/tests/test_exponential.py::test_exp_leading_term", "sympy/functions/elementary/tests/test_hyperbolic.py::test_asech_series", "sympy/integrals/tests/test_integrals.py::test_issue_13733", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_series", "sympy/solvers/diophantine/tests/test_diophantine.py::test_issue_9106", "sympy/matrices/tests/test_matrixbase.py::test_issue_17247_expression_blowup_20", "sympy/series/tests/test_order.py::test_multivar_3", "sympy/core/tests/test_expr.py::test_is_constant", "sympy/simplify/tests/test_simplify.py::test_issue_4194", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_to_loads[pA_vec6-pB_vec6-pA_vec_expected6-pB_vec_expected6-pO_vec_expected6]", "sympy/concrete/tests/test_sums_products.py::test_Product_doit", "sympy/series/tests/test_nseries.py::test_genexp_x", "sympy/series/tests/test_limits.py::test_set_signs", "sympy/series/tests/test_order.py::test_issue_3468", "sympy/core/tests/test_args.py::test_sympy__series__formal__FormalPowerSeriesProduct", "sympy/concrete/tests/test_sums_products.py::test_hypersum", "sympy/solvers/tests/test_solveset.py::test_solve_mul", "sympy/functions/elementary/tests/test_hyperbolic.py::test_asech_nseries", "sympy/solvers/diophantine/tests/test_diophantine.py::test_issue_18138", "sympy/solvers/tests/test_solvers.py::test_solve_conjugate", "sympy/simplify/tests/test_simplify.py::test_besselsimp", "sympy/series/tests/test_order.py::test_leading_order", "sympy/printing/tests/test_octave.py::test_Function", "sympy/series/tests/test_nseries.py::test_genexp_x2", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_as_leading_term", "sympy/core/tests/test_expr.py::test_equals", "sympy/physics/control/tests/test_lti.py::test_TransferFunction_functions", "sympy/functions/elementary/tests/test_trigonometric.py::test_cot", "sympy/physics/biomechanics/tests/test_activation.py::TestFirstOrderActivationDeGroote2016::test_rhs", "sympy/stats/tests/test_continuous_rv.py::test_Lomax", "sympy/series/tests/test_order.py::test_leading_order2", "sympy/physics/vector/tests/test_frame.py::test_coordinate_vars", "sympy/series/tests/test_limits.py::test_heuristic", "sympy/core/tests/test_power.py::test_nseries", "sympy/matrices/expressions/tests/test_matexpr.py::test_matadd_simplify", "sympy/series/tests/test_series.py::test_sin", "sympy/solvers/tests/test_solvers.py::test_solve_nonlinear", "sympy/series/tests/test_nseries.py::test_seriesbug2", "sympy/concrete/tests/test_sums_products.py::test_issue_4170", "sympy/solvers/diophantine/tests/test_diophantine.py::test_transformation_to_pell", "sympy/matrices/tests/test_matrices.py::test_issue_17247_expression_blowup_23", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_static_pathway_on_cylinder_to_loads[pA_vec7-pB_vec7-pA_vec_expected7-pB_vec_expected7-pO_vec_expected7]", "sympy/simplify/tests/test_simplify.py::test_Piecewise", "sympy/core/tests/test_power.py::test_issue_6990", "sympy/core/tests/test_args.py::test_sympy__series__formal__FormalPowerSeriesCompose", "sympy/simplify/tests/test_simplify.py::test_issue_from_PR1599", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_11045", "sympy/series/tests/test_order.py::test_order_leadterm", "sympy/functions/combinatorial/tests/test_comb_numbers.py::test_fibonacci", "sympy/solvers/tests/test_solveset.py::test_solve_polynomial", "sympy/matrices/tests/test_matrixbase.py::test_issue_17247_expression_blowup_23", "sympy/solvers/diophantine/tests/test_diophantine.py::test_diop_ternary_quadratic_normal", "sympy/series/tests/test_nseries.py::test_seriesbug2b", "sympy/functions/elementary/tests/test_exponential.py::test_log_leading_term", "sympy/functions/elementary/tests/test_trigonometric.py::test_cot_series", "sympy/concrete/tests/test_sums_products.py::test_noncommutativity_honoured", "sympy/stats/tests/test_continuous_rv.py::test_maxwell", "sympy/core/tests/test_power.py::test_issue_6068", "sympy/series/tests/test_limits.py::test_issue_3871", "sympy/integrals/tests/test_integrals.py::test_issue_13749", "sympy/core/tests/test_expr.py::test_round", "sympy/simplify/tests/test_simplify.py::test_issue_6811", "sympy/series/tests/test_order.py::test_order_symbols", "sympy/solvers/diophantine/tests/test_diophantine.py::test_transformation_to_normal", "sympy/physics/quantum/tests/test_spin.py::test_represent_spin_states", "sympy/simplify/tests/test_simplify.py::test_issue_6920", "sympy/series/tests/test_nseries.py::test_seriesbug2d", "sympy/solvers/tests/test_solvers.py::test_issue_7228", "sympy/functions/elementary/tests/test_hyperbolic.py::test_acsch", "sympy/matrices/expressions/tests/test_matexpr.py::test_matmul_simplify", "sympy/functions/elementary/tests/test_exponential.py::test_log_nseries", "sympy/series/tests/test_series.py::test_cos", "sympy/series/tests/test_gruntz.py::test_gruntz_Ei", "sympy/matrices/tests/test_matrices.py::test_issue_17247_expression_blowup_24", "sympy/solvers/diophantine/tests/test_diophantine.py::test_diop_ternary_quadratic", "sympy/concrete/tests/test_sums_products.py::test_issue_4171", "sympy/series/tests/test_gruntz.py::test_gruntz_hyperbolic", "sympy/geometry/tests/test_line.py::test_arbitrary_point", "sympy/core/tests/test_power.py::test_issue_6782", "sympy/solvers/tests/test_solveset.py::test_return_root_of", "sympy/simplify/tests/test_simplify.py::test_issue_7001", "sympy/functions/combinatorial/tests/test_comb_numbers.py::test_tribonacci", "sympy/stats/tests/test_continuous_rv.py::test_nakagami", "sympy/series/tests/test_order.py::test_nan", "sympy/geometry/tests/test_line.py::test_are_concurrent_2d", "sympy/core/tests/test_args.py::test_sympy__series__formal__FormalPowerSeriesInverse", "sympy/functions/elementary/tests/test_hyperbolic.py::test_acsch_leading_term", "sympy/series/tests/test_nseries.py::test_seriesbug2c", "sympy/matrices/tests/test_matrixbase.py::test_issue_17247_expression_blowup_24", "sympy/solvers/tests/test_solvers.py::test_issue_7190", "sympy/series/tests/test_gruntz.py::test_compare1", "sympy/matrices/tests/test_matrices.py::test_issue_17247_expression_blowup_25", "sympy/series/tests/test_order.py::test_O1", "sympy/core/tests/test_power.py::test_issue_6653", "sympy/solvers/diophantine/tests/test_diophantine.py::test_parametrize_ternary_quadratic", "sympy/physics/control/tests/test_lti.py::test_PIDController", "sympy/functions/elementary/tests/test_exponential.py::test_log_series", "sympy/integrals/tests/test_manual.py::test_find_substitutions", "sympy/series/tests/test_gruntz.py::test_compare2", "sympy/series/tests/test_gruntz.py::test_compare3", "sympy/solvers/ode/tests/test_ode.py::test_dsolve_all_hint", "sympy/series/tests/test_series.py::test_exp", "sympy/stats/tests/test_rv.py::test_H", "sympy/core/tests/test_expr.py::test_issue_7426", "sympy/solvers/diophantine/tests/test_diophantine.py::test_no_square_ternary_quadratic", "sympy/series/tests/test_order.py::test_getn", "sympy/concrete/tests/test_sums_products.py::test_simplify_sum", "sympy/series/tests/test_gruntz.py::test_sign1", "sympy/series/tests/test_limits.py::test_exponential", "sympy/series/tests/test_nseries.py::test_expbug4", "sympy/functions/elementary/tests/test_hyperbolic.py::test_acsch_series", "sympy/physics/units/tests/test_quantities.py::test_issue_14932", "sympy/series/tests/test_gruntz.py::test_mrv1", "sympy/stats/tests/test_continuous_rv.py::test_gaussian_inverse", "sympy/solvers/tests/test_solveset.py::test_solveset_sqrt_1", "sympy/core/tests/test_power.py::test_issue_6429", "sympy/geometry/tests/test_line.py::test_are_concurrent_3d", "sympy/simplify/tests/test_simplify.py::test_inequality_no_auto_simplify", "sympy/solvers/tests/test_solvers.py::test_issue_21004", "sympy/series/tests/test_series.py::test_exp2", "sympy/solvers/diophantine/tests/test_diophantine.py::test_diophantine", "sympy/series/tests/test_gruntz.py::test_mrv2a", "sympy/core/tests/test_expr.py::test_issue_10651", "sympy/series/tests/test_order.py::test_diff", "sympy/functions/combinatorial/tests/test_comb_numbers.py::test_bell", "sympy/simplify/tests/test_simplify.py::test_issue_9398", "sympy/polys/tests/test_polyroots.py::test_roots_quadratic", "sympy/functions/elementary/tests/test_trigonometric.py::test_sinc", "sympy/matrices/tests/test_matrixbase.py::test_issue_17247_expression_blowup_25", "sympy/series/tests/test_nseries.py::test_logbug4", "sympy/solvers/diophantine/tests/test_diophantine.py::test_general_pythagorean", "sympy/physics/quantum/tests/test_spin.py::test_represent_uncoupled_states", "sympy/series/tests/test_gruntz.py::test_mrv2b", "sympy/concrete/tests/test_sums_products.py::test_issue_7097", "sympy/series/tests/test_order.py::test_getO", "sympy/tensor/tests/test_indexed.py::test_indexed_series", "sympy/series/tests/test_gruntz.py::test_mrv2c", "sympy/physics/mechanics/tests/test_pathway.py::TestWrappingPathway::test_2D_pathway_on_cylinder_to_loads", "sympy/geometry/tests/test_line.py::test_basic_properties_2d", "sympy/simplify/tests/test_simplify.py::test_issue_9324_simplify", "sympy/series/tests/test_nseries.py::test_expbug5", "sympy/functions/elementary/tests/test_hyperbolic.py::test_acsch_nseries", "sympy/solvers/diophantine/tests/test_diophantine.py::test_diop_general_sum_of_squares_quick", "sympy/series/tests/test_gruntz.py::test_mrv3", "sympy/matrices/tests/test_matrices.py::test_issue_17247_expression_blowup_27", "sympy/simplify/tests/test_simplify.py::test_issue_9817_simplify", "sympy/physics/control/tests/test_lti.py::test_Feedback_construction", "sympy/integrals/tests/test_manual.py::test_manualintegrate_polynomials", "sympy/series/tests/test_gruntz.py::test_mrv4", "sympy/matrices/expressions/tests/test_matexpr.py::test_inv", "sympy/core/tests/test_expr.py::test_issue_11877", "sympy/series/tests/test_gruntz.py::test_rewrite1", "sympy/simplify/tests/test_simplify.py::test_issue_13474", "sympy/series/tests/test_series.py::test_issue_5223", "sympy/polys/tests/test_polyroots.py::test_issue_7724", "sympy/series/tests/test_order.py::test_leading_term", "sympy/series/tests/test_gruntz.py::test_rewrite2", "sympy/solvers/tests/test_solveset.py::test_solveset_sqrt_2", "sympy/stats/tests/test_rv.py::test_factorial_moment", "sympy/series/tests/test_gruntz.py::test_rewrite3", "sympy/functions/elementary/tests/test_exponential.py::test_log_product", "sympy/geometry/tests/test_line.py::test_basic_properties_3d", "sympy/series/tests/test_gruntz.py::test_mrv_leadterm1", "sympy/solvers/ode/tests/test_ode.py::test_dsolve_ics", "sympy/core/tests/test_power.py::test_issue_18762", "sympy/simplify/tests/test_simplify.py::test_simplify_function_inverse", "sympy/tensor/tests/test_indexed.py::test_indexed_is_constant", "sympy/series/tests/test_limits.py::test_exponential2", "sympy/solvers/diophantine/tests/test_diophantine.py::test_diopcoverage", "sympy/series/tests/test_nseries.py::test_sinsinbug", "sympy/geometry/tests/test_line.py::test_contains", "sympy/integrals/tests/test_meijerint.py::test_rewrite_single", "sympy/stats/tests/test_continuous_rv.py::test_pareto", "sympy/parsing/tests/test_sympy_parser.py::test_issue_7663", "sympy/simplify/tests/test_simplify.py::test_nc_simplify", "sympy/matrices/tests/test_matrixbase.py::test_issue_17247_expression_blowup_27", "sympy/series/tests/test_gruntz.py::test_mrv_leadterm2", "sympy/physics/control/tests/test_lti.py::test_Feedback_functions", "sympy/functions/elementary/tests/test_trigonometric.py::test_asin_series", "sympy/series/tests/test_order.py::test_eval", "sympy/functions/elementary/tests/test_exponential.py::test_issue_8866", "sympy/simplify/tests/test_fu.py::test_TR2i", "sympy/series/tests/test_gruntz.py::test_mrv_leadterm3", "sympy/matrices/expressions/tests/test_matexpr.py::test_issue_2749", "sympy/utilities/tests/test_pickling.py::test_series", "sympy/physics/mechanics/tests/test_system_class.py::TestSystemExamples::test_cart_pendulum_kanes", "sympy/integrals/tests/test_integrals.py::test_issue_18133", "sympy/series/tests/test_series.py::test_issue_6350", "sympy/series/tests/test_gruntz.py::test_limit1", "sympy/series/tests/test_order.py::test_issue_4279", "sympy/functions/combinatorial/tests/test_comb_numbers.py::test_harmonic_calculus", "sympy/series/tests/test_gruntz.py::test_limit2", "sympy/simplify/tests/test_hyperexpand.py::test_branch_bug", "sympy/solvers/ode/tests/test_ode.py::test_classify_ode", "sympy/series/tests/test_gruntz.py::test_limit3", "sympy/solvers/tests/test_solveset.py::test_solve_polynomial_symbolic_param", "sympy/concrete/tests/test_delta.py::test_deltaproduct_trivial", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_Beam", "sympy/functions/special/tests/test_bessel.py::test_besselj_leading_term", "sympy/stats/tests/test_rv.py::test_dependence", "sympy/series/tests/test_gruntz.py::test_limit4", "sympy/geometry/tests/test_line.py::test_contains_nonreal_symbols", "sympy/physics/quantum/tests/test_spin.py::test_represent_coupled_states", "sympy/series/tests/test_order.py::test_issue_4855", "sympy/concrete/tests/test_delta.py::test_deltaproduct_basic", "sympy/series/tests/test_gruntz.py::test_gruntz_I", "sympy/polys/tests/test_ring_series.py::test_RR", "sympy/physics/control/tests/test_lti.py::test_Feedback_with_Series", "sympy/core/tests/test_expr.py::test_issue_22020", "sympy/core/tests/test_power.py::test_issue_25165", "sympy/functions/elementary/tests/test_exponential.py::test_issue_18473", "sympy/integrals/tests/test_manual.py::test_manualintegrate_exponentials", "sympy/series/tests/test_order.py::test_order_conjugate_transpose", "sympy/series/tests/test_limits.py::test_doit", "sympy/functions/elementary/tests/test_hyperbolic.py::test_atanh_leading_term", "sympy/simplify/tests/test_simplify.py::test_issue_15965", "sympy/functions/special/tests/test_error_functions.py::test_erf", "sympy/functions/special/tests/test_bessel.py::test_bessely_leading_term", "sympy/integrals/tests/test_heurisch.py::test_issue_21166", "sympy/series/tests/test_nseries.py::test_issue_3258", "sympy/geometry/tests/test_line.py::test_distance_3d", "sympy/stats/tests/test_continuous_rv.py::test_pareto_numeric", "sympy/series/tests/test_gruntz.py::test_intractable", "sympy/polys/tests/test_subresultants_qq_zz.py::test_subresultants_sylv", "sympy/series/tests/test_gruntz.py::test_aseries_trig", "sympy/series/tests/test_series.py::test_issue_11313", "sympy/solvers/ode/tests/test_ode.py::test_classify_ode_ics", "sympy/series/tests/test_order.py::test_order_noncommutative", "sympy/simplify/tests/test_cse_diff.py::test_forward_jacobian[expr14-wrt14]", "sympy/simplify/tests/test_radsimp.py::test_radsimp", "sympy/functions/elementary/tests/test_trigonometric.py::test_asin_leading_term", "sympy/integrals/tests/test_meijerint.py::test_meijerint_indefinite_numerically", "sympy/functions/special/tests/test_error_functions.py::test_erf_series", "sympy/functions/elementary/tests/test_complexes.py::test_arg_leading_term_and_series", "sympy/simplify/tests/test_simplify.py::test_issue_17137", "sympy/series/tests/test_gruntz.py::test_exp_log_series", "sympy/series/tests/test_nseries.py::test_issue_3204", "sympy/functions/elementary/tests/test_piecewise.py::test__intervals", "sympy/concrete/tests/test_delta.py::test_deltaproduct_mul_x_kd", "sympy/functions/combinatorial/tests/test_comb_numbers.py::test_andre", "sympy/solvers/tests/test_solveset.py::test_solve_rational", "sympy/series/tests/test_limits.py::test_series_AccumBounds", "sympy/simplify/tests/test_simplify.py::test_issue_21869", "sympy/physics/control/tests/test_lti.py::test_issue_26161", "sympy/functions/elementary/tests/test_hyperbolic.py::test_atanh_series", "sympy/functions/special/tests/test_bessel.py::test_besseli_leading_term", "sympy/series/tests/test_gruntz.py::test_issue_3644", "sympy/simplify/tests/test_radsimp.py::test_radsimp_issue_3214", "sympy/integrals/tests/test_manual.py::test_manualintegrate_parts", "sympy/physics/mechanics/tests/test_joint.py::test_pin_joint_double_pendulum", "sympy/physics/vector/tests/test_frame.py::test_dcm_diff_16824", "sympy/series/tests/test_gruntz.py::test_issue_6843", "sympy/series/tests/test_order.py::test_issue_6753", "sympy/simplify/tests/test_radsimp.py::test_collect_1", "sympy/geometry/tests/test_line.py::test_equals", "sympy/series/tests/test_nseries.py::test_issue_3224", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_insufficient_bconditions", "sympy/series/tests/test_gruntz.py::test_issue_4190", "sympy/solvers/tests/test_inequalities.py::test_reduce_inequalities_general", "sympy/physics/mechanics/tests/test_system_class.py::TestSystemExamples::test_cart_pendulum_lagrange", "sympy/matrices/tests/test_solvers.py::test_issue_17247_expression_blowup_30", "sympy/simplify/tests/test_hyperexpand.py::test_hyperexpand", "sympy/series/tests/test_order.py::test_order_at_infinity", "sympy/functions/special/tests/test_error_functions.py::test__erfs", "sympy/series/tests/test_gruntz.py::test_issue_4109", "sympy/core/tests/test_expr.py::test_issue_24045", "sympy/geometry/tests/test_line.py::test_equation", "sympy/series/tests/test_nseries.py::test_issue_3463", "sympy/stats/tests/test_rv.py::test_normality", "sympy/functions/special/tests/test_bessel.py::test_besselk_leading_term", "sympy/functions/elementary/tests/test_trigonometric.py::test_acos_leading_term", "sympy/functions/elementary/tests/test_complexes.py::test_issue_11413", "sympy/simplify/tests/test_radsimp.py::test_collect_3", "sympy/concrete/tests/test_sums_products.py::test_issue_2787", "sympy/geometry/tests/test_line.py::test_intersection_2d", "sympy/solvers/tests/test_inequalities.py::test_reduce_inequalities_errors", "sympy/series/tests/test_series.py::test_series_of_Subs", "sympy/series/tests/test_gruntz.py::test_issue_6682", "sympy/holonomic/tests/test_holonomic.py::test_addition_initial_condition", "sympy/stats/tests/test_continuous_rv.py::test_rayleigh", "sympy/functions/elementary/tests/test_hyperbolic.py::test_atanh_nseries", "sympy/simplify/tests/test_simplify.py::test_issue_17141", "sympy/integrals/tests/test_risch.py::test_issue_13947", "sympy/concrete/tests/test_delta.py::test_deltaproduct_mul_add_x_y_kd", "sympy/series/tests/test_gruntz.py::test_issue_7096", "sympy/simplify/tests/test_hyperexpand.py::test_roach", "sympy/functions/special/tests/test_bessel.py::test_besselj_series", "sympy/series/tests/test_nseries.py::test_sin", "sympy/series/tests/test_gruntz.py::test_issue_7391_8166", "sympy/solvers/ode/tests/test_ode.py::test_solve_ics", "sympy/integrals/tests/test_meijerint.py::test_recursive", "sympy/integrals/tests/test_manual.py::test_manualintegrate_trigonometry", "sympy/simplify/tests/test_cse_diff.py::test_forward_jacobian[expr15-wrt15]", "sympy/physics/quantum/tests/test_spin.py::test_rewrite_Bra", "sympy/solvers/tests/test_solveset.py::test_no_sol", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_statically_indeterminate", "sympy/series/tests/test_gruntz.py::test_issue_24210_25885", "sympy/series/tests/test_order.py::test_mixing_order_at_zero_and_infinity", "sympy/functions/elementary/tests/test_trigonometric.py::test_acos_series", "sympy/solvers/ode/tests/test_systems.py::test__classify_linear_system", "sympy/geometry/tests/test_line.py::test_line_intersection", "sympy/concrete/tests/test_delta.py::test_deltaproduct_add_kd_kd", "sympy/integrals/tests/test_integrals.py::test_integrate_functions", "sympy/functions/special/tests/test_bessel.py::test_bessely_series", "sympy/physics/mechanics/tests/test_joint.py::test_pin_joint_interframe", "sympy/simplify/tests/test_radsimp.py::test_collect_5", "sympy/simplify/tests/test_trigsimp.py::test_issue_4661", "sympy/stats/tests/test_rv.py::test_issue_12237", "sympy/geometry/tests/test_polygon.py::test_triangle_kwargs", "sympy/series/tests/test_order.py::test_order_at_some_point", "sympy/functions/special/tests/test_error_functions.py::test_erfc", "sympy/concrete/tests/test_products.py::test_karr_proposition_2a", "sympy/concrete/tests/test_products.py::test_simple_products", "sympy/series/tests/test_series.py::test_issue_3978", "sympy/concrete/tests/test_sums_products.py::test_is_absolutely_convergent", "sympy/simplify/tests/test_simplify.py::test_simplify_kroneckerdelta", "sympy/concrete/tests/test_products.py::test_multiple_products", "sympy/concrete/tests/test_products.py::test_rational_products", "sympy/functions/elementary/tests/test_piecewise.py::test_containment", "sympy/simplify/tests/test_radsimp.py::test_collect_order", "sympy/series/tests/test_limits.py::test_bessel_functions_at_infinity", "sympy/series/tests/test_order.py::test_order_subs_limits", "sympy/concrete/tests/test_products.py::test_special_products", "sympy/solvers/tests/test_solveset.py::test_no_sol_rational_extragenous", "sympy/simplify/tests/test_simplify.py::test_issue_17292", "sympy/simplify/tests/test_fu.py::test_issue_25590", "sympy/concrete/tests/test_products.py::test__eval_product", "sympy/integrals/tests/test_manual.py::test_manualintegrate_trig_substitution", "sympy/geometry/tests/test_line.py::test_intersection_3d", "sympy/functions/special/tests/test_error_functions.py::test_erfc_series", "sympy/concrete/tests/test_products.py::test_product_pow", "sympy/series/tests/test_order.py::test_issue_9351", "sympy/simplify/tests/test_hyperexpand.py::test_polynomial", "sympy/series/tests/test_nseries.py::test_issue_3515", "sympy/functions/special/tests/test_bessel.py::test_besseli_series", "sympy/geometry/tests/test_polygon.py::test_reflect", "sympy/matrices/tests/test_solvers.py::test_cholesky_solve", "sympy/solvers/ode/tests/test_ode.py::test_homogeneous_order", "sympy/functions/elementary/tests/test_hyperbolic.py::test_acoth_leading_term", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_beam_units", "sympy/polys/tests/test_subresultants_qq_zz.py::test_subresultants_bezout", "sympy/concrete/tests/test_delta.py::test_deltaproduct_mul_x_add_kd_kd", "sympy/functions/elementary/tests/test_trigonometric.py::test_atan_leading_term", "sympy/series/tests/test_limits.py::test_issue_2929", "sympy/stats/tests/test_finite_rv.py::test_discreteuniform", "sympy/integrals/tests/test_meijerint.py::test_bessel", "sympy/geometry/tests/test_polygon.py::test_bisectors", "sympy/stats/tests/test_continuous_rv.py::test_trapezoidal", "sympy/solvers/tests/test_inequalities.py::test_solve_univariate_inequality", "sympy/simplify/tests/test_radsimp.py::test_fraction", "sympy/functions/special/tests/test_bessel.py::test_besselk_series", "sympy/simplify/tests/test_simplify.py::test_issue_19822", "sympy/concrete/tests/test_products.py::test_simplify_prod", "sympy/geometry/tests/test_line.py::test_is_parallel", "sympy/series/tests/test_nseries.py::test_issue_3505", "sympy/functions/special/tests/test_error_functions.py::test_erfi", "sympy/geometry/tests/test_polygon.py::test_incenter", "sympy/solvers/ode/tests/test_ode.py::test_undetermined_coefficients_match", "sympy/functions/special/tests/test_gamma_functions.py::test_gamma_series", "sympy/holonomic/tests/test_holonomic.py::test_multiplication_initial_condition", "sympy/concrete/tests/test_sums_products.py::test_issue_10973", "sympy/matrices/tests/test_solvers.py::test_LDLsolve", "sympy/polys/tests/test_polyroots.py::test_issue_14522", "sympy/simplify/tests/test_radsimp.py::test_issue_5615", "sympy/series/tests/test_order.py::test_issue_9910", "sympy/geometry/tests/test_line.py::test_is_perpendicular", "sympy/functions/special/tests/test_error_functions.py::test_erfi_series", "sympy/physics/quantum/tests/test_spin.py::test_rewrite_Ket", "sympy/concrete/tests/test_products.py::test_Product_is_convergent", "sympy/solvers/tests/test_inequalities.py::test_trig_inequalities", "sympy/solvers/ode/tests/test_ode.py::test_issue_4785_22462", "sympy/functions/elementary/tests/test_trigonometric.py::test_atan2", "sympy/geometry/tests/test_polygon.py::test_incircle", "sympy/solvers/ode/tests/test_systems.py::test_canonical_odes", "sympy/integrals/tests/test_meijerint.py::test_inversion", "sympy/simplify/tests/test_hyperexpand.py::test_hyperexpand_bases", "sympy/matrices/tests/test_eigen.py::test_eigen", "sympy/geometry/tests/test_line.py::test_projection", "sympy/simplify/tests/test_trigsimp.py::test_trigsimp_issues", "sympy/algebras/tests/test_quaternion.py::test_quaternion_construction", "sympy/series/tests/test_limits.py::test_issue_3792", "sympy/functions/special/tests/test_bessel.py::test_besselk_frac_order_series", "sympy/integrals/tests/test_integrals.py::test_transform", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_variable_moment", "sympy/series/tests/test_series.py::test_issue_5852", "sympy/concrete/tests/test_delta.py::test_deltaproduct_mul_add_x_y_add_kd_kd", "sympy/functions/special/tests/test_gamma_functions.py::test_lowergamma", "sympy/geometry/tests/test_polygon.py::test_exradii", "sympy/solvers/tests/test_inequalities.py::test_issue_10198", "sympy/concrete/tests/test_delta.py::test_deltaproduct_add_mul_x_y_mul_x_kd", "sympy/concrete/tests/test_sums_products.py::test_issue_14103", "sympy/simplify/tests/test_radsimp.py::test_issue_5933", "sympy/solvers/tests/test_solveset.py::test_solveset_real_rational", "sympy/physics/mechanics/tests/test_joint.py::test_pin_joint_arbitrary_axis", "sympy/simplify/tests/test_simplify.py::test_issue_18645", "sympy/integrals/tests/test_meijerint.py::test_inversion_conditional_output", "sympy/geometry/tests/test_ellipse.py::test_construction", "sympy/series/tests/test_order.py::test_performance_of_adding_order", "sympy/series/tests/test_nseries.py::test_issue_3501", "sympy/geometry/tests/test_line.py::test_perpendicular_line", "sympy/integrals/tests/test_manual.py::test_manualintegrate_trivial_substitution", "sympy/concrete/tests/test_products.py::test_issue_9983", "sympy/geometry/tests/test_polygon.py::test_eulerline", "sympy/concrete/tests/test_sums_products.py::test_issue_14129", "sympy/functions/special/tests/test_error_functions.py::test_ei", "sympy/series/tests/test_series.py::test_issue_4583", "sympy/simplify/tests/test_radsimp.py::test_issue_21355", "sympy/geometry/tests/test_line.py::test_raises", "sympy/polys/tests/test_polyroots.py::test_issue_16589", "sympy/matrices/tests/test_matrices.py::test_simplify", "sympy/simplify/tests/test_hyperexpand.py::test_hyperexpand_parametric", "sympy/concrete/tests/test_delta.py::test_deltaproduct_mul_x_add_y_kd", "sympy/simplify/tests/test_powsimp.py::test_powsimp", "sympy/geometry/tests/test_ellipse.py::test_reflect", "sympy/series/tests/test_limits.py::test_issue_4090", "sympy/functions/elementary/tests/test_piecewise.py::test_unevaluated_integrals", "sympy/series/tests/test_order.py::test_issue_14622", "sympy/concrete/tests/test_products.py::test_issue_13546", "sympy/solvers/ode/tests/test_ode.py::test_issue_4825", "sympy/simplify/tests/test_powsimp.py::test_powsimp_negated_base", "sympy/functions/elementary/tests/test_hyperbolic.py::test_acoth_series", "sympy/integrals/tests/test_meijerint.py::test_inversion_exp_real_nonreal_shift", "sympy/simplify/tests/test_powsimp.py::test_powsimp_nc", "sympy/concrete/tests/test_products.py::test_issue_14036", "sympy/polys/tests/test_subresultants_qq_zz.py::test_sturm_pg", "sympy/simplify/tests/test_simplify.py::test_issue_7950", "sympy/functions/special/tests/test_error_functions.py::test_expint", "sympy/simplify/tests/test_powsimp.py::test_issue_6440", "sympy/integrals/tests/test_integrals.py::test_evalf_issue_939", "sympy/matrices/expressions/tests/test_matpow.py::test_as_explicit_symbol", "sympy/stats/tests/test_continuous_rv.py::test_uniform", "sympy/simplify/tests/test_powsimp.py::test_powdenest", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_composite_beam", "sympy/codegen/tests/test_rewriting.py::test_log1p_opt", "sympy/concrete/tests/test_products.py::test_issue_20848", "sympy/integrals/tests/test_risch.py::test_risch_integrate", "sympy/geometry/tests/test_polygon.py::test_intersection", "sympy/holonomic/tests/test_holonomic.py::test_HolonomicFunction_composition", "sympy/polys/tests/test_subresultants_qq_zz.py::test_sturm_amv", "sympy/integrals/tests/test_meijerint.py::test_branch_bug", "sympy/series/tests/test_nseries.py::test_issue_3502", "sympy/functions/elementary/tests/test_trigonometric.py::test_acot_leading_term", "sympy/series/tests/test_order.py::test_issue_15539", "sympy/concrete/tests/test_delta.py::test_deltaproduct_mul_x_add_y_twokd", "sympy/matrices/tests/test_matrices.py::test_issue_3749", "sympy/concrete/tests/test_sums_products.py::test_issue_14112", "sympy/matrices/tests/test_solvers.py::test_cramer_solve[M2-rhs2-bird]", "sympy/simplify/tests/test_powsimp.py::test_powdenest_polar", "sympy/solvers/tests/test_solveset.py::test_solveset_real_log", "sympy/polys/tests/test_polyroots.py::test_roots_quartic", "sympy/geometry/tests/test_ellipse.py::test_is_tangent", "sympy/simplify/tests/test_powsimp.py::test_issue_5805", "sympy/geometry/tests/test_line.py::test_ray_generation", "sympy/simplify/tests/test_powsimp.py::test_issue_9324_powsimp_on_matrix_symbol", "sympy/concrete/tests/test_delta.py::test_deltaproduct_mul_add_x_y_add_y_kd", "sympy/simplify/tests/test_trigsimp.py::test_trigsimp_noncommutative", "sympy/solvers/ode/tests/test_systems.py::test_sysode_linear_neq_order1_type1", "sympy/simplify/tests/test_powsimp.py::test_issue_6367", "sympy/utilities/tests/test_wester.py::test_J7", "sympy/polys/tests/test_subresultants_qq_zz.py::test_euclid_pg", "sympy/simplify/tests/test_powsimp.py::test_powsimp_polar", "sympy/simplify/tests/test_hyperexpand.py::test_shifted_sum", "sympy/simplify/tests/test_powsimp.py::test_issue_5728", "sympy/series/tests/test_limits.py::test_issue_4547", "sympy/simplify/tests/test_powsimp.py::test_issue_from_PR1599", "sympy/integrals/tests/test_meijerint.py::test_linear_subs", "sympy/holonomic/tests/test_holonomic.py::test_from_hyper", "sympy/solvers/tests/test_inequalities.py::test_issue_10047", "sympy/concrete/tests/test_delta.py::test_deltaproduct_mul_add_x_kd_add_y_kd", "sympy/simplify/tests/test_powsimp.py::test_issue_10195", "sympy/physics/quantum/tests/test_spin.py::test_rewrite_uncoupled_state", "sympy/functions/elementary/tests/test_hyperbolic.py::test_acoth_nseries", "sympy/simplify/tests/test_simplify.py::test_issue_22020", "sympy/series/tests/test_formal.py::test_rational_algorithm", "sympy/simplify/tests/test_powsimp.py::test_issue_15709", "sympy/simplify/tests/test_powsimp.py::test_issue_11981", "sympy/algebras/tests/test_quaternion.py::test_product_matrices", "sympy/simplify/tests/test_powsimp.py::test_issue_17524", "sympy/series/tests/test_series.py::test_issue_6318", "sympy/series/tests/test_order.py::test_issue_22165", "sympy/matrices/tests/test_solvers.py::test_cramer_solve[M2-rhs2-laplace]", "sympy/simplify/tests/test_powsimp.py::test_issue_19627", "sympy/concrete/tests/test_delta.py::test_deltasummation_basic_numerical", "sympy/matrices/tests/test_eigen.py::test_diagonalize", "sympy/functions/elementary/tests/test_trigonometric.py::test_as_leading_term_issue_5272", "sympy/geometry/tests/test_line.py::test_parameter_value", "sympy/codegen/tests/test_rewriting.py::test_optims_c99", "sympy/simplify/tests/test_powsimp.py::test_issue_22546", "sympy/geometry/tests/test_polygon.py::test_parameter_value", "sympy/geometry/tests/test_ellipse.py::test_parameter_value", "sympy/concrete/tests/test_sums_products.py::test_sin_times_absolutely_convergent", "sympy/integrals/tests/test_integrals.py::test_integrate_DiracDelta", "sympy/simplify/tests/test_simplify.py::test_issue_19484", "sympy/matrices/expressions/tests/test_matpow.py::test_OneMatrix_power", "sympy/series/tests/test_nseries.py::test_issue_3503", "sympy/polys/tests/test_subresultants_qq_zz.py::test_modified_subresultants_pg", "sympy/solvers/ode/tests/test_ode.py::test_issue_5770", "sympy/solvers/ode/tests/test_systems.py::test_sysode_linear_neq_order1_type2", "sympy/stats/tests/test_continuous_rv.py::test_weibull", "sympy/functions/elementary/tests/test_piecewise.py::test_Piecewise_rewrite_as_ITE", "sympy/stats/tests/test_discrete_rv.py::test_PoissonDistribution", "sympy/geometry/tests/test_line.py::test_issue_12598", "sympy/series/tests/test_limits.py::test_issue_5164", "sympy/simplify/tests/test_simplify.py::test_issue_23543", "sympy/integrals/tests/test_manual.py::test_manualintegrate_special", "sympy/solvers/tests/test_solveset.py::test_poly_gens", "sympy/polys/tests/test_subresultants_qq_zz.py::test_subresultants_pg", "sympy/concrete/tests/test_sums_products.py::test_issue_14111", "sympy/series/tests/test_series.py::test_x_is_base_detection", "sympy/polys/tests/test_polyroots.py::test_roots_quintic", "sympy/integrals/tests/test_meijerint.py::test_messy", "sympy/series/tests/test_order.py::test_issue_23231", "sympy/holonomic/tests/test_holonomic.py::test_from_meijerg", "sympy/geometry/tests/test_ellipse.py::test_circumference", "sympy/geometry/tests/test_polygon.py::test_issue_12966", "sympy/utilities/tests/test_wester.py::test_J8", "sympy/polys/tests/test_subresultants_qq_zz.py::test_subresultants_amv_q", "sympy/stats/tests/test_discrete_rv.py::test_Poisson", "sympy/series/tests/test_series.py::test_issue_7203", "sympy/functions/special/tests/test_gamma_functions.py::test_loggamma", "sympy/simplify/tests/test_simplify.py::test_issue_11004", "sympy/stats/tests/test_finite_rv.py::test_bernoulli", "sympy/functions/elementary/tests/test_trigonometric.py::test_leading_terms", "sympy/functions/special/tests/test_error_functions.py::test__eis", "sympy/series/tests/test_demidovich.py::test_leadterm", "sympy/geometry/tests/test_ellipse.py::test_issue_15797_equals", "sympy/functions/special/tests/test_bessel.py::test_expand", "sympy/solvers/tests/test_inequalities.py::test_issue_10268", "sympy/matrices/tests/test_eigen.py::test_is_diagonalizable", "sympy/concrete/tests/test_sums_products.py::test_issue_14484", "sympy/utilities/tests/test_wester.py::test_J11", "sympy/series/tests/test_nseries.py::test_issue_3506", "sympy/polys/tests/test_polyroots.py::test_roots_binomial", "sympy/integrals/tests/test_integrals.py::test_integrate_returns_piecewise", "sympy/physics/mechanics/tests/test_joint.py::test_prismatic_joint_arbitrary_axis", "sympy/geometry/tests/test_polygon.py::test_first_moment", "sympy/stats/tests/test_continuous_rv.py::test_weibull_numeric", "sympy/polys/tests/test_subresultants_qq_zz.py::test_subresultants_amv", "sympy/matrices/tests/test_matrices.py::test_vech", "sympy/series/tests/test_limits.py::test_issue_5383", "sympy/functions/elementary/tests/test_hyperbolic.py::test_leading_term", "sympy/integrals/tests/test_manual.py::test_manualintegrate_orthogonal_poly", "sympy/solvers/tests/test_solveset.py::test_solve_abs", "sympy/series/tests/test_order.py::test_issue_9917", "sympy/polys/tests/test_polyroots.py::test_roots0", "sympy/utilities/tests/test_wester.py::test_J14", "sympy/concrete/tests/test_sums_products.py::test_issue_14640", "sympy/physics/mechanics/tests/test_body.py::test_parallel_axis", "sympy/series/tests/test_series.py::test_exp_product_positive_factors", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_21481", "sympy/core/tests/test_expand.py::test_expand_arit", "sympy/integrals/tests/test_heurisch.py::test_heurisch_symbolic_coeffs", "sympy/polys/tests/test_subresultants_qq_zz.py::test_modified_subresultants_amv", "sympy/simplify/tests/test_simplify.py::test_issue_22210", "sympy/geometry/tests/test_polygon.py::test_section_modulus_and_polar_second_moment_of_area", "sympy/stats/tests/test_discrete_rv.py::test_FlorySchulz", "sympy/physics/quantum/tests/test_spin.py::test_rewrite_coupled_state", "sympy/solvers/ode/tests/test_systems.py::test_sysode_linear_neq_order1_type3", "sympy/series/tests/test_series.py::test_issue_9549", "sympy/solvers/ode/tests/test_ode.py::test_issue_5095", "sympy/polys/tests/test_subresultants_qq_zz.py::test_subresultants_rem", "sympy/holonomic/tests/test_holonomic.py::test_to_Sequence_Initial_Coniditons", "sympy/matrices/tests/test_eigen.py::test_jordan_form", "sympy/series/tests/test_demidovich.py::test_Limits_simple_0", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_point_cflexure", "sympy/matrices/tests/test_sparse.py::test_hermitian", "sympy/simplify/tests/test_simplify.py::test_reduce_inverses_nc_pow", "sympy/functions/special/tests/test_error_functions.py::test_li", "sympy/functions/elementary/tests/test_trigonometric.py::test_atan2_expansion", "sympy/series/tests/test_nseries.py::test_issue_3508", "sympy/concrete/tests/test_sums_products.py::test_issue_15943", "sympy/functions/elementary/tests/test_hyperbolic.py::test_issue_25847", "sympy/polys/tests/test_subresultants_qq_zz.py::test_subresultants_vv", "sympy/matrices/tests/test_matrices.py::test_inv_block", "sympy/series/tests/test_formal.py::test_fps", "sympy/functions/special/tests/test_gamma_functions.py::test_polygamma_expansion", "sympy/functions/special/tests/test_error_functions.py::test_Li", "sympy/geometry/tests/test_polygon.py::test_cut_section", "sympy/series/tests/test_limits.py::test_issue_14793", "sympy/integrals/tests/test_heurisch.py::test_heurisch_symbolic_coeffs_1130", "sympy/functions/combinatorial/tests/test_comb_factorials.py::test_factorial_series", "sympy/series/tests/test_order.py::test_issue_22836", "sympy/functions/special/tests/test_error_functions.py::test_si", "sympy/functions/special/tests/test_bessel.py::test_airyai", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_8458", "sympy/stats/tests/test_continuous_rv.py::test_wignersemicircle", "sympy/simplify/tests/test_simplify.py::test_nc_recursion_coeff", "sympy/solvers/tests/test_inequalities.py::test_integer_domain_relational_isolve", "sympy/algebras/tests/test_quaternion.py::test_rotation_matrix_homogeneous", "sympy/polys/tests/test_subresultants_qq_zz.py::test_subresultants_vv_2", "sympy/stats/tests/test_finite_rv.py::test_binomial_symbolic", "sympy/integrals/tests/test_meijerint.py::test_issue_6122", "sympy/solvers/tests/test_inequalities.py::test_issue_10671_12466", "sympy/concrete/tests/test_sums_products.py::test_issue_15852", "sympy/holonomic/tests/test_holonomic.py::test_series", "sympy/matrices/tests/test_eigen.py::test_singular_values", "sympy/stats/tests/test_discrete_rv.py::test_Hermite", "sympy/utilities/tests/test_wester.py::test_K7", "sympy/solvers/tests/test_solveset.py::test_issue_9824", "sympy/integrals/tests/test_integrals.py::test_integrate_max_min", "sympy/functions/combinatorial/tests/test_comb_numbers.py::test_nD_derangements", "sympy/series/tests/test_nseries.py::test_issue_3507", "sympy/physics/mechanics/tests/test_joint.py::test_planar_joint_advanced", "sympy/integrals/tests/test_manual.py::test_issue_12251", "sympy/series/tests/test_demidovich.py::test_Limits_simple_1", "sympy/series/tests/test_limits.py::test_issue_5183", "sympy/functions/special/tests/test_bessel.py::test_airybi", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_apply_support", "sympy/polys/tests/test_multivariate_resultants.py::test_KSY_precondition", "sympy/series/tests/test_series.py::test_issue_10761", "sympy/functions/elementary/tests/test_hyperbolic.py::test_issue_25175", "sympy/utilities/tests/test_wester.py::test_K8", "sympy/integrals/tests/test_manual.py::test_issue_3796", "sympy/concrete/tests/test_sums_products.py::test_exceptions", "sympy/vector/tests/test_vector.py::test_kind", "sympy/matrices/tests/test_matrices.py::test_diagonal_symmetrical", "sympy/integrals/tests/test_meijerint.py::test_issue_6252", "sympy/functions/elementary/tests/test_trigonometric.py::test_aseries", "sympy/functions/special/tests/test_error_functions.py::test_ci", "sympy/functions/special/tests/test_gamma_functions.py::test_polygamma_leading_term", "sympy/series/tests/test_nseries.py::test_issue_3639", "sympy/calculus/tests/test_util.py::test_function_range", "sympy/functions/special/tests/test_bessel.py::test_airyaiprime", "sympy/stats/tests/test_continuous_rv.py::test_unevaluated", "sympy/geometry/tests/test_polygon.py::test_type_of_triangle", "sympy/integrals/tests/test_heurisch.py::test_heurisch_hacking", "sympy/solvers/ode/tests/test_systems.py::test_sysode_linear_neq_order1_type5_type6", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_20360", "sympy/series/tests/test_formal.py::test_fps_shift", "sympy/solvers/ode/tests/test_ode.py::test_series", "sympy/solvers/tests/test_inequalities.py::test__solve_inequality", "sympy/matrices/tests/test_eigen.py::test_definite", "sympy/matrices/expressions/tests/test_indexing.py::test_pow_index", "sympy/utilities/tests/test_wester.py::test_K10", "sympy/physics/quantum/tests/test_spin.py::test_innerproducts_of_rewritten_states", "sympy/series/tests/test_series.py::test_issue_12578", "sympy/series/tests/test_demidovich.py::test_Limits_simple_2", "sympy/series/tests/test_limits.py::test_issue_5184", "sympy/polys/tests/test_multivariate_resultants.py::test_get_KSY_Dixon_resultant_example_one", "sympy/solvers/tests/test_recurr.py::test_rsolve_ratio", "sympy/integrals/tests/test_meijerint.py::test_issue_6348", "sympy/vector/tests/test_vector.py::test_vector_simplify", "sympy/physics/control/tests/test_lti.py::test_TransferFunction_gain_margin", "sympy/solvers/ode/tests/test_single.py::test_linear_coefficients", "sympy/functions/special/tests/test_bessel.py::test_airybiprime", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_apply_rotation_hinge", "sympy/series/tests/test_series.py::test_issue_12791", "sympy/solvers/tests/test_solveset.py::test_issue_9565", "sympy/stats/tests/test_discrete_rv.py::test_Logarithmic", "sympy/concrete/tests/test_sums_products.py::test_issue_8016", "sympy/solvers/tests/test_inequalities.py::test_issue_25697", "sympy/functions/special/tests/test_gamma_functions.py::test_multigamma", "sympy/matrices/tests/test_matrices.py::test_diagonalization", "sympy/series/tests/test_demidovich.py::test_Limits_simple_3a", "sympy/utilities/tests/test_wester.py::test_M2", "sympy/matrices/tests/test_eigen.py::test_issue_19210", "sympy/series/tests/test_limitseq.py::test_limit_seq", "sympy/series/tests/test_series.py::test_issue_14384", "sympy/holonomic/tests/test_holonomic.py::test_expr_to_holonomic", "sympy/simplify/tests/test_sqrtdenest.py::test_sqrtdenest2", "sympy/series/tests/test_nseries.py::test_hyperbolic", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_22533", "sympy/solvers/ode/tests/test_ode.py::test_2nd_power_series_regular", "sympy/integrals/tests/test_manual.py::test_manual_true", "sympy/calculus/tests/test_util.py::test_continuous_domain", "sympy/series/tests/test_limits.py::test_issue_5229", "sympy/concrete/tests/test_sums_products.py::test_issue_14313", "sympy/series/tests/test_formal.py::test_fps__Add_expr", "sympy/polys/tests/test_multivariate_resultants.py::test_get_KSY_Dixon_resultant_example_two", "sympy/solvers/tests/test_recurr.py::test_rsolve_hyper", "sympy/integrals/tests/test_manual.py::test_issue_6746", "sympy/functions/special/tests/test_bessel.py::test_marcumq", "sympy/stats/tests/test_continuous_rv.py::test_NormalDistribution", "sympy/physics/mechanics/tests/test_joint.py::test_spherical_joint_orient_body", "sympy/functions/special/tests/test_error_functions.py::test_fresnel", "sympy/stats/tests/test_joint_rv.py::test_Normal", "sympy/solvers/ode/tests/test_systems.py::test_higher_order_to_first_order", "sympy/solvers/tests/test_recurr.py::test_rsolve_bulk", "sympy/core/tests/test_noncommutative.py::test_combsimp", "sympy/utilities/tests/test_wester.py::test_M6", "sympy/functions/special/tests/test_gamma_functions.py::test_gamma_as_leading_term", "sympy/sets/tests/test_setexpr.py::test_SetExpr_Interval_div", "sympy/series/tests/test_series.py::test_issue_14885", "sympy/series/tests/test_nseries.py::test_series2", "sympy/solvers/tests/test_recurr.py::test_rsolve_0_sol_homogeneous", "sympy/functions/elementary/tests/test_trigonometric.py::test_sec", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_apply_sliding_hinge", "sympy/integrals/tests/test_meijerint.py::test_fresnel", "sympy/functions/special/tests/test_error_functions.py::test_fresnel_series", "sympy/physics/control/tests/test_lti.py::test_conversion", "sympy/holonomic/tests/test_holonomic.py::test_to_hyper", "sympy/vector/tests/test_coordsysrect.py::test_coordinate_vars", "sympy/integrals/tests/test_integrals.py::test_as_sum_midpoint2", "sympy/solvers/ode/tests/test_ode.py::test_issue_15913", "sympy/stats/tests/test_discrete_rv.py::test_negative_binomial", "sympy/solvers/tests/test_recurr.py::test_rsolve", "sympy/series/tests/test_series.py::test_issue_15539", "sympy/calculus/tests/test_util.py::test_not_empty_in", "sympy/concrete/tests/test_sums_products.py::test_issue_16735", "sympy/solvers/tests/test_solveset.py::test_issue_10069", "sympy/solvers/tests/test_inequalities.py::test_issue_25738", "sympy/solvers/ode/tests/test_riccati.py::test_solve_riccati", "sympy/physics/mechanics/tests/test_joint.py::test_spherical_joint_orient_space", "sympy/series/tests/test_demidovich.py::test_Limits_simple_3b", "sympy/diffgeom/tests/test_diffgeom.py::test_R2", "sympy/sets/tests/test_setexpr.py::test_SetExpr_Interval_pow", "sympy/stats/tests/test_continuous_rv.py::test_random_parameters", "sympy/solvers/tests/test_recurr.py::test_rsolve_raises", "sympy/solvers/ode/tests/test_single.py::test_Airy_equation", "sympy/series/tests/test_limitseq.py::test_alternating_sign", "sympy/series/tests/test_nseries.py::test_series3", "sympy/series/tests/test_residues.py::test_basic1", "sympy/integrals/tests/test_transforms.py::test_undefined_function", "sympy/stats/tests/test_finite_rv.py::test_hypergeometric_numeric", "sympy/utilities/tests/test_wester.py::test_M7", "sympy/core/tests/test_exprtools.py::test_gcd_terms", "sympy/matrices/tests/test_matrices.py::test_jordan_form_complex_issue_9274", "sympy/integrals/tests/test_manual.py::test_issue_9462", "sympy/series/tests/test_formal.py::test_fps__asymptotic", "sympy/solvers/tests/test_recurr.py::test_issue_6844", "sympy/series/tests/test_limits.py::test_issue_4546", "sympy/functions/special/tests/test_hyper.py::test_expand_func", "sympy/simplify/tests/test_sqrtdenest.py::test_sqrtdenest3", "sympy/core/tests/test_noncommutative.py::test_factor", "sympy/functions/elementary/tests/test_integers.py::test_series", "sympy/solvers/tests/test_inequalities.py::test_issue_25983", "sympy/diffgeom/tests/test_diffgeom.py::test_R3", "sympy/calculus/tests/test_util.py::test_periodicity", "sympy/solvers/tests/test_recurr.py::test_issue_18751", "sympy/geometry/tests/test_point.py::test_point", "sympy/simplify/tests/test_sqrtdenest.py::test_sqrtdenest4", "sympy/stats/tests/test_joint_rv.py::test_MultivariateTDist", "sympy/holonomic/tests/test_holonomic.py::test_to_expr", "sympy/series/tests/test_residues.py::test_basic2", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_shear_force", "sympy/series/tests/test_nseries.py::test_bug4", "sympy/functions/elementary/tests/test_trigonometric.py::test_csc", "sympy/concrete/tests/test_sums_products.py::test_issue_14871", "sympy/series/tests/test_limitseq.py::test_accum_bounds", "sympy/integrals/tests/test_meijerint.py::test_issue_7337", "sympy/geometry/tests/test_point.py::test_point3D", "sympy/physics/control/tests/test_lti.py::test_StateSpace_dsolve", "sympy/series/tests/test_demidovich.py::test_Limits_simple_4a", "sympy/solvers/tests/test_recurr.py::test_constant_naming", "sympy/series/tests/test_residues.py::test_f", "sympy/solvers/ode/tests/test_ode.py::test_dsolve_remove_redundant_solutions", "sympy/matrices/tests/test_matrixbase.py::test_simplify", "sympy/solvers/tests/test_recurr.py::test_issue_17990", "sympy/geometry/tests/test_point.py::test_arguments", "sympy/calculus/tests/test_util.py::test_periodicity_check", "sympy/solvers/ode/tests/test_systems.py::test_higher_order_to_first_order_12", "sympy/solvers/tests/test_recurr.py::test_issue_8697", "sympy/functions/elementary/tests/test_trigonometric.py::test_asec_leading_term", "sympy/calculus/tests/test_util.py::test_is_convex", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_bmoment", "sympy/series/tests/test_demidovich.py::test_limits_simple_4aa", "sympy/solvers/tests/test_recurr.py::test_diofantissue_294", "sympy/series/tests/test_formal.py::test_fps__fractional", "sympy/series/tests/test_nseries.py::test_bug5", "sympy/integrals/tests/test_integrals.py::test_as_sum_left", "sympy/diffgeom/tests/test_diffgeom.py::test_intcurve_diffequ", "sympy/geometry/tests/test_point.py::test_unit", "sympy/solvers/ode/tests/test_single.py::test_2nd_2F1_hypergeometric_integral", "sympy/stats/tests/test_continuous_rv.py::test_conjugate_priors", "sympy/stats/tests/test_joint_rv.py::test_multivariate_laplace", "sympy/calculus/tests/test_util.py::test_stationary_points", "sympy/concrete/tests/test_sums_products.py::test_issue_17165", "sympy/holonomic/tests/test_holonomic.py::test_integrate", "sympy/utilities/tests/test_wester.py::test_M10", "sympy/functions/elementary/tests/test_integers.py::test_issue_14355", "sympy/integrals/tests/test_manual.py::test_cyclic_parts", "sympy/series/tests/test_limits.py::test_issue_3934", "sympy/functions/elementary/tests/test_trigonometric.py::test_asec_series", "sympy/matrices/tests/test_matrixbase.py::test_issue_3749", "sympy/series/tests/test_residues.py::test_functions", "sympy/core/tests/test_exprtools.py::test_factor_nc", "sympy/core/tests/test_noncommutative.py::test_simplify", "sympy/core/tests/test_noncommutative.py::test_subs", "sympy/integrals/tests/test_transforms.py::test_mellin_transform", "sympy/solvers/tests/test_solveset.py::test_solve_only_exp_1", "sympy/series/tests/test_series.py::test_issue_7259", "sympy/series/tests/test_limitseq.py::test_limitseq_sum", "sympy/series/tests/test_residues.py::test_expressions", "sympy/simplify/tests/test_sqrtdenest.py::test_sqrt_ratcomb", "sympy/series/tests/test_residues.py::test_NotImplemented", "sympy/utilities/tests/test_wester.py::test_M12", "sympy/stats/tests/test_discrete_rv.py::test_skellam", "sympy/printing/tests/test_precedence.py::test_Order", "sympy/core/tests/test_exprtools.py::test_issue_7903", "sympy/matrices/tests/test_matrices.py::test_find_reasonable_pivot_naive_finds_guaranteed_nonzero2", "sympy/solvers/tests/test_recurr.py::test_issue_15553", "sympy/integrals/tests/test_meijerint.py::test_issue_8368", "sympy/series/tests/test_nseries.py::test_issue_4115", "sympy/concrete/tests/test_sums_products.py::test_issue_19379", "sympy/series/tests/test_demidovich.py::test_Limits_simple_4b", "sympy/physics/optics/tests/test_utils.py::test_refraction_angle", "sympy/core/tests/test_noncommutative.py::test_trigsimp", "sympy/series/tests/test_limits.py::test_calculate_series", "sympy/series/tests/test_series.py::test_issue_11884", "sympy/printing/tests/test_python.py::test_python_limits", "sympy/matrices/tests/test_reductions.py::test_rref", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_deflection", "sympy/diffgeom/tests/test_diffgeom.py::test_simplify", "sympy/series/tests/test_residues.py::test_bug", "sympy/solvers/ode/tests/test_ode.py::test_issue_13060", "sympy/stats/tests/test_discrete_rv.py::test_yule_simon", "sympy/functions/elementary/tests/test_integers.py::test_frac_leading_term", "sympy/physics/optics/tests/test_utils.py::test_deviation", "sympy/stats/tests/test_joint_rv.py::test_GeneralizedMultivariateLogGammaDistribution", "sympy/physics/control/tests/test_lti.py::test_StateSpace_functions", "sympy/concrete/tests/test_gosper.py::test_gosper_term", "sympy/solvers/tests/test_solveset.py::test_piecewise_solveset", "sympy/integrals/tests/test_integrals.py::test_as_sum_right", "sympy/series/tests/test_demidovich.py::test_Limits_simple_4c", "sympy/matrices/tests/test_matrices.py::test_find_reasonable_pivot_naive_simplifies", "sympy/integrals/tests/test_manual.py::test_issue_12641", "sympy/series/tests/test_formal.py::test_fps__logarithmic_singularity", "sympy/utilities/tests/test_wester.py::test_M20", "sympy/solvers/ode/tests/test_single.py::test_2nd_nonlinear_autonomous_conserved_integral", "sympy/concrete/tests/test_gosper.py::test_gosper_sum", "sympy/concrete/tests/test_sums_products.py::test_issue_20777", "sympy/matrices/tests/test_reductions.py::test_rank", "sympy/functions/elementary/tests/test_integers.py::test_issue_25230", "sympy/concrete/tests/test_gosper.py::test_gosper_sum_indefinite", "sympy/integrals/tests/test_transforms.py::test_mellin_transform2", "sympy/functions/special/tests/test_hyper.py::test_limits", "sympy/physics/vector/tests/test_vector.py::test_Vector_diffs", "sympy/series/tests/test_nseries.py::test_pole", "sympy/concrete/tests/test_gosper.py::test_gosper_sum_parametric", "sympy/series/tests/test_limitseq.py::test_issue_9308", "sympy/holonomic/tests/test_holonomic.py::test_diff", "sympy/calculus/tests/test_util.py::test_maximum", "sympy/matrices/tests/test_matrices.py::test_limit", "sympy/physics/optics/tests/test_utils.py::test_mirror_formula", "sympy/integrals/tests/test_meijerint.py::test_issue_10211", "sympy/series/tests/test_residues.py::test_issue_5654", "sympy/matrices/tests/test_reductions.py::test_issue_11434", "sympy/stats/tests/test_discrete_rv.py::test_zeta", "sympy/stats/tests/test_continuous_rv.py::test_precomputed_cdf", "sympy/solvers/ode/tests/test_systems.py::test_second_order_to_first_order_2", "sympy/physics/quantum/tests/test_density.py::test_represent", "sympy/series/tests/test_limits.py::test_issue_5955", "sympy/series/tests/test_demidovich.py::test_bounded", "sympy/functions/elementary/tests/test_trigonometric.py::test_acsc_leading_term", "sympy/concrete/tests/test_gosper.py::test_gosper_sum_algebraic", "sympy/matrices/tests/test_matrixbase.py::test_vech", "sympy/series/tests/test_limitseq.py::test_issue_10382", "sympy/matrices/tests/test_decompositions.py::test_singular_value_decompositionD", "sympy/utilities/tests/test_wester.py::test_M21", "sympy/concrete/tests/test_sums_products.py::test_matrixsymbol_summation_numerical_limits", "sympy/concrete/tests/test_gosper.py::test_gosper_sum_iterated", "sympy/simplify/tests/test_hyperexpand.py::test_meijerg_lookup", "sympy/assumptions/tests/test_query.py::test_integer", "sympy/solvers/ode/tests/test_ode.py::test_issue_22523", "sympy/series/tests/test_nseries.py::test_expsinbug", "sympy/concrete/tests/test_gosper.py::test_gosper_sum_AeqB_part1", "sympy/series/tests/test_residues.py::test_issue_6499", "sympy/series/tests/test_series.py::test_issue_18008", "sympy/solvers/tests/test_pde.py::test_pde_separate_add", "sympy/vector/tests/test_coordsysrect.py::test_transformation_equations", "sympy/physics/optics/tests/test_utils.py::test_lens_formula", "sympy/holonomic/tests/test_holonomic.py::test_extended_domain_in_expr_to_holonomic", "sympy/series/tests/test_demidovich.py::test_f1a", "sympy/functions/special/tests/test_hyper.py::test_eval_nseries", "sympy/matrices/expressions/tests/test_derivatives.py::test_matrix_derivative_vectors_and_scalars", "sympy/matrices/tests/test_reductions.py::test_rank_regression_from_so", "sympy/series/tests/test_formal.py::test_fps_symbolic", "sympy/concrete/tests/test_gosper.py::test_gosper_sum_AeqB_part2", "sympy/series/tests/test_residues.py::test_issue_14037", "sympy/integrals/tests/test_transforms.py::test_fourier_transform", "sympy/solvers/tests/test_constantsimp.py::test_constant_mul", "sympy/functions/elementary/tests/test_trigonometric.py::test_acsc_series", "sympy/integrals/tests/test_integrals.py::test_as_sum_trapezoid", "sympy/integrals/tests/test_manual.py::test_issue_14470", "sympy/matrices/expressions/tests/test_trace.py::test_trace_rewrite", "sympy/functions/special/tests/test_zeta_functions.py::test_zeta_series", "sympy/concrete/tests/test_gosper.py::test_gosper_nan", "sympy/solvers/tests/test_solveset.py::test_solveset_complex_polynomial", "sympy/solvers/tests/test_pde.py::test_pde_separate_mul", "sympy/physics/control/tests/test_lti.py::test_StateSpace_series", "sympy/physics/vector/tests/test_vector.py::test_vector_simplify", "sympy/calculus/tests/test_util.py::test_minimum", "sympy/stats/tests/test_discrete_rv.py::test_discrete_probability", "sympy/vector/tests/test_coordsysrect.py::test_check_orthogonality", "sympy/concrete/tests/test_gosper.py::test_gosper_sum_AeqB_part3", "sympy/physics/vector/tests/test_functions.py::test_cross_different_frames", "sympy/solvers/tests/test_pde.py::test_issue_11726", "sympy/integrals/tests/test_rationaltools.py::test_issue_5817", "sympy/series/tests/test_limits.py::test_newissue", "sympy/series/tests/test_residues.py::test_issue_21176", "sympy/utilities/tests/test_wester.py::test_M22", "sympy/vector/tests/test_coordsysrect.py::test_rotation_trans_equations", "sympy/matrices/tests/test_matrixbase.py::test_inv_block", "sympy/series/tests/test_nseries.py::test_floor", "sympy/integrals/tests/test_manual.py::test_issue_8520", "sympy/physics/mechanics/tests/test_kane.py::test_pend", "sympy/series/tests/test_series.py::test_issue_18842", "sympy/physics/quantum/tests/test_density.py::test_fidelity", "sympy/matrices/tests/test_decompositions.py::test_LDLdecomposition", "sympy/solvers/tests/test_constantsimp.py::test_constant_multiple", "sympy/physics/units/tests/test_util.py::test_eval_simplify", "sympy/series/tests/test_formal.py::test_fps__slow", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_solve_for_ild_reactions", "sympy/series/tests/test_demidovich.py::test_f1a2", "sympy/concrete/tests/test_sums_products.py::test_summation_by_residues", "sympy/solvers/ode/tests/test_single.py::test_nth_linear_constant_coeff_var_of_parameters", "sympy/physics/control/tests/test_lti.py::test_StateSpace_parallel", "sympy/holonomic/tests/test_holonomic.py::test_to_meijerg", "sympy/functions/special/tests/test_zeta_functions.py::test_dirichlet_eta_eval", "sympy/series/tests/test_nseries.py::test_frac", "sympy/utilities/tests/test_wester.py::test_M23", "sympy/stats/tests/test_discrete_rv.py::test_DiscreteRV", "sympy/solvers/ode/tests/test_systems.py::test_second_order_to_first_order_slow4", "sympy/solvers/ode/tests/test_ode.py::test_issue_22604", "sympy/functions/special/tests/test_zeta_functions.py::test_rewriting", "sympy/solvers/tests/test_solveset.py::test_solveset_complex_rational", "sympy/integrals/tests/test_transforms.py::test_sine_transform", "sympy/matrices/tests/test_matrices.py::test_cholesky", "sympy/matrices/expressions/tests/test_derivatives.py::test_matrix_derivatives_of_traces", "sympy/series/tests/test_limitseq.py::test_issue_11672", "sympy/solvers/tests/test_constantsimp.py::test_ode_solutions", "sympy/integrals/tests/test_meijerint.py::test_issue_11806", "sympy/functions/elementary/tests/test_trigonometric.py::test_asin_nseries", "sympy/physics/mechanics/tests/test_kane.py::test_rolling_disc", "sympy/series/tests/test_residues.py::test_issue_21177", "sympy/integrals/tests/test_integrals.py::test_issue_4884", "sympy/calculus/tests/test_util.py::test_issue_19869", "sympy/stats/tests/test_discrete_rv.py::test_precomputed_characteristic_functions", "sympy/stats/tests/test_random_matrix.py::test_GaussianUnitaryEnsemble", "sympy/series/tests/test_demidovich.py::test_f1b", "sympy/physics/vector/tests/test_functions.py::test_express", "sympy/stats/tests/test_random_matrix.py::test_GaussianOrthogonalEnsemble", "sympy/calculus/tests/test_util.py::test_issue_16469", "sympy/series/tests/test_limits.py::test_issue_5436", "sympy/utilities/tests/test_wester.py::test_M24", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_solve_for_ild_shear", "sympy/matrices/tests/test_matrixbase.py::test_diagonal_symmetrical", "sympy/physics/mechanics/tests/test_kane.py::test_aux", "sympy/stats/tests/test_random_matrix.py::test_GaussianSymplecticEnsemble", "sympy/series/tests/test_nseries.py::test_ceiling", "sympy/functions/special/tests/test_zeta_functions.py::test_derivatives", "sympy/stats/tests/test_random_matrix.py::test_CircularUnitaryEnsemble", "sympy/integrals/tests/test_manual.py::test_quadratic_denom", "sympy/vector/tests/test_field_functions.py::test_product_rules", "sympy/series/tests/test_series.py::test_issue_19534", "sympy/stats/tests/test_random_matrix.py::test_CircularOrthogonalEnsemble", "sympy/stats/tests/test_continuous_rv.py::test_issue_20756", "sympy/integrals/tests/test_transforms.py::test_cosine_transform", "sympy/stats/tests/test_random_matrix.py::test_CircularSymplecticEnsemble", "sympy/concrete/tests/test_sums_products.py::test_process_limits", "sympy/vector/tests/test_field_functions.py::test_conservative", "sympy/holonomic/tests/test_holonomic.py::test_beta", "sympy/functions/special/tests/test_zeta_functions.py::test_polylog_expansion", "sympy/integrals/tests/test_meijerint.py::test_issue_10681", "sympy/physics/control/tests/test_lti.py::test_StateSpace_feedback", "sympy/solvers/tests/test_solveset.py::test_solveset_complex_exp", "sympy/solvers/tests/test_pde.py::test_checkpdesol", "sympy/series/tests/test_nseries.py::test_abs", "sympy/calculus/tests/test_util.py::test_issue_18747", "sympy/utilities/tests/test_wester.py::test_M25", "sympy/stats/tests/test_joint_rv.py::test_NegativeMultinomial", "sympy/vector/tests/test_field_functions.py::test_solenoidal", "sympy/series/tests/test_demidovich.py::test_f2a", "sympy/matrices/tests/test_matrices.py::test_matrix_norm", "sympy/series/tests/test_limitseq.py::test_issue_14196", "sympy/calculus/tests/test_util.py::test_issue_25942", "sympy/functions/elementary/tests/test_trigonometric.py::test_acos_nseries", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_solve_for_ild_moment", "sympy/concrete/tests/test_sums_products.py::test_pr_22677", "sympy/series/tests/test_fourier.py::test_FourierSeries", "sympy/polys/tests/test_polytools.py::test_torational_factor_list", "sympy/series/tests/test_limitseq.py::test_issue_16735", "sympy/matrices/tests/test_matrixbase.py::test_diagonalization", "sympy/stats/tests/test_discrete_rv.py::test_moment_generating_functions", "sympy/series/tests/test_limits.py::test_polynomial", "sympy/series/tests/test_series.py::test_issue_11407", "sympy/series/tests/test_nseries.py::test_dir", "sympy/physics/mechanics/tests/test_kane.py::test_implicit_kinematics", "sympy/solvers/ode/tests/test_single.py::test_nth_order_reducible", "sympy/integrals/tests/test_meijerint.py::test_issue_13536", "sympy/solvers/ode/tests/test_ode.py::test_issue_22462", "sympy/solvers/ode/tests/test_systems.py::test_component_division", "sympy/utilities/tests/test_wester.py::test_M26", "sympy/functions/special/tests/test_zeta_functions.py::test_polylog_series", "sympy/stats/tests/test_discrete_rv.py::test_Or", "sympy/stats/tests/test_joint_rv.py::test_JointRV", "sympy/solvers/tests/test_pde.py::test_pde_1st_linear_constant_coeff_homogeneous", "sympy/series/tests/test_demidovich.py::test_f2", "sympy/integrals/tests/test_integrals.py::test_series", "sympy/series/tests/test_series.py::test_issue_14037", "sympy/integrals/tests/test_transforms.py::test_hankel_transform", "sympy/series/tests/test_formal.py::test_fps__operations", "sympy/calculus/tests/test_singularities.py::test_singularities", "sympy/physics/mechanics/tests/test_rigidbody.py::test_parallel_axis", "sympy/stats/tests/test_continuous_rv.py::test_union", "sympy/series/tests/test_nseries.py::test_cdir", "sympy/solvers/ode/tests/test_lie_group.py::test_heuristic1", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_ild_with_rotation_hinge", "sympy/solvers/ode/tests/test_lie_group.py::test_heuristic3", "sympy/solvers/tests/test_solveset.py::test_solve_complex_log", "sympy/holonomic/tests/test_holonomic.py::test_gamma", "sympy/solvers/tests/test_solvers.py::test_solve_for_functions_derivatives", "sympy/functions/special/tests/test_zeta_functions.py::test_issue_8404", "sympy/utilities/tests/test_wester.py::test_M27", "sympy/stats/tests/test_discrete_rv.py::test_conditional", "sympy/series/tests/test_limitseq.py::test_issue_19868", "sympy/functions/elementary/tests/test_trigonometric.py::test_atan_nseries", "sympy/series/tests/test_limits.py::test_rational", "sympy/physics/vector/tests/test_fieldfunctions.py::test_divergence", "sympy/solvers/ode/tests/test_lie_group.py::test_heuristic_function_sum", "sympy/vector/tests/test_field_functions.py::test_scalar_potential_difference", "sympy/calculus/tests/test_singularities.py::test_is_increasing", "sympy/solvers/tests/test_pde.py::test_pde_1st_linear_constant_coeff", "sympy/matrices/tests/test_matrices.py::test_condition_number", "sympy/series/tests/test_series.py::test_issue_20551", "sympy/functions/special/tests/test_zeta_functions.py::test_polylog_values", "sympy/integrals/tests/test_manual.py::test_issue_23348", "sympy/physics/mechanics/tests/test_kane.py::test_issue_24887", "sympy/physics/vector/tests/test_fieldfunctions.py::test_conservative", "sympy/integrals/tests/test_meijerint.py::test_issue_6462", "sympy/series/tests/test_lseries.py::test_sin", "sympy/series/tests/test_nseries.py::test_issue_3504", "sympy/solvers/ode/tests/test_ode.py::test_issue_23425", "sympy/stats/tests/test_joint_rv.py::test_expectation", "sympy/integrals/tests/test_integrals.py::test_trig_nonelementary_integrals", "sympy/series/tests/test_demidovich.py::test_f3", "sympy/matrices/tests/test_matrixbase.py::test_jordan_form_complex_issue_9274", "sympy/integrals/tests/test_transforms.py::test_issue_7181", "sympy/series/tests/test_formal.py::test_fps__product", "sympy/solvers/ode/tests/test_single.py::test_Riccati_special_minus2", "sympy/solvers/ode/tests/test_lie_group.py::test_heuristic_abaco2_similar", "sympy/functions/special/tests/test_zeta_functions.py::test_lerchphi_expansion", "sympy/stats/tests/test_discrete_rv.py::test_product_spaces", "sympy/integrals/tests/test_manual.py::test_issue_23566", "sympy/solvers/ode/tests/test_systems.py::test_linodesolve", "sympy/stats/tests/test_matrix_distributions.py::test_MatrixGamma", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_ild_with_sliding_hinge", "sympy/utilities/tests/test_wester.py::test_M30", "sympy/integrals/tests/test_meijerint.py::test_indefinite_1_bug", "sympy/solvers/tests/test_solvers.py::test_issue_3725", "sympy/physics/vector/tests/test_fieldfunctions.py::test_solenoidal", "sympy/calculus/tests/test_singularities.py::test_is_strictly_increasing", "sympy/series/tests/test_series.py::test_issue_20697", "sympy/stats/tests/test_continuous_rv.py::test_Or", "sympy/geometry/tests/test_util.py::test_idiff", "sympy/series/tests/test_nseries.py::test_issue_4441", "sympy/solvers/tests/test_solveset.py::test_solve_complex_sqrt", "sympy/series/tests/test_lseries.py::test_cos", "sympy/stats/tests/test_stochastic_process.py::test_DiscreteMarkovChain", "sympy/stats/tests/test_matrix_distributions.py::test_Wishart", "sympy/physics/vector/tests/test_fieldfunctions.py::test_scalar_potential_difference", "sympy/functions/elementary/tests/test_trigonometric.py::test_acot_nseries", "sympy/geometry/tests/test_entity.py::test_entity", "sympy/solvers/ode/tests/test_lie_group.py::test_heuristic_abaco2_unique_unknown", "sympy/solvers/tests/test_pde.py::test_pdsolve_all", "sympy/physics/mechanics/tests/test_lagrange.py::test_disc_on_an_incline_plane", "sympy/series/tests/test_limits.py::test_issue_5740", "sympy/series/tests/test_formal.py::test_fps__compose", "sympy/calculus/tests/test_singularities.py::test_is_decreasing", "sympy/concrete/tests/test_guess.py::test_guess", "sympy/integrals/tests/test_transforms.py::test_issue_12591", "sympy/physics/mechanics/tests/test_jointsmethod.py::test_chaos_pendulum", "sympy/integrals/tests/test_manual.py::test_nested_pow", "sympy/matrices/tests/test_matrices.py::test_invertible_check", "sympy/series/tests/test_nseries.py::test_issue_4329", "sympy/stats/tests/test_compound_rv.py::test_normal_CompoundDist", "sympy/polys/tests/test_polytools.py::test_to_rational_coeffs", "sympy/geometry/tests/test_util.py::test_intersection", "sympy/physics/mechanics/tests/test_lagrange.py::test_nonminimal_pendulum", "sympy/integrals/tests/test_meijerint.py::test_pr_23583", "sympy/utilities/tests/test_wester.py::test_M31", "sympy/solvers/ode/tests/test_lie_group.py::test_heuristic_linear", "sympy/solvers/tests/test_solveset.py::test_solveset_complex_tan", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_Beam3D", "sympy/integrals/tests/test_integrals.py::test_issue_4403", "sympy/matrices/expressions/tests/test_applyfunc.py::test_applyfunc_matrix", "sympy/geometry/tests/test_entity.py::test_subs", "sympy/matrices/tests/test_matrixbase.py::test_find_reasonable_pivot_naive_finds_guaranteed_nonzero2", "sympy/stats/tests/test_stochastic_process.py::test_ContinuousMarkovChain", "sympy/series/tests/test_lseries.py::test_exp", "sympy/functions/special/tests/test_singularity_functions.py::test_leading_term", "sympy/functions/elementary/tests/test_trigonometric.py::test_asec_nseries", "sympy/solvers/ode/tests/test_single.py::test_Bernoulli", "sympy/solvers/ode/tests/test_lie_group.py::test_user_infinitesimals", "sympy/solvers/ode/tests/test_systems.py::test_neq_order1_type4_slow3", "sympy/calculus/tests/test_singularities.py::test_is_strictly_decreasing", "sympy/series/tests/test_series.py::test_issue_21245", "sympy/geometry/tests/test_entity.py::test_reflect_entity_overrides", "sympy/solvers/tests/test_solvers.py::test_solve_undetermined_coeffs", "sympy/matrices/tests/test_matrixbase.py::test_find_reasonable_pivot_naive_simplifies", "sympy/physics/continuum_mechanics/tests/test_arch.py::test_arch_init", "sympy/series/tests/test_lseries.py::test_exp2", "sympy/functions/special/tests/test_singularity_functions.py::test_series", "sympy/series/tests/test_nseries.py::test_issue_5183", "sympy/solvers/tests/test_pde.py::test_pdsolve_variable_coeff", "sympy/stats/tests/test_continuous_rv.py::test_ContinuousDistributionHandmade", "sympy/matrices/tests/test_matrices.py::test_dual", "sympy/series/tests/test_limits.py::test_issue_6366", "sympy/physics/tests/test_hydrogen.py::test_wavefunction", "sympy/series/tests/test_formal.py::test_fps__inverse", "sympy/geometry/tests/test_util.py::test_centroid", "sympy/physics/tests/test_qho_1d.py::test_wavefunction", "sympy/series/tests/test_series.py::test_issue_21938", "sympy/geometry/tests/test_entity.py::test_geometry_EvalfMixin", "sympy/physics/tests/test_hydrogen.py::test_norm", "sympy/calculus/tests/test_singularities.py::test_is_monotonic", "sympy/physics/tests/test_qho_1d.py::test_norm", "sympy/physics/mechanics/tests/test_linearize.py::test_linearize_pendulum_kane_minimal", "sympy/physics/mechanics/tests/test_lagrange.py::test_dub_pen", "sympy/integrals/tests/test_failing_integrals.py::test_issue_4511", "sympy/tensor/array/tests/test_ndim_array.py::test_issue_18361", "sympy/calculus/tests/test_finite_diff.py::test_apply_finite_diff", "sympy/utilities/tests/test_wester.py::test_M36", "sympy/integrals/tests/test_meijerint.py::test_integrate_function_of_square_over_negatives", "sympy/stats/tests/test_compound_rv.py::test_poisson_CompoundDist", "sympy/physics/mechanics/tests/test_linearize.py::test_linearize_pendulum_kane_nonminimal", "sympy/series/tests/test_nseries.py::test_issue_5654", "sympy/stats/tests/test_stochastic_process.py::test_BernoulliProcess", "sympy/series/tests/test_lseries.py::test_simple", "sympy/geometry/tests/test_curve.py::test_curve", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_parabolic_loads", "sympy/functions/special/tests/test_elliptic_integrals.py::test_K", "sympy/solvers/tests/test_solveset.py::test_solve_trig", "sympy/integrals/tests/test_manual.py::test_manualintegrate_sqrt_linear", "sympy/matrices/tests/test_matrixbase.py::test_cholesky", "sympy/diffgeom/tests/test_function_diffgeom_book.py::test_functional_diffgeom_ch2", "sympy/solvers/tests/test_solvers.py::test_solve_inequalities", "sympy/calculus/tests/test_singularities.py::test_issue_23401", "sympy/physics/mechanics/tests/test_linearize.py::test_linearize_pendulum_lagrange_minimal", "sympy/functions/elementary/tests/test_trigonometric.py::test_acsc_nseries", "sympy/series/tests/test_limits.py::test_factorial", "sympy/integrals/tests/test_integrals.py::test_issue_4403_2", "sympy/matrices/tests/test_matrices.py::test_anti_symmetric", "sympy/solvers/ode/tests/test_single.py::test_1st_linear", "sympy/physics/mechanics/tests/test_lagrange.py::test_rolling_disc", "sympy/diffgeom/tests/test_function_diffgeom_book.py::test_functional_diffgeom_ch3", "sympy/utilities/tests/test_wester.py::test_M39", "sympy/geometry/tests/test_curve.py::test_parameter_value", "sympy/physics/mechanics/tests/test_kane2.py::test_aux_dep", "sympy/solvers/ode/tests/test_systems.py::test_dsolve_system", "sympy/series/tests/test_series.py::test_issue_23432", "sympy/stats/tests/test_mix.py::test_density", "sympy/series/tests/test_lseries.py::test_issue_5183", "sympy/series/tests/test_nseries.py::test_issue_5925", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_cross_section", "sympy/stats/tests/test_stochastic_process.py::test_PoissonProcess", "sympy/functions/special/tests/test_elliptic_integrals.py::test_F", "sympy/integrals/tests/test_meijerint.py::test_issue_25949", "sympy/simplify/tests/test_trigsimp.py::test_exptrigsimp", "sympy/stats/tests/test_continuous_rv.py::test_compute_density", "sympy/physics/tests/test_qho_1d.py::test_orthogonality", "sympy/physics/mechanics/tests/test_linearize.py::test_linearize_pendulum_lagrange_nonminimal", "sympy/series/tests/test_nseries.py::test_exp_2", "sympy/solvers/tests/test_polysys.py::test_solve_poly_system", "sympy/matrices/tests/test_matrices.py::test_simplify_immutable", "sympy/diffgeom/tests/test_function_diffgeom_book.py::test_functional_diffgeom_ch4", "sympy/vector/tests/test_integrals.py::test_parametric_lineintegrals", "sympy/series/tests/test_series.py::test_issue_23727", "sympy/vector/tests/test_integrals.py::test_parametric_surfaceintegrals", "sympy/utilities/tests/test_wester.py::test_N9", "sympy/vector/tests/test_implicitregion.py::test_singular_points_and_multiplicty", "sympy/matrices/tests/test_matrixbase.py::test_matrix_norm", "sympy/series/tests/test_limits.py::test_issue_6560", "sympy/solvers/tests/test_polysys.py::test_solve_generic", "sympy/vector/tests/test_integrals.py::test_parametric_volumeintegrals", "sympy/series/tests/test_lseries.py::test_issue_6999", "sympy/simplify/tests/test_trigsimp.py::test_Piecewise", "sympy/solvers/ode/tests/test_systems.py::test_second_order_type2_slow1", "sympy/series/tests/test_series.py::test_issue_24266", "sympy/codegen/tests/test_approximations.py::test_SumApprox_monotone_terms", "sympy/solvers/tests/test_solveset.py::test_solve_trig_hyp_by_inversion", "sympy/vector/tests/test_integrals.py::test_vector_integrate", "sympy/functions/elementary/tests/test_interface.py::test_function_series1", "sympy/physics/tests/test_qho_1d.py::test_coherent_state", "sympy/physics/vector/tests/test_dyadic.py::test_dyadic_simplify", "sympy/stats/tests/test_compound_rv.py::test_unevaluated_CompoundDist", "sympy/simplify/tests/test_trigsimp.py::test_issue_21594", "sympy/solvers/ode/tests/test_single.py::test_almost_linear", "sympy/functions/elementary/tests/test_trigonometric.py::test_issue_25833", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_deflection_Beam3D", "sympy/stats/tests/test_stochastic_process.py::test_WienerProcess", "sympy/vector/tests/test_implicitregion.py::test_rational_parametrization", "sympy/integrals/tests/test_integrals.py::test_issue_4890", "sympy/functions/special/tests/test_elliptic_integrals.py::test_E", "sympy/functions/elementary/tests/test_interface.py::test_function_series2", "sympy/integrals/tests/test_failing_integrals.py::test_integrate_DiracDelta_no_meijerg", "sympy/physics/quantum/tests/test_cartesian.py::test_x", "sympy/integrals/tests/test_manual.py::test_manualintegrate_sqrt_quadratic", "sympy/matrices/tests/test_matrices.py::test_pinv", "sympy/stats/tests/test_symbolic_probability.py::test_literal_probability", "sympy/parsing/tests/test_maxima.py::test_maxima_functions", "sympy/utilities/tests/test_wester.py::test_N10", "sympy/solvers/tests/test_simplex.py::test_lp", "sympy/stats/tests/test_mix.py::test_compound_distribution", "sympy/series/tests/test_limits.py::test_issue_7088", "sympy/functions/elementary/tests/test_interface.py::test_function_series3", "sympy/codegen/tests/test_approximations.py::test_SeriesApprox_trivial", "sympy/solvers/tests/test_solvers.py::test_issue_4793", "sympy/matrices/tests/test_matrixbase.py::test_condition_number", "sympy/stats/tests/test_compound_rv.py::test_Compound_Distribution", "sympy/simplify/tests/test_hyperexpand.py::test_meijerg_with_Floats", "sympy/vector/tests/test_dyadic.py::test_dyadic_simplify", "sympy/physics/quantum/tests/test_spin.py::test_innerproduct", "sympy/vector/tests/test_functions.py::test_express", "sympy/solvers/ode/tests/test_single.py::test_nth_order_linear_euler_eq_homogeneous", "sympy/geometry/tests/test_plane.py::test_plane", "sympy/solvers/tests/test_simplex.py::test_simplex", "sympy/functions/special/tests/test_beta_functions.py::test_beta", "sympy/geometry/tests/test_parabola.py::test_parabola_geom", "sympy/solvers/tests/test_solvers.py::test_PR1964", "sympy/stats/tests/test_symbolic_multivariate.py::test_multivariate_expectation", "sympy/functions/special/tests/test_elliptic_integrals.py::test_P", "sympy/utilities/tests/test_wester.py::test_N11", "sympy/integrals/tests/test_failing_integrals.py::test_issue_15925b", "sympy/matrices/tests/test_matrices.py::test_hermitian", "sympy/geometry/tests/test_plane.py::test_dimension_normalization", "sympy/geometry/tests/test_parabola.py::test_parabola_intersection", "sympy/solvers/tests/test_simplex.py::test_lpmin_lpmax", "sympy/series/tests/test_limits.py::test_branch_cuts", "sympy/functions/elementary/tests/test_trigonometric.py::test_issue_25847", "sympy/simplify/tests/test_gammasimp.py::test_gammasimp", "sympy/vector/tests/test_functions.py::test_orthogonalize", "sympy/stats/tests/test_symbolic_probability.py::test_symbolic_Moment", "sympy/stats/tests/test_stochastic_process.py::test_GammaProcess_symbolic", "sympy/physics/quantum/tests/test_cartesian.py::test_p", "sympy/geometry/tests/test_plane.py::test_parameter_value", "sympy/integrals/tests/test_manual.py::test_mul_pow_derivative", "sympy/stats/tests/test_error_prop.py::test_variance_prop", "sympy/physics/tests/test_sho.py::test_sho_R_nl", "sympy/simplify/tests/test_hyperexpand.py::test_lerchphi", "sympy/solvers/tests/test_simplex.py::test_linprog", "sympy/matrices/tests/test_matrixbase.py::test_invertible_check", "sympy/series/tests/test_limits.py::test_issue_6364", "sympy/utilities/tests/test_wester.py::test_N12", "sympy/stats/tests/test_error_prop.py::test_variance_prop_with_covar", "sympy/integrals/tests/test_integrals.py::test_issue_4551", "sympy/series/tests/test_approximants.py::test_approximants", "sympy/codegen/tests/test_numpy_nodes.py::test_logaddexp", "sympy/stats/tests/test_symbolic_probability.py::test_symbolic_CentralMoment", "sympy/ntheory/tests/test_continued_fraction.py::test_continued_fraction", "sympy/matrices/tests/test_matrices.py::test_opportunistic_simplification", "sympy/solvers/tests/test_solvers.py::test_issue_5197", "sympy/codegen/tests/test_numpy_nodes.py::test_logaddexp2", "sympy/simplify/tests/test_hyperexpand.py::test_partial_simp", "sympy/solvers/ode/tests/test_systems.py::test_linear_2eq_order1", "sympy/matrices/tests/test_matrixbase.py::test_dual", "sympy/physics/optics/tests/test_waves.py::test_twave", "sympy/stats/tests/test_stochastic_process.py::test_GammaProcess_numeric", "sympy/series/tests/test_limits.py::test_issue_6682", "sympy/solvers/ode/tests/test_single.py::test_nth_order_linear_euler_eq_nonhomogeneous_undetermined_coefficients", "sympy/utilities/tests/test_wester.py::test_N13", "sympy/physics/mechanics/tests/test_kane5.py::test_kane_rolling_disc_kdes_callable", "sympy/physics/quantum/tests/test_spin.py::test_rotation_small_d", "sympy/series/tests/test_aseries.py::test_simple", "sympy/solvers/ode/tests/test_subscheck.py::test_checksysodesol", "sympy/functions/elementary/tests/test_trigonometric.py::test_issue_23843", "sympy/solvers/tests/test_solvers.py::test_checking", "sympy/series/tests/test_aseries.py::test_hierarchical", "sympy/solvers/ode/tests/test_systems.py::test_nonlinear_2eq_order1", "sympy/series/tests/test_limits.py::test_issue_4099", "sympy/assumptions/tests/test_query.py::test_matrix", "sympy/utilities/tests/test_wester.py::test_N15", "sympy/matrices/tests/test_matrices.py::test_issue_11238", "sympy/matrices/tests/test_matrixbase.py::test_anti_symmetric", "sympy/codegen/tests/test_matrix_nodes.py::test_matrix_solve_derivative_exact", "sympy/integrals/tests/test_integrals.py::test_issue_4376", "sympy/vector/tests/test_parametricregion.py::test_parametric_region_list", "sympy/solvers/tests/test_solveset.py::test_solve_hyperbolic", "sympy/integrals/tests/test_integrals.py::test_issue_4517", "sympy/codegen/tests/test_scipy_nodes.py::test_cosm1", "sympy/matrices/tests/test_matrices.py::test_func", "sympy/codegen/tests/test_scipy_nodes.py::test_powm1", "sympy/series/tests/test_limits.py::test_issue_4503", "sympy/utilities/tests/test_wester.py::test_N16", "sympy/solvers/tests/test_solvers.py::test_issue_4671_4463_4467", "sympy/physics/quantum/tests/test_spin.py::test_rotation_d", "sympy/matrices/tests/test_matrixbase.py::test_pinv", "sympy/simplify/tests/test_hyperexpand.py::test_hyperexpand_special", "sympy/solvers/tests/test_solveset.py::test_solve_trig_hyp_symbolic", "sympy/solvers/ode/tests/test_systems.py::test_dsolve_linsystem_symbol", "sympy/series/tests/test_limits.py::test_issue_6052", "sympy/utilities/tests/test_wester.py::test_P11_workaround", "sympy/solvers/tests/test_solvers.py::test_issue_5132", "sympy/simplify/tests/test_hyperexpand.py::test_Mod1_behavior", "sympy/matrices/tests/test_matrixbase.py::test_hermitian", "sympy/integrals/tests/test_integrals.py::test_issue_4527", "sympy/matrices/tests/test_matrices.py::test_rref", "sympy/physics/quantum/tests/test_spin.py::test_jplus", "sympy/solvers/tests/test_solvers.py::test_issue_5335", "sympy/utilities/tests/test_wester.py::test_P13", "sympy/assumptions/tests/test_query.py::test_Add_queries", "sympy/series/tests/test_limits.py::test_issue_7224", "sympy/simplify/tests/test_hyperexpand.py::test_prudnikov_1", "sympy/matrices/tests/test_matrixbase.py::test_opportunistic_simplification", "sympy/matrices/tests/test_matrices.py::test_rank", "sympy/integrals/tests/test_heurisch.py::test_issue_15498", "sympy/simplify/tests/test_hyperexpand.py::test_prudnikov_3", "sympy/solvers/tests/test_solvers.py::test_issue_24609", "sympy/matrices/tests/test_matrixbase.py::test_issue_11238", "sympy/series/tests/test_limits.py::test_issue_7391_8166", "sympy/utilities/tests/test_wester.py::test_P17", "sympy/physics/quantum/tests/test_state.py::test_wavefunction", "sympy/series/tests/test_limits.py::test_issue_8208", "sympy/matrices/tests/test_matrices.py::test_issue_11434", "sympy/simplify/tests/test_hyperexpand.py::test_prudnikov_9", "sympy/solvers/tests/test_solvers.py::test_polysys", "sympy/series/tests/test_limits.py::test_issue_8229", "sympy/solvers/tests/test_solveset.py::test_issue_9616", "sympy/matrices/tests/test_matrixbase.py::test_func", "sympy/physics/quantum/tests/test_spin.py::test_jminus", "sympy/integrals/tests/test_integrals.py::test_issue_4199", "sympy/matrices/tests/test_matrices.py::test_rank_regression_from_so", "sympy/simplify/tests/test_hyperexpand.py::test_prudnikov_11", "sympy/integrals/tests/test_heurisch.py::test_heurisch_issue_26922", "sympy/solvers/tests/test_solvers.py::test__invert", "sympy/utilities/tests/test_wester.py::test_P32", "sympy/simplify/tests/test_hyperexpand.py::test_prudnikov_12", "sympy/series/tests/test_limits.py::test_issue_8433", "sympy/integrals/tests/test_integrals.py::test_issue_3940", "sympy/solvers/tests/test_solvers.py::test_issue_4463", "sympy/solvers/tests/test_solveset.py::test_solve_invalid_sol", "sympy/utilities/tests/test_wester.py::test_P33", "sympy/simplify/tests/test_hyperexpand.py::test_bug", "sympy/solvers/tests/test_solvers.py::test_issue_5849", "sympy/series/tests/test_limits.py::test_issue_8481", "sympy/solvers/tests/test_solveset.py::test_solveset", "sympy/simplify/tests/test_hyperexpand.py::test_omgissue_203", "sympy/integrals/tests/test_integrals.py::test_issue_4892b", "sympy/utilities/tests/test_wester.py::test_P42", "sympy/physics/quantum/tests/test_spin.py::test_jz", "sympy/series/tests/test_limits.py::test_issue_8462", "sympy/solvers/tests/test_solvers.py::test_issue_21882", "sympy/utilities/tests/test_wester.py::test_P45", "sympy/utilities/tests/test_wester.py::test_R9", "sympy/series/tests/test_limits.py::test_issue_8634", "sympy/solvers/tests/test_solvers.py::test_issue_5901", "sympy/integrals/tests/test_integrals.py::test_integrate_series", "sympy/utilities/tests/test_wester.py::test_R16", "sympy/solvers/tests/test_solvers.py::test_issue_5912", "sympy/series/tests/test_limits.py::test_issue_8635_18176", "sympy/physics/quantum/tests/test_spin.py::test_rotation", "sympy/integrals/tests/test_integrals.py::test_limit_bug", "sympy/utilities/tests/test_wester.py::test_R17", "sympy/solvers/tests/test_solveset.py::test__solveset_multi", "sympy/solvers/tests/test_solvers.py::test_float_handling", "sympy/series/tests/test_limits.py::test_issue_8730", "sympy/utilities/tests/test_wester.py::test_R18", "sympy/series/tests/test_limits.py::test_issue_9252", "sympy/solvers/tests/test_solvers.py::test_issue_6056", "sympy/integrals/tests/test_integrals.py::test_issue_4703", "sympy/utilities/tests/test_wester.py::test_R24", "sympy/utilities/tests/test_wester.py::test_S1", "sympy/series/tests/test_limits.py::test_issue_9558", "sympy/solvers/tests/test_solvers.py::test_issue_5673", "sympy/utilities/tests/test_wester.py::test_S3", "sympy/integrals/tests/test_integrals.py::test_issue_3558", "sympy/solvers/tests/test_solvers.py::test_exclude", "sympy/utilities/tests/test_wester.py::test_S4", "sympy/series/tests/test_limits.py::test_issue_10801", "sympy/solvers/tests/test_solveset.py::test_conditionset", "sympy/utilities/tests/test_wester.py::test_T1", "sympy/series/tests/test_limits.py::test_issue_10976", "sympy/integrals/tests/test_integrals.py::test_issue_4422", "sympy/series/tests/test_limits.py::test_issue_9041", "sympy/solvers/tests/test_solveset.py::test_solveset_domain", "sympy/integrals/tests/test_integrals.py::test_issue_4493", "sympy/utilities/tests/test_wester.py::test_T2", "sympy/solvers/tests/test_solveset.py::test_improve_coverage", "sympy/series/tests/test_limits.py::test_issue_9471", "sympy/utilities/tests/test_wester.py::test_T3", "sympy/solvers/tests/test_solveset.py::test_issue_9522", "sympy/integrals/tests/test_integrals.py::test_issue_4737", "sympy/series/tests/test_limits.py::test_issue_10382", "sympy/utilities/tests/test_wester.py::test_T4", "sympy/solvers/tests/test_solveset.py::test_solvify", "sympy/integrals/tests/test_integrals.py::test_issue_4992", "sympy/series/tests/test_limits.py::test_issue_11496", "sympy/utilities/tests/test_wester.py::test_T5", "sympy/integrals/tests/test_integrals.py::test_issue_4487", "sympy/solvers/tests/test_solveset.py::test_solvify_piecewise", "sympy/series/tests/test_limits.py::test_issue_11879", "sympy/utilities/tests/test_wester.py::test_T6", "sympy/series/tests/test_limits.py::test_issue_10610", "sympy/utilities/tests/test_wester.py::test_T7", "sympy/solvers/tests/test_solveset.py::test_abs_invert_solvify", "sympy/integrals/tests/test_integrals.py::test_issue_4215", "sympy/series/tests/test_limits.py::test_issue_10868", "sympy/utilities/tests/test_wester.py::test_T8", "sympy/utilities/tests/test_wester.py::test_T12", "sympy/integrals/tests/test_integrals.py::test_issue_6253", "sympy/series/tests/test_limits.py::test_issue_6599", "sympy/utilities/tests/test_wester.py::test_T13", "sympy/series/tests/test_limits.py::test_issue_12555", "sympy/integrals/tests/test_integrals.py::test_issue_4153", "sympy/utilities/tests/test_wester.py::test_T14", "sympy/solvers/tests/test_solveset.py::test_solve_decomposition", "sympy/series/tests/test_limits.py::test_issue_12769", "sympy/solvers/tests/test_solveset.py::test_nonlinsolve_basic", "sympy/solvers/tests/test_solveset.py::test_nonlinsolve_abs", "sympy/utilities/tests/test_wester.py::test_U10", "sympy/solvers/tests/test_solveset.py::test_trig_system", "sympy/series/tests/test_limits.py::test_issue_13332", "sympy/utilities/tests/test_wester.py::test_U13", "sympy/series/tests/test_limits.py::test_issue_12564", "sympy/solvers/tests/test_solveset.py::test_nonlinsolve_positive_dimensional", "sympy/utilities/tests/test_wester.py::test_V3", "sympy/solvers/tests/test_solveset.py::test_nonlinsolve_polysys", "sympy/series/tests/test_limits.py::test_issue_14411", "sympy/utilities/tests/test_wester.py::test_V4", "sympy/solvers/tests/test_solveset.py::test_nonlinsolve_using_substitution", "sympy/series/tests/test_limits.py::test_issue_13382", "sympy/solvers/tests/test_solveset.py::test_nonlinsolve_complex", "sympy/utilities/tests/test_wester.py::test_V7", "sympy/series/tests/test_limits.py::test_issue_13403", "sympy/integrals/tests/test_integrals.py::test_issue_4326", "sympy/solvers/tests/test_solveset.py::test_nonlinsolve_radical", "sympy/series/tests/test_limits.py::test_issue_13416", "sympy/series/tests/test_limits.py::test_issue_13462", "sympy/solvers/tests/test_solveset.py::test_nonlinsolve_inexact", "sympy/utilities/tests/test_wester.py::test_V12", "sympy/integrals/tests/test_integrals.py::test_manual_option", "sympy/solvers/tests/test_solveset.py::test_nonlinsolve_issue_25182", "sympy/series/tests/test_limits.py::test_issue_13750", "sympy/solvers/tests/test_solveset.py::test_issue_14642", "sympy/polys/numberfields/tests/test_minpoly.py::test_issue_18248", "sympy/series/tests/test_limits.py::test_issue_14276", "sympy/utilities/tests/test_wester.py::test_V15", "sympy/polys/numberfields/tests/test_minpoly.py::test_issue_13230", "sympy/integrals/tests/test_integrals.py::test_issue_4234", "sympy/solvers/tests/test_solveset.py::test_issue_13961", "sympy/utilities/tests/test_wester.py::test_W7", "sympy/series/tests/test_limits.py::test_issue_14514", "sympy/solvers/tests/test_solveset.py::test_issue_14541", "sympy/integrals/tests/test_integrals.py::test_issue_4492", "sympy/series/tests/test_limits.py::test_issues_14525", "sympy/utilities/tests/test_wester.py::test_W12", "sympy/solvers/tests/test_solveset.py::test_issue_12032", "sympy/integrals/tests/test_integrals.py::test_issue_2708", "sympy/utilities/tests/test_wester.py::test_W14", "sympy/series/tests/test_limits.py::test_issue_14574", "sympy/series/tests/test_limits.py::test_issue_10102", "sympy/solvers/tests/test_solveset.py::test_issue_10876", "sympy/utilities/tests/test_wester.py::test_W17", "sympy/solvers/tests/test_solveset.py::test_issue_19050", "sympy/series/tests/test_limits.py::test_issue_14377", "sympy/utilities/tests/test_wester.py::test_W18", "sympy/solvers/tests/test_solvers.py::test_issue_6605", "sympy/solvers/tests/test_solveset.py::test_issue_16618", "sympy/series/tests/test_limits.py::test_issue_15146", "sympy/utilities/tests/test_wester.py::test_W21", "sympy/solvers/tests/test_solvers.py::test_issue_6644", "sympy/series/tests/test_limits.py::test_issue_15202", "sympy/solvers/tests/test_solveset.py::test_issue_17566", "sympy/integrals/tests/test_integrals.py::test_issue_8368i", "sympy/utilities/tests/test_wester.py::test_W23b", "sympy/solvers/tests/test_solveset.py::test_issue_19587", "sympy/series/tests/test_limits.py::test_issue_15282", "sympy/solvers/tests/test_solvers.py::test_issues_6819_6820_6821_6248_8692_25777_25779", "sympy/series/tests/test_limits.py::test_issue_15984", "sympy/solvers/tests/test_solveset.py::test_issue_5132_1", "sympy/utilities/tests/test_wester.py::test_X1", "sympy/solvers/tests/test_solvers.py::test_issue_17638", "sympy/series/tests/test_limits.py::test_issue_13571", "sympy/integrals/tests/test_integrals.py::test_issue_11856", "sympy/utilities/tests/test_wester.py::test_X2", "sympy/solvers/tests/test_solveset.py::test_issue_5132_2", "sympy/series/tests/test_limits.py::test_issue_13575", "sympy/utilities/tests/test_wester.py::test_X3", "sympy/solvers/tests/test_solveset.py::test_issue_6752", "sympy/series/tests/test_limits.py::test_issue_17325", "sympy/solvers/tests/test_solvers.py::test_issue_14607", "sympy/utilities/tests/test_wester.py::test_X4", "sympy/series/tests/test_limits.py::test_issue_10978", "sympy/solvers/tests/test_solveset.py::test_issue_2777", "sympy/solvers/tests/test_solvers.py::test_lambert_multivariate", "sympy/utilities/tests/test_wester.py::test_X6", "sympy/series/tests/test_limits.py::test_issue_14313_comment", "sympy/solvers/tests/test_solveset.py::test_issue_8828", "sympy/solvers/tests/test_solvers.py::test_rewrite_trig", "sympy/integrals/tests/test_integrals.py::test_singularities", "sympy/series/tests/test_limits.py::test_issue_15323", "sympy/solvers/tests/test_solvers.py::test_uselogcombine", "sympy/utilities/tests/test_wester.py::test_X7", "sympy/solvers/tests/test_solveset.py::test_nonlinsolve_conditionset", "sympy/integrals/tests/test_integrals.py::test_issue_12645", "sympy/solvers/tests/test_solveset.py::test_substitution_basic", "sympy/solvers/tests/test_solvers.py::test_atan2", "sympy/series/tests/test_limits.py::test_issue_12571", "sympy/utilities/tests/test_wester.py::test_X8", "sympy/solvers/tests/test_solvers.py::test_errorinverses", "sympy/utilities/tests/test_wester.py::test_X9", "sympy/series/tests/test_limits.py::test_issue_14590", "sympy/solvers/tests/test_solveset.py::test_substitution_incorrect", "sympy/integrals/tests/test_integrals.py::test_issue_14078", "sympy/solvers/tests/test_solvers.py::test_issue_2725", "sympy/utilities/tests/test_wester.py::test_X10", "sympy/series/tests/test_limits.py::test_issue_14393", "sympy/solvers/tests/test_solveset.py::test_substitution_redundant", "sympy/integrals/tests/test_integrals.py::test_issue_8170", "sympy/utilities/tests/test_wester.py::test_X11", "sympy/series/tests/test_limits.py::test_issue_14556", "sympy/solvers/tests/test_solvers.py::test_real_imag_splitting", "sympy/solvers/tests/test_solveset.py::test_issue_5132_substitution", "sympy/utilities/tests/test_wester.py::test_X13", "sympy/solvers/tests/test_solvers.py::test_units", "sympy/series/tests/test_limits.py::test_issue_14811", "sympy/integrals/tests/test_integrals.py::test_issue_8440_14040", "sympy/utilities/tests/test_wester.py::test_X16", "sympy/solvers/tests/test_solveset.py::test_issue_21022", "sympy/solvers/tests/test_solvers.py::test_issue_7895", "sympy/solvers/tests/test_solvers.py::test_issue_2777", "sympy/solvers/tests/test_solveset.py::test_issue_17906", "sympy/series/tests/test_limits.py::test_issue_16222", "sympy/series/tests/test_limits.py::test_issue_16714", "sympy/utilities/tests/test_wester.py::test_Y2", "sympy/solvers/tests/test_solvers.py::test_base_0_exp_0", "sympy/solvers/tests/test_solveset.py::test_issue_17933_bis", "sympy/series/tests/test_limits.py::test_issue_16722", "sympy/solvers/tests/test_solveset.py::test_issue_14565", "sympy/solvers/tests/test_solvers.py::test_issue_2840_8155", "sympy/utilities/tests/test_wester.py::test_Y3", "sympy/series/tests/test_limits.py::test_issue_17431", "sympy/solvers/tests/test_solvers.py::test_issue_11538", "sympy/solvers/tests/test_solveset.py::test_issue_9913", "sympy/integrals/tests/test_integrals.py::test_issue_14144", "sympy/utilities/tests/test_wester.py::test_Y4", "sympy/series/tests/test_limits.py::test_issue_17671", "sympy/solvers/tests/test_solveset.py::test_integer_domain_relational", "sympy/solvers/tests/test_solvers.py::test_issue_12476", "sympy/integrals/tests/test_integrals.py::test_issue_14375", "sympy/series/tests/test_limits.py::test_issue_17751", "sympy/utilities/tests/test_wester.py::test_Y5_Y6", "sympy/solvers/tests/test_solveset.py::test_issue_10555", "sympy/solvers/tests/test_solvers.py::test_issue_14860", "sympy/series/tests/test_limits.py::test_issue_17792", "sympy/utilities/tests/test_wester.py::test_Y9", "sympy/solvers/tests/test_solvers.py::test_issue_14721", "sympy/solvers/tests/test_solveset.py::test_issue_8715", "sympy/series/tests/test_limits.py::test_issue_18118", "sympy/series/tests/test_limits.py::test_issue_18306", "sympy/integrals/tests/test_integrals.py::test_issue_14782", "sympy/utilities/tests/test_wester.py::test_Y10", "sympy/solvers/tests/test_solvers.py::test_issue_14779", "sympy/solvers/tests/test_solveset.py::test_issue_11534", "sympy/utilities/tests/test_wester.py::test_Z1", "sympy/series/tests/test_limits.py::test_issue_18378", "sympy/solvers/tests/test_solveset.py::test_issue_10477", "sympy/solvers/tests/test_solvers.py::test_issue_15415", "sympy/utilities/tests/test_wester.py::test_Z2", "sympy/integrals/tests/test_integrals.py::test_issue_12081", "sympy/utilities/tests/test_wester.py::test_Z3", "sympy/series/tests/test_limits.py::test_issue_18399", "sympy/solvers/tests/test_solveset.py::test_issue_10671", "sympy/solvers/tests/test_solvers.py::test_issue_14645", "sympy/integrals/tests/test_integrals.py::test_issue_15285", "sympy/solvers/tests/test_solvers.py::test_issue_12024", "sympy/series/tests/test_limits.py::test_issue_18442", "sympy/solvers/tests/test_solveset.py::test_issue_11064", "sympy/integrals/tests/test_integrals.py::test_issue_15432", "sympy/solvers/tests/test_solvers.py::test_issue_17452", "sympy/solvers/tests/test_solveset.py::test_issue_12478", "sympy/series/tests/test_limits.py::test_issue_18452", "sympy/series/tests/test_limits.py::test_issue_18473", "sympy/solvers/tests/test_solvers.py::test_issue_17799", "sympy/solvers/tests/test_solveset.py::test_issue_12429", "sympy/integrals/tests/test_integrals.py::test_issue_15124", "sympy/series/tests/test_limits.py::test_issue_18482", "sympy/solvers/tests/test_solvers.py::test_issue_17650", "sympy/solvers/tests/test_solveset.py::test_issue_19506", "sympy/integrals/tests/test_integrals.py::test_issue_15292", "sympy/series/tests/test_limits.py::test_issue_18508", "sympy/solvers/tests/test_solveset.py::test_solveset_arg", "sympy/solvers/tests/test_solvers.py::test_issue_17882", "sympy/integrals/tests/test_integrals.py::test_issue_4514", "sympy/solvers/tests/test_solvers.py::test_issue_17949", "sympy/series/tests/test_limits.py::test_issue_18521", "sympy/solvers/tests/test_solveset.py::test_issue_13550", "sympy/solvers/tests/test_solvers.py::test_issue_10993", "sympy/solvers/tests/test_solveset.py::test_issue_13849", "sympy/series/tests/test_limits.py::test_issue_18969", "sympy/series/tests/test_limits.py::test_issue_18992", "sympy/solvers/tests/test_solveset.py::test_issue_14223", "sympy/integrals/tests/test_integrals.py::test_issue_15431", "sympy/solvers/tests/test_solvers.py::test_issue_19113_19102", "sympy/series/tests/test_limits.py::test_issue_19067", "sympy/solvers/tests/test_solvers.py::test_issue_20747", "sympy/solvers/tests/test_solveset.py::test_issue_10158", "sympy/series/tests/test_limits.py::test_issue_19586", "sympy/solvers/tests/test_solvers.py::test_issue_27001", "sympy/integrals/tests/test_integrals.py::test_issue_15640_log_substitutions", "sympy/series/tests/test_limits.py::test_issue_13715", "sympy/solvers/tests/test_solveset.py::test_issue_17882", "sympy/solvers/tests/test_solvers.py::test_issue_21034", "sympy/series/tests/test_limits.py::test_issue_15055", "sympy/solvers/tests/test_solveset.py::test_transolve", "sympy/series/tests/test_limits.py::test_issue_16708", "sympy/solvers/tests/test_solvers.py::test_issue_6819", "sympy/solvers/tests/test_solveset.py::test_issue_21276", "sympy/integrals/tests/test_integrals.py::test_issue_14241", "sympy/series/tests/test_limits.py::test_issue_19154", "sympy/solvers/tests/test_solvers.py::test_issue_17454", "sympy/series/tests/test_limits.py::test_issue_19453", "sympy/integrals/tests/test_integrals.py::test_issue_13112", "sympy/solvers/tests/test_solveset.py::test_exponential_real", "sympy/solvers/tests/test_solveset.py::test_expo_conditionset", "sympy/solvers/tests/test_solvers.py::test_issue_21852", "sympy/solvers/tests/test_solvers.py::test_issue_21942", "sympy/solvers/tests/test_solveset.py::test_exponential_symbols", "sympy/series/tests/test_limits.py::test_issue_19739", "sympy/integrals/tests/test_integrals.py::test_issue_14709b", "sympy/solvers/tests/test_solvers.py::test_issue_22717", "sympy/solvers/tests/test_solveset.py::test_ignore_assumptions", "sympy/series/tests/test_limits.py::test_issue_19766", "sympy/solvers/tests/test_solvers.py::test_issue_25176", "sympy/solvers/tests/test_solveset.py::test_solve_exponential", "sympy/solvers/tests/test_solveset.py::test_logarithmic", "sympy/series/tests/test_limits.py::test_issue_19770", "sympy/integrals/tests/test_integrals.py::test_issue_8614", "sympy/solvers/tests/test_solvers.py::test_solve_undetermined_coeffs_issue_23927", "sympy/series/tests/test_limits.py::test_issue_7535", "sympy/solvers/tests/test_solvers.py::test_issue_24368", "sympy/integrals/tests/test_integrals.py::test_li_integral", "sympy/series/tests/test_limits.py::test_issue_20365", "sympy/integrals/tests/test_integrals.py::test_issue_17473", "sympy/solvers/tests/test_solvers.py::test_solve_Piecewise", "sympy/solvers/tests/test_solveset.py::test_issue_17276", "sympy/series/tests/test_limits.py::test_issue_21031", "sympy/solvers/tests/test_solveset.py::test_issue_18208", "sympy/series/tests/test_limits.py::test_issue_21038", "sympy/integrals/tests/test_integrals.py::test_issue_17671", "sympy/solvers/tests/test_solveset.py::test_substitution_with_infeasible_solution", "sympy/series/tests/test_limits.py::test_issue_20578", "sympy/integrals/tests/test_integrals.py::test_issue_2975", "sympy/series/tests/test_limits.py::test_issue_21227", "sympy/solvers/tests/test_solveset.py::test_issue_20097", "sympy/integrals/tests/test_integrals.py::test_issue_7827", "sympy/series/tests/test_limits.py::test_issue_21415", "sympy/solvers/tests/test_solveset.py::test_issue_15350", "sympy/series/tests/test_limits.py::test_issue_21530", "sympy/solvers/tests/test_solveset.py::test_issue_18359", "sympy/integrals/tests/test_integrals.py::test_issue_21034", "sympy/series/tests/test_limits.py::test_issue_21550", "sympy/series/tests/test_limits.py::test_issue_21661", "sympy/solvers/tests/test_solveset.py::test_issue_17604", "sympy/solvers/tests/test_solveset.py::test_issue_17566_actual", "sympy/series/tests/test_limits.py::test_issue_21701", "sympy/series/tests/test_limits.py::test_issue_21721", "sympy/solvers/tests/test_solveset.py::test_issue_17565", "sympy/solvers/tests/test_solveset.py::test_issue_15024", "sympy/integrals/tests/test_integrals.py::test_issue_4187", "sympy/solvers/tests/test_solveset.py::test_issue_16877", "sympy/series/tests/test_limits.py::test_issue_21756", "sympy/solvers/tests/test_solveset.py::test_issue_16876", "sympy/integrals/tests/test_integrals.py::test_issue_5547", "sympy/series/tests/test_limits.py::test_issue_21785", "sympy/solvers/tests/test_solveset.py::test_issue_21236", "sympy/solvers/tests/test_solveset.py::test_issue_21908", "sympy/series/tests/test_limits.py::test_issue_22181", "sympy/integrals/tests/test_integrals.py::test_issue_15810", "sympy/solvers/tests/test_solveset.py::test_issue_19144", "sympy/series/tests/test_limits.py::test_issue_22220", "sympy/solvers/tests/test_solveset.py::test_issue_22413", "sympy/solvers/tests/test_solveset.py::test_issue_23318", "sympy/series/tests/test_limits.py::test_issue_22334", "sympy/solvers/tests/test_solveset.py::test_issue_19814", "sympy/series/tests/test_limits.py::test_issue_22836_limit", "sympy/solvers/tests/test_solveset.py::test_issue_22058", "sympy/solvers/tests/test_solveset.py::test_issue_11184", "sympy/series/tests/test_limits.py::test_sympyissue_22986", "sympy/integrals/tests/test_integrals.py::test_issue_21721", "sympy/series/tests/test_limits.py::test_issue_23231", "sympy/solvers/tests/test_solveset.py::test_issue_21890", "sympy/solvers/tests/test_solveset.py::test_issue_22628", "sympy/series/tests/test_limits.py::test_issue_23596", "sympy/solvers/tests/test_solveset.py::test_issue_25781", "sympy/integrals/tests/test_integrals.py::test_issue_21831", "sympy/solvers/tests/test_solveset.py::test_issue_26077", "sympy/series/tests/test_limits.py::test_issue_23752", "sympy/series/tests/test_limits.py::test_issue_24276", "sympy/series/tests/test_limits.py::test_issue_25230", "sympy/series/tests/test_limits.py::test_issue_25582", "sympy/integrals/tests/test_integrals.py::test_issue_18527", "sympy/series/tests/test_limits.py::test_issue_25847", "sympy/integrals/tests/test_integrals.py::test_issue_23718", "sympy/series/tests/test_limits.py::test_issue_26040", "sympy/series/tests/test_limits.py::test_issue_26250", "sympy/series/tests/test_limits.py::test_issue_26513", "sympy/series/tests/test_limits.py::test_issue_26916", "sympy/integrals/tests/test_integrals.py::test_issue_23566", "sympy/series/tests/test_limits.py::test_issue_22982_15323", "sympy/integrals/tests/test_integrals.py::test_pr_23583", "sympy/series/tests/test_limits.py::test_issue_26991", "sympy/integrals/tests/test_integrals.py::test_issue_7264", "sympy/integrals/tests/test_integrals.py::test_issue_11254b", "sympy/integrals/tests/test_integrals.py::test_issue_11254d", "sympy/integrals/tests/test_integrals.py::test_issue_22863", "sympy/integrals/tests/test_integrals.py::test_exp_substitution", "sympy/integrals/tests/test_integrals.py::test_nested_pow", "sympy/integrals/tests/test_integrals.py::test_sqrt_quadratic", "sympy/integrals/tests/test_integrals.py::test_mul_pow_derivative", "sympy/integrals/tests/test_integrals.py::test_issue_23942", "sympy/integrals/tests/test_integrals.py::test_old_issues", "sympy/integrals/tests/test_integrals.py::test_integral_issue_26566" ], "PASS_TO_PASS": null }
sympy__sympy-82
1.0
{ "code": "diff --git b/sympy/series/formal.py a/sympy/series/formal.py\nindex 38ad9fc400..ada591e03d 100644\n--- b/sympy/series/formal.py\n+++ a/sympy/series/formal.py\n@@ -100,6 +100,69 @@ def rational_algorithm(f, x, k, order=4, full=False):\n .. [2] Power Series in Computer Algebra - Wolfram Koepf\n \n \"\"\"\n+ from sympy.polys import RootSum, apart\n+ from sympy.integrals import integrate\n+\n+ diff = f\n+ ds = [] # list of diff\n+\n+ for i in range(order + 1):\n+ if i:\n+ diff = diff.diff(x)\n+\n+ if diff.is_rational_function(x):\n+ coeff, sep = S.Zero, S.Zero\n+\n+ terms = apart(diff, x, full=full)\n+ if terms.has(RootSum):\n+ terms = terms.doit()\n+\n+ for t in Add.make_args(terms):\n+ num, den = t.as_numer_denom()\n+ if not den.has(x):\n+ sep += t\n+ else:\n+ if isinstance(den, Mul):\n+ # m*(n*x - a)**j -> (n*x - a)**j\n+ ind = den.as_independent(x)\n+ den = ind[1]\n+ num /= ind[0]\n+\n+ # (n*x - a)**j -> (x - b)\n+ den, j = den.as_base_exp()\n+ a, xterm = den.as_coeff_add(x)\n+\n+ # term -> m/x**n\n+ if not a:\n+ sep += t\n+ continue\n+\n+ xc = xterm[0].coeff(x)\n+ a /= -xc\n+ num /= xc**j\n+\n+ ak = ((-1)**j * num *\n+ binomial(j + k - 1, k).rewrite(factorial) /\n+ a**(j + k))\n+ coeff += ak\n+\n+ # Hacky, better way?\n+ if coeff.is_zero:\n+ return None\n+ if (coeff.has(x) or coeff.has(zoo) or coeff.has(oo) or\n+ coeff.has(nan)):\n+ return None\n+\n+ for j in range(i):\n+ coeff = (coeff / (k + j + 1))\n+ sep = integrate(sep, x)\n+ sep += (ds.pop() - sep).limit(x, 0) # constant of integration\n+ return (coeff.subs(k, k - i), sep, i)\n+\n+ else:\n+ ds.append(diff)\n+\n+ return None\n \n \n def rational_independent(terms, x):\n", "test": null }
null
{ "code": "diff --git a/sympy/series/formal.py b/sympy/series/formal.py\nindex ada591e03d..38ad9fc400 100644\n--- a/sympy/series/formal.py\n+++ b/sympy/series/formal.py\n@@ -100,69 +100,6 @@ def rational_algorithm(f, x, k, order=4, full=False):\n .. [2] Power Series in Computer Algebra - Wolfram Koepf\n \n \"\"\"\n- from sympy.polys import RootSum, apart\n- from sympy.integrals import integrate\n-\n- diff = f\n- ds = [] # list of diff\n-\n- for i in range(order + 1):\n- if i:\n- diff = diff.diff(x)\n-\n- if diff.is_rational_function(x):\n- coeff, sep = S.Zero, S.Zero\n-\n- terms = apart(diff, x, full=full)\n- if terms.has(RootSum):\n- terms = terms.doit()\n-\n- for t in Add.make_args(terms):\n- num, den = t.as_numer_denom()\n- if not den.has(x):\n- sep += t\n- else:\n- if isinstance(den, Mul):\n- # m*(n*x - a)**j -> (n*x - a)**j\n- ind = den.as_independent(x)\n- den = ind[1]\n- num /= ind[0]\n-\n- # (n*x - a)**j -> (x - b)\n- den, j = den.as_base_exp()\n- a, xterm = den.as_coeff_add(x)\n-\n- # term -> m/x**n\n- if not a:\n- sep += t\n- continue\n-\n- xc = xterm[0].coeff(x)\n- a /= -xc\n- num /= xc**j\n-\n- ak = ((-1)**j * num *\n- binomial(j + k - 1, k).rewrite(factorial) /\n- a**(j + k))\n- coeff += ak\n-\n- # Hacky, better way?\n- if coeff.is_zero:\n- return None\n- if (coeff.has(x) or coeff.has(zoo) or coeff.has(oo) or\n- coeff.has(nan)):\n- return None\n-\n- for j in range(i):\n- coeff = (coeff / (k + j + 1))\n- sep = integrate(sep, x)\n- sep += (ds.pop() - sep).limit(x, 0) # constant of integration\n- return (coeff.subs(k, k - i), sep, i)\n-\n- else:\n- ds.append(diff)\n-\n- return None\n \n \n def rational_independent(terms, x):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/series/formal.py.\nHere is the description for the function:\ndef rational_algorithm(f, x, k, order=4, full=False):\n \"\"\"\n Rational algorithm for computing\n formula of coefficients of Formal Power Series\n of a function.\n\n Explanation\n ===========\n\n Applicable when f(x) or some derivative of f(x)\n is a rational function in x.\n\n :func:`rational_algorithm` uses :func:`~.apart` function for partial fraction\n decomposition. :func:`~.apart` by default uses 'undetermined coefficients\n method'. By setting ``full=True``, 'Bronstein's algorithm' can be used\n instead.\n\n Looks for derivative of a function up to 4'th order (by default).\n This can be overridden using order option.\n\n Parameters\n ==========\n\n x : Symbol\n order : int, optional\n Order of the derivative of ``f``, Default is 4.\n full : bool\n\n Returns\n =======\n\n formula : Expr\n ind : Expr\n Independent terms.\n order : int\n full : bool\n\n Examples\n ========\n\n >>> from sympy import log, atan\n >>> from sympy.series.formal import rational_algorithm as ra\n >>> from sympy.abc import x, k\n\n >>> ra(1 / (1 - x), x, k)\n (1, 0, 0)\n >>> ra(log(1 + x), x, k)\n (-1/((-1)**k*k), 0, 1)\n\n >>> ra(atan(x), x, k, full=True)\n ((-I/(2*(-I)**k) + I/(2*I**k))/k, 0, 1)\n\n Notes\n =====\n\n By setting ``full=True``, range of admissible functions to be solved using\n ``rational_algorithm`` can be increased. This option should be used\n carefully as it can significantly slow down the computation as ``doit`` is\n performed on the :class:`~.RootSum` object returned by the :func:`~.apart`\n function. Use ``full=False`` whenever possible.\n\n See Also\n ========\n\n sympy.polys.partfrac.apart\n\n References\n ==========\n\n .. [1] Formal Power Series - Dominik Gruntz, Wolfram Koepf\n .. [2] Power Series in Computer Algebra - Wolfram Koepf\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/printing/tests/test_latex.py::test_latex_FormalPowerSeries", "sympy/printing/pretty/tests/test_pretty.py::test_pretty_FormalPowerSeries", "sympy/core/tests/test_args.py::test_sympy__series__formal__FormalPowerSeries", "sympy/core/tests/test_args.py::test_sympy__series__formal__FormalPowerSeriesProduct", "sympy/core/tests/test_args.py::test_sympy__series__formal__FormalPowerSeriesCompose", "sympy/core/tests/test_args.py::test_sympy__series__formal__FormalPowerSeriesInverse", "sympy/series/tests/test_formal.py::test_rational_algorithm", "sympy/series/tests/test_formal.py::test_fps", "sympy/series/tests/test_formal.py::test_fps_shift", "sympy/series/tests/test_formal.py::test_fps__Add_expr", "sympy/series/tests/test_formal.py::test_fps__asymptotic", "sympy/series/tests/test_formal.py::test_fps__fractional", "sympy/series/tests/test_formal.py::test_fps__logarithmic_singularity", "sympy/series/tests/test_formal.py::test_fps_symbolic", "sympy/series/tests/test_formal.py::test_fps__slow", "sympy/series/tests/test_formal.py::test_fps__operations", "sympy/series/tests/test_formal.py::test_fps__product", "sympy/series/tests/test_formal.py::test_fps__compose", "sympy/series/tests/test_formal.py::test_fps__inverse" ], "PASS_TO_PASS": null }
sympy__sympy-83
1.0
{ "code": "diff --git b/sympy/utilities/misc.py a/sympy/utilities/misc.py\nindex d44eda35cc..9e4ab2b969 100644\n--- b/sympy/utilities/misc.py\n+++ a/sympy/utilities/misc.py\n@@ -147,6 +147,27 @@ def rawlines(s):\n ========\n filldedent, strlines\n \"\"\"\n+ lines = s.split('\\n')\n+ if len(lines) == 1:\n+ return repr(lines[0])\n+ triple = [\"'''\" in s, '\"\"\"' in s]\n+ if any(li.endswith(' ') for li in lines) or '\\\\' in s or all(triple):\n+ rv = []\n+ # add on the newlines\n+ trailing = s.endswith('\\n')\n+ last = len(lines) - 1\n+ for i, li in enumerate(lines):\n+ if i != last or trailing:\n+ rv.append(repr(li + '\\n'))\n+ else:\n+ rv.append(repr(li))\n+ return '(\\n %s\\n)' % '\\n '.join(rv)\n+ else:\n+ rv = '\\n '.join(lines)\n+ if triple[0]:\n+ return 'dedent(\"\"\"\\\\\\n %s\"\"\")' % rv\n+ else:\n+ return \"dedent('''\\\\\\n %s''')\" % rv\n \n ARCH = str(struct.calcsize('P') * 8) + \"-bit\"\n \n", "test": null }
null
{ "code": "diff --git a/sympy/utilities/misc.py b/sympy/utilities/misc.py\nindex 9e4ab2b969..d44eda35cc 100644\n--- a/sympy/utilities/misc.py\n+++ b/sympy/utilities/misc.py\n@@ -147,27 +147,6 @@ def rawlines(s):\n ========\n filldedent, strlines\n \"\"\"\n- lines = s.split('\\n')\n- if len(lines) == 1:\n- return repr(lines[0])\n- triple = [\"'''\" in s, '\"\"\"' in s]\n- if any(li.endswith(' ') for li in lines) or '\\\\' in s or all(triple):\n- rv = []\n- # add on the newlines\n- trailing = s.endswith('\\n')\n- last = len(lines) - 1\n- for i, li in enumerate(lines):\n- if i != last or trailing:\n- rv.append(repr(li + '\\n'))\n- else:\n- rv.append(repr(li))\n- return '(\\n %s\\n)' % '\\n '.join(rv)\n- else:\n- rv = '\\n '.join(lines)\n- if triple[0]:\n- return 'dedent(\"\"\"\\\\\\n %s\"\"\")' % rv\n- else:\n- return \"dedent('''\\\\\\n %s''')\" % rv\n \n ARCH = str(struct.calcsize('P') * 8) + \"-bit\"\n \n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/utilities/misc.py.\nHere is the description for the function:\ndef rawlines(s):\n \"\"\"Return a cut-and-pastable string that, when printed, is equivalent\n to the input. Use this when there is more than one line in the\n string. The string returned is formatted so it can be indented\n nicely within tests; in some cases it is wrapped in the dedent\n function which has to be imported from textwrap.\n\n Examples\n ========\n\n Note: because there are characters in the examples below that need\n to be escaped because they are themselves within a triple quoted\n docstring, expressions below look more complicated than they would\n be if they were printed in an interpreter window.\n\n >>> from sympy.utilities.misc import rawlines\n >>> from sympy import TableForm\n >>> s = str(TableForm([[1, 10]], headings=(None, ['a', 'bee'])))\n >>> print(rawlines(s))\n (\n 'a bee\\\\n'\n '-----\\\\n'\n '1 10 '\n )\n >>> print(rawlines('''this\n ... that'''))\n dedent('''\\\\\n this\n that''')\n\n >>> print(rawlines('''this\n ... that\n ... '''))\n dedent('''\\\\\n this\n that\n ''')\n\n >>> s = \\\"\\\"\\\"this\n ... is a triple '''\n ... \\\"\\\"\\\"\n >>> print(rawlines(s))\n dedent(\\\"\\\"\\\"\\\\\n this\n is a triple '''\n \\\"\\\"\\\")\n\n >>> print(rawlines('''this\n ... that\n ... '''))\n (\n 'this\\\\n'\n 'that\\\\n'\n ' '\n )\n\n See Also\n ========\n filldedent, strlines\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/utilities/tests/test_misc.py::test_rawlines", "sympy/utilities/tests/test_misc.py::test_strlines" ], "PASS_TO_PASS": null }
sympy__sympy-84
1.0
{ "code": "diff --git b/sympy/printing/rcode.py a/sympy/printing/rcode.py\nindex 56d437fbfe..3107e6e94d 100644\n--- b/sympy/printing/rcode.py\n+++ a/sympy/printing/rcode.py\n@@ -394,6 +394,8 @@ def rcode(expr, assign_to=None, **settings):\n \n \"\"\"\n \n+ return RCodePrinter(settings).doprint(expr, assign_to)\n+\n \n def print_rcode(expr, **settings):\n \"\"\"Prints R representation of the given expression.\"\"\"\n", "test": null }
null
{ "code": "diff --git a/sympy/printing/rcode.py b/sympy/printing/rcode.py\nindex 3107e6e94d..56d437fbfe 100644\n--- a/sympy/printing/rcode.py\n+++ b/sympy/printing/rcode.py\n@@ -394,8 +394,6 @@ def rcode(expr, assign_to=None, **settings):\n \n \"\"\"\n \n- return RCodePrinter(settings).doprint(expr, assign_to)\n-\n \n def print_rcode(expr, **settings):\n \"\"\"Prints R representation of the given expression.\"\"\"\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/printing/rcode.py.\nHere is the description for the function:\ndef rcode(expr, assign_to=None, **settings):\n \"\"\"Converts an expr to a string of r code\n\n Parameters\n ==========\n\n expr : Expr\n A SymPy expression to be converted.\n assign_to : optional\n When given, the argument is used as the name of the variable to which\n the expression is assigned. Can be a string, ``Symbol``,\n ``MatrixSymbol``, or ``Indexed`` type. This is helpful in case of\n line-wrapping, or for expressions that generate multi-line statements.\n precision : integer, optional\n The precision for numbers such as pi [default=15].\n user_functions : dict, optional\n A dictionary where the keys are string representations of either\n ``FunctionClass`` or ``UndefinedFunction`` instances and the values\n are their desired R string representations. Alternatively, the\n dictionary value can be a list of tuples i.e. [(argument_test,\n rfunction_string)] or [(argument_test, rfunction_formater)]. See below\n for examples.\n human : bool, optional\n If True, the result is a single string that may contain some constant\n declarations for the number symbols. If False, the same information is\n returned in a tuple of (symbols_to_declare, not_supported_functions,\n code_text). [default=True].\n contract: bool, optional\n If True, ``Indexed`` instances are assumed to obey tensor contraction\n rules and the corresponding nested loops over indices are generated.\n Setting contract=False will not generate loops, instead the user is\n responsible to provide values for the indices in the code.\n [default=True].\n\n Examples\n ========\n\n >>> from sympy import rcode, symbols, Rational, sin, ceiling, Abs, Function\n >>> x, tau = symbols(\"x, tau\")\n >>> rcode((2*tau)**Rational(7, 2))\n '8*sqrt(2)*tau^(7.0/2.0)'\n >>> rcode(sin(x), assign_to=\"s\")\n 's = sin(x);'\n\n Simple custom printing can be defined for certain types by passing a\n dictionary of {\"type\" : \"function\"} to the ``user_functions`` kwarg.\n Alternatively, the dictionary value can be a list of tuples i.e.\n [(argument_test, cfunction_string)].\n\n >>> custom_functions = {\n ... \"ceiling\": \"CEIL\",\n ... \"Abs\": [(lambda x: not x.is_integer, \"fabs\"),\n ... (lambda x: x.is_integer, \"ABS\")],\n ... \"func\": \"f\"\n ... }\n >>> func = Function('func')\n >>> rcode(func(Abs(x) + ceiling(x)), user_functions=custom_functions)\n 'f(fabs(x) + CEIL(x))'\n\n or if the R-function takes a subset of the original arguments:\n\n >>> rcode(2**x + 3**x, user_functions={'Pow': [\n ... (lambda b, e: b == 2, lambda b, e: 'exp2(%s)' % e),\n ... (lambda b, e: b != 2, 'pow')]})\n 'exp2(x) + pow(3, x)'\n\n ``Piecewise`` expressions are converted into conditionals. If an\n ``assign_to`` variable is provided an if statement is created, otherwise\n the ternary operator is used. Note that if the ``Piecewise`` lacks a\n default term, represented by ``(expr, True)`` then an error will be thrown.\n This is to prevent generating an expression that may not evaluate to\n anything.\n\n >>> from sympy import Piecewise\n >>> expr = Piecewise((x + 1, x > 0), (x, True))\n >>> print(rcode(expr, assign_to=tau))\n tau = ifelse(x > 0,x + 1,x);\n\n Support for loops is provided through ``Indexed`` types. With\n ``contract=True`` these expressions will be turned into loops, whereas\n ``contract=False`` will just print the assignment expression that should be\n looped over:\n\n >>> from sympy import Eq, IndexedBase, Idx\n >>> len_y = 5\n >>> y = IndexedBase('y', shape=(len_y,))\n >>> t = IndexedBase('t', shape=(len_y,))\n >>> Dy = IndexedBase('Dy', shape=(len_y-1,))\n >>> i = Idx('i', len_y-1)\n >>> e=Eq(Dy[i], (y[i+1]-y[i])/(t[i+1]-t[i]))\n >>> rcode(e.rhs, assign_to=e.lhs, contract=False)\n 'Dy[i] = (y[i + 1] - y[i])/(t[i + 1] - t[i]);'\n\n Matrices are also supported, but a ``MatrixSymbol`` of the same dimensions\n must be provided to ``assign_to``. Note that any expression that can be\n generated normally can also exist inside a Matrix:\n\n >>> from sympy import Matrix, MatrixSymbol\n >>> mat = Matrix([x**2, Piecewise((x + 1, x > 0), (x, True)), sin(x)])\n >>> A = MatrixSymbol('A', 3, 1)\n >>> print(rcode(mat, A))\n A[0] = x^2;\n A[1] = ifelse(x > 0,x + 1,x);\n A[2] = sin(x);\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/printing/tests/test_rcode.py::test_printmethod", "sympy/printing/tests/test_rcode.py::test_rcode_sqrt", "sympy/printing/tests/test_rcode.py::test_rcode_Pow", "sympy/printing/tests/test_rcode.py::test_rcode_Max", "sympy/printing/tests/test_rcode.py::test_rcode_constants_mathh", "sympy/printing/tests/test_rcode.py::test_rcode_constants_other", "sympy/printing/tests/test_rcode.py::test_rcode_Rational", "sympy/printing/tests/test_rcode.py::test_rcode_Integer", "sympy/printing/tests/test_rcode.py::test_rcode_functions", "sympy/printing/tests/test_rcode.py::test_rcode_inline_function", "sympy/printing/tests/test_rcode.py::test_rcode_exceptions", "sympy/printing/tests/test_rcode.py::test_rcode_user_functions", "sympy/printing/tests/test_rcode.py::test_rcode_boolean", "sympy/printing/tests/test_rcode.py::test_rcode_Relational", "sympy/printing/tests/test_rcode.py::test_rcode_Piecewise", "sympy/printing/tests/test_rcode.py::test_rcode_sinc", "sympy/printing/tests/test_rcode.py::test_rcode_Piecewise_deep", "sympy/printing/tests/test_rcode.py::test_rcode_ITE", "sympy/printing/tests/test_rcode.py::test_rcode_settings", "sympy/printing/tests/test_rcode.py::test_rcode_Indexed_without_looking_for_contraction", "sympy/printing/tests/test_rcode.py::test_rcode_loops_matrix_vector", "sympy/printing/tests/test_rcode.py::test_dummy_loops", "sympy/printing/tests/test_rcode.py::test_rcode_loops_add", "sympy/printing/tests/test_rcode.py::test_rcode_loops_multiple_contractions", "sympy/printing/tests/test_rcode.py::test_rcode_loops_addfactor", "sympy/printing/tests/test_rcode.py::test_rcode_loops_multiple_terms", "sympy/printing/tests/test_rcode.py::test_dereference_printing", "sympy/printing/tests/test_rcode.py::test_Matrix_printing", "sympy/printing/tests/test_rcode.py::test_rcode_sgn", "sympy/printing/tests/test_rcode.py::test_rcode_Assignment", "sympy/printing/tests/test_rcode.py::test_rcode_For", "sympy/printing/tests/test_rcode.py::test_MatrixElement_printing" ], "PASS_TO_PASS": null }
sympy__sympy-85
1.0
{ "code": "diff --git b/sympy/physics/optics/utils.py a/sympy/physics/optics/utils.py\nindex e83fa40ff0..72c3b78bd4 100644\n--- b/sympy/physics/optics/utils.py\n+++ a/sympy/physics/optics/utils.py\n@@ -119,6 +119,101 @@ def refraction_angle(incident, medium1, medium2, normal=None, plane=None):\n 0.41152\n \"\"\"\n \n+ n1 = refractive_index_of_medium(medium1)\n+ n2 = refractive_index_of_medium(medium2)\n+\n+ # check if an incidence angle was supplied instead of a ray\n+ try:\n+ angle_of_incidence = float(incident)\n+ except TypeError:\n+ angle_of_incidence = None\n+\n+ try:\n+ critical_angle_ = critical_angle(medium1, medium2)\n+ except (ValueError, TypeError):\n+ critical_angle_ = None\n+\n+ if angle_of_incidence is not None:\n+ if normal is not None or plane is not None:\n+ raise ValueError('Normal/plane not allowed if incident is an angle')\n+\n+ if not 0.0 <= angle_of_incidence < pi*0.5:\n+ raise ValueError('Angle of incidence not in range [0:pi/2)')\n+\n+ if critical_angle_ and angle_of_incidence > critical_angle_:\n+ raise ValueError('Ray undergoes total internal reflection')\n+ return asin(n1*sin(angle_of_incidence)/n2)\n+\n+ # Treat the incident as ray below\n+ # A flag to check whether to return Ray3D or not\n+ return_ray = False\n+\n+ if plane is not None and normal is not None:\n+ raise ValueError(\"Either plane or normal is acceptable.\")\n+\n+ if not isinstance(incident, Matrix):\n+ if is_sequence(incident):\n+ _incident = Matrix(incident)\n+ elif isinstance(incident, Ray3D):\n+ _incident = Matrix(incident.direction_ratio)\n+ else:\n+ raise TypeError(\n+ \"incident should be a Matrix, Ray3D, or sequence\")\n+ else:\n+ _incident = incident\n+\n+ # If plane is provided, get direction ratios of the normal\n+ # to the plane from the plane else go with `normal` param.\n+ if plane is not None:\n+ if not isinstance(plane, Plane):\n+ raise TypeError(\"plane should be an instance of geometry.plane.Plane\")\n+ # If we have the plane, we can get the intersection\n+ # point of incident ray and the plane and thus return\n+ # an instance of Ray3D.\n+ if isinstance(incident, Ray3D):\n+ return_ray = True\n+ intersection_pt = plane.intersection(incident)[0]\n+ _normal = Matrix(plane.normal_vector)\n+ else:\n+ if not isinstance(normal, Matrix):\n+ if is_sequence(normal):\n+ _normal = Matrix(normal)\n+ elif isinstance(normal, Ray3D):\n+ _normal = Matrix(normal.direction_ratio)\n+ if isinstance(incident, Ray3D):\n+ intersection_pt = intersection(incident, normal)\n+ if len(intersection_pt) == 0:\n+ raise ValueError(\n+ \"Normal isn't concurrent with the incident ray.\")\n+ else:\n+ return_ray = True\n+ intersection_pt = intersection_pt[0]\n+ else:\n+ raise TypeError(\n+ \"Normal should be a Matrix, Ray3D, or sequence\")\n+ else:\n+ _normal = normal\n+\n+ eta = n1/n2 # Relative index of refraction\n+ # Calculating magnitude of the vectors\n+ mag_incident = sqrt(sum(i**2 for i in _incident))\n+ mag_normal = sqrt(sum(i**2 for i in _normal))\n+ # Converting vectors to unit vectors by dividing\n+ # them with their magnitudes\n+ _incident /= mag_incident\n+ _normal /= mag_normal\n+ c1 = -_incident.dot(_normal) # cos(angle_of_incidence)\n+ cs2 = 1 - eta**2*(1 - c1**2) # cos(angle_of_refraction)**2\n+ if cs2.is_negative: # This is the case of total internal reflection(TIR).\n+ return S.Zero\n+ drs = eta*_incident + (eta*c1 - sqrt(cs2))*_normal\n+ # Multiplying unit vector by its magnitude\n+ drs = drs*mag_incident\n+ if not return_ray:\n+ return drs\n+ else:\n+ return Ray3D(intersection_pt, direction_ratio=drs)\n+\n \n def fresnel_coefficients(angle_of_incidence, medium1, medium2):\n \"\"\"\n", "test": null }
null
{ "code": "diff --git a/sympy/physics/optics/utils.py b/sympy/physics/optics/utils.py\nindex 72c3b78bd4..e83fa40ff0 100644\n--- a/sympy/physics/optics/utils.py\n+++ b/sympy/physics/optics/utils.py\n@@ -119,101 +119,6 @@ def refraction_angle(incident, medium1, medium2, normal=None, plane=None):\n 0.41152\n \"\"\"\n \n- n1 = refractive_index_of_medium(medium1)\n- n2 = refractive_index_of_medium(medium2)\n-\n- # check if an incidence angle was supplied instead of a ray\n- try:\n- angle_of_incidence = float(incident)\n- except TypeError:\n- angle_of_incidence = None\n-\n- try:\n- critical_angle_ = critical_angle(medium1, medium2)\n- except (ValueError, TypeError):\n- critical_angle_ = None\n-\n- if angle_of_incidence is not None:\n- if normal is not None or plane is not None:\n- raise ValueError('Normal/plane not allowed if incident is an angle')\n-\n- if not 0.0 <= angle_of_incidence < pi*0.5:\n- raise ValueError('Angle of incidence not in range [0:pi/2)')\n-\n- if critical_angle_ and angle_of_incidence > critical_angle_:\n- raise ValueError('Ray undergoes total internal reflection')\n- return asin(n1*sin(angle_of_incidence)/n2)\n-\n- # Treat the incident as ray below\n- # A flag to check whether to return Ray3D or not\n- return_ray = False\n-\n- if plane is not None and normal is not None:\n- raise ValueError(\"Either plane or normal is acceptable.\")\n-\n- if not isinstance(incident, Matrix):\n- if is_sequence(incident):\n- _incident = Matrix(incident)\n- elif isinstance(incident, Ray3D):\n- _incident = Matrix(incident.direction_ratio)\n- else:\n- raise TypeError(\n- \"incident should be a Matrix, Ray3D, or sequence\")\n- else:\n- _incident = incident\n-\n- # If plane is provided, get direction ratios of the normal\n- # to the plane from the plane else go with `normal` param.\n- if plane is not None:\n- if not isinstance(plane, Plane):\n- raise TypeError(\"plane should be an instance of geometry.plane.Plane\")\n- # If we have the plane, we can get the intersection\n- # point of incident ray and the plane and thus return\n- # an instance of Ray3D.\n- if isinstance(incident, Ray3D):\n- return_ray = True\n- intersection_pt = plane.intersection(incident)[0]\n- _normal = Matrix(plane.normal_vector)\n- else:\n- if not isinstance(normal, Matrix):\n- if is_sequence(normal):\n- _normal = Matrix(normal)\n- elif isinstance(normal, Ray3D):\n- _normal = Matrix(normal.direction_ratio)\n- if isinstance(incident, Ray3D):\n- intersection_pt = intersection(incident, normal)\n- if len(intersection_pt) == 0:\n- raise ValueError(\n- \"Normal isn't concurrent with the incident ray.\")\n- else:\n- return_ray = True\n- intersection_pt = intersection_pt[0]\n- else:\n- raise TypeError(\n- \"Normal should be a Matrix, Ray3D, or sequence\")\n- else:\n- _normal = normal\n-\n- eta = n1/n2 # Relative index of refraction\n- # Calculating magnitude of the vectors\n- mag_incident = sqrt(sum(i**2 for i in _incident))\n- mag_normal = sqrt(sum(i**2 for i in _normal))\n- # Converting vectors to unit vectors by dividing\n- # them with their magnitudes\n- _incident /= mag_incident\n- _normal /= mag_normal\n- c1 = -_incident.dot(_normal) # cos(angle_of_incidence)\n- cs2 = 1 - eta**2*(1 - c1**2) # cos(angle_of_refraction)**2\n- if cs2.is_negative: # This is the case of total internal reflection(TIR).\n- return S.Zero\n- drs = eta*_incident + (eta*c1 - sqrt(cs2))*_normal\n- # Multiplying unit vector by its magnitude\n- drs = drs*mag_incident\n- if not return_ray:\n- return drs\n- else:\n- return Ray3D(intersection_pt, direction_ratio=drs)\n-\n \n def fresnel_coefficients(angle_of_incidence, medium1, medium2):\n \"\"\"\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/physics/optics/utils.py.\nHere is the description for the function:\ndef refraction_angle(incident, medium1, medium2, normal=None, plane=None):\n \"\"\"\n This function calculates transmitted vector after refraction at planar\n surface. ``medium1`` and ``medium2`` can be ``Medium`` or any sympifiable object.\n If ``incident`` is a number then treated as angle of incidence (in radians)\n in which case refraction angle is returned.\n\n If ``incident`` is an object of `Ray3D`, `normal` also has to be an instance\n of `Ray3D` in order to get the output as a `Ray3D`. Please note that if\n plane of separation is not provided and normal is an instance of `Ray3D`,\n ``normal`` will be assumed to be intersecting incident ray at the plane of\n separation. This will not be the case when `normal` is a `Matrix` or\n any other sequence.\n If ``incident`` is an instance of `Ray3D` and `plane` has not been provided\n and ``normal`` is not `Ray3D`, output will be a `Matrix`.\n\n Parameters\n ==========\n\n incident : Matrix, Ray3D, sequence or a number\n Incident vector or angle of incidence\n medium1 : sympy.physics.optics.medium.Medium or sympifiable\n Medium 1 or its refractive index\n medium2 : sympy.physics.optics.medium.Medium or sympifiable\n Medium 2 or its refractive index\n normal : Matrix, Ray3D, or sequence\n Normal vector\n plane : Plane\n Plane of separation of the two media.\n\n Returns\n =======\n\n Returns an angle of refraction or a refracted ray depending on inputs.\n\n Examples\n ========\n\n >>> from sympy.physics.optics import refraction_angle\n >>> from sympy.geometry import Point3D, Ray3D, Plane\n >>> from sympy.matrices import Matrix\n >>> from sympy import symbols, pi\n >>> n = Matrix([0, 0, 1])\n >>> P = Plane(Point3D(0, 0, 0), normal_vector=[0, 0, 1])\n >>> r1 = Ray3D(Point3D(-1, -1, 1), Point3D(0, 0, 0))\n >>> refraction_angle(r1, 1, 1, n)\n Matrix([\n [ 1],\n [ 1],\n [-1]])\n >>> refraction_angle(r1, 1, 1, plane=P)\n Ray3D(Point3D(0, 0, 0), Point3D(1, 1, -1))\n\n With different index of refraction of the two media\n\n >>> n1, n2 = symbols('n1, n2')\n >>> refraction_angle(r1, n1, n2, n)\n Matrix([\n [ n1/n2],\n [ n1/n2],\n [-sqrt(3)*sqrt(-2*n1**2/(3*n2**2) + 1)]])\n >>> refraction_angle(r1, n1, n2, plane=P)\n Ray3D(Point3D(0, 0, 0), Point3D(n1/n2, n1/n2, -sqrt(3)*sqrt(-2*n1**2/(3*n2**2) + 1)))\n >>> round(refraction_angle(pi/6, 1.2, 1.5), 5)\n 0.41152\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/physics/optics/tests/test_utils.py::test_refraction_angle", "sympy/physics/optics/tests/test_utils.py::test_deviation" ], "PASS_TO_PASS": null }
sympy__sympy-86
1.0
{ "code": "diff --git b/sympy/printing/codeprinter.py a/sympy/printing/codeprinter.py\nindex 5d19a0523a..765f7f01f4 100644\n--- b/sympy/printing/codeprinter.py\n+++ a/sympy/printing/codeprinter.py\n@@ -1026,6 +1026,13 @@ def rust_code(expr, assign_to=None, **settings):\n x\n }, x.sin()];\n \"\"\"\n+ from sympy.printing.rust import RustCodePrinter\n+ printer = RustCodePrinter(settings)\n+ expr = printer._rewrite_known_functions(expr)\n+ if isinstance(expr, Expr):\n+ for src_func, dst_func in printer.function_overrides.values():\n+ expr = expr.replace(src_func, dst_func)\n+ return printer.doprint(expr, assign_to)\n \n \n def print_rust_code(expr, **settings):\n", "test": null }
null
{ "code": "diff --git a/sympy/printing/codeprinter.py b/sympy/printing/codeprinter.py\nindex 765f7f01f4..5d19a0523a 100644\n--- a/sympy/printing/codeprinter.py\n+++ b/sympy/printing/codeprinter.py\n@@ -1026,13 +1026,6 @@ def rust_code(expr, assign_to=None, **settings):\n x\n }, x.sin()];\n \"\"\"\n- from sympy.printing.rust import RustCodePrinter\n- printer = RustCodePrinter(settings)\n- expr = printer._rewrite_known_functions(expr)\n- if isinstance(expr, Expr):\n- for src_func, dst_func in printer.function_overrides.values():\n- expr = expr.replace(src_func, dst_func)\n- return printer.doprint(expr, assign_to)\n \n \n def print_rust_code(expr, **settings):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/printing/codeprinter.py.\nHere is the description for the function:\ndef rust_code(expr, assign_to=None, **settings):\n \"\"\"Converts an expr to a string of Rust code\n\n Parameters\n ==========\n\n expr : Expr\n A SymPy expression to be converted.\n assign_to : optional\n When given, the argument is used as the name of the variable to which\n the expression is assigned. Can be a string, ``Symbol``,\n ``MatrixSymbol``, or ``Indexed`` type. This is helpful in case of\n line-wrapping, or for expressions that generate multi-line statements.\n precision : integer, optional\n The precision for numbers such as pi [default=15].\n user_functions : dict, optional\n A dictionary where the keys are string representations of either\n ``FunctionClass`` or ``UndefinedFunction`` instances and the values\n are their desired C string representations. Alternatively, the\n dictionary value can be a list of tuples i.e. [(argument_test,\n cfunction_string)]. See below for examples.\n dereference : iterable, optional\n An iterable of symbols that should be dereferenced in the printed code\n expression. These would be values passed by address to the function.\n For example, if ``dereference=[a]``, the resulting code would print\n ``(*a)`` instead of ``a``.\n human : bool, optional\n If True, the result is a single string that may contain some constant\n declarations for the number symbols. If False, the same information is\n returned in a tuple of (symbols_to_declare, not_supported_functions,\n code_text). [default=True].\n contract: bool, optional\n If True, ``Indexed`` instances are assumed to obey tensor contraction\n rules and the corresponding nested loops over indices are generated.\n Setting contract=False will not generate loops, instead the user is\n responsible to provide values for the indices in the code.\n [default=True].\n\n Examples\n ========\n\n >>> from sympy import rust_code, symbols, Rational, sin, ceiling, Abs, Function\n >>> x, tau = symbols(\"x, tau\")\n >>> rust_code((2*tau)**Rational(7, 2))\n '8.0*1.4142135623731*tau.powf(7_f64/2.0)'\n >>> rust_code(sin(x), assign_to=\"s\")\n 's = x.sin();'\n\n Simple custom printing can be defined for certain types by passing a\n dictionary of {\"type\" : \"function\"} to the ``user_functions`` kwarg.\n Alternatively, the dictionary value can be a list of tuples i.e.\n [(argument_test, cfunction_string)].\n\n >>> custom_functions = {\n ... \"ceiling\": \"CEIL\",\n ... \"Abs\": [(lambda x: not x.is_integer, \"fabs\", 4),\n ... (lambda x: x.is_integer, \"ABS\", 4)],\n ... \"func\": \"f\"\n ... }\n >>> func = Function('func')\n >>> rust_code(func(Abs(x) + ceiling(x)), user_functions=custom_functions)\n '(fabs(x) + x.ceil()).f()'\n\n ``Piecewise`` expressions are converted into conditionals. If an\n ``assign_to`` variable is provided an if statement is created, otherwise\n the ternary operator is used. Note that if the ``Piecewise`` lacks a\n default term, represented by ``(expr, True)`` then an error will be thrown.\n This is to prevent generating an expression that may not evaluate to\n anything.\n\n >>> from sympy import Piecewise\n >>> expr = Piecewise((x + 1, x > 0), (x, True))\n >>> print(rust_code(expr, tau))\n tau = if (x > 0.0) {\n x + 1\n } else {\n x\n };\n\n Support for loops is provided through ``Indexed`` types. With\n ``contract=True`` these expressions will be turned into loops, whereas\n ``contract=False`` will just print the assignment expression that should be\n looped over:\n\n >>> from sympy import Eq, IndexedBase, Idx\n >>> len_y = 5\n >>> y = IndexedBase('y', shape=(len_y,))\n >>> t = IndexedBase('t', shape=(len_y,))\n >>> Dy = IndexedBase('Dy', shape=(len_y-1,))\n >>> i = Idx('i', len_y-1)\n >>> e=Eq(Dy[i], (y[i+1]-y[i])/(t[i+1]-t[i]))\n >>> rust_code(e.rhs, assign_to=e.lhs, contract=False)\n 'Dy[i] = (y[i + 1] - y[i])/(t[i + 1] - t[i]);'\n\n Matrices are also supported, but a ``MatrixSymbol`` of the same dimensions\n must be provided to ``assign_to``. Note that any expression that can be\n generated normally can also exist inside a Matrix:\n\n >>> from sympy import Matrix, MatrixSymbol\n >>> mat = Matrix([x**2, Piecewise((x + 1, x > 0), (x, True)), sin(x)])\n >>> A = MatrixSymbol('A', 3, 1)\n >>> print(rust_code(mat, A))\n A = [x.powi(2), if (x > 0.0) {\n x + 1\n } else {\n x\n }, x.sin()];\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/printing/tests/test_rust.py::test_Integer", "sympy/printing/tests/test_rust.py::test_Relational", "sympy/printing/tests/test_rust.py::test_Rational", "sympy/printing/tests/test_rust.py::test_basic_ops", "sympy/printing/tests/test_rust.py::test_printmethod", "sympy/printing/tests/test_rust.py::test_Functions", "sympy/printing/tests/test_rust.py::test_Pow", "sympy/printing/tests/test_rust.py::test_constants", "sympy/printing/tests/test_rust.py::test_constants_other", "sympy/printing/tests/test_rust.py::test_boolean", "sympy/printing/tests/test_rust.py::test_Piecewise", "sympy/printing/tests/test_rust.py::test_dereference_printing", "sympy/printing/tests/test_rust.py::test_sign", "sympy/printing/tests/test_rust.py::test_reserved_words", "sympy/printing/tests/test_rust.py::test_ITE", "sympy/printing/tests/test_rust.py::test_Indexed", "sympy/printing/tests/test_rust.py::test_dummy_loops", "sympy/printing/tests/test_rust.py::test_loops", "sympy/printing/tests/test_rust.py::test_loops_multiple_contractions", "sympy/printing/tests/test_rust.py::test_loops_addfactor", "sympy/printing/tests/test_rust.py::test_settings", "sympy/printing/tests/test_rust.py::test_inline_function", "sympy/printing/tests/test_rust.py::test_user_functions", "sympy/printing/tests/test_rust.py::test_matrix", "sympy/printing/tests/test_rust.py::test_sparse_matrix" ], "PASS_TO_PASS": null }
sympy__sympy-87
1.0
{ "code": "diff --git b/sympy/polys/matrices/sdm.py a/sympy/polys/matrices/sdm.py\nindex 312bda7f35..0e0685f5d6 100644\n--- b/sympy/polys/matrices/sdm.py\n+++ a/sympy/polys/matrices/sdm.py\n@@ -1620,6 +1620,134 @@ def sdm_irref(A):\n sdm_rref_den\n Fraction-free version of this routine.\n \"\"\"\n+ #\n+ # Any zeros in the matrix are not stored at all so an element is zero if\n+ # its row dict has no index at that key. A row is entirely zero if its\n+ # row index is not in the outer dict. Since rref reorders the rows and\n+ # removes zero rows we can completely discard the row indices. The first\n+ # step then copies the row dicts into a list sorted by the index of the\n+ # first nonzero column in each row.\n+ #\n+ # The algorithm then processes each row Ai one at a time. Previously seen\n+ # rows are used to cancel their pivot columns from Ai. Then a pivot from\n+ # Ai is chosen and is cancelled from all previously seen rows. At this\n+ # point Ai joins the previously seen rows. Once all rows are seen all\n+ # elimination has occurred and the rows are sorted by pivot column index.\n+ #\n+ # The previously seen rows are stored in two separate groups. The reduced\n+ # group consists of all rows that have been reduced to a single nonzero\n+ # element (the pivot). There is no need to attempt any further reduction\n+ # with these. Rows that still have other nonzeros need to be considered\n+ # when Ai is cancelled from the previously seen rows.\n+ #\n+ # A dict nonzerocolumns is used to map from a column index to a set of\n+ # previously seen rows that still have a nonzero element in that column.\n+ # This means that we can cancel the pivot from Ai into the previously seen\n+ # rows without needing to loop over each row that might have a zero in\n+ # that column.\n+ #\n+\n+ # Row dicts sorted by index of first nonzero column\n+ # (Maybe sorting is not needed/useful.)\n+ Arows = sorted((Ai.copy() for Ai in A.values()), key=min)\n+\n+ # Each processed row has an associated pivot column.\n+ # pivot_row_map maps from the pivot column index to the row dict.\n+ # This means that we can represent a set of rows purely as a set of their\n+ # pivot indices.\n+ pivot_row_map = {}\n+\n+ # Set of pivot indices for rows that are fully reduced to a single nonzero.\n+ reduced_pivots = set()\n+\n+ # Set of pivot indices for rows not fully reduced\n+ nonreduced_pivots = set()\n+\n+ # Map from column index to a set of pivot indices representing the rows\n+ # that have a nonzero at that column.\n+ nonzero_columns = defaultdict(set)\n+\n+ while Arows:\n+ # Select pivot element and row\n+ Ai = Arows.pop()\n+\n+ # Nonzero columns from fully reduced pivot rows can be removed\n+ Ai = {j: Aij for j, Aij in Ai.items() if j not in reduced_pivots}\n+\n+ # Others require full row cancellation\n+ for j in nonreduced_pivots & set(Ai):\n+ Aj = pivot_row_map[j]\n+ Aij = Ai[j]\n+ Ainz = set(Ai)\n+ Ajnz = set(Aj)\n+ for k in Ajnz - Ainz:\n+ Ai[k] = - Aij * Aj[k]\n+ Ai.pop(j)\n+ Ainz.remove(j)\n+ for k in Ajnz & Ainz:\n+ Aik = Ai[k] - Aij * Aj[k]\n+ if Aik:\n+ Ai[k] = Aik\n+ else:\n+ Ai.pop(k)\n+\n+ # We have now cancelled previously seen pivots from Ai.\n+ # If it is zero then discard it.\n+ if not Ai:\n+ continue\n+\n+ # Choose a pivot from Ai:\n+ j = min(Ai)\n+ Aij = Ai[j]\n+ pivot_row_map[j] = Ai\n+ Ainz = set(Ai)\n+\n+ # Normalise the pivot row to make the pivot 1.\n+ #\n+ # This approach is slow for some domains. Cross cancellation might be\n+ # better for e.g. QQ(x) with division delayed to the final steps.\n+ Aijinv = Aij**-1\n+ for l in Ai:\n+ Ai[l] *= Aijinv\n+\n+ # Use Aij to cancel column j from all previously seen rows\n+ for k in nonzero_columns.pop(j, ()):\n+ Ak = pivot_row_map[k]\n+ Akj = Ak[j]\n+ Aknz = set(Ak)\n+ for l in Ainz - Aknz:\n+ Ak[l] = - Akj * Ai[l]\n+ nonzero_columns[l].add(k)\n+ Ak.pop(j)\n+ Aknz.remove(j)\n+ for l in Ainz & Aknz:\n+ Akl = Ak[l] - Akj * Ai[l]\n+ if Akl:\n+ Ak[l] = Akl\n+ else:\n+ # Drop nonzero elements\n+ Ak.pop(l)\n+ if l != j:\n+ nonzero_columns[l].remove(k)\n+ if len(Ak) == 1:\n+ reduced_pivots.add(k)\n+ nonreduced_pivots.remove(k)\n+\n+ if len(Ai) == 1:\n+ reduced_pivots.add(j)\n+ else:\n+ nonreduced_pivots.add(j)\n+ for l in Ai:\n+ if l != j:\n+ nonzero_columns[l].add(j)\n+\n+ # All done!\n+ pivots = sorted(reduced_pivots | nonreduced_pivots)\n+ pivot2row = {p: n for n, p in enumerate(pivots)}\n+ nonzero_columns = {c: {pivot2row[p] for p in s} for c, s in nonzero_columns.items()}\n+ rows = [pivot_row_map[i] for i in pivots]\n+ rref = dict(enumerate(rows))\n+ return rref, pivots, nonzero_columns\n \n \n def sdm_rref_den(A, K):\n", "test": null }
null
{ "code": "diff --git a/sympy/polys/matrices/sdm.py b/sympy/polys/matrices/sdm.py\nindex 0e0685f5d6..312bda7f35 100644\n--- a/sympy/polys/matrices/sdm.py\n+++ b/sympy/polys/matrices/sdm.py\n@@ -1620,134 +1620,6 @@ def sdm_irref(A):\n sdm_rref_den\n Fraction-free version of this routine.\n \"\"\"\n- #\n- # Any zeros in the matrix are not stored at all so an element is zero if\n- # its row dict has no index at that key. A row is entirely zero if its\n- # row index is not in the outer dict. Since rref reorders the rows and\n- # removes zero rows we can completely discard the row indices. The first\n- # step then copies the row dicts into a list sorted by the index of the\n- # first nonzero column in each row.\n- #\n- # The algorithm then processes each row Ai one at a time. Previously seen\n- # rows are used to cancel their pivot columns from Ai. Then a pivot from\n- # Ai is chosen and is cancelled from all previously seen rows. At this\n- # point Ai joins the previously seen rows. Once all rows are seen all\n- # elimination has occurred and the rows are sorted by pivot column index.\n- #\n- # The previously seen rows are stored in two separate groups. The reduced\n- # group consists of all rows that have been reduced to a single nonzero\n- # element (the pivot). There is no need to attempt any further reduction\n- # with these. Rows that still have other nonzeros need to be considered\n- # when Ai is cancelled from the previously seen rows.\n- #\n- # A dict nonzerocolumns is used to map from a column index to a set of\n- # previously seen rows that still have a nonzero element in that column.\n- # This means that we can cancel the pivot from Ai into the previously seen\n- # rows without needing to loop over each row that might have a zero in\n- # that column.\n- #\n-\n- # Row dicts sorted by index of first nonzero column\n- # (Maybe sorting is not needed/useful.)\n- Arows = sorted((Ai.copy() for Ai in A.values()), key=min)\n-\n- # Each processed row has an associated pivot column.\n- # pivot_row_map maps from the pivot column index to the row dict.\n- # This means that we can represent a set of rows purely as a set of their\n- # pivot indices.\n- pivot_row_map = {}\n-\n- # Set of pivot indices for rows that are fully reduced to a single nonzero.\n- reduced_pivots = set()\n-\n- # Set of pivot indices for rows not fully reduced\n- nonreduced_pivots = set()\n-\n- # Map from column index to a set of pivot indices representing the rows\n- # that have a nonzero at that column.\n- nonzero_columns = defaultdict(set)\n-\n- while Arows:\n- # Select pivot element and row\n- Ai = Arows.pop()\n-\n- # Nonzero columns from fully reduced pivot rows can be removed\n- Ai = {j: Aij for j, Aij in Ai.items() if j not in reduced_pivots}\n-\n- # Others require full row cancellation\n- for j in nonreduced_pivots & set(Ai):\n- Aj = pivot_row_map[j]\n- Aij = Ai[j]\n- Ainz = set(Ai)\n- Ajnz = set(Aj)\n- for k in Ajnz - Ainz:\n- Ai[k] = - Aij * Aj[k]\n- Ai.pop(j)\n- Ainz.remove(j)\n- for k in Ajnz & Ainz:\n- Aik = Ai[k] - Aij * Aj[k]\n- if Aik:\n- Ai[k] = Aik\n- else:\n- Ai.pop(k)\n-\n- # We have now cancelled previously seen pivots from Ai.\n- # If it is zero then discard it.\n- if not Ai:\n- continue\n-\n- # Choose a pivot from Ai:\n- j = min(Ai)\n- Aij = Ai[j]\n- pivot_row_map[j] = Ai\n- Ainz = set(Ai)\n-\n- # Normalise the pivot row to make the pivot 1.\n- #\n- # This approach is slow for some domains. Cross cancellation might be\n- # better for e.g. QQ(x) with division delayed to the final steps.\n- Aijinv = Aij**-1\n- for l in Ai:\n- Ai[l] *= Aijinv\n-\n- # Use Aij to cancel column j from all previously seen rows\n- for k in nonzero_columns.pop(j, ()):\n- Ak = pivot_row_map[k]\n- Akj = Ak[j]\n- Aknz = set(Ak)\n- for l in Ainz - Aknz:\n- Ak[l] = - Akj * Ai[l]\n- nonzero_columns[l].add(k)\n- Ak.pop(j)\n- Aknz.remove(j)\n- for l in Ainz & Aknz:\n- Akl = Ak[l] - Akj * Ai[l]\n- if Akl:\n- Ak[l] = Akl\n- else:\n- # Drop nonzero elements\n- Ak.pop(l)\n- if l != j:\n- nonzero_columns[l].remove(k)\n- if len(Ak) == 1:\n- reduced_pivots.add(k)\n- nonreduced_pivots.remove(k)\n-\n- if len(Ai) == 1:\n- reduced_pivots.add(j)\n- else:\n- nonreduced_pivots.add(j)\n- for l in Ai:\n- if l != j:\n- nonzero_columns[l].add(j)\n-\n- # All done!\n- pivots = sorted(reduced_pivots | nonreduced_pivots)\n- pivot2row = {p: n for n, p in enumerate(pivots)}\n- nonzero_columns = {c: {pivot2row[p] for p in s} for c, s in nonzero_columns.items()}\n- rows = [pivot_row_map[i] for i in pivots]\n- rref = dict(enumerate(rows))\n- return rref, pivots, nonzero_columns\n \n \n def sdm_rref_den(A, K):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/polys/matrices/sdm.py.\nHere is the description for the function:\ndef sdm_irref(A):\n \"\"\"RREF and pivots of a sparse matrix *A*.\n\n Compute the reduced row echelon form (RREF) of the matrix *A* and return a\n list of the pivot columns. This routine does not work in place and leaves\n the original matrix *A* unmodified.\n\n The domain of the matrix must be a field.\n\n Examples\n ========\n\n This routine works with a dict of dicts sparse representation of a matrix:\n\n >>> from sympy import QQ\n >>> from sympy.polys.matrices.sdm import sdm_irref\n >>> A = {0: {0: QQ(1), 1: QQ(2)}, 1: {0: QQ(3), 1: QQ(4)}}\n >>> Arref, pivots, _ = sdm_irref(A)\n >>> Arref\n {0: {0: 1}, 1: {1: 1}}\n >>> pivots\n [0, 1]\n\n The analogous calculation with :py:class:`~.MutableDenseMatrix` would be\n\n >>> from sympy import Matrix\n >>> M = Matrix([[1, 2], [3, 4]])\n >>> Mrref, pivots = M.rref()\n >>> Mrref\n Matrix([\n [1, 0],\n [0, 1]])\n >>> pivots\n (0, 1)\n\n Notes\n =====\n\n The cost of this algorithm is determined purely by the nonzero elements of\n the matrix. No part of the cost of any step in this algorithm depends on\n the number of rows or columns in the matrix. No step depends even on the\n number of nonzero rows apart from the primary loop over those rows. The\n implementation is much faster than ddm_rref for sparse matrices. In fact\n at the time of writing it is also (slightly) faster than the dense\n implementation even if the input is a fully dense matrix so it seems to be\n faster in all cases.\n\n The elements of the matrix should support exact division with ``/``. For\n example elements of any domain that is a field (e.g. ``QQ``) should be\n fine. No attempt is made to handle inexact arithmetic.\n\n See Also\n ========\n\n sympy.polys.matrices.domainmatrix.DomainMatrix.rref\n The higher-level function that would normally be used to call this\n routine.\n sympy.polys.matrices.dense.ddm_irref\n The dense equivalent of this routine.\n sdm_rref_den\n Fraction-free version of this routine.\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/polys/matrices/tests/test_rref.py::test_Matrix_rref[zz_7-A6-A_rref6-1]", "sympy/integrals/tests/test_integrals.py::test_improper_integral", "sympy/polys/matrices/tests/test_rref.py::test_Matrix_rref[zz_8-A7-A_rref7-1]", "sympy/matrices/tests/test_matrices.py::test_power", "sympy/solvers/tests/test_solvers.py::test_swap_back", "sympy/polys/matrices/tests/test_rref.py::test_Matrix_rref[zz_18-A17-A_rref17-1]", "sympy/matrices/tests/test_matrixbase.py::test_power", "sympy/polys/matrices/tests/test_rref.py::test_Matrix_rref[zz_20-A19-A_rref19-1]", "sympy/polys/matrices/tests/test_rref.py::test_Matrix_rref[zz_21-A20-A_rref20-1]", "sympy/printing/tests/test_latex.py::test_latex_FourierSeries", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise1", "sympy/polys/matrices/tests/test_rref.py::test_Matrix_rref[zz_large_1-A22-A_rref22-1]", "sympy/concrete/tests/test_sums_products.py::test_arithmetic_sums", "sympy/polys/matrices/tests/test_rref.py::test_Matrix_rref[zz_large_2-A23-A_rref23-1]", "sympy/polys/matrices/tests/test_nullspace.py::test_Matrix_nullspace[zz_4-A3-A_null3]", "sympy/polys/matrices/tests/test_nullspace.py::test_Matrix_nullspace[zz_5-A4-A_null4]", "sympy/integrals/tests/test_integrals.py::test_issue_3664", "sympy/polys/numberfields/tests/test_modules.py::test_Module_whole_submodule", "sympy/polys/matrices/tests/test_rref.py::test_Matrix_rref[qq_large_1-A31-A_rref31-den31]", "sympy/integrals/tests/test_integrals.py::test_issue_3686", "sympy/polys/matrices/tests/test_nullspace.py::test_Matrix_nullspace[zz_10-A9-A_null9]", "sympy/polys/numberfields/tests/test_modules.py::test_Submodule_discard_before", "sympy/polys/matrices/tests/test_nullspace.py::test_dm_dense_nullspace[zz_4-A3-A_null3]", "sympy/polys/numberfields/tests/test_modules.py::test_Submodule_represent", "sympy/polys/matrices/tests/test_nullspace.py::test_dm_dense_nullspace[zz_5-A4-A_null4]", "sympy/polys/matrices/tests/test_rref.py::test_dm_dense_rref[zz_7-A6-A_rref6-1]", "sympy/integrals/tests/test_integrals.py::test_transcendental_functions", "sympy/polys/matrices/tests/test_rref.py::test_dm_dense_rref[zz_8-A7-A_rref7-1]", "sympy/polys/matrices/tests/test_nullspace.py::test_dm_dense_nullspace[zz_10-A9-A_null9]", "sympy/solvers/tests/test_solvers.py::test_solve_args", "sympy/matrices/tests/test_matrices.py::test_issue_17247_expression_blowup_13", "sympy/matrices/tests/test_matrixbase.py::test_issue_17247_expression_blowup_13", "sympy/polys/matrices/tests/test_nullspace.py::test_dm_sparse_nullspace[zz_4-A3-A_null3]", "sympy/polys/matrices/tests/test_nullspace.py::test_dm_sparse_nullspace[zz_5-A4-A_null4]", "sympy/polys/matrices/tests/test_rref.py::test_dm_dense_rref[zz_18-A17-A_rref17-1]", "sympy/printing/pretty/tests/test_pretty.py::test_pretty_FourierSeries", "sympy/integrals/tests/test_integrals.py::test_log_polylog", "sympy/polys/matrices/tests/test_rref.py::test_dm_dense_rref[zz_20-A19-A_rref19-1]", "sympy/polys/numberfields/tests/test_modules.py::test_ModuleElement_compatibility", "sympy/polys/matrices/tests/test_rref.py::test_dm_dense_rref[zz_21-A20-A_rref20-1]", "sympy/polys/matrices/tests/test_nullspace.py::test_dm_sparse_nullspace[zz_10-A9-A_null9]", "sympy/polys/matrices/tests/test_rref.py::test_dm_dense_rref[zz_large_1-A22-A_rref22-1]", "sympy/polys/numberfields/tests/test_modules.py::test_ModuleElement_pow", "sympy/polys/matrices/tests/test_domainmatrix.py::test_DomainMatrix_rref", "sympy/polys/matrices/tests/test_rref.py::test_dm_dense_rref[qq_large_1-A31-A_rref31-den31]", "sympy/polys/matrices/tests/test_domainmatrix.py::test_DomainMatrix_solve", "sympy/solvers/tests/test_solvers.py::test_solve_polynomial1", "sympy/polys/matrices/tests/test_rref.py::test_dm_dense_rref[zz_i_1-A34-A_rref34-den34]", "sympy/polys/matrices/tests/test_nullspace.py::test_sdm_nullspace[zz_1-A0-A_null0]", "sympy/polys/matrices/tests/test_nullspace.py::test_sdm_nullspace[zz_2-A1-A_null1]", "sympy/simplify/tests/test_simplify.py::test_issue_3557", "sympy/polys/matrices/tests/test_nullspace.py::test_sdm_nullspace[zz_3-A2-A_null2]", "sympy/matrices/tests/test_matrices.py::test_issue_17247_expression_blowup_19", "sympy/matrices/tests/test_matrixbase.py::test_issue_17247_expression_blowup_19", "sympy/polys/matrices/tests/test_nullspace.py::test_sdm_nullspace[zz_4-A3-A_null3]", "sympy/polys/matrices/tests/test_nullspace.py::test_sdm_nullspace[zz_5-A4-A_null4]", "sympy/polys/matrices/tests/test_nullspace.py::test_sdm_nullspace[zz_6-A5-A_null5]", "sympy/polys/matrices/tests/test_nullspace.py::test_sdm_nullspace[zz_7-A6-A_null6]", "sympy/polys/matrices/tests/test_nullspace.py::test_sdm_nullspace[zz_8-A7-A_null7]", "sympy/polys/matrices/tests/test_rref.py::test_dm_dense_rref_den[zz_7-A6-A_rref6-1]", "sympy/polys/matrices/tests/test_nullspace.py::test_sdm_nullspace[zz_9-A8-A_null8]", "sympy/polys/matrices/tests/test_rref.py::test_dm_dense_rref_den[zz_8-A7-A_rref7-1]", "sympy/polys/matrices/tests/test_nullspace.py::test_sdm_nullspace[zz_10-A9-A_null9]", "sympy/polys/matrices/tests/test_nullspace.py::test_dm_dense_nullspace_fracfree[zz_4-A3-A_null3]", "sympy/polys/matrices/tests/test_nullspace.py::test_dm_dense_nullspace_fracfree[zz_5-A4-A_null4]", "sympy/polys/matrices/tests/test_rref.py::test_dm_dense_rref_den[zz_18-A17-A_rref17-1]", "sympy/polys/matrices/tests/test_nullspace.py::test_dm_dense_nullspace_fracfree[zz_10-A9-A_null9]", "sympy/polys/matrices/tests/test_rref.py::test_dm_dense_rref_den[zz_20-A19-A_rref19-1]", "sympy/polys/matrices/tests/test_rref.py::test_dm_dense_rref_den[zz_21-A20-A_rref20-1]", "sympy/polys/matrices/tests/test_rref.py::test_dm_dense_rref_den[zz_large_1-A22-A_rref22-1]", "sympy/matrices/tests/test_matrixbase.py::test_issue_17247_expression_blowup_20", "sympy/polys/matrices/tests/test_rref.py::test_dm_dense_rref_den[zz_large_2-A23-A_rref23-1]", "sympy/matrices/tests/test_matrices.py::test_issue_17247_expression_blowup_20", "sympy/polys/matrices/tests/test_nullspace.py::test_dm_sparse_nullspace_fracfree[zz_4-A3-A_null3]", "sympy/polys/matrices/tests/test_xxm.py::test_XXM_nullspace_QQ[DMQ_sdm]", "sympy/polys/matrices/tests/test_nullspace.py::test_dm_sparse_nullspace_fracfree[zz_5-A4-A_null4]", "sympy/polys/matrices/tests/test_rref.py::test_dm_dense_rref_den[qq_large_1-A31-A_rref31-den31]", "sympy/core/tests/test_evalf.py::test_issue_4806", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref[zz_7-A6-A_rref6-1]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref[zz_8-A7-A_rref7-1]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref[zz_18-A17-A_rref17-1]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref[zz_20-A19-A_rref19-1]", "sympy/integrals/tests/test_integrals.py::test_issue_3740", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref[zz_21-A20-A_rref20-1]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref[zz_large_1-A22-A_rref22-1]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref[qq_large_1-A31-A_rref31-den31]", "sympy/tensor/tests/test_tensor.py::test_valued_tensor_iter", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref[zz_i_1-A34-A_rref34-den34]", "sympy/matrices/tests/test_matrices.py::test_issue_17247_expression_blowup_27", "sympy/matrices/tests/test_matrixbase.py::test_issue_17247_expression_blowup_27", "sympy/integrals/tests/test_integrals.py::test_issue_8623", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref[EX_1-A35-A_rref35-den35]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den[zz_7-A6-A_rref6-1]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den[zz_8-A7-A_rref7-1]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den[zz_18-A17-A_rref17-1]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den[zz_20-A19-A_rref19-1]", "sympy/tensor/tests/test_tensor.py::test_valued_tensor_covariant_contravariant_elements", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den[zz_21-A20-A_rref20-1]", "sympy/polys/numberfields/tests/test_modules.py::test_find_min_poly", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den[zz_large_1-A22-A_rref22-1]", "sympy/integrals/tests/test_integrals.py::test_issue_9569", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den[zz_large_2-A23-A_rref23-1]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den[qq_large_1-A31-A_rref31-den31]", "sympy/polys/matrices/tests/test_inverse.py::test_Matrix_inv[zz_5-A4-A_inv4-8]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain[zz_7-A6-A_rref6-1]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain[zz_8-A7-A_rref7-1]", "sympy/tensor/tests/test_tensor.py::test_valued_tensor_get_matrix", "sympy/polys/matrices/tests/test_inverse.py::test_dm_inv_den[zz_5-A4-A_inv4-8]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain[zz_18-A17-A_rref17-1]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain[zz_20-A19-A_rref19-1]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain[zz_21-A20-A_rref20-1]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain[zz_large_1-A22-A_rref22-1]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain[zz_large_2-A23-A_rref23-1]", "sympy/tensor/tests/test_tensor.py::test_valued_tensor_contraction", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain[qq_large_1-A31-A_rref31-den31]", "sympy/polys/matrices/tests/test_sdm.py::test_SDM_nullspace", "sympy/polys/matrices/tests/test_nullspace.py::test_dm_sparse_nullspace_fracfree[zz_10-A9-A_null9]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_1-A0-A_rref0-1]", "sympy/polys/matrices/tests/test_sdm.py::test_SDM_rref", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_2-A1-A_rref1-1]", "sympy/polys/matrices/tests/test_sdm.py::test_SDM_particular", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_3-A2-A_rref2-1]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_4-A3-A_rref3-1]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_5-A4-A_rref4-1]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_6-A5-A_rref5-1]", "sympy/tensor/tests/test_tensor.py::test_valued_tensor_self_contraction", "sympy/core/tests/test_args.py::test_sympy__series__fourier__FourierSeries", "sympy/polys/matrices/tests/test_ddm.py::test_DDM_particular", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_7-A6-A_rref6-1]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_8-A7-A_rref7-1]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_9-A8-A_rref8-1]", "sympy/integrals/tests/test_integrals.py::test_issue_13749", "sympy/core/tests/test_args.py::test_sympy__series__formal__FormalPowerSeriesProduct", "sympy/concrete/tests/test_sums_products.py::test_other_sums", "sympy/matrices/tests/test_matrixbase.py::test_expand", "sympy/tensor/tests/test_tensor.py::test_valued_tensor_pow", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_10-A9-A_rref9-1]", "sympy/solvers/ode/tests/test_ode.py::test_dsolve_all_hint", "sympy/matrices/tests/test_matrices.py::test_expand", "sympy/physics/units/tests/test_quantities.py::test_conversion_with_2_nonstandard_dimensions", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_11-A10-A_rref10-1]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_12-A11-A_rref11-1]", "sympy/core/tests/test_args.py::test_sympy__series__formal__FormalPowerSeriesCompose", "sympy/integrals/tests/test_integrals.py::test_issue_18133", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_13-A12-A_rref12-1]", "sympy/stats/tests/test_rv.py::test_dependence", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_14-A13-A_rref13-1]", "sympy/core/tests/test_args.py::test_sympy__series__formal__FormalPowerSeriesInverse", "sympy/matrices/tests/test_matrixbase.py::test_inverse", "sympy/integrals/tests/test_heurisch.py::test_issue_10680", "sympy/integrals/tests/test_risch.py::test_integrate_hyperexponential", "sympy/integrals/tests/test_integrals.py::test_issue_21741", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_15-A14-A_rref14-1]", "sympy/matrices/tests/test_matrices.py::test_inverse", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_16-A15-A_rref15-1]", "sympy/tensor/tests/test_tensor.py::test_valued_tensor_expressions", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_17-A16-A_rref16-1]", "sympy/holonomic/tests/test_holonomic.py::test_HolonomicFunction_addition", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_Beam", "sympy/holonomic/tests/test_holonomic.py::test_HolonomicFunction_multiplication", "sympy/concrete/tests/test_delta.py::test_deltaproduct_add_kd_kd", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_18-A17-A_rref17-1]", "sympy/integrals/tests/test_heurisch.py::test_issue_21166", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_19-A18-A_rref18-3]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_20-A19-A_rref19-1]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_21-A20-A_rref20-1]", "sympy/series/tests/test_series.py::test_issue_11313", "sympy/holonomic/tests/test_holonomic.py::test_HolonomicFunction_power", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_insufficient_bconditions", "sympy/tensor/tests/test_tensor.py::test_valued_tensor_add_scalar", "sympy/matrices/tests/test_matrices.py::test_inv_iszerofunc", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_22-A21-A_rref21-1]", "sympy/integrals/tests/test_heurisch.py::test_heurisch_polynomials", "sympy/concrete/tests/test_delta.py::test_deltaproduct_mul_x_add_kd_kd", "sympy/holonomic/tests/test_holonomic.py::test_addition_initial_condition", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_large_1-A22-A_rref22-1]", "sympy/integrals/tests/test_risch.py::test_issue_13947", "sympy/integrals/tests/test_heurisch.py::test_heurisch_fractions", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_large_2-A23-A_rref23-1]", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_large_3-A24-A_rref24-2028539767964472550625641331179545072876560857886207583101]", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_statically_indeterminate", "sympy/holonomic/tests/test_holonomic.py::test_multiplication_initial_condition", "sympy/integrals/tests/test_heurisch.py::test_heurisch_log", "sympy/integrals/tests/test_risch.py::test_integrate_primitive", "sympy/tensor/tests/test_tensor.py::test_noncommuting_components", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_beam_units", "sympy/integrals/tests/test_heurisch.py::test_heurisch_exp", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[qq_1-A25-A_rref25-den25]", "sympy/integrals/tests/test_integrals.py::test_issue_4052", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[qq_2-A26-A_rref26-den26]", "sympy/matrices/tests/test_matrices.py::test_diagonalization", "sympy/integrals/tests/test_heurisch.py::test_heurisch_trigonometric", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[qq_3-A27-A_rref27-den27]", "sympy/concrete/tests/test_delta.py::test_deltaproduct_mul_add_x_y_add_kd_kd", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[qq_4-A28-A_rref28-den28]", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_variable_moment", "sympy/integrals/tests/test_risch.py::test_DifferentialExtension_exp", "sympy/integrals/tests/test_heurisch.py::test_heurisch_hyperbolic", "sympy/solvers/tests/test_solvers.py::test_linear_system", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[qq_5-A29-A_rref29-den29]", "sympy/integrals/tests/test_heurisch.py::test_heurisch_mixed", "sympy/solvers/ode/tests/test_systems.py::test__classify_linear_system", "sympy/tensor/tests/test_tensor.py::test_valued_non_diagonal_metric", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[qq_6-A30-A_rref30-den30]", "sympy/integrals/tests/test_risch.py::test_DifferentialExtension_log", "sympy/integrals/tests/test_heurisch.py::test_heurisch_radicals", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[qq_large_1-A31-A_rref31-den31]", "sympy/matrices/tests/test_matrices.py::test_jordan_form", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_composite_beam", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[qq_large_2-A32-A_rref32-den32]", "sympy/solvers/tests/test_solvers.py::test_linear_system_symbols_doesnt_hang_1", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_12557", "sympy/integrals/tests/test_heurisch.py::test_heurisch_special", "sympy/integrals/tests/test_risch.py::test_DifferentialExtension_symlog", "sympy/holonomic/tests/test_holonomic.py::test_from_meijerg", "sympy/core/tests/test_expr.py::test_issue_11877", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[qq_7-A33-A_rref33-den33]", "sympy/integrals/tests/test_heurisch.py::test_heurisch_symbolic_coeffs", "sympy/matrices/tests/test_matrices.py::test_issue_10220", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[zz_i_1-A34-A_rref34-den34]", "sympy/matrices/tests/test_solvers.py::test_gauss_jordan_solve", "sympy/tensor/tests/test_tensor.py::test_valued_assign_numpy_ndarray", "sympy/integrals/tests/test_heurisch.py::test_heurisch_symbolic_coeffs_1130", "sympy/polys/matrices/tests/test_rref.py::test_dm_sparse_rref_den_keep_domain_GJ[EX_1-A35-A_rref35-den35]", "sympy/integrals/tests/test_risch.py::test_DifferentialExtension_handle_first", "sympy/solvers/tests/test_solvers.py::test_linear_system_symbols_doesnt_hang_2", "sympy/holonomic/tests/test_holonomic.py::test_to_Sequence", "sympy/integrals/tests/test_risch.py::test_DifferentialExtension_all_attrs", "sympy/solvers/ode/tests/test_systems.py::test_matrix_exp", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_4313", "sympy/matrices/tests/test_solvers.py::test_linsolve_underdetermined_AND_gauss_jordan_solve", "sympy/matrices/tests/test_matrices.py::test_exp", "sympy/tensor/tests/test_tensor.py::test_valued_metric_inverse", "sympy/integrals/tests/test_heurisch.py::test_heurisch_hacking", "sympy/holonomic/tests/test_holonomic.py::test_to_Sequence_Initial_Coniditons", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_point_cflexure", "sympy/integrals/tests/test_risch.py::test_DifferentialExtension_misc", "sympy/stats/tests/test_rv.py::test_normality", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_1-A0-A_rref0-1]", "sympy/matrices/tests/test_eigen.py::test_eigen", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_2-A1-A_rref1-1]", "sympy/matrices/tests/test_matrices.py::test_log", "sympy/integrals/tests/test_risch.py::test_DifferentialExtension_Rothstein", "sympy/solvers/ode/tests/test_systems.py::test_canonical_odes", "sympy/integrals/tests/test_heurisch.py::test_heurisch_wrapper", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_3-A2-A_rref2-1]", "sympy/holonomic/tests/test_holonomic.py::test_series", "sympy/solvers/tests/test_solvers.py::test_solve_for_functions_derivatives", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_4-A3-A_rref3-1]", "sympy/tensor/tests/test_tensor.py::test_valued_canon_bp_swapaxes", "sympy/integrals/tests/test_risch.py::test_DecrementLevel", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_5-A4-A_rref4-1]", "sympy/integrals/tests/test_heurisch.py::test_issue_3609", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_apply_support", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_6-A5-A_rref5-1]", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_7-A6-A_rref6-1]", "sympy/integrals/tests/test_risch.py::test_risch_integrate", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_8-A7-A_rref7-1]", "sympy/integrals/tests/test_heurisch.py::test_pmint_rat", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_9-A8-A_rref8-1]", "sympy/solvers/ode/tests/test_systems.py::test_sysode_linear_neq_order1_type1", "sympy/solvers/tests/test_solvers.py::test_issue_3870", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_apply_rotation_hinge", "sympy/integrals/tests/test_heurisch.py::test_pmint_trig", "sympy/tensor/tests/test_tensor.py::test_valued_components_with_wrong_symmetry", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_10-A9-A_rref9-1]", "sympy/matrices/tests/test_eigen.py::test_diagonalize", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_11-A10-A_rref10-1]", "sympy/matrices/tests/test_matrixbase.py::test_inv_iszerofunc", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_12-A11-A_rref11-1]", "sympy/holonomic/tests/test_holonomic.py::test_expr_to_holonomic", "sympy/integrals/tests/test_integrals.py::test_double_previously_failing_integrals", "sympy/integrals/tests/test_risch.py::test_NonElementaryIntegral", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_apply_sliding_hinge", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_13-A12-A_rref12-1]", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_14-A13-A_rref13-1]", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_15-A14-A_rref14-1]", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_16-A15-A_rref15-1]", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_17-A16-A_rref16-1]", "sympy/matrices/tests/test_eigen.py::test_is_diagonalizable", "sympy/solvers/ode/tests/test_systems.py::test_sysode_linear_neq_order1_type2", "sympy/series/tests/test_formal.py::test_rational_algorithm", "sympy/matrices/expressions/tests/test_matpow.py::test_as_explicit_symbol", "sympy/concrete/tests/test_sums_products.py::test_telescopic_sums", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_shear_force", "sympy/tensor/tests/test_tensor.py::test_TensMul_data", "sympy/integrals/tests/test_risch.py::test_xtothex", "sympy/geometry/tests/test_line.py::test_bisectors", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_18-A17-A_rref17-1]", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_19-A18-A_rref18-3]", "sympy/polys/numberfields/tests/test_primes.py::test_valuation_at_prime_ideal", "sympy/matrices/tests/test_eigen.py::test_jordan_form", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_20-A19-A_rref19-1]", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_bmoment", "sympy/simplify/tests/test_trigsimp.py::test_trigsimp_groebner", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_21-A20-A_rref20-1]", "sympy/holonomic/tests/test_holonomic.py::test_to_expr", "sympy/integrals/tests/test_risch.py::test_DifferentialExtension_printing", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_22-A21-A_rref21-1]", "sympy/polys/numberfields/tests/test_primes.py::test_decomp_5", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_large_1-A22-A_rref22-1]", "sympy/series/tests/test_formal.py::test_simpleDE", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_large_2-A23-A_rref23-1]", "sympy/matrices/tests/test_matrixbase.py::test_diagonalization", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_large_3-A24-A_rref24-2028539767964472550625641331179545072876560857886207583101]", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_deflection", "sympy/integrals/tests/test_risch.py::test_issue_23948", "sympy/polys/numberfields/tests/test_primes.py::test_decomp_6", "sympy/series/tests/test_formal.py::test_fps", "sympy/matrices/tests/test_eigen.py::test_issue_20582", "sympy/holonomic/tests/test_holonomic.py::test_integrate", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[qq_1-A25-A_rref25-den25]", "sympy/solvers/ode/tests/test_systems.py::test_sysode_linear_neq_order1_type3", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[qq_2-A26-A_rref26-den26]", "sympy/tensor/tests/test_tensor.py::test_tensor_replacement", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[qq_3-A27-A_rref27-den27]", "sympy/polys/numberfields/tests/test_primes.py::test_decomp_7", "sympy/series/tests/test_formal.py::test_fps_shift", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[qq_4-A28-A_rref28-den28]", "sympy/matrices/tests/test_matrixbase.py::test_jordan_form", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[qq_5-A29-A_rref29-den29]", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[qq_6-A30-A_rref30-den30]", "sympy/matrices/tests/test_sparse.py::test_sparse_matrix", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[qq_large_1-A31-A_rref31-den31]", "sympy/stats/tests/test_continuous_rv.py::test_BoundedPareto", "sympy/holonomic/tests/test_holonomic.py::test_diff", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_solve_for_ild_reactions", "sympy/polys/numberfields/tests/test_primes.py::test_decomp_8", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[qq_large_2-A32-A_rref32-den32]", "sympy/series/tests/test_formal.py::test_fps__Add_expr", "sympy/matrices/tests/test_eigen.py::test_issue_20275", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[qq_7-A33-A_rref33-den33]", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[zz_i_1-A34-A_rref34-den34]", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_solve_for_ild_shear", "sympy/polys/matrices/tests/test_rref.py::test_sdm_rref[EX_1-A35-A_rref35-den35]", "sympy/polys/numberfields/tests/test_primes.py::test_str", "sympy/matrices/tests/test_sparse.py::test_sparse_solve", "sympy/matrices/tests/test_matrixbase.py::test_issue_10220", "sympy/series/tests/test_formal.py::test_fps__asymptotic", "sympy/polys/numberfields/tests/test_primes.py::test_repr", "sympy/integrals/tests/test_integrals.py::test_integrate_returns_piecewise", "sympy/holonomic/tests/test_holonomic.py::test_extended_domain_in_expr_to_holonomic", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_solve_for_ild_moment", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_1-A0-A_rref0-1]", "sympy/series/tests/test_formal.py::test_fps__fractional", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_2-A1-A_rref1-1]", "sympy/polys/numberfields/tests/test_primes.py::test_PrimeIdeal_reduce", "sympy/matrices/tests/test_matrices.py::test_pinv", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_3-A2-A_rref2-1]", "sympy/diffgeom/tests/test_diffgeom.py::test_coordsys_transform", "sympy/integrals/tests/test_integrals.py::test_integrate_max_min", "sympy/matrices/tests/test_matrixbase.py::test_exp", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_ild_with_rotation_hinge", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_4-A3-A_rref3-1]", "sympy/holonomic/tests/test_holonomic.py::test_to_meijerg", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_5-A4-A_rref4-1]", "sympy/series/tests/test_formal.py::test_fps__logarithmic_singularity", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_6-A5-A_rref5-1]", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_7-A6-A_rref6-1]", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_8-A7-A_rref7-1]", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_ild_with_sliding_hinge", "sympy/integrals/tests/test_prde.py::test_constant_system", "sympy/physics/control/tests/test_lti.py::test_StateSpace_dsolve", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_9-A8-A_rref8-1]", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_10-A9-A_rref9-1]", "sympy/holonomic/tests/test_holonomic.py::test_gaussian", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_11-A10-A_rref10-1]", "sympy/integrals/tests/test_prde.py::test_prde_no_cancel", "sympy/matrices/tests/test_matrixbase.py::test_log", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_12-A11-A_rref11-1]", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_13-A12-A_rref12-1]", "sympy/integrals/tests/test_heurisch.py::test_pmint_erf", "sympy/utilities/tests/test_wester.py::test_M35", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_14-A13-A_rref13-1]", "sympy/series/tests/test_formal.py::test_fps_symbolic", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_Beam3D", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_15-A14-A_rref14-1]", "sympy/integrals/tests/test_prde.py::test_prde_cancel_liouvillian", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_16-A15-A_rref15-1]", "sympy/holonomic/tests/test_holonomic.py::test_beta", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_17-A16-A_rref16-1]", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_18-A17-A_rref17-1]", "sympy/integrals/tests/test_prde.py::test_param_poly_rischDE", "sympy/series/tests/test_formal.py::test_fps__slow", "sympy/solvers/ode/tests/test_riccati.py::test_construct_c_case_2", "sympy/geometry/tests/test_point.py::test_point", "sympy/stats/tests/test_joint_rv.py::test_Normal", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_19-A18-A_rref18-3]", "sympy/utilities/tests/test_wester.py::test_M37", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_20-A19-A_rref19-1]", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_parabolic_loads", "sympy/integrals/tests/test_heurisch.py::test_pmint_LambertW", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_21-A20-A_rref20-1]", "sympy/integrals/tests/test_prde.py::test_param_rischDE", "sympy/stats/tests/test_continuous_rv.py::test_Lomax", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_22-A21-A_rref21-1]", "sympy/holonomic/tests/test_holonomic.py::test_gamma", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_large_1-A22-A_rref22-1]", "sympy/solvers/ode/tests/test_ode.py::test_solve_ics", "sympy/solvers/ode/tests/test_riccati.py::test_construct_d_case_4", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_large_2-A23-A_rref23-1]", "sympy/integrals/tests/test_heurisch.py::test_pmint_besselj", "sympy/integrals/tests/test_prde.py::test_limited_integrate", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_large_3-A24-A_rref24-2028539767964472550625641331179545072876560857886207583101]", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_cross_section", "sympy/polys/tests/test_partfrac.py::test_apart_symbolic", "sympy/series/tests/test_formal.py::test_fps__operations", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[qq_1-A25-A_rref25-den25]", "sympy/utilities/tests/test_wester.py::test_M38", "sympy/solvers/ode/tests/test_riccati.py::test_construct_d_case_5", "sympy/integrals/tests/test_prde.py::test_is_log_deriv_k_t_radical", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[qq_2-A26-A_rref26-den26]", "sympy/integrals/tests/test_heurisch.py::test_pmint_WrightOmega", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[qq_3-A27-A_rref27-den27]", "sympy/series/tests/test_formal.py::test_fps__product", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[qq_4-A28-A_rref28-den28]", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[qq_5-A29-A_rref29-den29]", "sympy/integrals/tests/test_integrals.py::test_issue_4884", "sympy/solvers/ode/tests/test_riccati.py::test_rational_laurent_series", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[qq_6-A30-A_rref30-den30]", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_deflection_Beam3D", "sympy/integrals/tests/test_rationaltools.py::test_ratint", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[qq_large_1-A31-A_rref31-den31]", "sympy/integrals/tests/test_prde.py::test_is_deriv_k", "sympy/series/tests/test_formal.py::test_fps__compose", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[qq_large_2-A32-A_rref32-den32]", "sympy/polys/tests/test_partfrac.py::test_apart_extension", "sympy/solvers/ode/tests/test_riccati.py::test_solve_riccati", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[qq_7-A33-A_rref33-den33]", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[zz_i_1-A34-A_rref34-den34]", "sympy/stats/tests/test_joint_rv.py::test_GeneralizedMultivariateLogGammaDistribution", "sympy/solvers/ode/tests/test_systems.py::test_higher_order_to_first_order", "sympy/polys/matrices/tests/test_rref.py::test_sparse_sdm_rref[EX_1-A35-A_rref35-den35]", "sympy/polys/tests/test_partfrac.py::test_apart_extension_xfail", "sympy/integrals/tests/test_integrals.py::test_issue_18153", "sympy/series/tests/test_formal.py::test_fps__inverse", "sympy/matrices/tests/test_decompositions.py::test_LUdecomp", "sympy/matrices/tests/test_reductions.py::test_rref", "sympy/integrals/tests/test_rationaltools.py::test_issue_5817", "sympy/solvers/tests/test_solvers.py::test_issue_5132", "sympy/concrete/tests/test_gosper.py::test_gosper_sum", "sympy/matrices/tests/test_decompositions.py::test_singular_value_decompositionD", "sympy/physics/quantum/tests/test_qubit.py::test_eval_trace", "sympy/polys/tests/test_partfrac.py::test_apart_full", "sympy/concrete/tests/test_gosper.py::test_gosper_sum_indefinite", "sympy/integrals/tests/test_integrals.py::test_trig_nonelementary_integrals", "sympy/integrals/tests/test_rationaltools.py::test_issue_10488", "sympy/physics/quantum/tests/test_qubit.py::test_matrix_to_density", "sympy/concrete/tests/test_sums_products.py::test_failing_matrix_sum", "sympy/concrete/tests/test_gosper.py::test_gosper_sum_parametric", "sympy/matrices/tests/test_decompositions.py::test_pinv_succeeds_with_rank_decomposition_method", "sympy/polys/tests/test_partfrac.py::test_apart_undetermined_coeffs", "sympy/concrete/tests/test_gosper.py::test_gosper_sum_algebraic", "sympy/integrals/tests/test_rationaltools.py::test_issue_6308", "sympy/physics/units/tests/test_util.py::test_convert_to_tuples_of_quantities", "sympy/matrices/tests/test_immutable.py::test_function_return_types", "sympy/integrals/tests/test_integrals.py::test_issue_4403", "sympy/functions/special/tests/test_bsplines.py::test_10_points_degree_1", "sympy/integrals/tests/test_rde.py::test_bound_degree_fail", "sympy/polys/tests/test_solvers.py::test_solve_lin_sys_6x6_1", "sympy/concrete/tests/test_gosper.py::test_gosper_sum_AeqB_part1", "sympy/integrals/tests/test_rationaltools.py::test_issue_5907", "sympy/polys/tests/test_solvers.py::test_solve_lin_sys_6x6_2", "sympy/integrals/tests/test_integrals.py::test_issue_4403_2", "sympy/concrete/tests/test_gosper.py::test_gosper_sum_AeqB_part2", "sympy/functions/special/tests/test_bsplines.py::test_issue_19262", "sympy/matrices/tests/test_matrixbase.py::test_pinv", "sympy/integrals/tests/test_integrals.py::test_issue_4100", "sympy/integrals/tests/test_heurisch.py::test_issue_22527", "sympy/concrete/tests/test_gosper.py::test_gosper_nan", "sympy/integrals/tests/test_transforms.py::test_mellin_transform2", "sympy/utilities/tests/test_wester.py::test_P27", "sympy/physics/units/tests/test_unitsystem.py::test_convert_to", "sympy/matrices/tests/test_matrices.py::test_deprecated", "sympy/physics/units/tests/test_dimensionsystem.py::test_dim_can_vector", "sympy/utilities/tests/test_wester.py::test_P30", "sympy/integrals/tests/test_integrals.py::test_issue_4890", "sympy/integrals/tests/test_heurisch.py::test_heurisch_complex_erf_issue_26338", "sympy/matrices/tests/test_matrices.py::test_func", "sympy/physics/units/tests/test_dimensionsystem.py::test_can_transf_matrix", "sympy/series/tests/test_fourier.py::test_FourierSeries", "sympy/integrals/tests/test_heurisch.py::test_issue_15498", "sympy/physics/units/tests/test_dimensionsystem.py::test_print_dim_base", "sympy/solvers/ode/tests/test_lie_group.py::test_heuristic1", "sympy/series/tests/test_fourier.py::test_FourierSeries_2", "sympy/utilities/tests/test_wester.py::test_P33", "sympy/integrals/tests/test_integrals.py::test_issue_4376", "sympy/solvers/tests/test_pde.py::test_pde_1st_linear_constant_coeff", "sympy/series/tests/test_fourier.py::test_sawtooth_wave", "sympy/series/tests/test_fourier.py::test_FourierSeries__operations", "sympy/solvers/tests/test_pde.py::test_pdsolve_all", "sympy/solvers/tests/test_solvers.py::test_issue_5849", "sympy/concrete/tests/test_sums_products.py::test_issue_14129", "sympy/series/tests/test_fourier.py::test_FourierSeries__neg", "sympy/physics/mechanics/tests/test_jointsmethod.py::test_four_bar_linkage_with_manual_constraints", "sympy/utilities/tests/test_wester.py::test_P37", "sympy/geometry/tests/test_util.py::test_intersection", "sympy/geometry/tests/test_curve.py::test_length", "sympy/simplify/tests/test_hyperexpand.py::test_lerchphi", "sympy/series/tests/test_fourier.py::test_FourierSeries__add__sub", "sympy/integrals/tests/test_integrals.py::test_issue_4527", "sympy/physics/mechanics/tests/test_linearize.py::test_linearize_pendulum_kane_nonminimal", "sympy/solvers/ode/tests/test_systems.py::test_second_order_to_first_order_2", "sympy/integrals/tests/test_failing_integrals.py::test_issue_4511", "sympy/solvers/tests/test_solvers.py::test_issue_5849_matrix", "sympy/physics/continuum_mechanics/tests/test_arch.py::test_symbol_magnitude", "sympy/matrices/tests/test_normalforms.py::test_smith_normal", "sympy/integrals/tests/test_heurisch.py::test_heurisch_issue_26922", "sympy/integrals/tests/test_integrals.py::test_issue_3940", "sympy/physics/mechanics/tests/test_kane2.py::test_aux_dep", "sympy/vector/tests/test_integrals.py::test_parametric_lineintegrals", "sympy/solvers/tests/test_solvers.py::test_issue_5901", "sympy/integrals/tests/test_failing_integrals.py::test_issue_15925b", "sympy/solvers/ode/tests/test_systems.py::test_second_order_to_first_order_slow4", "sympy/integrals/tests/test_integrals.py::test_issue_4892a", "sympy/concrete/tests/test_sums_products.py::test_issue_14640", "sympy/solvers/ode/tests/test_lie_group.py::test_heuristic3", "sympy/integrals/tests/test_integrals.py::test_issue_4892b", "sympy/polys/matrices/tests/test_linsolve.py::test__linsolve", "sympy/polys/matrices/tests/test_linsolve.py::test__linsolve_float", "sympy/solvers/ode/tests/test_systems.py::test_component_division", "sympy/physics/mechanics/tests/test_kane2.py::test_sub_qdot", "sympy/matrices/tests/test_matrixbase.py::test_deprecated", "sympy/geometry/tests/test_plane.py::test_plane", "sympy/solvers/ode/tests/test_single.py::test_2nd_nonlinear_autonomous_conserved_integral", "sympy/integrals/tests/test_integrals.py::test_limit_bug", "sympy/vector/tests/test_coordsysrect.py::test_transformation_equations", "sympy/matrices/tests/test_matrixbase.py::test_func", "sympy/vector/tests/test_integrals.py::test_vector_integrate", "sympy/solvers/ode/tests/test_systems.py::test_linodesolve", "sympy/polys/numberfields/tests/test_basis.py::test_round_two", "sympy/integrals/tests/test_manual.py::test_issue_3796", "sympy/simplify/tests/test_ratsimp.py::test_ratsimpmodprime", "sympy/polys/numberfields/tests/test_utilities.py::test_supplement_a_subspace_1", "sympy/polys/numberfields/tests/test_utilities.py::test_supplement_a_subspace_2", "sympy/integrals/tests/test_integrals.py::test_issue_4493", "sympy/solvers/tests/test_solvers.py::test_minsolve_linear_system", "sympy/geometry/tests/test_polygon.py::test_parameter_value", "sympy/integrals/tests/test_integrals.py::test_issue_4487", "sympy/stats/tests/test_continuous_rv.py::test_precomputed_cdf", "sympy/stats/tests/test_stochastic_process.py::test_ContinuousMarkovChain", "sympy/integrals/tests/test_integrals.py::test_issue_4400", "sympy/utilities/tests/test_wester.py::test_T12", "sympy/solvers/tests/test_solvers.py::test_issues_6819_6820_6821_6248_8692_25777_25779", "sympy/integrals/tests/test_integrals.py::test_issue_4153", "sympy/solvers/ode/tests/test_lie_group.py::test_heuristic_linear", "sympy/integrals/tests/test_integrals.py::test_issue_4326", "sympy/solvers/ode/tests/test_systems.py::test_nonlinear_2eq_order1", "sympy/solvers/ode/tests/test_ode.py::test_dsolve_remove_redundant_solutions", "sympy/solvers/ode/tests/test_lie_group.py::test_user_infinitesimals", "sympy/integrals/tests/test_integrals.py::test_powers", "sympy/utilities/tests/test_wester.py::test_V7", "sympy/utilities/tests/test_wester.py::test_V10", "sympy/integrals/tests/test_integrals.py::test_risch_option", "sympy/geometry/tests/test_polygon.py::test_cut_section", "sympy/utilities/tests/test_wester.py::test_V11", "sympy/integrals/tests/test_integrals.py::test_issue_4234", "sympy/utilities/tests/test_wester.py::test_V12", "sympy/utilities/tests/test_wester.py::test_V15", "sympy/integrals/tests/test_integrals.py::test_issue_4492", "sympy/polys/matrices/tests/test_eigen.py::test_dom_eigenvects_algebraic", "sympy/polys/matrices/tests/test_eigen.py::test_dom_eigenvects_rootof", "sympy/integrals/tests/test_integrals.py::test_issue_2708", "sympy/integrals/tests/test_meijerint.py::test_fresnel", "sympy/integrals/tests/test_integrals.py::test_issue_2884", "sympy/integrals/tests/test_transforms.py::test_issue_7181", "sympy/integrals/tests/test_manual.py::test_issue_9462", "sympy/integrals/tests/test_integrals.py::test_issue_8901", "sympy/integrals/tests/test_transforms.py::test_issue_12591", "sympy/integrals/tests/test_integrals.py::test_issue_11742", "sympy/integrals/tests/test_integrals.py::test_issue_11856", "sympy/matrices/expressions/tests/test_inverse.py::test_inverse", "sympy/integrals/tests/test_meijerint.py::test_issue_10211", "sympy/integrals/tests/test_integrals.py::test_issue_4968", "sympy/integrals/tests/test_meijerint.py::test_issue_11806", "sympy/integrals/tests/test_integrals.py::test_issue_12645", "sympy/solvers/ode/tests/test_single.py::test_nth_order_reducible", "sympy/integrals/tests/test_integrals.py::test_issue_14078", "sympy/solvers/ode/tests/test_ode.py::test_issue_22604", "sympy/solvers/tests/test_solvers.py::test_issue_5114_6611", "sympy/solvers/tests/test_recurr.py::test_rsolve", "sympy/utilities/tests/test_wester.py::test_X21", "sympy/solvers/tests/test_solvers.py::test_issue_11538", "sympy/solvers/tests/test_solvers.py::test_issue_12448", "sympy/integrals/tests/test_integrals.py::test_issue_14064", "sympy/polys/numberfields/tests/test_minpoly.py::test_issue_20163", "sympy/solvers/tests/test_solvers.py::test_issue_13849", "sympy/integrals/tests/test_integrals.py::test_issue_14096", "sympy/integrals/tests/test_integrals.py::test_issue_14144", "sympy/utilities/tests/test_wester.py::test_Z1", "sympy/utilities/tests/test_wester.py::test_Z3", "sympy/integrals/tests/test_integrals.py::test_issue_14375", "sympy/integrals/tests/test_integrals.py::test_issue_14877", "sympy/integrals/tests/test_manual.py::test_manualintegrate_sqrt_linear", "sympy/integrals/tests/test_integrals.py::test_issue_14782", "sympy/concrete/tests/test_sums_products.py::test_pr_22677", "sympy/integrals/tests/test_integrals.py::test_issue_12081", "sympy/integrals/tests/test_integrals.py::test_issue_15124", "sympy/solvers/tests/test_solvers.py::test_issue_11553", "sympy/integrals/tests/test_integrals.py::test_issue_15431", "sympy/integrals/tests/test_integrals.py::test_issue_15640_log_substitutions", "sympy/integrals/tests/test_integrals.py::test_issue_15509", "sympy/integrals/tests/test_integrals.py::test_integrate_with_complex_constants", "sympy/integrals/tests/test_integrals.py::test_issue_14241", "sympy/integrals/tests/test_integrals.py::test_issue_13112", "sympy/integrals/tests/test_integrals.py::test_li_integral", "sympy/integrals/tests/test_integrals.py::test_issue_17473", "sympy/integrals/tests/test_integrals.py::test_issue_17671", "sympy/solvers/tests/test_solvers.py::test_issue_21034", "sympy/integrals/tests/test_integrals.py::test_issue_4231", "sympy/solvers/tests/test_solvers.py::test_issue_10169", "sympy/integrals/tests/test_integrals.py::test_issue_17841", "sympy/integrals/tests/test_integrals.py::test_issue_21034", "sympy/solvers/ode/tests/test_single.py::test_nth_order_linear_euler_eq_nonhomogeneous_undetermined_coefficients", "sympy/integrals/tests/test_integrals.py::test_issue_4187", "sympy/integrals/tests/test_integrals.py::test_issue_5547", "sympy/integrals/tests/test_integrals.py::test_issue_21024", "sympy/integrals/tests/test_integrals.py::test_issue_21831", "sympy/integrals/tests/test_integrals.py::test_issue_23718", "sympy/integrals/tests/test_integrals.py::test_issue_23566", "sympy/integrals/tests/test_integrals.py::test_issue_7264", "sympy/integrals/tests/test_integrals.py::test_issue_11254a", "sympy/integrals/tests/test_integrals.py::test_issue_11254d", "sympy/integrals/tests/test_integrals.py::test_issue_22863", "sympy/integrals/tests/test_integrals.py::test_issue_23704", "sympy/integrals/tests/test_integrals.py::test_hyperbolic", "sympy/integrals/tests/test_integrals.py::test_nested_pow", "sympy/integrals/tests/test_integrals.py::test_sqrt_quadratic", "sympy/integrals/tests/test_integrals.py::test_mul_pow_derivative", "sympy/integrals/tests/test_integrals.py::test_issue_23942", "sympy/integrals/tests/test_integrals.py::test_old_issues", "sympy/integrals/tests/test_integrals.py::test_integral_issue_26566", "sympy/solvers/tests/test_solveset.py::test_linsolve", "sympy/solvers/tests/test_solveset.py::test_linsolve_large_sparse", "sympy/solvers/tests/test_solveset.py::test_issue_18208" ], "PASS_TO_PASS": null }
sympy__sympy-88
1.0
{ "code": "diff --git b/sympy/calculus/singularities.py a/sympy/calculus/singularities.py\nindex 4feed6cfd0..5adafc59ef 100644\n--- b/sympy/calculus/singularities.py\n+++ a/sympy/calculus/singularities.py\n@@ -86,6 +86,30 @@ def singularities(expression, symbol, domain=None):\n {0}\n \n \"\"\"\n+ from sympy.solvers.solveset import solveset\n+\n+ if domain is None:\n+ domain = S.Reals if symbol.is_real else S.Complexes\n+ try:\n+ sings = S.EmptySet\n+ e = expression.rewrite([sec, csc, cot, tan], cos)\n+ e = e.rewrite([sech, csch, coth, tanh], cosh)\n+ for i in e.atoms(Pow):\n+ if i.exp.is_infinite:\n+ raise NotImplementedError\n+ if i.exp.is_negative:\n+ # XXX: exponent of varying sign not handled\n+ sings += solveset(i.base, symbol, domain)\n+ for i in expression.atoms(log, asech, acsch):\n+ sings += solveset(i.args[0], symbol, domain)\n+ for i in expression.atoms(atanh, acoth):\n+ sings += solveset(i.args[0] - 1, symbol, domain)\n+ sings += solveset(i.args[0] + 1, symbol, domain)\n+ return sings\n+ except NotImplementedError:\n+ raise NotImplementedError(filldedent('''\n+ Methods for determining the singularities\n+ of this function have not been developed.'''))\n \n \n ###########################################################################\n", "test": null }
null
{ "code": "diff --git a/sympy/calculus/singularities.py b/sympy/calculus/singularities.py\nindex 5adafc59ef..4feed6cfd0 100644\n--- a/sympy/calculus/singularities.py\n+++ b/sympy/calculus/singularities.py\n@@ -86,30 +86,6 @@ def singularities(expression, symbol, domain=None):\n {0}\n \n \"\"\"\n- from sympy.solvers.solveset import solveset\n-\n- if domain is None:\n- domain = S.Reals if symbol.is_real else S.Complexes\n- try:\n- sings = S.EmptySet\n- e = expression.rewrite([sec, csc, cot, tan], cos)\n- e = e.rewrite([sech, csch, coth, tanh], cosh)\n- for i in e.atoms(Pow):\n- if i.exp.is_infinite:\n- raise NotImplementedError\n- if i.exp.is_negative:\n- # XXX: exponent of varying sign not handled\n- sings += solveset(i.base, symbol, domain)\n- for i in expression.atoms(log, asech, acsch):\n- sings += solveset(i.args[0], symbol, domain)\n- for i in expression.atoms(atanh, acoth):\n- sings += solveset(i.args[0] - 1, symbol, domain)\n- sings += solveset(i.args[0] + 1, symbol, domain)\n- return sings\n- except NotImplementedError:\n- raise NotImplementedError(filldedent('''\n- Methods for determining the singularities\n- of this function have not been developed.'''))\n \n \n ###########################################################################\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/calculus/singularities.py.\nHere is the description for the function:\ndef singularities(expression, symbol, domain=None):\n \"\"\"\n Find singularities of a given function.\n\n Parameters\n ==========\n\n expression : Expr\n The target function in which singularities need to be found.\n symbol : Symbol\n The symbol over the values of which the singularity in\n expression in being searched for.\n\n Returns\n =======\n\n Set\n A set of values for ``symbol`` for which ``expression`` has a\n singularity. An ``EmptySet`` is returned if ``expression`` has no\n singularities for any given value of ``Symbol``.\n\n Raises\n ======\n\n NotImplementedError\n Methods for determining the singularities of this function have\n not been developed.\n\n Notes\n =====\n\n This function does not find non-isolated singularities\n nor does it find branch points of the expression.\n\n Currently supported functions are:\n - univariate continuous (real or complex) functions\n\n References\n ==========\n\n .. [1] https://en.wikipedia.org/wiki/Mathematical_singularity\n\n Examples\n ========\n\n >>> from sympy import singularities, Symbol, log\n >>> x = Symbol('x', real=True)\n >>> y = Symbol('y', real=False)\n >>> singularities(x**2 + x + 1, x)\n EmptySet\n >>> singularities(1/(x + 1), x)\n {-1}\n >>> singularities(1/(y**2 + 1), y)\n {-I, I}\n >>> singularities(1/(y**3 + 1), y)\n {-1, 1/2 - sqrt(3)*I/2, 1/2 + sqrt(3)*I/2}\n >>> singularities(log(x), x)\n {0}\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise1", "sympy/integrals/tests/test_integrals.py::test_constructor", "sympy/sets/tests/test_fancysets.py::test_ImageSet", "sympy/core/tests/test_relational.py::test_univariate_relational_as_set", "sympy/series/tests/test_limits.py::test_piecewise2", "sympy/simplify/tests/test_cse.py::test_issue_7840", "sympy/sets/tests/test_sets.py::test_Union_as_relational", "sympy/sets/tests/test_sets.py::test_image_interval", "sympy/sets/tests/test_sets.py::test_image_piecewise", "sympy/sets/tests/test_sets.py::test_image_Union", "sympy/logic/tests/test_boolalg.py::test_bool_as_set", "sympy/logic/tests/test_boolalg.py::test_issue_8777", "sympy/sets/tests/test_sets.py::test_issue_10113", "sympy/sets/tests/test_fancysets.py::test_imageset_intersect_interval", "sympy/logic/tests/test_boolalg.py::test_issue_8975", "sympy/sets/tests/test_sets.py::test_issue_14336", "sympy/solvers/tests/test_solveset.py::test_invert_trig_hyp_real", "sympy/sets/tests/test_fancysets.py::test_ComplexRegion_intersect", "sympy/sets/tests/test_fancysets.py::test_ComplexRegion_union", "sympy/sets/tests/test_fancysets.py::test_ComplexRegion_from_real", "sympy/sets/tests/test_fancysets.py::test_issue_11938", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_fold_piecewise_in_cond", "sympy/sets/tests/test_fancysets.py::test_issue_11914", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise_fold_piecewise_in_cond_2", "sympy/functions/elementary/tests/test_piecewise.py::test_as_expr_set_pairs", "sympy/solvers/tests/test_inequalities.py::test_reduce_rational_inequalities_real_relational", "sympy/solvers/tests/test_inequalities.py::test_reduce_inequalities_general", "sympy/functions/elementary/tests/test_piecewise.py::test__intervals", "sympy/solvers/tests/test_inequalities.py::test_solve_univariate_inequality", "sympy/solvers/tests/test_inequalities.py::test_trig_inequalities", "sympy/solvers/tests/test_inequalities.py::test_issue_8974", "sympy/solvers/tests/test_inequalities.py::test_issue_10198", "sympy/functions/elementary/tests/test_piecewise.py::test_containment", "sympy/solvers/tests/test_inequalities.py::test_issue_10047", "sympy/solvers/tests/test_inequalities.py::test_issue_10268", "sympy/functions/elementary/tests/test_piecewise.py::test_conditions_as_alternate_booleans", "sympy/functions/elementary/tests/test_piecewise.py::test_Piecewise_rewrite_as_ITE", "sympy/solvers/tests/test_inequalities.py::test_integer_domain_relational_isolve", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_14052", "sympy/solvers/tests/test_inequalities.py::test_issue_10671_12466", "sympy/stats/tests/test_continuous_rv.py::test_beta", "sympy/solvers/tests/test_inequalities.py::test__solve_inequality", "sympy/solvers/tests/test_inequalities.py::test_issue_25697", "sympy/stats/tests/test_continuous_rv.py::test_betaprime", "sympy/solvers/tests/test_inequalities.py::test_issue_25738", "sympy/solvers/tests/test_inequalities.py::test_issue_25983", "sympy/stats/tests/test_continuous_rv.py::test_BoundedPareto", "sympy/stats/tests/test_continuous_rv.py::test_dagum", "sympy/sets/tests/test_setexpr.py::test_Add_Mul", "sympy/calculus/tests/test_util.py::test_function_range", "sympy/sets/tests/test_setexpr.py::test_compound", "sympy/calculus/tests/test_util.py::test_continuous_domain", "sympy/calculus/tests/test_util.py::test_not_empty_in", "sympy/sets/tests/test_setexpr.py::test_Interval_FiniteSet", "sympy/utilities/tests/test_wester.py::test_M30", "sympy/sets/tests/test_setexpr.py::test_Many_Sets", "sympy/sets/tests/test_setexpr.py::test_SetExpr_Interval_div", "sympy/utilities/tests/test_wester.py::test_M31", "sympy/sets/tests/test_setexpr.py::test_SetExpr_Interval_pow", "sympy/stats/tests/test_continuous_rv.py::test_Lomax", "sympy/integrals/tests/test_integrals.py::test_integrate_max_min", "sympy/utilities/tests/test_wester.py::test_N9", "sympy/utilities/tests/test_wester.py::test_N10", "sympy/stats/tests/test_continuous_rv.py::test_nakagami", "sympy/utilities/tests/test_wester.py::test_N11", "sympy/utilities/tests/test_wester.py::test_N12", "sympy/utilities/tests/test_wester.py::test_N13", "sympy/stats/tests/test_continuous_rv.py::test_pareto_numeric", "sympy/stats/tests/test_continuous_rv.py::test_PowerFunction", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_16715", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_20360", "sympy/stats/tests/test_continuous_rv.py::test_trapezoidal", "sympy/functions/elementary/tests/test_piecewise.py::test_piecewise__eval_is_meromorphic", "sympy/stats/tests/test_stochastic_process.py::test_DiscreteMarkovChain", "sympy/calculus/tests/test_singularities.py::test_singularities", "sympy/calculus/tests/test_singularities.py::test_is_increasing", "sympy/calculus/tests/test_singularities.py::test_is_strictly_increasing", "sympy/stats/tests/test_stochastic_process.py::test_ContinuousMarkovChain", "sympy/calculus/tests/test_singularities.py::test_is_decreasing", "sympy/stats/tests/test_continuous_rv.py::test_uniform", "sympy/calculus/tests/test_singularities.py::test_is_strictly_decreasing", "sympy/stats/tests/test_stochastic_process.py::test_PoissonProcess", "sympy/calculus/tests/test_util.py::test_is_convex", "sympy/calculus/tests/test_util.py::test_stationary_points", "sympy/calculus/tests/test_util.py::test_maximum", "sympy/calculus/tests/test_util.py::test_minimum", "sympy/calculus/tests/test_util.py::test_issue_19869", "sympy/calculus/tests/test_singularities.py::test_issue_23401", "sympy/calculus/tests/test_util.py::test_issue_16469", "sympy/integrals/tests/test_meijerint.py::test_messy", "sympy/calculus/tests/test_util.py::test_issue_25942", "sympy/concrete/tests/test_sums_products.py::test_issue_15852", "sympy/solvers/tests/test_simplex.py::test_lp", "sympy/solvers/tests/test_simplex.py::test_simplex", "sympy/codegen/tests/test_approximations.py::test_SumApprox_monotone_terms", "sympy/solvers/tests/test_simplex.py::test_lpmin_lpmax", "sympy/solvers/tests/test_simplex.py::test_linprog", "sympy/vector/tests/test_integrals.py::test_parametric_surfaceintegrals", "sympy/integrals/tests/test_failing_integrals.py::test_issue_15925b", "sympy/concrete/tests/test_sums_products.py::test_issue_17165", "sympy/utilities/tests/test_wester.py::test_U13", "sympy/solvers/tests/test_solvers.py::test_solve_inequalities", "sympy/stats/tests/test_continuous_rv.py::test_ContinuousDistributionHandmade", "sympy/integrals/tests/test_integrals.py::test_issue_4492", "sympy/concrete/tests/test_sums_products.py::test_process_limits", "sympy/solvers/tests/test_solvers.py::test_issue_17638", "sympy/solvers/tests/test_solvers.py::test_issue_17650", "sympy/solvers/tests/test_solveset.py::test_solve_abs", "sympy/solvers/tests/test_solveset.py::test_issue_9565", "sympy/solvers/tests/test_solveset.py::test_issue_10069", "sympy/solvers/tests/test_solveset.py::test_piecewise_solveset", "sympy/solvers/tests/test_solveset.py::test_solveset", "sympy/solvers/tests/test_solveset.py::test_solvify_piecewise", "sympy/solvers/tests/test_solveset.py::test_abs_invert_solvify", "sympy/solvers/tests/test_solveset.py::test_solve_decomposition", "sympy/solvers/tests/test_solveset.py::test_integer_domain_relational", "sympy/solvers/tests/test_solveset.py::test_issue_8715", "sympy/solvers/tests/test_solveset.py::test_issue_10477", "sympy/solvers/tests/test_solveset.py::test_issue_10671", "sympy/solvers/tests/test_solveset.py::test_issue_11064", "sympy/solvers/tests/test_solveset.py::test_issue_12478", "sympy/solvers/tests/test_solveset.py::test_issue_12429", "sympy/solvers/tests/test_solveset.py::test_solveset_arg", "sympy/solvers/tests/test_solveset.py::test_issue_14223", "sympy/solvers/tests/test_solveset.py::test_issue_10158", "sympy/solvers/tests/test_solveset.py::test_issue_18359", "sympy/solvers/tests/test_solveset.py::test_issue_17565", "sympy/solvers/tests/test_solveset.py::test_issue_21890", "sympy/solvers/tests/test_solveset.py::test_issue_26077" ], "PASS_TO_PASS": null }
sympy__sympy-89
1.0
{ "code": "diff --git b/sympy/ntheory/factor_.py a/sympy/ntheory/factor_.py\nindex d3c6d19be1..b3baeeee47 100644\n--- b/sympy/ntheory/factor_.py\n+++ a/sympy/ntheory/factor_.py\n@@ -113,6 +113,47 @@ def smoothness_p(n, m=-1, power=0, visual=None):\n factorint, smoothness\n \"\"\"\n \n+ # visual must be True, False or other (stored as None)\n+ if visual in (1, 0):\n+ visual = bool(visual)\n+ elif visual not in (True, False):\n+ visual = None\n+\n+ if isinstance(n, str):\n+ if visual:\n+ return n\n+ d = {}\n+ for li in n.splitlines():\n+ k, v = [int(i) for i in\n+ li.split('has')[0].split('=')[1].split('**')]\n+ d[k] = v\n+ if visual is not True and visual is not False:\n+ return d\n+ return smoothness_p(d, visual=False)\n+ elif not isinstance(n, tuple):\n+ facs = factorint(n, visual=False)\n+\n+ if power:\n+ k = -1\n+ else:\n+ k = 1\n+ if isinstance(n, tuple):\n+ rv = n\n+ else:\n+ rv = (m, sorted([(f,\n+ tuple([M] + list(smoothness(f + m))))\n+ for f, M in list(facs.items())],\n+ key=lambda x: (x[1][k], x[0])))\n+\n+ if visual is False or (visual is not True) and (type(n) in [int, Mul]):\n+ return rv\n+ lines = []\n+ for dat in rv[1]:\n+ dat = flatten(dat)\n+ dat.insert(2, m)\n+ lines.append('p**i=%i**%i has p%+i B=%i, B-pow=%i' % tuple(dat))\n+ return '\\n'.join(lines)\n+\n \n def multiplicity(p, n):\n \"\"\"\n", "test": null }
null
{ "code": "diff --git a/sympy/ntheory/factor_.py b/sympy/ntheory/factor_.py\nindex b3baeeee47..d3c6d19be1 100644\n--- a/sympy/ntheory/factor_.py\n+++ b/sympy/ntheory/factor_.py\n@@ -113,47 +113,6 @@ def smoothness_p(n, m=-1, power=0, visual=None):\n factorint, smoothness\n \"\"\"\n \n- # visual must be True, False or other (stored as None)\n- if visual in (1, 0):\n- visual = bool(visual)\n- elif visual not in (True, False):\n- visual = None\n-\n- if isinstance(n, str):\n- if visual:\n- return n\n- d = {}\n- for li in n.splitlines():\n- k, v = [int(i) for i in\n- li.split('has')[0].split('=')[1].split('**')]\n- d[k] = v\n- if visual is not True and visual is not False:\n- return d\n- return smoothness_p(d, visual=False)\n- elif not isinstance(n, tuple):\n- facs = factorint(n, visual=False)\n-\n- if power:\n- k = -1\n- else:\n- k = 1\n- if isinstance(n, tuple):\n- rv = n\n- else:\n- rv = (m, sorted([(f,\n- tuple([M] + list(smoothness(f + m))))\n- for f, M in list(facs.items())],\n- key=lambda x: (x[1][k], x[0])))\n-\n- if visual is False or (visual is not True) and (type(n) in [int, Mul]):\n- return rv\n- lines = []\n- for dat in rv[1]:\n- dat = flatten(dat)\n- dat.insert(2, m)\n- lines.append('p**i=%i**%i has p%+i B=%i, B-pow=%i' % tuple(dat))\n- return '\\n'.join(lines)\n-\n \n def multiplicity(p, n):\n \"\"\"\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/ntheory/factor_.py.\nHere is the description for the function:\ndef smoothness_p(n, m=-1, power=0, visual=None):\n \"\"\"\n Return a list of [m, (p, (M, sm(p + m), psm(p + m)))...]\n where:\n\n 1. p**M is the base-p divisor of n\n 2. sm(p + m) is the smoothness of p + m (m = -1 by default)\n 3. psm(p + m) is the power smoothness of p + m\n\n The list is sorted according to smoothness (default) or by power smoothness\n if power=1.\n\n The smoothness of the numbers to the left (m = -1) or right (m = 1) of a\n factor govern the results that are obtained from the p +/- 1 type factoring\n methods.\n\n >>> from sympy.ntheory.factor_ import smoothness_p, factorint\n >>> smoothness_p(10431, m=1)\n (1, [(3, (2, 2, 4)), (19, (1, 5, 5)), (61, (1, 31, 31))])\n >>> smoothness_p(10431)\n (-1, [(3, (2, 2, 2)), (19, (1, 3, 9)), (61, (1, 5, 5))])\n >>> smoothness_p(10431, power=1)\n (-1, [(3, (2, 2, 2)), (61, (1, 5, 5)), (19, (1, 3, 9))])\n\n If visual=True then an annotated string will be returned:\n\n >>> print(smoothness_p(21477639576571, visual=1))\n p**i=4410317**1 has p-1 B=1787, B-pow=1787\n p**i=4869863**1 has p-1 B=2434931, B-pow=2434931\n\n This string can also be generated directly from a factorization dictionary\n and vice versa:\n\n >>> factorint(17*9)\n {3: 2, 17: 1}\n >>> smoothness_p(_)\n 'p**i=3**2 has p-1 B=2, B-pow=2\\\\np**i=17**1 has p-1 B=2, B-pow=16'\n >>> smoothness_p(_)\n {3: 2, 17: 1}\n\n The table of the output logic is:\n\n ====== ====== ======= =======\n | Visual\n ------ ----------------------\n Input True False other\n ====== ====== ======= =======\n dict str tuple str\n str str tuple dict\n tuple str tuple str\n n str tuple tuple\n mul str tuple tuple\n ====== ====== ======= =======\n\n See Also\n ========\n\n factorint, smoothness\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/ntheory/tests/test_factor_.py::test_smoothness_and_smoothness_p", "sympy/ntheory/tests/test_factor_.py::test_visual_io" ], "PASS_TO_PASS": null }
sympy__sympy-90
1.0
{ "code": "diff --git b/sympy/solvers/polysys.py a/sympy/solvers/polysys.py\nindex 2482889f11..dfe77d2eed 100644\n--- b/sympy/solvers/polysys.py\n+++ a/sympy/solvers/polysys.py\n@@ -245,6 +245,97 @@ def solve_generic(polys, opt, strict=False):\n UnsolvableFactorError\n \n \"\"\"\n+ def _is_univariate(f):\n+ \"\"\"Returns True if 'f' is univariate in its last variable. \"\"\"\n+ for monom in f.monoms():\n+ if any(monom[:-1]):\n+ return False\n+\n+ return True\n+\n+ def _subs_root(f, gen, zero):\n+ \"\"\"Replace generator with a root so that the result is nice. \"\"\"\n+ p = f.as_expr({gen: zero})\n+\n+ if f.degree(gen) >= 2:\n+ p = p.expand(deep=False)\n+\n+ return p\n+\n+ def _solve_reduced_system(system, gens, entry=False):\n+ \"\"\"Recursively solves reduced polynomial systems. \"\"\"\n+ if len(system) == len(gens) == 1:\n+ # the below line will produce UnsolvableFactorError if\n+ # strict=True and the solution from `roots` is incomplete\n+ zeros = list(roots(system[0], gens[-1], strict=strict).keys())\n+ return [(zero,) for zero in zeros]\n+\n+ basis = groebner(system, gens, polys=True)\n+\n+ if len(basis) == 1 and basis[0].is_ground:\n+ if not entry:\n+ return []\n+ else:\n+ return None\n+\n+ univariate = list(filter(_is_univariate, basis))\n+\n+ if len(basis) < len(gens):\n+ raise NotImplementedError(filldedent('''\n+ only zero-dimensional systems supported\n+ (finite number of solutions)\n+ '''))\n+\n+ if len(univariate) == 1:\n+ f = univariate.pop()\n+ else:\n+ raise NotImplementedError(filldedent('''\n+ only zero-dimensional systems supported\n+ (finite number of solutions)\n+ '''))\n+\n+ gens = f.gens\n+ gen = gens[-1]\n+\n+ # the below line will produce UnsolvableFactorError if\n+ # strict=True and the solution from `roots` is incomplete\n+ zeros = list(roots(f.ltrim(gen), strict=strict).keys())\n+\n+ if not zeros:\n+ return []\n+\n+ if len(basis) == 1:\n+ return [(zero,) for zero in zeros]\n+\n+ solutions = []\n+\n+ for zero in zeros:\n+ new_system = []\n+ new_gens = gens[:-1]\n+\n+ for b in basis[:-1]:\n+ eq = _subs_root(b, gen, zero)\n+\n+ if eq is not S.Zero:\n+ new_system.append(eq)\n+\n+ for solution in _solve_reduced_system(new_system, new_gens):\n+ solutions.append(solution + (zero,))\n+\n+ if solutions and len(solutions[0]) != len(gens):\n+ raise NotImplementedError(filldedent('''\n+ only zero-dimensional systems supported\n+ (finite number of solutions)\n+ '''))\n+ return solutions\n+\n+ try:\n+ result = _solve_reduced_system(polys, opt.gens, entry=True)\n+ except CoercionFailed:\n+ raise NotImplementedError\n+\n+ if result is not None:\n+ return sorted(result, key=default_sort_key)\n \n \n def solve_triangulated(polys, *gens, **args):\n", "test": null }
null
{ "code": "diff --git a/sympy/solvers/polysys.py b/sympy/solvers/polysys.py\nindex dfe77d2eed..2482889f11 100644\n--- a/sympy/solvers/polysys.py\n+++ b/sympy/solvers/polysys.py\n@@ -245,97 +245,6 @@ def solve_generic(polys, opt, strict=False):\n UnsolvableFactorError\n \n \"\"\"\n- def _is_univariate(f):\n- \"\"\"Returns True if 'f' is univariate in its last variable. \"\"\"\n- for monom in f.monoms():\n- if any(monom[:-1]):\n- return False\n-\n- return True\n-\n- def _subs_root(f, gen, zero):\n- \"\"\"Replace generator with a root so that the result is nice. \"\"\"\n- p = f.as_expr({gen: zero})\n-\n- if f.degree(gen) >= 2:\n- p = p.expand(deep=False)\n-\n- return p\n-\n- def _solve_reduced_system(system, gens, entry=False):\n- \"\"\"Recursively solves reduced polynomial systems. \"\"\"\n- if len(system) == len(gens) == 1:\n- # the below line will produce UnsolvableFactorError if\n- # strict=True and the solution from `roots` is incomplete\n- zeros = list(roots(system[0], gens[-1], strict=strict).keys())\n- return [(zero,) for zero in zeros]\n-\n- basis = groebner(system, gens, polys=True)\n-\n- if len(basis) == 1 and basis[0].is_ground:\n- if not entry:\n- return []\n- else:\n- return None\n-\n- univariate = list(filter(_is_univariate, basis))\n-\n- if len(basis) < len(gens):\n- raise NotImplementedError(filldedent('''\n- only zero-dimensional systems supported\n- (finite number of solutions)\n- '''))\n-\n- if len(univariate) == 1:\n- f = univariate.pop()\n- else:\n- raise NotImplementedError(filldedent('''\n- only zero-dimensional systems supported\n- (finite number of solutions)\n- '''))\n-\n- gens = f.gens\n- gen = gens[-1]\n-\n- # the below line will produce UnsolvableFactorError if\n- # strict=True and the solution from `roots` is incomplete\n- zeros = list(roots(f.ltrim(gen), strict=strict).keys())\n-\n- if not zeros:\n- return []\n-\n- if len(basis) == 1:\n- return [(zero,) for zero in zeros]\n-\n- solutions = []\n-\n- for zero in zeros:\n- new_system = []\n- new_gens = gens[:-1]\n-\n- for b in basis[:-1]:\n- eq = _subs_root(b, gen, zero)\n-\n- if eq is not S.Zero:\n- new_system.append(eq)\n-\n- for solution in _solve_reduced_system(new_system, new_gens):\n- solutions.append(solution + (zero,))\n-\n- if solutions and len(solutions[0]) != len(gens):\n- raise NotImplementedError(filldedent('''\n- only zero-dimensional systems supported\n- (finite number of solutions)\n- '''))\n- return solutions\n-\n- try:\n- result = _solve_reduced_system(polys, opt.gens, entry=True)\n- except CoercionFailed:\n- raise NotImplementedError\n-\n- if result is not None:\n- return sorted(result, key=default_sort_key)\n \n \n def solve_triangulated(polys, *gens, **args):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/solvers/polysys.py.\nHere is the description for the function:\ndef solve_generic(polys, opt, strict=False):\n \"\"\"\n Solve a generic system of polynomial equations.\n\n Returns all possible solutions over C[x_1, x_2, ..., x_m] of a\n set F = { f_1, f_2, ..., f_n } of polynomial equations, using\n Groebner basis approach. For now only zero-dimensional systems\n are supported, which means F can have at most a finite number\n of solutions. If the basis contains only the ground, None is\n returned.\n\n The algorithm works by the fact that, supposing G is the basis\n of F with respect to an elimination order (here lexicographic\n order is used), G and F generate the same ideal, they have the\n same set of solutions. By the elimination property, if G is a\n reduced, zero-dimensional Groebner basis, then there exists an\n univariate polynomial in G (in its last variable). This can be\n solved by computing its roots. Substituting all computed roots\n for the last (eliminated) variable in other elements of G, new\n polynomial system is generated. Applying the above procedure\n recursively, a finite number of solutions can be found.\n\n The ability of finding all solutions by this procedure depends\n on the root finding algorithms. If no solutions were found, it\n means only that roots() failed, but the system is solvable. To\n overcome this difficulty use numerical algorithms instead.\n\n Parameters\n ==========\n\n polys: a list/tuple/set\n Listing all the polynomial equations that are needed to be solved\n opt: an Options object\n For specifying keyword arguments and generators\n strict: a boolean\n If strict is True, NotImplementedError will be raised if the solution\n is known to be incomplete\n\n Returns\n =======\n\n List[Tuple]\n a list of tuples with elements being solutions for the\n symbols in the order they were passed as gens\n None\n None is returned when the computed basis contains only the ground.\n\n References\n ==========\n\n .. [Buchberger01] B. Buchberger, Groebner Bases: A Short\n Introduction for Systems Theorists, In: R. Moreno-Diaz,\n B. Buchberger, J.L. Freire, Proceedings of EUROCAST'01,\n February, 2001\n\n .. [Cox97] D. Cox, J. Little, D. O'Shea, Ideals, Varieties\n and Algorithms, Springer, Second Edition, 1997, pp. 112\n\n Raises\n ========\n\n NotImplementedError\n If the system is not zero-dimensional (does not have a finite\n number of solutions)\n\n UnsolvableFactorError\n If ``strict`` is True and not all solution components are\n expressible in radicals\n\n Examples\n ========\n\n >>> from sympy import Poly, Options\n >>> from sympy.solvers.polysys import solve_generic\n >>> from sympy.abc import x, y\n >>> NewOption = Options((x, y), {'domain': 'ZZ'})\n\n >>> a = Poly(x - y + 5, x, y, domain='ZZ')\n >>> b = Poly(x + y - 3, x, y, domain='ZZ')\n >>> solve_generic([a, b], NewOption)\n [(-1, 4)]\n\n >>> a = Poly(x - 2*y + 5, x, y, domain='ZZ')\n >>> b = Poly(2*x - y - 3, x, y, domain='ZZ')\n >>> solve_generic([a, b], NewOption)\n [(11/3, 13/3)]\n\n >>> a = Poly(x**2 + y, x, y, domain='ZZ')\n >>> b = Poly(x + y*4, x, y, domain='ZZ')\n >>> solve_generic([a, b], NewOption)\n [(0, 0), (1/4, -1/16)]\n\n >>> a = Poly(x**5 - x + y**3, x, y, domain='ZZ')\n >>> b = Poly(y**2 - 1, x, y, domain='ZZ')\n >>> solve_generic([a, b], NewOption, strict=True)\n Traceback (most recent call last):\n ...\n UnsolvableFactorError\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/solvers/tests/test_solvers.py::test_swap_back", "sympy/integrals/tests/test_integrals.py::test_issue_3664", "sympy/printing/tests/test_latex.py::test_latex_FourierSeries", "sympy/solvers/tests/test_solvers.py::test_solve_args", "sympy/printing/pretty/tests/test_pretty.py::test_pretty_FourierSeries", "sympy/core/tests/test_args.py::test_sympy__series__fourier__FourierSeries", "sympy/integrals/tests/test_integrals.py::test_issue_13733", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_12557", "sympy/integrals/tests/test_integrals.py::test_issue_21741", "sympy/solvers/ode/tests/test_systems.py::test__classify_linear_system", "sympy/solvers/ode/tests/test_ode.py::test_dsolve_ics", "sympy/solvers/ode/tests/test_systems.py::test_canonical_odes", "sympy/integrals/tests/test_heurisch.py::test_heurisch_radicals", "sympy/integrals/tests/test_heurisch.py::test_heurisch_wrapper", "sympy/diffgeom/tests/test_diffgeom.py::test_coordsys_transform", "sympy/solvers/ode/tests/test_systems.py::test_sysode_linear_neq_order1_type2", "sympy/integrals/tests/test_integrals.py::test_integrate_returns_piecewise", "sympy/utilities/tests/test_wester.py::test_M39", "sympy/integrals/tests/test_integrals.py::test_issue_18153", "sympy/solvers/tests/test_solvers.py::test_solve_undetermined_coeffs", "sympy/series/tests/test_fourier.py::test_FourierSeries", "sympy/series/tests/test_fourier.py::test_FourierSeries_2", "sympy/series/tests/test_fourier.py::test_sawtooth_wave", "sympy/series/tests/test_fourier.py::test_FourierSeries__operations", "sympy/series/tests/test_fourier.py::test_FourierSeries__neg", "sympy/integrals/tests/test_integrals.py::test_issue_4527", "sympy/series/tests/test_fourier.py::test_FourierSeries__add__sub", "sympy/geometry/tests/test_curve.py::test_parameter_value", "sympy/solvers/tests/test_polysys.py::test_solve_poly_system", "sympy/solvers/tests/test_polysys.py::test_solve_generic", "sympy/solvers/tests/test_polysys.py::test_solve_biquadratic", "sympy/vector/tests/test_implicitregion.py::test_singular_points_and_multiplicty", "sympy/solvers/tests/test_solvers.py::test_issue_5132", "sympy/solvers/tests/test_solvers.py::test_issue_5335", "sympy/solvers/tests/test_solvers.py::test_issue_5767", "sympy/integrals/tests/test_integrals.py::test_issue_4400", "sympy/solvers/tests/test_solvers.py::test_issue_21882", "sympy/solvers/tests/test_solvers.py::test_issue_5901", "sympy/solvers/tests/test_solvers.py::test_exclude", "sympy/utilities/tests/test_wester.py::test_X21", "sympy/integrals/tests/test_meijerint.py::test_issue_10211", "sympy/polys/numberfields/tests/test_minpoly.py::test_issue_18248", "sympy/solvers/tests/test_solvers.py::test_issue_14607", "sympy/solvers/tests/test_solvers.py::test_issue_2777", "sympy/solvers/tests/test_solvers.py::test_issue_11538", "sympy/solvers/tests/test_solvers.py::test_issue_12476", "sympy/solvers/tests/test_solvers.py::test_issue_14721", "sympy/solvers/tests/test_solvers.py::test_issue_15307", "sympy/solvers/tests/test_solvers.py::test_issue_14645", "sympy/solvers/ode/tests/test_systems.py::test_dsolve_system", "sympy/solvers/tests/test_solvers.py::test_issue_27001", "sympy/solvers/tests/test_solvers.py::test_issue_22717", "sympy/integrals/tests/test_integrals.py::test_issue_21034", "sympy/integrals/tests/test_integrals.py::test_issue_23718", "sympy/solvers/tests/test_solveset.py::test_nonlinsolve_inexact", "sympy/solvers/tests/test_solveset.py::test_nonlinsolve_issue_25182", "sympy/solvers/tests/test_solveset.py::test_issue_8828" ], "PASS_TO_PASS": null }
sympy__sympy-91
1.0
{ "code": "diff --git b/sympy/polys/solvers.py a/sympy/polys/solvers.py\nindex 23277df39d..b333e81d97 100644\n--- b/sympy/polys/solvers.py\n+++ a/sympy/polys/solvers.py\n@@ -249,6 +249,56 @@ def solve_lin_sys(eqs, ring, _raw=True):\n linsolve: ``linsolve`` uses ``solve_lin_sys`` internally.\n sympy.solvers.solvers.solve: ``solve`` uses ``solve_lin_sys`` internally.\n \"\"\"\n+ as_expr = not _raw\n+\n+ assert ring.domain.is_Field\n+\n+ eqs_dict = [dict(eq) for eq in eqs]\n+\n+ one_monom = ring.one.monoms()[0]\n+ zero = ring.domain.zero\n+\n+ eqs_rhs = []\n+ eqs_coeffs = []\n+ for eq_dict in eqs_dict:\n+ eq_rhs = eq_dict.pop(one_monom, zero)\n+ eq_coeffs = {}\n+ for monom, coeff in eq_dict.items():\n+ if sum(monom) != 1:\n+ msg = \"Nonlinear term encountered in solve_lin_sys\"\n+ raise PolyNonlinearError(msg)\n+ eq_coeffs[ring.gens[monom.index(1)]] = coeff\n+ if not eq_coeffs:\n+ if not eq_rhs:\n+ continue\n+ else:\n+ return None\n+ eqs_rhs.append(eq_rhs)\n+ eqs_coeffs.append(eq_coeffs)\n+\n+ result = _solve_lin_sys(eqs_coeffs, eqs_rhs, ring)\n+\n+ if result is not None and as_expr:\n+\n+ def to_sympy(x):\n+ as_expr = getattr(x, 'as_expr', None)\n+ if as_expr:\n+ return as_expr()\n+ else:\n+ return ring.domain.to_sympy(x)\n+\n+ tresult = {to_sympy(sym): to_sympy(val) for sym, val in result.items()}\n+\n+ # Remove 1.0x\n+ result = {}\n+ for k, v in tresult.items():\n+ if k.is_Mul:\n+ c, s = k.as_coeff_Mul()\n+ result[s] = v/c\n+ else:\n+ result[k] = v\n+\n+ return result\n \n \n def _solve_lin_sys(eqs_coeffs, eqs_rhs, ring):\n", "test": null }
null
{ "code": "diff --git a/sympy/polys/solvers.py b/sympy/polys/solvers.py\nindex b333e81d97..23277df39d 100644\n--- a/sympy/polys/solvers.py\n+++ b/sympy/polys/solvers.py\n@@ -249,56 +249,6 @@ def solve_lin_sys(eqs, ring, _raw=True):\n linsolve: ``linsolve`` uses ``solve_lin_sys`` internally.\n sympy.solvers.solvers.solve: ``solve`` uses ``solve_lin_sys`` internally.\n \"\"\"\n- as_expr = not _raw\n-\n- assert ring.domain.is_Field\n-\n- eqs_dict = [dict(eq) for eq in eqs]\n-\n- one_monom = ring.one.monoms()[0]\n- zero = ring.domain.zero\n-\n- eqs_rhs = []\n- eqs_coeffs = []\n- for eq_dict in eqs_dict:\n- eq_rhs = eq_dict.pop(one_monom, zero)\n- eq_coeffs = {}\n- for monom, coeff in eq_dict.items():\n- if sum(monom) != 1:\n- msg = \"Nonlinear term encountered in solve_lin_sys\"\n- raise PolyNonlinearError(msg)\n- eq_coeffs[ring.gens[monom.index(1)]] = coeff\n- if not eq_coeffs:\n- if not eq_rhs:\n- continue\n- else:\n- return None\n- eqs_rhs.append(eq_rhs)\n- eqs_coeffs.append(eq_coeffs)\n-\n- result = _solve_lin_sys(eqs_coeffs, eqs_rhs, ring)\n-\n- if result is not None and as_expr:\n-\n- def to_sympy(x):\n- as_expr = getattr(x, 'as_expr', None)\n- if as_expr:\n- return as_expr()\n- else:\n- return ring.domain.to_sympy(x)\n-\n- tresult = {to_sympy(sym): to_sympy(val) for sym, val in result.items()}\n-\n- # Remove 1.0x\n- result = {}\n- for k, v in tresult.items():\n- if k.is_Mul:\n- c, s = k.as_coeff_Mul()\n- result[s] = v/c\n- else:\n- result[k] = v\n-\n- return result\n \n \n def _solve_lin_sys(eqs_coeffs, eqs_rhs, ring):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/polys/solvers.py.\nHere is the description for the function:\ndef solve_lin_sys(eqs, ring, _raw=True):\n \"\"\"Solve a system of linear equations from a PolynomialRing\n\n Explanation\n ===========\n\n Solves a system of linear equations given as PolyElement instances of a\n PolynomialRing. The basic arithmetic is carried out using instance of\n DomainElement which is more efficient than :class:`~sympy.core.expr.Expr`\n for the most common inputs.\n\n While this is a public function it is intended primarily for internal use\n so its interface is not necessarily convenient. Users are suggested to use\n the :func:`sympy.solvers.solveset.linsolve` function (which uses this\n function internally) instead.\n\n Parameters\n ==========\n\n eqs: list[PolyElement]\n The linear equations to be solved as elements of a\n PolynomialRing (assumed equal to zero).\n ring: PolynomialRing\n The polynomial ring from which eqs are drawn. The generators of this\n ring are the unknowns to be solved for and the domain of the ring is\n the domain of the coefficients of the system of equations.\n _raw: bool\n If *_raw* is False, the keys and values in the returned dictionary\n will be of type Expr (and the unit of the field will be removed from\n the keys) otherwise the low-level polys types will be returned, e.g.\n PolyElement: PythonRational.\n\n Returns\n =======\n\n ``None`` if the system has no solution.\n\n dict[Symbol, Expr] if _raw=False\n\n dict[Symbol, DomainElement] if _raw=True.\n\n Examples\n ========\n\n >>> from sympy import symbols\n >>> from sympy.polys.solvers import solve_lin_sys, sympy_eqs_to_ring\n >>> x, y = symbols('x, y')\n >>> eqs = [x - y, x + y - 2]\n >>> eqs_ring, ring = sympy_eqs_to_ring(eqs, [x, y])\n >>> solve_lin_sys(eqs_ring, ring)\n {y: 1, x: 1}\n\n Passing ``_raw=False`` returns the same result except that the keys are\n ``Expr`` rather than low-level poly types.\n\n >>> solve_lin_sys(eqs_ring, ring, _raw=False)\n {x: 1, y: 1}\n\n See also\n ========\n\n sympy_eqs_to_ring: prepares the inputs to ``solve_lin_sys``.\n linsolve: ``linsolve`` uses ``solve_lin_sys`` internally.\n sympy.solvers.solvers.solve: ``solve`` uses ``solve_lin_sys`` internally.\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/solvers/tests/test_solvers.py::test_swap_back", "sympy/stats/tests/test_continuous_rv.py::test_single_normal", "sympy/integrals/tests/test_integrals.py::test_multiple_integration", "sympy/simplify/tests/test_simplify.py::test_simplify_expr", "sympy/concrete/tests/test_sums_products.py::test_arithmetic_sums", "sympy/concrete/tests/test_sums_products.py::test_geometric_sums", "sympy/simplify/tests/test_simplify.py::test_issue_3557", "sympy/integrals/tests/test_integrals.py::test_issue_3664", "sympy/printing/tests/test_latex.py::test_latex_FourierSeries", "sympy/integrals/tests/test_integrals.py::test_issue_3686", "sympy/integrals/tests/test_integrals.py::test_transcendental_functions", "sympy/concrete/tests/test_sums_products.py::test_hypergeometric_sums", "sympy/core/tests/test_evalf.py::test_evalf_sum", "sympy/integrals/tests/test_integrals.py::test_log_polylog", "sympy/solvers/tests/test_solvers.py::test_solve_args", "sympy/concrete/tests/test_sums_products.py::test_other_sums", "sympy/integrals/tests/test_integrals.py::test_issue_3788", "sympy/core/tests/test_expr.py::test_action_verbs", "sympy/solvers/tests/test_solvers.py::test_solve_polynomial1", "sympy/printing/pretty/tests/test_pretty.py::test_pretty_FourierSeries", "sympy/integrals/tests/test_integrals.py::test_issue_8623", "sympy/core/tests/test_evalf.py::test_issue_4806", "sympy/integrals/tests/test_integrals.py::test_issue_9569", "sympy/integrals/tests/test_integrals.py::test_issue_13733", "sympy/integrals/tests/test_integrals.py::test_issue_13749", "sympy/integrals/tests/test_integrals.py::test_issue_18133", "sympy/integrals/tests/test_integrals.py::test_issue_21741", "sympy/integrals/tests/test_integrals.py::test_issue_4052", "sympy/integrals/tests/test_integrals.py::test_evalf_issue_939", "sympy/core/tests/test_args.py::test_sympy__series__fourier__FourierSeries", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_11045", "sympy/integrals/tests/test_integrals.py::test_double_previously_failing_integrals", "sympy/concrete/tests/test_sums_products.py::test_telescopic_sums", "sympy/solvers/ode/tests/test_ode.py::test_dsolve_all_hint", "sympy/stats/tests/test_continuous_rv.py::test_cdf", "sympy/concrete/tests/test_sums_products.py::test_Sum_doit", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_12557", "sympy/concrete/tests/test_sums_products.py::test_hypersum", "sympy/functions/elementary/tests/test_piecewise.py::test_issue_4313", "sympy/integrals/tests/test_integrals.py::test_integrate_returns_piecewise", "sympy/integrals/tests/test_risch.py::test_integrate_hyperexponential", "sympy/integrals/tests/test_heurisch.py::test_issue_21166", "sympy/concrete/tests/test_delta.py::test_deltaproduct_basic", "sympy/integrals/tests/test_integrals.py::test_integrate_max_min", "sympy/concrete/tests/test_delta.py::test_deltaproduct_mul_x_kd", "sympy/utilities/tests/test_wester.py::test_H31", "sympy/simplify/tests/test_hyperexpand.py::test_hyperexpand", "sympy/integrals/tests/test_heurisch.py::test_heurisch_polynomials", "sympy/solvers/tests/test_solvers.py::test_linear_system", "sympy/concrete/tests/test_delta.py::test_deltaproduct_mul_add_x_y_kd", "sympy/integrals/tests/test_heurisch.py::test_heurisch_fractions", "sympy/integrals/tests/test_heurisch.py::test_heurisch_log", "sympy/integrals/tests/test_heurisch.py::test_heurisch_exp", "sympy/concrete/tests/test_delta.py::test_deltaproduct_add_kd_kd", "sympy/solvers/tests/test_solvers.py::test_linear_system_function", "sympy/integrals/tests/test_heurisch.py::test_heurisch_trigonometric", "sympy/integrals/tests/test_heurisch.py::test_heurisch_hyperbolic", "sympy/physics/mechanics/tests/test_system_class.py::TestSystemExamples::test_cart_pendulum_kanes", "sympy/integrals/tests/test_heurisch.py::test_heurisch_mixed", "sympy/integrals/tests/test_heurisch.py::test_heurisch_radicals", "sympy/core/tests/test_expr.py::test_issue_11877", "sympy/concrete/tests/test_delta.py::test_deltaproduct_mul_x_add_kd_kd", "sympy/stats/tests/test_continuous_rv.py::test_ContinuousRV", "sympy/solvers/tests/test_solvers.py::test_linear_system_symbols_doesnt_hang_1", "sympy/integrals/tests/test_heurisch.py::test_heurisch_special", "sympy/integrals/tests/test_heurisch.py::test_heurisch_symbolic_coeffs", "sympy/integrals/tests/test_heurisch.py::test_heurisch_symbolic_coeffs_1130", "sympy/concrete/tests/test_delta.py::test_deltaproduct_mul_add_x_y_add_kd_kd", "sympy/integrals/tests/test_heurisch.py::test_heurisch_hacking", "sympy/solvers/tests/test_solvers.py::test_linear_system_symbols_doesnt_hang_2", "sympy/solvers/ode/tests/test_systems.py::test__classify_linear_system", "sympy/integrals/tests/test_heurisch.py::test_heurisch_wrapper", "sympy/integrals/tests/test_heurisch.py::test_issue_3609", "sympy/concrete/tests/test_delta.py::test_deltaproduct_add_mul_x_y_mul_x_kd", "sympy/integrals/tests/test_heurisch.py::test_pmint_rat", "sympy/integrals/tests/test_integrals.py::test_issue_4884", "sympy/concrete/tests/test_delta.py::test_deltaproduct_mul_x_add_y_kd", "sympy/stats/tests/test_continuous_rv.py::test_betaprime", "sympy/integrals/tests/test_heurisch.py::test_pmint_trig", "sympy/solvers/tests/test_solvers.py::test_solve_for_functions_derivatives", "sympy/matrices/tests/test_solvers.py::test_linsolve_underdetermined_AND_gauss_jordan_solve", "sympy/integrals/tests/test_integrals.py::test_issue_18153", "sympy/integrals/tests/test_heurisch.py::test_pmint_logexp", "sympy/concrete/tests/test_delta.py::test_deltaproduct_mul_x_add_y_twokd", "sympy/solvers/tests/test_solvers.py::test_issue_3870", "sympy/stats/tests/test_continuous_rv.py::test_BoundedPareto", "sympy/solvers/ode/tests/test_systems.py::test_canonical_odes", "sympy/integrals/tests/test_integrals.py::test_trig_nonelementary_integrals", "sympy/concrete/tests/test_delta.py::test_deltaproduct_mul_add_x_y_add_y_kd", "sympy/solvers/tests/test_solvers.py::test_solve_undetermined_coeffs", "sympy/integrals/tests/test_integrals.py::test_issue_4403", "sympy/solvers/ode/tests/test_systems.py::test_sysode_linear_neq_order1_type1", "sympy/concrete/tests/test_delta.py::test_deltaproduct_mul_add_x_kd_add_y_kd", "sympy/holonomic/tests/test_holonomic.py::test_to_Sequence", "sympy/integrals/tests/test_integrals.py::test_issue_4403_2", "sympy/integrals/tests/test_integrals.py::test_issue_4100", "sympy/solvers/ode/tests/test_systems.py::test_sysode_linear_neq_order1_type2", "sympy/holonomic/tests/test_holonomic.py::test_to_Sequence_Initial_Coniditons", "sympy/series/tests/test_formal.py::test_rational_algorithm", "sympy/holonomic/tests/test_holonomic.py::test_series", "sympy/integrals/tests/test_integrals.py::test_issue_4890", "sympy/solvers/ode/tests/test_systems.py::test_sysode_linear_neq_order1_type3", "sympy/integrals/tests/test_integrals.py::test_issue_4551", "sympy/stats/tests/test_continuous_rv.py::test_Lomax", "sympy/series/tests/test_formal.py::test_fps", "sympy/integrals/tests/test_integrals.py::test_issue_4376", "sympy/integrals/tests/test_heurisch.py::test_pmint_erf", "sympy/geometry/tests/test_line.py::test_parameter_value", "sympy/solvers/ode/tests/test_systems.py::test_sysode_linear_neq_order1_type5_type6", "sympy/geometry/tests/test_line.py::test_issue_12598", "sympy/integrals/tests/test_heurisch.py::test_pmint_LambertW", "sympy/simplify/tests/test_trigsimp.py::test_trigsimp_groebner", "sympy/integrals/tests/test_heurisch.py::test_pmint_besselj", "sympy/integrals/tests/test_heurisch.py::test_pmint_WrightOmega", "sympy/integrals/tests/test_integrals.py::test_issue_4527", "sympy/solvers/ode/tests/test_systems.py::test_higher_order_to_first_order", "sympy/integrals/tests/test_manual.py::test_manualintegrate_trig_substitution", "sympy/diffgeom/tests/test_diffgeom.py::test_coordsys_transform", "sympy/series/tests/test_formal.py::test_fps__Add_expr", "sympy/solvers/tests/test_solvers.py::test_issue_5197", "sympy/integrals/tests/test_prde.py::test_prde_special_denom", "sympy/solvers/ode/tests/test_systems.py::test_higher_order_to_first_order_12", "sympy/integrals/tests/test_integrals.py::test_issue_3940", "sympy/series/tests/test_formal.py::test_fps__asymptotic", "sympy/solvers/tests/test_solvers.py::test_checking", "sympy/simplify/tests/test_trigsimp.py::test_trigsimp_old", "sympy/solvers/ode/tests/test_systems.py::test_second_order_to_first_order_2", "sympy/integrals/tests/test_integrals.py::test_issue_5413", "sympy/concrete/tests/test_sums_products.py::test_issue_14129", "sympy/physics/control/tests/test_lti.py::test_StateSpace_dsolve", "sympy/integrals/tests/test_prde.py::test_is_log_deriv_k_t_radical_in_field", "sympy/integrals/tests/test_integrals.py::test_issue_4892a", "sympy/solvers/ode/tests/test_systems.py::test_second_order_to_first_order_slow4", "sympy/holonomic/tests/test_holonomic.py::test_to_hyper", "sympy/polys/tests/test_partfrac.py::test_apart", "sympy/utilities/tests/test_wester.py::test_M38", "sympy/integrals/tests/test_prde.py::test_parametric_log_deriv", "sympy/solvers/tests/test_recurr.py::test_rsolve_poly", "sympy/integrals/tests/test_integrals.py::test_issue_4892b", "sympy/polys/tests/test_partfrac.py::test_apart_matrix", "sympy/solvers/ode/tests/test_systems.py::test_component_division", "sympy/holonomic/tests/test_holonomic.py::test_to_expr", "sympy/integrals/tests/test_heurisch.py::test_RR", "sympy/integrals/tests/test_rationaltools.py::test_ratint", "sympy/solvers/tests/test_recurr.py::test_rsolve_ratio", "sympy/solvers/tests/test_solvers.py::test_issue_5132", "sympy/integrals/tests/test_heurisch.py::test_issue_22527", "sympy/polys/tests/test_partfrac.py::test_apart_symbolic", "sympy/integrals/tests/test_rationaltools.py::test_issue_5414", "sympy/functions/special/tests/test_zeta_functions.py::test_issue_8404", "sympy/solvers/ode/tests/test_ode.py::test_solve_ics", "sympy/solvers/tests/test_recurr.py::test_rsolve_hyper", "sympy/integrals/tests/test_heurisch.py::test_heurisch_complex_erf_issue_26338", "sympy/holonomic/tests/test_holonomic.py::test_integrate", "sympy/integrals/tests/test_rationaltools.py::test_issue_5249", "sympy/polys/tests/test_partfrac.py::test_apart_extension", "sympy/integrals/tests/test_heurisch.py::test_issue_15498", "sympy/solvers/ode/tests/test_systems.py::test_linodesolve", "sympy/integrals/tests/test_integrals.py::test_limit_bug", "sympy/integrals/tests/test_rationaltools.py::test_issue_5817", "sympy/polys/tests/test_partfrac.py::test_apart_extension_xfail", "sympy/concrete/tests/test_gosper.py::test_gosper_term", "sympy/integrals/tests/test_rationaltools.py::test_issue_5981", "sympy/solvers/tests/test_recurr.py::test_rsolve_bulk", "sympy/polys/tests/test_partfrac.py::test_apart_full", "sympy/concrete/tests/test_gosper.py::test_gosper_sum", "sympy/solvers/ode/tests/test_systems.py::test_neq_order1_type4_slow3", "sympy/integrals/tests/test_integrals.py::test_issue_3558", "sympy/series/tests/test_formal.py::test_fps__logarithmic_singularity", "sympy/solvers/tests/test_recurr.py::test_rsolve_0_sol_homogeneous", "sympy/concrete/tests/test_sums_products.py::test_issue_14640", "sympy/concrete/tests/test_gosper.py::test_gosper_sum_indefinite", "sympy/concrete/tests/test_gosper.py::test_gosper_sum_parametric", "sympy/holonomic/tests/test_holonomic.py::test_diff", "sympy/integrals/tests/test_integrals.py::test_issue_4422", "sympy/polys/tests/test_partfrac.py::test_apart_undetermined_coeffs", "sympy/integrals/tests/test_rationaltools.py::test_issue_10488", "sympy/solvers/tests/test_recurr.py::test_rsolve", "sympy/series/tests/test_formal.py::test_fps_symbolic", "sympy/solvers/ode/tests/test_systems.py::test_dsolve_system", "sympy/polys/tests/test_partfrac.py::test_issue_5798", "sympy/integrals/tests/test_rationaltools.py::test_issues_8246_12050_13501_14080", "sympy/concrete/tests/test_gosper.py::test_gosper_sum_algebraic", "sympy/integrals/tests/test_integrals.py::test_issue_4493", "sympy/solvers/tests/test_recurr.py::test_issue_6844", "sympy/holonomic/tests/test_holonomic.py::test_extended_domain_in_expr_to_holonomic", "sympy/concrete/tests/test_gosper.py::test_gosper_sum_iterated", "sympy/solvers/ode/tests/test_single.py::test_2nd_2F1_hypergeometric_integral", "sympy/integrals/tests/test_rde.py::test_special_denom", "sympy/integrals/tests/test_integrals.py::test_issue_4737", "sympy/solvers/ode/tests/test_systems.py::test_second_order_type2_slow1", "sympy/concrete/tests/test_gosper.py::test_gosper_sum_AeqB_part1", "sympy/integrals/tests/test_rde.py::test_bound_degree_fail", "sympy/series/tests/test_formal.py::test_fps__slow", "sympy/integrals/tests/test_rationaltools.py::test_issue_6308", "sympy/functions/special/tests/test_bsplines.py::test_10_points_degree_1", "sympy/polys/tests/test_solvers.py::test_solve_lin_sys_2x2_one", "sympy/concrete/tests/test_gosper.py::test_gosper_sum_AeqB_part2", "sympy/polys/tests/test_solvers.py::test_solve_lin_sys_2x4_none", "sympy/polys/tests/test_solvers.py::test_solve_lin_sys_3x4_one", "sympy/integrals/tests/test_heurisch.py::test_heurisch_issue_26922", "sympy/solvers/tests/test_pde.py::test_checkpdesol", "sympy/polys/tests/test_solvers.py::test_solve_lin_sys_3x3_inf", "sympy/solvers/tests/test_recurr.py::test_constant_naming", "sympy/integrals/tests/test_rationaltools.py::test_issue_5907", "sympy/functions/special/tests/test_bsplines.py::test_3_points_degree_2", "sympy/concrete/tests/test_gosper.py::test_gosper_nan", "sympy/integrals/tests/test_transforms.py::test_mellin_transform2", "sympy/functions/special/tests/test_bsplines.py::test_5_points_degree_2", "sympy/solvers/ode/tests/test_systems.py::test_linear_2eq_order1", "sympy/polys/tests/test_solvers.py::test_solve_lin_sys_3x4_none", "sympy/polys/tests/test_solvers.py::test_solve_lin_sys_4x7_inf", "sympy/integrals/tests/test_integrals.py::test_issue_4487", "sympy/polys/tests/test_solvers.py::test_solve_lin_sys_5x5_inf", "sympy/polys/tests/test_solvers.py::test_solve_lin_sys_6x6_1", "sympy/functions/special/tests/test_bsplines.py::test_issue_19262", "sympy/polys/tests/test_solvers.py::test_solve_lin_sys_6x6_2", "sympy/integrals/tests/test_rationaltools.py::test_issue_25896", "sympy/concrete/tests/test_gosper.py::test_gosper_sum_AeqB_part3", "sympy/integrals/tests/test_integrals.py::test_issue_4400", "sympy/stats/tests/test_continuous_rv.py::test_unevaluated", "sympy/holonomic/tests/test_holonomic.py::test_to_meijerg", "sympy/series/tests/test_fourier.py::test_FourierSeries", "sympy/series/tests/test_fourier.py::test_FourierSeries_2", "sympy/utilities/tests/test_wester.py::test_R16", "sympy/solvers/ode/tests/test_lie_group.py::test_heuristic1", "sympy/solvers/tests/test_solvers.py::test_issue_5849", "sympy/stats/tests/test_stochastic_process.py::test_DiscreteMarkovChain", "sympy/solvers/ode/tests/test_systems.py::test_nonlinear_2eq_order1", "sympy/series/tests/test_fourier.py::test_sawtooth_wave", "sympy/integrals/tests/test_integrals.py::test_issue_4153", "sympy/solvers/ode/tests/test_single.py::test_2nd_nonlinear_autonomous_conserved_integral", "sympy/utilities/tests/test_wester.py::test_R18", "sympy/series/tests/test_fourier.py::test_FourierSeries__operations", "sympy/solvers/tests/test_solvers.py::test_issue_5849_matrix", "sympy/series/tests/test_fourier.py::test_FourierSeries__neg", "sympy/solvers/tests/test_pde.py::test_pde_1st_linear_constant_coeff", "sympy/series/tests/test_fourier.py::test_FourierSeries__add__sub", "sympy/solvers/tests/test_solvers.py::test_issue_21882", "sympy/solvers/tests/test_pde.py::test_pdsolve_all", "sympy/physics/mechanics/tests/test_jointsmethod.py::test_four_bar_linkage_with_manual_constraints", "sympy/integrals/tests/test_integrals.py::test_issue_4326", "sympy/concrete/tests/test_guess.py::test_guess_generating_function", "sympy/solvers/tests/test_solvers.py::test_issue_5901", "sympy/geometry/tests/test_curve.py::test_length", "sympy/physics/continuum_mechanics/tests/test_arch.py::test_arch_init", "sympy/matrices/tests/test_subspaces.py::test_columnspace_second", "sympy/solvers/tests/test_recurr.py::test_issue_8697", "sympy/physics/mechanics/tests/test_linearize.py::test_linearize_pendulum_kane_nonminimal", "sympy/physics/continuum_mechanics/tests/test_arch.py::test_arch_support", "sympy/simplify/tests/test_hyperexpand.py::test_lerchphi", "sympy/solvers/tests/test_solvers.py::test_float_handling", "sympy/integrals/tests/test_integrals.py::test_issue_6828", "sympy/physics/continuum_mechanics/tests/test_arch.py::test_arch_member", "sympy/solvers/tests/test_recurr.py::test_diofantissue_294", "sympy/integrals/tests/test_failing_integrals.py::test_issue_4511", "sympy/physics/continuum_mechanics/tests/test_arch.py::test_symbol_magnitude", "sympy/solvers/tests/test_recurr.py::test_issue_15553", "sympy/physics/continuum_mechanics/tests/test_arch.py::test_forces", "sympy/integrals/tests/test_integrals.py::test_issue_4234", "sympy/physics/mechanics/tests/test_kane2.py::test_aux_dep", "sympy/integrals/tests/test_integrals.py::test_issue_4492", "sympy/stats/tests/test_continuous_rv.py::test_precomputed_cdf", "sympy/physics/mechanics/tests/test_kane2.py::test_non_central_inertia", "sympy/integrals/tests/test_failing_integrals.py::test_issue_15925b", "sympy/vector/tests/test_integrals.py::test_parametric_lineintegrals", "sympy/integrals/tests/test_integrals.py::test_issue_2708", "sympy/solvers/ode/tests/test_lie_group.py::test_heuristic3", "sympy/physics/mechanics/tests/test_kane2.py::test_sub_qdot", "sympy/integrals/tests/test_integrals.py::test_issue_2884", "sympy/vector/tests/test_coordsysrect.py::test_transformation_equations", "sympy/integrals/tests/test_manual.py::test_issue_3796", "sympy/integrals/tests/test_integrals.py::test_issue_8901", "sympy/geometry/tests/test_polygon.py::test_parameter_value", "sympy/integrals/tests/test_integrals.py::test_issue_11742", "sympy/solvers/tests/test_solvers.py::test_minsolve_linear_system", "sympy/vector/tests/test_integrals.py::test_vector_integrate", "sympy/simplify/tests/test_ratsimp.py::test_ratsimpmodprime", "sympy/physics/continuum_mechanics/tests/test_cable.py::test_cable", "sympy/integrals/tests/test_integrals.py::test_issue_11856", "sympy/integrals/tests/test_integrals.py::test_issue_4968", "sympy/integrals/tests/test_integrals.py::test_singularities", "sympy/utilities/tests/test_wester.py::test_T12", "sympy/solvers/tests/test_solvers.py::test_issues_6819_6820_6821_6248_8692_25777_25779", "sympy/integrals/tests/test_integrals.py::test_issue_12645", "sympy/geometry/tests/test_plane.py::test_parameter_value", "sympy/integrals/tests/test_integrals.py::test_issue_14078", "sympy/utilities/tests/test_wester.py::test_V3", "sympy/integrals/tests/test_integrals.py::test_issue_14064", "sympy/integrals/tests/test_integrals.py::test_issue_14096", "sympy/solvers/ode/tests/test_ode.py::test_dsolve_remove_redundant_solutions", "sympy/utilities/tests/test_wester.py::test_V7", "sympy/utilities/tests/test_wester.py::test_V10", "sympy/integrals/tests/test_integrals.py::test_issue_14144", "sympy/utilities/tests/test_wester.py::test_V11", "sympy/integrals/tests/test_integrals.py::test_issue_14375", "sympy/utilities/tests/test_wester.py::test_V12", "sympy/solvers/ode/tests/test_ode.py::test_issue_13060", "sympy/utilities/tests/test_wester.py::test_V15", "sympy/integrals/tests/test_integrals.py::test_issue_14470", "sympy/solvers/ode/tests/test_lie_group.py::test_heuristic_linear", "sympy/integrals/tests/test_integrals.py::test_issue_14877", "sympy/solvers/ode/tests/test_lie_group.py::test_user_infinitesimals", "sympy/integrals/tests/test_integrals.py::test_issue_14782", "sympy/integrals/tests/test_integrals.py::test_issue_12081", "sympy/solvers/ode/tests/test_single.py::test_nth_order_reducible", "sympy/integrals/tests/test_meijerint.py::test_fresnel", "sympy/integrals/tests/test_integrals.py::test_issue_15124", "sympy/integrals/tests/test_transforms.py::test_issue_7181", "sympy/integrals/tests/test_transforms.py::test_issue_12591", "sympy/integrals/tests/test_integrals.py::test_issue_4514", "sympy/integrals/tests/test_manual.py::test_issue_9462", "sympy/integrals/tests/test_integrals.py::test_issue_15431", "sympy/integrals/tests/test_meijerint.py::test_issue_10211", "sympy/integrals/tests/test_integrals.py::test_issue_15640_log_substitutions", "sympy/solvers/ode/tests/test_ode.py::test_issue_22604", "sympy/integrals/tests/test_meijerint.py::test_issue_11806", "sympy/integrals/tests/test_integrals.py::test_issue_15509", "sympy/solvers/tests/test_solvers.py::test_issue_5114_6611", "sympy/integrals/tests/test_integrals.py::test_integrate_with_complex_constants", "sympy/integrals/tests/test_integrals.py::test_issue_14241", "sympy/integrals/tests/test_integrals.py::test_issue_13112", "sympy/integrals/tests/test_manual.py::test_issue_8520", "sympy/solvers/ode/tests/test_single.py::test_1st_linear", "sympy/utilities/tests/test_wester.py::test_X21", "sympy/solvers/tests/test_solvers.py::test_issue_11538", "sympy/integrals/tests/test_integrals.py::test_issue_8614", "sympy/integrals/tests/test_integrals.py::test_li_integral", "sympy/solvers/tests/test_solvers.py::test_issue_12448", "sympy/integrals/tests/test_manual.py::test_quadratic_denom", "sympy/concrete/tests/test_sums_products.py::test_pr_22677", "sympy/utilities/tests/test_wester.py::test_Y2", "sympy/integrals/tests/test_integrals.py::test_issue_17473", "sympy/solvers/tests/test_solvers.py::test_issue_13849", "sympy/integrals/tests/test_integrals.py::test_issue_17671", "sympy/solvers/ode/tests/test_single.py::test_almost_linear", "sympy/solvers/tests/test_solvers.py::test_issue_15307", "sympy/integrals/tests/test_integrals.py::test_issue_2975", "sympy/utilities/tests/test_wester.py::test_Y5_Y6", "sympy/integrals/tests/test_manual.py::test_manualintegrate_sqrt_linear", "sympy/solvers/tests/test_solvers.py::test_issue_15415", "sympy/integrals/tests/test_integrals.py::test_issue_4231", "sympy/polys/numberfields/tests/test_minpoly.py::test_issue_20163", "sympy/integrals/tests/test_integrals.py::test_issue_17841", "sympy/integrals/tests/test_integrals.py::test_issue_21034", "sympy/utilities/tests/test_wester.py::test_Z1", "sympy/utilities/tests/test_wester.py::test_Z2", "sympy/utilities/tests/test_wester.py::test_Z3", "sympy/solvers/tests/test_solvers.py::test_issue_11553", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_Beam3D", "sympy/physics/continuum_mechanics/tests/test_beam.py::test_max_deflection_Beam3D", "sympy/integrals/tests/test_trigonometry.py::test_trigintegrate_odd", "sympy/integrals/tests/test_trigonometry.py::test_trigintegrate_mixed", "sympy/solvers/ode/tests/test_single.py::test_nth_order_linear_euler_eq_nonhomogeneous_undetermined_coefficients", "sympy/solvers/tests/test_solvers.py::test_issue_21034", "sympy/solvers/tests/test_solvers.py::test_issue_10169", "sympy/integrals/tests/test_integrals.py::test_issue_4187", "sympy/integrals/tests/test_integrals.py::test_issue_5547", "sympy/integrals/tests/test_integrals.py::test_issue_21024", "sympy/integrals/tests/test_integrals.py::test_issue_21721", "sympy/integrals/tests/test_integrals.py::test_issue_21831", "sympy/integrals/tests/test_integrals.py::test_issue_23718", "sympy/integrals/tests/test_integrals.py::test_issue_23566", "sympy/integrals/tests/test_integrals.py::test_pr_23583", "sympy/integrals/tests/test_integrals.py::test_issue_7264", "sympy/integrals/tests/test_integrals.py::test_issue_11254a", "sympy/integrals/tests/test_integrals.py::test_issue_11254d", "sympy/integrals/tests/test_integrals.py::test_issue_22863", "sympy/integrals/tests/test_integrals.py::test_exp_substitution", "sympy/integrals/tests/test_integrals.py::test_hyperbolic", "sympy/integrals/tests/test_integrals.py::test_nested_pow", "sympy/integrals/tests/test_integrals.py::test_sqrt_quadratic", "sympy/integrals/tests/test_integrals.py::test_mul_pow_derivative", "sympy/integrals/tests/test_integrals.py::test_issue_23942", "sympy/integrals/tests/test_integrals.py::test_old_issues", "sympy/integrals/tests/test_integrals.py::test_integral_issue_26566", "sympy/series/tests/test_limits.py::test_issue_21721", "sympy/series/tests/test_limits.py::test_issue_23596", "sympy/solvers/tests/test_solveset.py::test_linsolve", "sympy/solvers/tests/test_solveset.py::test_linsolve_immutable", "sympy/solvers/tests/test_solveset.py::test_issue_18208" ], "PASS_TO_PASS": null }
sympy__sympy-92
1.0
{ "code": "diff --git b/sympy/physics/quantum/operatorset.py a/sympy/physics/quantum/operatorset.py\nindex 9c1cfa1780..bf32bcabbe 100644\n--- b/sympy/physics/quantum/operatorset.py\n+++ a/sympy/physics/quantum/operatorset.py\n@@ -203,6 +203,34 @@ def state_to_operators(state, **options):\n O\n \"\"\"\n \n+ if not (isinstance(state, StateBase) or issubclass(state, StateBase)):\n+ raise NotImplementedError(\"Argument is not a state!\")\n+\n+ if state in state_mapping: # state is a class\n+ state_inst = _make_default(state)\n+ try:\n+ ret = _get_ops(state_inst,\n+ _make_set(state_mapping[state]), **options)\n+ except (NotImplementedError, TypeError):\n+ ret = state_mapping[state]\n+ elif type(state) in state_mapping:\n+ ret = _get_ops(state,\n+ _make_set(state_mapping[type(state)]), **options)\n+ elif isinstance(state, BraBase) and state.dual_class() in state_mapping:\n+ ret = _get_ops(state,\n+ _make_set(state_mapping[state.dual_class()]))\n+ elif issubclass(state, BraBase) and state.dual_class() in state_mapping:\n+ state_inst = _make_default(state)\n+ try:\n+ ret = _get_ops(state_inst,\n+ _make_set(state_mapping[state.dual_class()]))\n+ except (NotImplementedError, TypeError):\n+ ret = state_mapping[state.dual_class()]\n+ else:\n+ ret = None\n+\n+ return _make_set(ret)\n+\n \n def _make_default(expr):\n # XXX: Catching TypeError like this is a bad way of distinguishing between\n", "test": null }
null
{ "code": "diff --git a/sympy/physics/quantum/operatorset.py b/sympy/physics/quantum/operatorset.py\nindex bf32bcabbe..9c1cfa1780 100644\n--- a/sympy/physics/quantum/operatorset.py\n+++ b/sympy/physics/quantum/operatorset.py\n@@ -203,34 +203,6 @@ def state_to_operators(state, **options):\n O\n \"\"\"\n \n- if not (isinstance(state, StateBase) or issubclass(state, StateBase)):\n- raise NotImplementedError(\"Argument is not a state!\")\n-\n- if state in state_mapping: # state is a class\n- state_inst = _make_default(state)\n- try:\n- ret = _get_ops(state_inst,\n- _make_set(state_mapping[state]), **options)\n- except (NotImplementedError, TypeError):\n- ret = state_mapping[state]\n- elif type(state) in state_mapping:\n- ret = _get_ops(state,\n- _make_set(state_mapping[type(state)]), **options)\n- elif isinstance(state, BraBase) and state.dual_class() in state_mapping:\n- ret = _get_ops(state,\n- _make_set(state_mapping[state.dual_class()]))\n- elif issubclass(state, BraBase) and state.dual_class() in state_mapping:\n- state_inst = _make_default(state)\n- try:\n- ret = _get_ops(state_inst,\n- _make_set(state_mapping[state.dual_class()]))\n- except (NotImplementedError, TypeError):\n- ret = state_mapping[state.dual_class()]\n- else:\n- ret = None\n-\n- return _make_set(ret)\n-\n \n def _make_default(expr):\n # XXX: Catching TypeError like this is a bad way of distinguishing between\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/physics/quantum/operatorset.py.\nHere is the description for the function:\ndef state_to_operators(state, **options):\n \"\"\" Returns the operator or set of operators corresponding to the\n given eigenstate\n\n A global function for mapping state classes to their associated\n operators or sets of operators. It takes either a state class\n or instance.\n\n This function can handle both instances of a given state or just\n the class itself (i.e. both XKet() and XKet)\n\n There are multiple use cases to consider:\n\n 1) A state class is passed: In this case, we first try\n instantiating a default instance of the class. If this succeeds,\n then we try to call state._state_to_operators on that instance.\n If the creation of the default instance or if the calling of\n _state_to_operators fails, then either an operator class or set of\n operator classes is returned. Otherwise, the appropriate\n operator instances are returned.\n\n 2) A state instance is returned: Here, state._state_to_operators\n is called for the instance. If this fails, then a class or set of\n operator classes is returned. Otherwise, the instances are returned.\n\n In either case, if the state's class does not exist in\n state_mapping, None is returned.\n\n Parameters\n ==========\n\n arg: StateBase class or instance (or subclasses)\n The class or instance of the state to be mapped to an\n operator or set of operators\n\n Examples\n ========\n\n >>> from sympy.physics.quantum.cartesian import XKet, PxKet, XBra, PxBra\n >>> from sympy.physics.quantum.operatorset import state_to_operators\n >>> from sympy.physics.quantum.state import Ket, Bra\n >>> state_to_operators(XKet)\n X\n >>> state_to_operators(XKet())\n X\n >>> state_to_operators(PxKet)\n Px\n >>> state_to_operators(PxKet())\n Px\n >>> state_to_operators(PxBra)\n Px\n >>> state_to_operators(XBra)\n X\n >>> state_to_operators(Ket)\n O\n >>> state_to_operators(Bra)\n O\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/physics/quantum/tests/test_density.py::test_represent", "sympy/physics/quantum/tests/test_cartesian.py::test_x", "sympy/physics/quantum/tests/test_cartesian.py::test_p", "sympy/physics/quantum/tests/test_operatorset.py::test_spin", "sympy/physics/quantum/tests/test_operatorset.py::test_op_to_state", "sympy/physics/quantum/tests/test_operatorset.py::test_state_to_op" ], "PASS_TO_PASS": null }
sympy__sympy-93
1.0
{ "code": "diff --git b/sympy/physics/secondquant.py a/sympy/physics/secondquant.py\nindex be04576198..6e2cc218e2 100644\n--- b/sympy/physics/secondquant.py\n+++ a/sympy/physics/secondquant.py\n@@ -2466,6 +2466,107 @@ def substitute_dummies(expr, new_indices=False, pretty_indices={}):\n \n \"\"\"\n \n+ # setup the replacing dummies\n+ if new_indices:\n+ letters_above = pretty_indices.get('above', \"\")\n+ letters_below = pretty_indices.get('below', \"\")\n+ letters_general = pretty_indices.get('general', \"\")\n+ len_above = len(letters_above)\n+ len_below = len(letters_below)\n+ len_general = len(letters_general)\n+\n+ def _i(number):\n+ try:\n+ return letters_below[number]\n+ except IndexError:\n+ return 'i_' + str(number - len_below)\n+\n+ def _a(number):\n+ try:\n+ return letters_above[number]\n+ except IndexError:\n+ return 'a_' + str(number - len_above)\n+\n+ def _p(number):\n+ try:\n+ return letters_general[number]\n+ except IndexError:\n+ return 'p_' + str(number - len_general)\n+\n+ aboves = []\n+ belows = []\n+ generals = []\n+\n+ dummies = expr.atoms(Dummy)\n+ if not new_indices:\n+ dummies = sorted(dummies, key=default_sort_key)\n+\n+ # generate lists with the dummies we will insert\n+ a = i = p = 0\n+ for d in dummies:\n+ assum = d.assumptions0\n+\n+ if assum.get(\"above_fermi\"):\n+ if new_indices:\n+ sym = _a(a)\n+ a += 1\n+ l1 = aboves\n+ elif assum.get(\"below_fermi\"):\n+ if new_indices:\n+ sym = _i(i)\n+ i += 1\n+ l1 = belows\n+ else:\n+ if new_indices:\n+ sym = _p(p)\n+ p += 1\n+ l1 = generals\n+\n+ if new_indices:\n+ l1.append(Dummy(sym, **assum))\n+ else:\n+ l1.append(d)\n+\n+ expr = expr.expand()\n+ terms = Add.make_args(expr)\n+ new_terms = []\n+ for term in terms:\n+ i = iter(belows)\n+ a = iter(aboves)\n+ p = iter(generals)\n+ ordered = _get_ordered_dummies(term)\n+ subsdict = {}\n+ for d in ordered:\n+ if d.assumptions0.get('below_fermi'):\n+ subsdict[d] = next(i)\n+ elif d.assumptions0.get('above_fermi'):\n+ subsdict[d] = next(a)\n+ else:\n+ subsdict[d] = next(p)\n+ subslist = []\n+ final_subs = []\n+ for k, v in subsdict.items():\n+ if k == v:\n+ continue\n+ if v in subsdict:\n+ # We check if the sequence of substitutions end quickly. In\n+ # that case, we can avoid temporary symbols if we ensure the\n+ # correct substitution order.\n+ if subsdict[v] in subsdict:\n+ # (x, y) -> (y, x), we need a temporary variable\n+ x = Dummy('x')\n+ subslist.append((k, x))\n+ final_subs.append((x, v))\n+ else:\n+ # (x, y) -> (y, a), x->y must be done last\n+ # but before temporary variables are resolved\n+ final_subs.insert(0, (k, v))\n+ else:\n+ subslist.append((k, v))\n+ subslist.extend(final_subs)\n+ new_terms.append(term.subs(subslist))\n+ return Add(*new_terms)\n+\n \n class KeyPrinter(StrPrinter):\n \"\"\"Printer for which only equal objects are equal in print\"\"\"\n", "test": null }
null
{ "code": "diff --git a/sympy/physics/secondquant.py b/sympy/physics/secondquant.py\nindex 6e2cc218e2..be04576198 100644\n--- a/sympy/physics/secondquant.py\n+++ b/sympy/physics/secondquant.py\n@@ -2466,107 +2466,6 @@ def substitute_dummies(expr, new_indices=False, pretty_indices={}):\n \n \"\"\"\n \n- # setup the replacing dummies\n- if new_indices:\n- letters_above = pretty_indices.get('above', \"\")\n- letters_below = pretty_indices.get('below', \"\")\n- letters_general = pretty_indices.get('general', \"\")\n- len_above = len(letters_above)\n- len_below = len(letters_below)\n- len_general = len(letters_general)\n-\n- def _i(number):\n- try:\n- return letters_below[number]\n- except IndexError:\n- return 'i_' + str(number - len_below)\n-\n- def _a(number):\n- try:\n- return letters_above[number]\n- except IndexError:\n- return 'a_' + str(number - len_above)\n-\n- def _p(number):\n- try:\n- return letters_general[number]\n- except IndexError:\n- return 'p_' + str(number - len_general)\n-\n- aboves = []\n- belows = []\n- generals = []\n-\n- dummies = expr.atoms(Dummy)\n- if not new_indices:\n- dummies = sorted(dummies, key=default_sort_key)\n-\n- # generate lists with the dummies we will insert\n- a = i = p = 0\n- for d in dummies:\n- assum = d.assumptions0\n-\n- if assum.get(\"above_fermi\"):\n- if new_indices:\n- sym = _a(a)\n- a += 1\n- l1 = aboves\n- elif assum.get(\"below_fermi\"):\n- if new_indices:\n- sym = _i(i)\n- i += 1\n- l1 = belows\n- else:\n- if new_indices:\n- sym = _p(p)\n- p += 1\n- l1 = generals\n-\n- if new_indices:\n- l1.append(Dummy(sym, **assum))\n- else:\n- l1.append(d)\n-\n- expr = expr.expand()\n- terms = Add.make_args(expr)\n- new_terms = []\n- for term in terms:\n- i = iter(belows)\n- a = iter(aboves)\n- p = iter(generals)\n- ordered = _get_ordered_dummies(term)\n- subsdict = {}\n- for d in ordered:\n- if d.assumptions0.get('below_fermi'):\n- subsdict[d] = next(i)\n- elif d.assumptions0.get('above_fermi'):\n- subsdict[d] = next(a)\n- else:\n- subsdict[d] = next(p)\n- subslist = []\n- final_subs = []\n- for k, v in subsdict.items():\n- if k == v:\n- continue\n- if v in subsdict:\n- # We check if the sequence of substitutions end quickly. In\n- # that case, we can avoid temporary symbols if we ensure the\n- # correct substitution order.\n- if subsdict[v] in subsdict:\n- # (x, y) -> (y, x), we need a temporary variable\n- x = Dummy('x')\n- subslist.append((k, x))\n- final_subs.append((x, v))\n- else:\n- # (x, y) -> (y, a), x->y must be done last\n- # but before temporary variables are resolved\n- final_subs.insert(0, (k, v))\n- else:\n- subslist.append((k, v))\n- subslist.extend(final_subs)\n- new_terms.append(term.subs(subslist))\n- return Add(*new_terms)\n-\n \n class KeyPrinter(StrPrinter):\n \"\"\"Printer for which only equal objects are equal in print\"\"\"\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/physics/secondquant.py.\nHere is the description for the function:\ndef substitute_dummies(expr, new_indices=False, pretty_indices={}):\n \"\"\"\n Collect terms by substitution of dummy variables.\n\n Explanation\n ===========\n\n This routine allows simplification of Add expressions containing terms\n which differ only due to dummy variables.\n\n The idea is to substitute all dummy variables consistently depending on\n the structure of the term. For each term, we obtain a sequence of all\n dummy variables, where the order is determined by the index range, what\n factors the index belongs to and its position in each factor. See\n _get_ordered_dummies() for more information about the sorting of dummies.\n The index sequence is then substituted consistently in each term.\n\n Examples\n ========\n\n >>> from sympy import symbols, Function, Dummy\n >>> from sympy.physics.secondquant import substitute_dummies\n >>> a,b,c,d = symbols('a b c d', above_fermi=True, cls=Dummy)\n >>> i,j = symbols('i j', below_fermi=True, cls=Dummy)\n >>> f = Function('f')\n\n >>> expr = f(a,b) + f(c,d); expr\n f(_a, _b) + f(_c, _d)\n\n Since a, b, c and d are equivalent summation indices, the expression can be\n simplified to a single term (for which the dummy indices are still summed over)\n\n >>> substitute_dummies(expr)\n 2*f(_a, _b)\n\n\n Controlling output:\n\n By default the dummy symbols that are already present in the expression\n will be reused in a different permutation. However, if new_indices=True,\n new dummies will be generated and inserted. The keyword 'pretty_indices'\n can be used to control this generation of new symbols.\n\n By default the new dummies will be generated on the form i_1, i_2, a_1,\n etc. If you supply a dictionary with key:value pairs in the form:\n\n { index_group: string_of_letters }\n\n The letters will be used as labels for the new dummy symbols. The\n index_groups must be one of 'above', 'below' or 'general'.\n\n >>> expr = f(a,b,i,j)\n >>> my_dummies = { 'above':'st', 'below':'uv' }\n >>> substitute_dummies(expr, new_indices=True, pretty_indices=my_dummies)\n f(_s, _t, _u, _v)\n\n If we run out of letters, or if there is no keyword for some index_group\n the default dummy generator will be used as a fallback:\n\n >>> p,q = symbols('p q', cls=Dummy) # general indices\n >>> expr = f(p,q)\n >>> substitute_dummies(expr, new_indices=True, pretty_indices=my_dummies)\n f(_p_0, _p_1)\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/physics/tests/test_secondquant.py::test_index_permutations_with_dummies", "sympy/physics/tests/test_secondquant.py::test_substitute_dummies_without_dummies", "sympy/physics/tests/test_secondquant.py::test_substitute_dummies_NO_operator", "sympy/physics/tests/test_secondquant.py::test_substitute_dummies_SQ_operator", "sympy/physics/tests/test_secondquant.py::test_substitute_dummies_new_indices", "sympy/physics/tests/test_secondquant.py::test_substitute_dummies_substitution_order", "sympy/physics/tests/test_secondquant.py::test_dummy_order_inner_outer_lines_VT1T1T1", "sympy/physics/tests/test_secondquant.py::test_dummy_order_inner_outer_lines_VT1T1T1T1", "sympy/physics/tests/test_secondquant.py::test_equivalent_internal_lines_VT1T1", "sympy/physics/tests/test_secondquant.py::test_equivalent_internal_lines_VT2conjT2", "sympy/physics/tests/test_secondquant.py::test_equivalent_internal_lines_VT2conjT2_ambiguous_order", "sympy/physics/tests/test_secondquant.py::test_equivalent_internal_lines_VT2", "sympy/physics/tests/test_secondquant.py::test_internal_external_VT2T2", "sympy/physics/tests/test_secondquant.py::test_internal_external_pqrs", "sympy/physics/tests/test_secondquant.py::test_dummy_order_ambiguous", "sympy/physics/tests/test_secondquant.py::test_dummy_order_inner_outer_lines_VT1T1T1_AT", "sympy/physics/tests/test_secondquant.py::test_dummy_order_inner_outer_lines_VT1T1T1T1_AT", "sympy/physics/tests/test_secondquant.py::test_equivalent_internal_lines_VT1T1_AT", "sympy/physics/tests/test_secondquant.py::test_equivalent_internal_lines_VT2conjT2_AT", "sympy/physics/tests/test_secondquant.py::test_equivalent_internal_lines_VT2conjT2_ambiguous_order_AT", "sympy/physics/tests/test_secondquant.py::test_equivalent_internal_lines_VT2_AT", "sympy/physics/tests/test_secondquant.py::test_internal_external_VT2T2_AT", "sympy/physics/tests/test_secondquant.py::test_internal_external_pqrs_AT" ], "PASS_TO_PASS": null }
sympy__sympy-94
1.0
{ "code": "diff --git b/sympy/core/sympify.py a/sympy/core/sympify.py\nindex 15c0641291..c849462799 100644\n--- b/sympy/core/sympify.py\n+++ a/sympy/core/sympify.py\n@@ -363,6 +363,126 @@ def sympify(a, locals=None, convert_xor=True, strict=False, rational=False,\n and the result will be returned.\n \n \"\"\"\n+ # XXX: If a is a Basic subclass rather than instance (e.g. sin rather than\n+ # sin(x)) then a.__sympy__ will be the property. Only on the instance will\n+ # a.__sympy__ give the *value* of the property (True). Since sympify(sin)\n+ # was used for a long time we allow it to pass. However if strict=True as\n+ # is the case in internal calls to _sympify then we only allow\n+ # is_sympy=True.\n+ #\n+ # https://github.com/sympy/sympy/issues/20124\n+ is_sympy = getattr(a, '__sympy__', None)\n+ if is_sympy is True:\n+ return a\n+ elif is_sympy is not None:\n+ if not strict:\n+ return a\n+ else:\n+ raise SympifyError(a)\n+\n+ if isinstance(a, CantSympify):\n+ raise SympifyError(a)\n+\n+ cls = getattr(a, \"__class__\", None)\n+\n+ #Check if there exists a converter for any of the types in the mro\n+ for superclass in getmro(cls):\n+ #First check for user defined converters\n+ conv = _external_converter.get(superclass)\n+ if conv is None:\n+ #if none exists, check for SymPy defined converters\n+ conv = _sympy_converter.get(superclass)\n+ if conv is not None:\n+ return conv(a)\n+\n+ if cls is type(None):\n+ if strict:\n+ raise SympifyError(a)\n+ else:\n+ return a\n+\n+ if evaluate is None:\n+ evaluate = global_parameters.evaluate\n+\n+ # Support for basic numpy datatypes\n+ if _is_numpy_instance(a):\n+ import numpy as np\n+ if np.isscalar(a):\n+ return _convert_numpy_types(a, locals=locals,\n+ convert_xor=convert_xor, strict=strict, rational=rational,\n+ evaluate=evaluate)\n+\n+ _sympy_ = getattr(a, \"_sympy_\", None)\n+ if _sympy_ is not None:\n+ return a._sympy_()\n+\n+ if not strict:\n+ # Put numpy array conversion _before_ float/int, see\n+ # <https://github.com/sympy/sympy/issues/13924>.\n+ flat = getattr(a, \"flat\", None)\n+ if flat is not None:\n+ shape = getattr(a, \"shape\", None)\n+ if shape is not None:\n+ from sympy.tensor.array import Array\n+ return Array(a.flat, a.shape) # works with e.g. NumPy arrays\n+\n+ if not isinstance(a, str):\n+ if _is_numpy_instance(a):\n+ import numpy as np\n+ assert not isinstance(a, np.number)\n+ if isinstance(a, np.ndarray):\n+ # Scalar arrays (those with zero dimensions) have sympify\n+ # called on the scalar element.\n+ if a.ndim == 0:\n+ try:\n+ return sympify(a.item(),\n+ locals=locals,\n+ convert_xor=convert_xor,\n+ strict=strict,\n+ rational=rational,\n+ evaluate=evaluate)\n+ except SympifyError:\n+ pass\n+ elif hasattr(a, '__float__'):\n+ # float and int can coerce size-one numpy arrays to their lone\n+ # element. See issue https://github.com/numpy/numpy/issues/10404.\n+ return sympify(float(a))\n+ elif hasattr(a, '__int__'):\n+ return sympify(int(a))\n+\n+ if strict:\n+ raise SympifyError(a)\n+\n+ if iterable(a):\n+ try:\n+ return type(a)([sympify(x, locals=locals, convert_xor=convert_xor,\n+ rational=rational, evaluate=evaluate) for x in a])\n+ except TypeError:\n+ # Not all iterables are rebuildable with their type.\n+ pass\n+\n+ if not isinstance(a, str):\n+ raise SympifyError('cannot sympify object of type %r' % type(a))\n+\n+ from sympy.parsing.sympy_parser import (parse_expr, TokenError,\n+ standard_transformations)\n+ from sympy.parsing.sympy_parser import convert_xor as t_convert_xor\n+ from sympy.parsing.sympy_parser import rationalize as t_rationalize\n+\n+ transformations = standard_transformations\n+\n+ if rational:\n+ transformations += (t_rationalize,)\n+ if convert_xor:\n+ transformations += (t_convert_xor,)\n+\n+ try:\n+ a = a.replace('\\n', '')\n+ expr = parse_expr(a, local_dict=locals, transformations=transformations, evaluate=evaluate)\n+ except (TokenError, SyntaxError) as exc:\n+ raise SympifyError('could not parse %r' % a, exc)\n+\n+ return expr\n \n \n def _sympify(a):\n", "test": null }
null
{ "code": "diff --git a/sympy/core/sympify.py b/sympy/core/sympify.py\nindex c849462799..15c0641291 100644\n--- a/sympy/core/sympify.py\n+++ b/sympy/core/sympify.py\n@@ -363,126 +363,6 @@ def sympify(a, locals=None, convert_xor=True, strict=False, rational=False,\n and the result will be returned.\n \n \"\"\"\n- # XXX: If a is a Basic subclass rather than instance (e.g. sin rather than\n- # sin(x)) then a.__sympy__ will be the property. Only on the instance will\n- # a.__sympy__ give the *value* of the property (True). Since sympify(sin)\n- # was used for a long time we allow it to pass. However if strict=True as\n- # is the case in internal calls to _sympify then we only allow\n- # is_sympy=True.\n- #\n- # https://github.com/sympy/sympy/issues/20124\n- is_sympy = getattr(a, '__sympy__', None)\n- if is_sympy is True:\n- return a\n- elif is_sympy is not None:\n- if not strict:\n- return a\n- else:\n- raise SympifyError(a)\n-\n- if isinstance(a, CantSympify):\n- raise SympifyError(a)\n-\n- cls = getattr(a, \"__class__\", None)\n-\n- #Check if there exists a converter for any of the types in the mro\n- for superclass in getmro(cls):\n- #First check for user defined converters\n- conv = _external_converter.get(superclass)\n- if conv is None:\n- #if none exists, check for SymPy defined converters\n- conv = _sympy_converter.get(superclass)\n- if conv is not None:\n- return conv(a)\n-\n- if cls is type(None):\n- if strict:\n- raise SympifyError(a)\n- else:\n- return a\n-\n- if evaluate is None:\n- evaluate = global_parameters.evaluate\n-\n- # Support for basic numpy datatypes\n- if _is_numpy_instance(a):\n- import numpy as np\n- if np.isscalar(a):\n- return _convert_numpy_types(a, locals=locals,\n- convert_xor=convert_xor, strict=strict, rational=rational,\n- evaluate=evaluate)\n-\n- _sympy_ = getattr(a, \"_sympy_\", None)\n- if _sympy_ is not None:\n- return a._sympy_()\n-\n- if not strict:\n- # Put numpy array conversion _before_ float/int, see\n- # <https://github.com/sympy/sympy/issues/13924>.\n- flat = getattr(a, \"flat\", None)\n- if flat is not None:\n- shape = getattr(a, \"shape\", None)\n- if shape is not None:\n- from sympy.tensor.array import Array\n- return Array(a.flat, a.shape) # works with e.g. NumPy arrays\n-\n- if not isinstance(a, str):\n- if _is_numpy_instance(a):\n- import numpy as np\n- assert not isinstance(a, np.number)\n- if isinstance(a, np.ndarray):\n- # Scalar arrays (those with zero dimensions) have sympify\n- # called on the scalar element.\n- if a.ndim == 0:\n- try:\n- return sympify(a.item(),\n- locals=locals,\n- convert_xor=convert_xor,\n- strict=strict,\n- rational=rational,\n- evaluate=evaluate)\n- except SympifyError:\n- pass\n- elif hasattr(a, '__float__'):\n- # float and int can coerce size-one numpy arrays to their lone\n- # element. See issue https://github.com/numpy/numpy/issues/10404.\n- return sympify(float(a))\n- elif hasattr(a, '__int__'):\n- return sympify(int(a))\n-\n- if strict:\n- raise SympifyError(a)\n-\n- if iterable(a):\n- try:\n- return type(a)([sympify(x, locals=locals, convert_xor=convert_xor,\n- rational=rational, evaluate=evaluate) for x in a])\n- except TypeError:\n- # Not all iterables are rebuildable with their type.\n- pass\n-\n- if not isinstance(a, str):\n- raise SympifyError('cannot sympify object of type %r' % type(a))\n-\n- from sympy.parsing.sympy_parser import (parse_expr, TokenError,\n- standard_transformations)\n- from sympy.parsing.sympy_parser import convert_xor as t_convert_xor\n- from sympy.parsing.sympy_parser import rationalize as t_rationalize\n-\n- transformations = standard_transformations\n-\n- if rational:\n- transformations += (t_rationalize,)\n- if convert_xor:\n- transformations += (t_convert_xor,)\n-\n- try:\n- a = a.replace('\\n', '')\n- expr = parse_expr(a, local_dict=locals, transformations=transformations, evaluate=evaluate)\n- except (TokenError, SyntaxError) as exc:\n- raise SympifyError('could not parse %r' % a, exc)\n-\n- return expr\n \n \n def _sympify(a):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/core/sympify.py.\nHere is the description for the function:\ndef sympify(a, locals=None, convert_xor=True, strict=False, rational=False,\n evaluate=None):\n \"\"\"\n Converts an arbitrary expression to a type that can be used inside SymPy.\n\n Explanation\n ===========\n\n It will convert Python ints into instances of :class:`~.Integer`, floats\n into instances of :class:`~.Float`, etc. It is also able to coerce\n symbolic expressions which inherit from :class:`~.Basic`. This can be\n useful in cooperation with SAGE.\n\n .. warning::\n Note that this function uses ``eval``, and thus shouldn't be used on\n unsanitized input.\n\n If the argument is already a type that SymPy understands, it will do\n nothing but return that value. This can be used at the beginning of a\n function to ensure you are working with the correct type.\n\n Examples\n ========\n\n >>> from sympy import sympify\n\n >>> sympify(2).is_integer\n True\n >>> sympify(2).is_real\n True\n\n >>> sympify(2.0).is_real\n True\n >>> sympify(\"2.0\").is_real\n True\n >>> sympify(\"2e-45\").is_real\n True\n\n If the expression could not be converted, a SympifyError is raised.\n\n >>> sympify(\"x***2\")\n Traceback (most recent call last):\n ...\n SympifyError: SympifyError: \"could not parse 'x***2'\"\n\n When attempting to parse non-Python syntax using ``sympify``, it raises a\n ``SympifyError``:\n\n >>> sympify(\"2x+1\")\n Traceback (most recent call last):\n ...\n SympifyError: Sympify of expression 'could not parse '2x+1'' failed\n\n To parse non-Python syntax, use ``parse_expr`` from ``sympy.parsing.sympy_parser``.\n\n >>> from sympy.parsing.sympy_parser import parse_expr\n >>> parse_expr(\"2x+1\", transformations=\"all\")\n 2*x + 1\n\n For more details about ``transformations``: see :func:`~sympy.parsing.sympy_parser.parse_expr`\n\n Locals\n ------\n\n The sympification happens with access to everything that is loaded\n by ``from sympy import *``; anything used in a string that is not\n defined by that import will be converted to a symbol. In the following,\n the ``bitcount`` function is treated as a symbol and the ``O`` is\n interpreted as the :class:`~.Order` object (used with series) and it raises\n an error when used improperly:\n\n >>> s = 'bitcount(42)'\n >>> sympify(s)\n bitcount(42)\n >>> sympify(\"O(x)\")\n O(x)\n >>> sympify(\"O + 1\")\n Traceback (most recent call last):\n ...\n TypeError: unbound method...\n\n In order to have ``bitcount`` be recognized it can be imported into a\n namespace dictionary and passed as locals:\n\n >>> ns = {}\n >>> exec('from sympy.core.evalf import bitcount', ns)\n >>> sympify(s, locals=ns)\n 6\n\n In order to have the ``O`` interpreted as a Symbol, identify it as such\n in the namespace dictionary. This can be done in a variety of ways; all\n three of the following are possibilities:\n\n >>> from sympy import Symbol\n >>> ns[\"O\"] = Symbol(\"O\") # method 1\n >>> exec('from sympy.abc import O', ns) # method 2\n >>> ns.update(dict(O=Symbol(\"O\"))) # method 3\n >>> sympify(\"O + 1\", locals=ns)\n O + 1\n\n If you want *all* single-letter and Greek-letter variables to be symbols\n then you can use the clashing-symbols dictionaries that have been defined\n there as private variables: ``_clash1`` (single-letter variables),\n ``_clash2`` (the multi-letter Greek names) or ``_clash`` (both single and\n multi-letter names that are defined in ``abc``).\n\n >>> from sympy.abc import _clash1\n >>> set(_clash1) # if this fails, see issue #23903\n {'E', 'I', 'N', 'O', 'Q', 'S'}\n >>> sympify('I & Q', _clash1)\n I & Q\n\n Strict\n ------\n\n If the option ``strict`` is set to ``True``, only the types for which an\n explicit conversion has been defined are converted. In the other\n cases, a SympifyError is raised.\n\n >>> print(sympify(None))\n None\n >>> sympify(None, strict=True)\n Traceback (most recent call last):\n ...\n SympifyError: SympifyError: None\n\n .. deprecated:: 1.6\n\n ``sympify(obj)`` automatically falls back to ``str(obj)`` when all\n other conversion methods fail, but this is deprecated. ``strict=True``\n will disable this deprecated behavior. See\n :ref:`deprecated-sympify-string-fallback`.\n\n Evaluation\n ----------\n\n If the option ``evaluate`` is set to ``False``, then arithmetic and\n operators will be converted into their SymPy equivalents and the\n ``evaluate=False`` option will be added. Nested ``Add`` or ``Mul`` will\n be denested first. This is done via an AST transformation that replaces\n operators with their SymPy equivalents, so if an operand redefines any\n of those operations, the redefined operators will not be used. If\n argument a is not a string, the mathematical expression is evaluated\n before being passed to sympify, so adding ``evaluate=False`` will still\n return the evaluated result of expression.\n\n >>> sympify('2**2 / 3 + 5')\n 19/3\n >>> sympify('2**2 / 3 + 5', evaluate=False)\n 2**2/3 + 5\n >>> sympify('4/2+7', evaluate=True)\n 9\n >>> sympify('4/2+7', evaluate=False)\n 4/2 + 7\n >>> sympify(4/2+7, evaluate=False)\n 9.00000000000000\n\n Extending\n ---------\n\n To extend ``sympify`` to convert custom objects (not derived from ``Basic``),\n just define a ``_sympy_`` method to your class. You can do that even to\n classes that you do not own by subclassing or adding the method at runtime.\n\n >>> from sympy import Matrix\n >>> class MyList1(object):\n ... def __iter__(self):\n ... yield 1\n ... yield 2\n ... return\n ... def __getitem__(self, i): return list(self)[i]\n ... def _sympy_(self): return Matrix(self)\n >>> sympify(MyList1())\n Matrix([\n [1],\n [2]])\n\n If you do not have control over the class definition you could also use the\n ``converter`` global dictionary. The key is the class and the value is a\n function that takes a single argument and returns the desired SymPy\n object, e.g. ``converter[MyList] = lambda x: Matrix(x)``.\n\n >>> class MyList2(object): # XXX Do not do this if you control the class!\n ... def __iter__(self): # Use _sympy_!\n ... yield 1\n ... yield 2\n ... return\n ... def __getitem__(self, i): return list(self)[i]\n >>> from sympy.core.sympify import converter\n >>> converter[MyList2] = lambda x: Matrix(x)\n >>> sympify(MyList2())\n Matrix([\n [1],\n [2]])\n\n Notes\n =====\n\n The keywords ``rational`` and ``convert_xor`` are only used\n when the input is a string.\n\n convert_xor\n -----------\n\n >>> sympify('x^y',convert_xor=True)\n x**y\n >>> sympify('x^y',convert_xor=False)\n x ^ y\n\n rational\n --------\n\n >>> sympify('0.1',rational=False)\n 0.1\n >>> sympify('0.1',rational=True)\n 1/10\n\n Sometimes autosimplification during sympification results in expressions\n that are very different in structure than what was entered. Until such\n autosimplification is no longer done, the ``kernS`` function might be of\n some use. In the example below you can see how an expression reduces to\n $-1$ by autosimplification, but does not do so when ``kernS`` is used.\n\n >>> from sympy.core.sympify import kernS\n >>> from sympy.abc import x\n >>> -2*(-(-x + 1/x)/(x*(x - 1/x)**2) - 1/(x*(x - 1/x))) - 1\n -1\n >>> s = '-2*(-(-x + 1/x)/(x*(x - 1/x)**2) - 1/(x*(x - 1/x))) - 1'\n >>> sympify(s)\n -1\n >>> kernS(s)\n -2*(-(-x + 1/x)/(x*(x - 1/x)**2) - 1/(x*(x - 1/x))) - 1\n\n Parameters\n ==========\n\n a :\n - any object defined in SymPy\n - standard numeric Python types: ``int``, ``long``, ``float``, ``Decimal``\n - strings (like ``\"0.09\"``, ``\"2e-19\"`` or ``'sin(x)'``)\n - booleans, including ``None`` (will leave ``None`` unchanged)\n - dicts, lists, sets or tuples containing any of the above\n\n convert_xor : bool, optional\n If true, treats ``^`` as exponentiation.\n If False, treats ``^`` as XOR itself.\n Used only when input is a string.\n\n locals : any object defined in SymPy, optional\n In order to have strings be recognized it can be imported\n into a namespace dictionary and passed as locals.\n\n strict : bool, optional\n If the option strict is set to ``True``, only the types for which\n an explicit conversion has been defined are converted. In the\n other cases, a SympifyError is raised.\n\n rational : bool, optional\n If ``True``, converts floats into :class:`~.Rational`.\n If ``False``, it lets floats remain as it is.\n Used only when input is a string.\n\n evaluate : bool, optional\n If False, then arithmetic and operators will be converted into\n their SymPy equivalents. If True the expression will be evaluated\n and the result will be returned.\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "assumptions/tests/test_matrices.py::test_invertible_fullrank", "assumptions/tests/test_matrices.py::test_non_trivial_implies", "assumptions/tests/test_query.py::test_bounded_xfail", "assumptions/tests/test_query.py::test_evenness_in_ternary_integer_product_with_odd", "assumptions/tests/test_query.py::test_oddness_in_ternary_integer_product_with_odd", "assumptions/tests/test_query.py::test_issue_7246_failing", "assumptions/tests/test_rel_queries.py::test_failing_number_line_properties", "assumptions/tests/test_rel_queries.py::test_equality_failing", "assumptions/tests/test_satask.py::test_invertible", "bin/test_executable.py::test_executable", "bin/test_external_imports.py::test_external_imports", "bin/test_submodule_imports.py::test_submodule_imports", "calculus/tests/test_accumulationbounds.py::test_AccumBounds_powf", "calculus/tests/test_util.py::test_continuous_domain_acot", "calculus/tests/test_util.py::test_continuous_domain_gamma", "calculus/tests/test_util.py::test_continuous_domain_neg_power", "codegen/tests/test_algorithms.py::test_newtons_method_function__ccode", "codegen/tests/test_algorithms.py::test_newtons_method_function__fcode", "codegen/tests/test_algorithms.py::test_newtons_method_function__ccode_parameters", "codegen/tests/test_applications.py::test_copying_function", "codegen/tests/test_fnodes.py::test_size_assumed_shape", "codegen/tests/test_fnodes.py::test_ImpliedDoLoop", "codegen/tests/test_fnodes.py::test_Program", "codegen/tests/test_fnodes.py::test_Module", "codegen/tests/test_fnodes.py::test_Subroutine", "codegen/tests/test_fnodes.py::test_bind_C", "codegen/tests/test_matrix_nodes.py::test_matrix_solve_derivative_numpy", "codegen/tests/test_rewriting.py::test_optims_numpy_TODO", "codegen/tests/test_rewriting.py::test_compiled_ccode_with_rewriting", "combinatorics/tests/test_perm_groups.py::test_rubik", "combinatorics/tests/test_perm_groups.py::test_subgroup_search2", "combinatorics/tests/test_tensor_can.py::test_riemann_invariants1", "concrete/tests/test_sums_products.py::test_evalf_fast_series", "concrete/tests/test_sums_products.py::test_evalf_fast_series_issue_4021", "concrete/tests/test_sums_products.py::test_evalf_slow_series", "concrete/tests/test_sums_products.py::test_telescopic_sums", "concrete/tests/test_sums_products.py::test_convergent_failing", "concrete/tests/test_sums_products.py::test_matrixsymbol_summation_symbolic_limits", "core/tests/test_args.py::test_all_classes_are_tested", "core/tests/test_args.py::test_sympy__assumptions__assume__Predicate", "core/tests/test_args.py::test_sympy__assumptions__relation__binrel__BinaryRelation", "core/tests/test_args.py::test_sympy__codegen__ast__CodegenAST", "core/tests/test_args.py::test_sympy__codegen__ast__AssignmentBase", "core/tests/test_args.py::test_sympy__codegen__ast__AugmentedAssignment", "core/tests/test_args.py::test_sympy__concrete__expr_with_limits__ExprWithLimits", "core/tests/test_args.py::test_sympy__concrete__expr_with_limits__AddWithLimits", "core/tests/test_args.py::test_sympy__concrete__expr_with_intlimits__ExprWithIntLimits", "core/tests/test_args.py::test_sympy__core__function__Function", "core/tests/test_args.py::test_sympy__core__numbers__IntegerConstant", "core/tests/test_args.py::test_sympy__core__numbers__RationalConstant", "core/tests/test_args.py::test_sympy__core__operations__AssocOp", "core/tests/test_args.py::test_sympy__core__operations__LatticeOp", "core/tests/test_args.py::test_sympy__core__relational__Relational", "core/tests/test_args.py::test_sympy__sets__sets__Set", "core/tests/test_args.py::test_sympy__stats__rv__Distribution", "core/tests/test_args.py::test_sympy__stats__crv__SingleContinuousDistribution", "core/tests/test_args.py::test_sympy__stats__drv__SingleDiscreteDistribution", "core/tests/test_args.py::test_sympy__stats__drv__DiscreteDistribution", "core/tests/test_args.py::test_sympy__stats__drv__DiscreteDomain", "core/tests/test_args.py::test_sympy__stats__rv__SinglePSpace", "core/tests/test_args.py::test_sympy__stats__rv__ProductPSpace", "core/tests/test_args.py::test_sympy__stats__frv__SingleFiniteDistribution", "core/tests/test_args.py::test_sympy__stats__crv__ContinuousDistribution", "core/tests/test_args.py::test_sympy__functions__combinatorial__factorials__CombinatorialFunction", "core/tests/test_args.py::test_sympy__functions__elementary__exponential__ExpBase", "core/tests/test_args.py::test_sympy__functions__elementary__hyperbolic__HyperbolicFunction", "core/tests/test_args.py::test_sympy__functions__elementary__hyperbolic__ReciprocalHyperbolicFunction", "core/tests/test_args.py::test_sympy__functions__elementary__hyperbolic__InverseHyperbolicFunction", "core/tests/test_args.py::test_sympy__functions__elementary__integers__RoundFunction", "core/tests/test_args.py::test_sympy__functions__elementary__miscellaneous__MinMaxBase", "core/tests/test_args.py::test_sympy__functions__elementary__trigonometric__TrigonometricFunction", "core/tests/test_args.py::test_sympy__functions__elementary__trigonometric__ReciprocalTrigonometricFunction", "core/tests/test_args.py::test_sympy__functions__elementary__trigonometric__InverseTrigonometricFunction", "core/tests/test_args.py::test_sympy__functions__special__bessel__BesselBase", "core/tests/test_args.py::test_sympy__functions__special__bessel__SphericalBesselBase", "core/tests/test_args.py::test_sympy__functions__special__bessel__SphericalHankelBase", "core/tests/test_args.py::test_sympy__functions__special__error_functions__FresnelIntegral", "core/tests/test_args.py::test_sympy__functions__special__error_functions__TrigonometricIntegral", "core/tests/test_args.py::test_sympy__functions__special__hyper__TupleParametersBase", "core/tests/test_args.py::test_sympy__functions__special__hyper__TupleArg", "core/tests/test_args.py::test_sympy__functions__special__hyper__HyperRep", "core/tests/test_args.py::test_sympy__functions__special__polynomials__OrthogonalPolynomial", "core/tests/test_args.py::test_sympy__integrals__transforms__IntegralTransform", "core/tests/test_args.py::test_sympy__integrals__transforms__FourierTypeTransform", "core/tests/test_args.py::test_sympy__integrals__transforms__SineCosineTypeTransform", "core/tests/test_args.py::test_sympy__integrals__transforms__HankelTypeTransform", "core/tests/test_args.py::test_sympy__logic__boolalg__Boolean", "core/tests/test_args.py::test_sympy__logic__boolalg__BooleanAtom", "core/tests/test_args.py::test_sympy__matrices__expressions__matexpr__MatrixBase", "core/tests/test_args.py::test_sympy__matrices__immutable__ImmutableRepMatrix", "core/tests/test_args.py::test_sympy__matrices__expressions__matexpr__MatrixExpr", "core/tests/test_args.py::test_sympy__matrices__expressions__factorizations__Factorization", "core/tests/test_args.py::test_sympy__physics__biomechanics__curve__CharacteristicCurveFunction", "core/tests/test_args.py::test_sympy__physics__quantum__shor__CMod", "core/tests/test_args.py::test_sympy__physics__secondquant__Annihilator", "core/tests/test_args.py::test_sympy__physics__secondquant__BosonicOperator", "core/tests/test_args.py::test_sympy__physics__secondquant__Creator", "core/tests/test_args.py::test_sympy__polys__rootoftools__RootOf", "core/tests/test_args.py::test_sympy__series__sequences__SeqBase", "core/tests/test_args.py::test_sympy__series__sequences__SeqExpr", "core/tests/test_args.py::test_sympy__series__series_class__SeriesBase", "core/tests/test_args.py::test_sympy__series__formal__FiniteFormalPowerSeries", "core/tests/test_args.py::test_sympy__tensor__array__ndim_array__ImmutableNDimArray", "core/tests/test_args.py::test_sympy__tensor__tensor__TensorType", "core/tests/test_args.py::test_sympy__tensor__tensor__TensExpr", "core/tests/test_args.py::test_sympy__geometry__line__LinearEntity", "core/tests/test_args.py::test_sympy__geometry__line__LinearEntity2D", "core/tests/test_args.py::test_sympy__geometry__line__LinearEntity3D", "core/tests/test_args.py::test_sympy__geometry__entity__GeometrySet", "core/tests/test_args.py::test_sympy__categories__baseclasses__Morphism", "core/tests/test_arit.py::test_evenness_in_ternary_integer_product_with_odd", "core/tests/test_arit.py::test_oddness_in_ternary_integer_product_with_odd", "core/tests/test_assumptions.py::test_symbol_infinitereal_mul", "core/tests/test_assumptions.py::test_neg_symbol_falsenonnegative", "core/tests/test_assumptions.py::test_issue_6275", "core/tests/test_assumptions.py::test_issue_7993", "core/tests/test_constructor_postprocessor.py::test_subexpression_postprocessors", "core/tests/test_eval.py::test_pow_eval_X1", "core/tests/test_evalf.py::test_evalf_complex_bug", "core/tests/test_evalf.py::test_evalf_complex_powers_bug", "core/tests/test_evalf.py::test_evalf_sum", "core/tests/test_evalf.py::test_evalf_divergent_series", "core/tests/test_expr.py::test_call_2", "core/tests/test_expr.py::test_float_0_fail", "core/tests/test_function.py::test_Subs2", "core/tests/test_match.py::test_functions_X1", "core/tests/test_match.py::test_issue_4883", "core/tests/test_noncommutative.py::test_collect", "core/tests/test_noncommutative.py::test_ratsimp", "core/tests/test_noncommutative.py::test_rcollect", "core/tests/test_numbers.py::test_mpmath_issues", "core/tests/test_numbers.py::test_numpy_to_float", "core/tests/test_relational.py::test_multivariate_relational_as_set", "core/tests/test_relational.py::test_issue_8444_nonworkingtests", "core/tests/test_subs.py::test_mul2", "core/tests/test_sympify.py::test_issue_16772", "core/tests/test_sympify.py::test_issue_19399", "core/tests/test_sympify.py::test_issue_10295", "core/tests/test_sympify.py::test_sympify_numpy", "core/tests/test_sympify.py::test_sympify_rational_numbers_set", "core/tests/test_sympify.py::test_issue_13924", "core/tests/test_sympify.py::test_numpy_sympify_args", "core/tests/test_sympify.py::test_issue_14706", "external/tests/test_autowrap.py::test_issue_15230", "external/tests/test_autowrap.py::test_wrap_twice_f95_f2py", "external/tests/test_autowrap.py::test_autowrap_trace_f95_f2py", "external/tests/test_autowrap.py::test_autowrap_matrix_vector_f95_f2py", "external/tests/test_autowrap.py::test_autowrap_matrix_matrix_f95_f2py", "external/tests/test_autowrap.py::test_ufuncify_f95_f2py", "external/tests/test_autowrap.py::test_issue_15337_f95_f2py", "external/tests/test_autowrap.py::test_wrap_twice_c_cython", "external/tests/test_autowrap.py::test_autowrap_trace_C_Cython", "external/tests/test_autowrap.py::test_autowrap_matrix_vector_C_cython", "external/tests/test_autowrap.py::test_autowrap_matrix_matrix_C_cython", "external/tests/test_autowrap.py::test_ufuncify_C_Cython", "external/tests/test_autowrap.py::test_issue_10274_C_cython", "external/tests/test_autowrap.py::test_issue_15337_C_cython", "external/tests/test_autowrap.py::test_autowrap_custom_printer", "external/tests/test_autowrap.py::test_ufuncify_numpy", "external/tests/test_codegen.py::test_C89_cc", "external/tests/test_codegen.py::test_C99_cc", "external/tests/test_codegen.py::test_F95_ifort", "external/tests/test_codegen.py::test_F95_gfortran", "external/tests/test_codegen.py::test_F95_g95", "external/tests/test_numpy.py::test_systematic_basic", "external/tests/test_numpy.py::test_basics", "external/tests/test_numpy.py::test_arrays", "external/tests/test_numpy.py::test_conversion1", "external/tests/test_numpy.py::test_conversion2", "external/tests/test_numpy.py::test_list2numpy", "external/tests/test_numpy.py::test_Matrix1", "external/tests/test_numpy.py::test_Matrix2", "external/tests/test_numpy.py::test_Matrix3", "external/tests/test_numpy.py::test_Matrix4", "external/tests/test_numpy.py::test_Matrix_sum", "external/tests/test_numpy.py::test_Matrix_mul", "external/tests/test_numpy.py::test_Matrix_array", "external/tests/test_numpy.py::test_matrix2numpy", "external/tests/test_numpy.py::test_matrix2numpy_conversion", "external/tests/test_numpy.py::test_issue_3728", "external/tests/test_numpy.py::test_lambdify", "external/tests/test_numpy.py::test_lambdify_matrix", "external/tests/test_numpy.py::test_lambdify_matrix_multi_input", "external/tests/test_numpy.py::test_lambdify_matrix_vec_input", "external/tests/test_numpy.py::test_lambdify_transl", "external/tests/test_numpy.py::test_symarray", "external/tests/test_numpy.py::test_vectorize", "external/tests/test_scipy.py::test_jn_zeros", "functions/combinatorial/tests/test_comb_factorials.py::test_rf_lambdify_mpmath", "functions/combinatorial/tests/test_comb_factorials.py::test_factorial_simplify_fail", "functions/combinatorial/tests/test_comb_numbers.py::test_bell", "functions/elementary/tests/test_complexes.py::test_sign_issue_3068", "functions/elementary/tests/test_complexes.py::test_principal_branch_fail", "functions/elementary/tests/test_complexes.py::test_issue_6167_6151", "functions/elementary/tests/test_exponential.py::test_log_expand_fail", "functions/elementary/tests/test_exponential.py::test_log_product_simplify_to_sum", "functions/elementary/tests/test_integers.py::test_issue_4149", "functions/elementary/tests/test_miscellaneous.py::test_issue_11463", "functions/elementary/tests/test_piecewise.py::test_piecewise_lambdify", "functions/elementary/tests/test_trigonometric.py::test_tan_cot_sin_cos_ratsimp", "functions/elementary/tests/test_trigonometric.py::test_sin_cos_with_infinity", "integrals/tests/test_failing_integrals.py::test_issue_3880", "integrals/tests/test_failing_integrals.py::test_issue_4212", "integrals/tests/test_failing_integrals.py::test_integrate_DiracDelta_fails", "integrals/tests/test_failing_integrals.py::test_issue_4525", "integrals/tests/test_failing_integrals.py::test_issue_4540", "integrals/tests/test_failing_integrals.py::test_issue_4891", "integrals/tests/test_failing_integrals.py::test_issue_1796a", "integrals/tests/test_failing_integrals.py::test_issue_4895b", "integrals/tests/test_failing_integrals.py::test_issue_4895c", "integrals/tests/test_failing_integrals.py::test_issue_4895d", "integrals/tests/test_failing_integrals.py::test_issue_4941", "integrals/tests/test_failing_integrals.py::test_issue_4992", "integrals/tests/test_failing_integrals.py::test_issue_16396a", "integrals/tests/test_failing_integrals.py::test_issue_16396b", "integrals/tests/test_failing_integrals.py::test_issue_16046", "integrals/tests/test_failing_integrals.py::test_issue_15925a", "integrals/tests/test_failing_integrals.py::test_issue_15925b_manual", "integrals/tests/test_failing_integrals.py::test_issue_15227", "integrals/tests/test_failing_integrals.py::test_issue_14716", "integrals/tests/test_failing_integrals.py::test_issue_14709a", "integrals/tests/test_failing_integrals.py::test_issue_14398", "integrals/tests/test_failing_integrals.py::test_issue_14074", "integrals/tests/test_failing_integrals.py::test_issue_14078b", "integrals/tests/test_failing_integrals.py::test_issue_13792", "integrals/tests/test_failing_integrals.py::test_issue_11845a", "integrals/tests/test_failing_integrals.py::test_issue_11845b", "integrals/tests/test_failing_integrals.py::test_issue_11813", "integrals/tests/test_failing_integrals.py::test_issue_11254c", "integrals/tests/test_failing_integrals.py::test_issue_10584", "integrals/tests/test_failing_integrals.py::test_issue_9101", "integrals/tests/test_failing_integrals.py::test_issue_7147", "integrals/tests/test_failing_integrals.py::test_issue_7109", "integrals/tests/test_failing_integrals.py::test_integrate_Piecewise_rational_over_reals", "integrals/tests/test_failing_integrals.py::test_issue_4311_slow", "integrals/tests/test_failing_integrals.py::test_issue_20370", "integrals/tests/test_failing_integrals.py::test_polylog", "integrals/tests/test_failing_integrals.py::test_polylog_manual", "integrals/tests/test_heurisch.py::test_heurisch_function_derivative", "integrals/tests/test_transforms.py::test_mellin_transform_fail", "interactive/tests/test_ipython.py::test_automatic_symbols", "interactive/tests/test_ipython.py::test_int_to_Integer", "interactive/tests/test_ipython.py::test_ipythonprinting", "interactive/tests/test_ipython.py::test_print_builtin_option", "interactive/tests/test_ipython.py::test_builtin_containers", "interactive/tests/test_ipython.py::test_matplotlib_bad_latex", "interactive/tests/test_ipython.py::test_override_repr_latex", "logic/tests/test_boolalg.py::test_multivariate_bool_as_set", "logic/tests/test_inference.py::test_literal", "logic/tests/test_inference.py::test_z3", "logic/tests/test_inference.py::test_z3_vs_lra_dpll2", "logic/tests/test_lra_theory.py::test_random_problems", "logic/tests/test_lra_theory.py::test_pos_neg_zero", "logic/tests/test_lra_theory.py::test_pos_neg_infinite", "logic/tests/test_lra_theory.py::test_infinite_strict_inequalities", "matrices/expressions/tests/test_indexing.py::test_block_index_symbolic_fail", "matrices/expressions/tests/test_matadd.py::test_matrix_Add_with_scalar", "matrices/expressions/tests/test_matexpr.py::test_factor_expand", "matrices/expressions/tests/test_matexpr.py::test_numpy_conversion", "matrices/expressions/tests/test_matexpr.py::test_MatAdd_postprocessor_xfail", "matrices/expressions/tests/test_matmul.py::test_matmul_args_cnc_symbols", "matrices/expressions/tests/test_slice.py::test_symmetry", "matrices/tests/test_commonmatrix.py::test_diff", "matrices/tests/test_eigen.py::test_eigen_vects", "matrices/tests/test_matrices.py::test_issue_3979", "matrices/tests/test_matrices.py::test_from_ndarray", "matrices/tests/test_matrices.py::test_17522_numpy", "matrices/tests/test_matrices.py::test_17522_scipy", "matrices/tests/test_matrices.py::test_issue_14943", "matrices/tests/test_matrixbase.py::test_numpy_conversion", "matrices/tests/test_matrixbase.py::test_from_ndarray", "matrices/tests/test_matrixbase.py::test_17522_numpy", "matrices/tests/test_matrixbase.py::test_17522_scipy", "matrices/tests/test_matrixbase.py::test_issue_14943", "parsing/tests/test_autolev.py::test_rule_tests", "parsing/tests/test_autolev.py::test_pydy_examples", "parsing/tests/test_autolev.py::test_output_01", "parsing/tests/test_custom_latex.py::test_custom1", "parsing/tests/test_custom_latex.py::test_custom2", "parsing/tests/test_latex.py::test_parseable", "parsing/tests/test_latex.py::test_not_parseable", "parsing/tests/test_latex.py::test_failing_not_parseable", "parsing/tests/test_latex.py::test_strict_mode", "parsing/tests/test_latex_lark.py::test_symbol_expressions", "parsing/tests/test_latex_lark.py::test_simple_expressions", "parsing/tests/test_latex_lark.py::test_fraction_expressions", "parsing/tests/test_latex_lark.py::test_relation_expressions", "parsing/tests/test_latex_lark.py::test_power_expressions", "parsing/tests/test_latex_lark.py::test_integral_expressions", "parsing/tests/test_latex_lark.py::test_derivative_expressions", "parsing/tests/test_latex_lark.py::test_trigonometric_expressions", "parsing/tests/test_latex_lark.py::test_limit_expressions", "parsing/tests/test_latex_lark.py::test_square_root_expressions", "parsing/tests/test_latex_lark.py::test_factorial_expressions", "parsing/tests/test_latex_lark.py::test_sum_expressions", "parsing/tests/test_latex_lark.py::test_product_expressions", "parsing/tests/test_latex_lark.py::test_applied_function_expressions", "parsing/tests/test_latex_lark.py::test_common_function_expressions", "parsing/tests/test_latex_lark.py::test_spacing", "parsing/tests/test_latex_lark.py::test_binomial_expressions", "parsing/tests/test_latex_lark.py::test_miscellaneous_expressions", "parsing/tests/test_latex_lark.py::test_literal_complex_number_expressions", "parsing/tests/test_latex_lark.py::test_matrix_expressions", "physics/biomechanics/tests/test_curve.py::TestTendonForceLengthDeGroote2016::test_lambdify", "physics/biomechanics/tests/test_curve.py::TestTendonForceLengthDeGroote2016::test_lambdify_numpy", "physics/biomechanics/tests/test_curve.py::TestTendonForceLengthDeGroote2016::test_lambdify_jax", "physics/biomechanics/tests/test_curve.py::TestTendonForceLengthInverseDeGroote2016::test_lambdify", "physics/biomechanics/tests/test_curve.py::TestTendonForceLengthInverseDeGroote2016::test_lambdify_numpy", "physics/biomechanics/tests/test_curve.py::TestTendonForceLengthInverseDeGroote2016::test_lambdify_jax", "physics/biomechanics/tests/test_curve.py::TestFiberForceLengthPassiveDeGroote2016::test_lambdify", "physics/biomechanics/tests/test_curve.py::TestFiberForceLengthPassiveDeGroote2016::test_lambdify_numpy", "physics/biomechanics/tests/test_curve.py::TestFiberForceLengthPassiveDeGroote2016::test_lambdify_jax", "physics/biomechanics/tests/test_curve.py::TestFiberForceLengthPassiveInverseDeGroote2016::test_lambdify", "physics/biomechanics/tests/test_curve.py::TestFiberForceLengthPassiveInverseDeGroote2016::test_lambdify_numpy", "physics/biomechanics/tests/test_curve.py::TestFiberForceLengthPassiveInverseDeGroote2016::test_lambdify_jax", "physics/biomechanics/tests/test_curve.py::TestFiberForceLengthActiveDeGroote2016::test_lambdify", "physics/biomechanics/tests/test_curve.py::TestFiberForceLengthActiveDeGroote2016::test_lambdify_numpy", "physics/biomechanics/tests/test_curve.py::TestFiberForceLengthActiveDeGroote2016::test_lambdify_jax", "physics/biomechanics/tests/test_curve.py::TestFiberForceVelocityDeGroote2016::test_lambdify", "physics/biomechanics/tests/test_curve.py::TestFiberForceVelocityDeGroote2016::test_lambdify_numpy", "physics/biomechanics/tests/test_curve.py::TestFiberForceVelocityDeGroote2016::test_lambdify_jax", "physics/biomechanics/tests/test_curve.py::TestFiberForceVelocityInverseDeGroote2016::test_lambdify", "physics/biomechanics/tests/test_curve.py::TestFiberForceVelocityInverseDeGroote2016::test_lambdify_numpy", "physics/biomechanics/tests/test_curve.py::TestFiberForceVelocityInverseDeGroote2016::test_lambdify_jax", "physics/biomechanics/tests/test_curve.py::TestCharacteristicCurveCollection::test_invalid_constructor_keyword_only", "physics/control/tests/test_control_plots.py::test_errors", "physics/control/tests/test_control_plots.py::test_bode", "physics/control/tests/test_control_plots.py::test_impulse_response", "physics/control/tests/test_control_plots.py::test_step_response", "physics/control/tests/test_control_plots.py::test_ramp_response", "physics/mechanics/tests/test_jointsmethod.py::test_four_bar_linkage_with_manual_constraints", "physics/mechanics/tests/test_kane5.py::test_kane_rolling_disc_lu", "physics/mechanics/tests/test_kane5.py::test_kane_rolling_disc_kdes_callable", "physics/quantum/tests/test_circuitplot.py::test_cnot", "physics/quantum/tests/test_circuitplot.py::test_ex1", "physics/quantum/tests/test_circuitplot.py::test_ex4", "physics/quantum/tests/test_dagger.py::test_numpy_dagger", "physics/quantum/tests/test_dagger.py::test_scipy_sparse_dagger", "physics/quantum/tests/test_identitysearch.py::test_is_scalar_sparse_matrix", "physics/quantum/tests/test_matrixutils.py::test_to_numpy", "physics/quantum/tests/test_matrixutils.py::test_matrix_tensor_product", "physics/quantum/tests/test_matrixutils.py::test_to_scipy_sparse", "physics/quantum/tests/test_matrixutils.py::test_matrix_zeros_numpy", "physics/quantum/tests/test_matrixutils.py::test_matrix_zeros_scipy", "physics/quantum/tests/test_printing.py::test_gate_failing", "physics/quantum/tests/test_represent.py::test_format_numpy", "physics/quantum/tests/test_represent.py::test_scalar_numpy", "physics/quantum/tests/test_represent.py::test_format_scipy_sparse", "physics/quantum/tests/test_represent.py::test_scalar_scipy_sparse", "physics/quantum/tests/test_sho1d.py::test_RaisingOp", "physics/quantum/tests/test_shor.py::test_CMod", "physics/tests/test_clebsch_gordan.py::test_clebsch_gordan_numpy", "physics/tests/test_paulialgebra.py::test_Pauli_should_work", "plotting/intervalmath/tests/test_interval_functions.py::test_interval_pow", "plotting/intervalmath/tests/test_interval_functions.py::test_exp", "plotting/intervalmath/tests/test_interval_functions.py::test_log", "plotting/intervalmath/tests/test_interval_functions.py::test_log10", "plotting/intervalmath/tests/test_interval_functions.py::test_atan", "plotting/intervalmath/tests/test_interval_functions.py::test_sin", "plotting/intervalmath/tests/test_interval_functions.py::test_cos", "plotting/intervalmath/tests/test_interval_functions.py::test_tan", "plotting/intervalmath/tests/test_interval_functions.py::test_sqrt", "plotting/intervalmath/tests/test_interval_functions.py::test_sinh", "plotting/intervalmath/tests/test_interval_functions.py::test_cosh", "plotting/intervalmath/tests/test_interval_functions.py::test_tanh", "plotting/intervalmath/tests/test_interval_functions.py::test_asin", "plotting/intervalmath/tests/test_interval_functions.py::test_acos", "plotting/intervalmath/tests/test_interval_functions.py::test_ceil", "plotting/intervalmath/tests/test_interval_functions.py::test_floor", "plotting/intervalmath/tests/test_interval_functions.py::test_asinh", "plotting/intervalmath/tests/test_interval_functions.py::test_acosh", "plotting/intervalmath/tests/test_interval_functions.py::test_atanh", "plotting/pygletplot/tests/test_plotting.py::test_plot_2d", "plotting/pygletplot/tests/test_plotting.py::test_plot_2d_discontinuous", "plotting/pygletplot/tests/test_plotting.py::test_plot_3d", "plotting/pygletplot/tests/test_plotting.py::test_plot_3d_discontinuous", "plotting/pygletplot/tests/test_plotting.py::test_plot_2d_polar", "plotting/pygletplot/tests/test_plotting.py::test_plot_3d_cylinder", "plotting/pygletplot/tests/test_plotting.py::test_plot_3d_spherical", "plotting/pygletplot/tests/test_plotting.py::test_plot_2d_parametric", "plotting/pygletplot/tests/test_plotting.py::test_plot_3d_parametric", "plotting/pygletplot/tests/test_plotting.py::test_plot_integral", "plotting/tests/test_plot.py::test_plot_and_save_1[True]", "plotting/tests/test_plot.py::test_plot_and_save_1[False]", "plotting/tests/test_plot.py::test_plot_and_save_2[True]", "plotting/tests/test_plot.py::test_plot_and_save_2[False]", "plotting/tests/test_plot.py::test_plot_and_save_3[True]", "plotting/tests/test_plot.py::test_plot_and_save_3[False]", "plotting/tests/test_plot.py::test_plot_and_save_4[True]", "plotting/tests/test_plot.py::test_plot_and_save_5[True]", "plotting/tests/test_plot.py::test_plot_and_save_5[False]", "plotting/tests/test_plot.py::test_plot_and_save_6[True]", "plotting/tests/test_plot.py::test_plot_and_save_6[False]", "plotting/tests/test_plot.py::test_plotgrid_and_save[True]", "plotting/tests/test_plot.py::test_plotgrid_and_save[False]", "plotting/tests/test_plot.py::test_append_issue_7140[True]", "plotting/tests/test_plot.py::test_append_issue_7140[False]", "plotting/tests/test_plot.py::test_issue_15265[True]", "plotting/tests/test_plot.py::test_issue_15265[False]", "plotting/tests/test_plot.py::test_empty_Plot", "plotting/tests/test_plot.py::test_issue_17405[True]", "plotting/tests/test_plot.py::test_issue_17405[False]", "plotting/tests/test_plot.py::test_logplot_PR_16796[True]", "plotting/tests/test_plot.py::test_logplot_PR_16796[False]", "plotting/tests/test_plot.py::test_issue_16572[True]", "plotting/tests/test_plot.py::test_issue_16572[False]", "plotting/tests/test_plot.py::test_issue_11865[True]", "plotting/tests/test_plot.py::test_issue_11865[False]", "plotting/tests/test_plot.py::test_issue_11461", "plotting/tests/test_plot.py::test_issue_11764[True]", "plotting/tests/test_plot.py::test_issue_11764[False]", "plotting/tests/test_plot.py::test_issue_13516[True]", "plotting/tests/test_plot.py::test_issue_13516[False]", "plotting/tests/test_plot.py::test_plot_limits[True]", "plotting/tests/test_plot.py::test_plot_limits[False]", "plotting/tests/test_plot.py::test_plot3d_parametric_line_limits[True]", "plotting/tests/test_plot.py::test_plot3d_parametric_line_limits[False]", "plotting/tests/test_plot.py::test_plot_size[True]", "plotting/tests/test_plot.py::test_plot_size[False]", "plotting/tests/test_plot.py::test_issue_20113", "plotting/tests/test_plot.py::test_deprecated_get_segments[True]", "plotting/tests/test_plot.py::test_deprecated_get_segments[False]", "plotting/tests/test_plot.py::test_generic_data_series[True]", "plotting/tests/test_plot.py::test_generic_data_series[False]", "plotting/tests/test_plot.py::test_deprecated_markers_annotations_rectangles_fill", "plotting/tests/test_plot.py::test_back_compatibility", "plotting/tests/test_plot.py::test_plot_arguments", "plotting/tests/test_plot.py::test_plot_parametric_arguments", "plotting/tests/test_plot.py::test_plot3d_parametric_line_arguments", "plotting/tests/test_plot.py::test_plot3d_plot_contour_arguments", "plotting/tests/test_plot.py::test_plot3d_parametric_surface_arguments", "plotting/tests/test_plot_implicit.py::test_no_adaptive_meshing", "plotting/tests/test_plot_implicit.py::test_matplotlib", "plotting/tests/test_plot_implicit.py::test_region_and", "plotting/tests/test_series.py::test_adaptive", "plotting/tests/test_series.py::test_detect_poles", "plotting/tests/test_series.py::test_number_discretization_points", "plotting/tests/test_series.py::test_list2dseries", "plotting/tests/test_series.py::test_lin_log_scale", "plotting/tests/test_series.py::test_rendering_kw", "plotting/tests/test_series.py::test_data_shape", "plotting/tests/test_series.py::test_only_integers", "plotting/tests/test_series.py::test_is_point_is_filled", "plotting/tests/test_series.py::test_steps", "plotting/tests/test_series.py::test_interactive_data", "plotting/tests/test_series.py::test_list2dseries_interactive", "plotting/tests/test_series.py::test_mpmath", "plotting/tests/test_series.py::test_use_cm", "plotting/tests/test_series.py::test_sums", "plotting/tests/test_series.py::test_apply_transforms", "plotting/tests/test_series.py::test_series_labels", "plotting/tests/test_series.py::test_is_polar_2d_parametric", "plotting/tests/test_series.py::test_is_polar_3d", "plotting/tests/test_series.py::test_color_func", "plotting/tests/test_series.py::test_color_func_scalar_val", "plotting/tests/test_series.py::test_color_func_expression", "plotting/tests/test_series.py::test_complex_adaptive_false", "plotting/tests/test_series.py::test_expr_is_lambda_function", "plotting/tests/test_series.py::test_particular_case_1_with_adaptive_true", "plotting/tests/test_series.py::test_particular_case_1_with_adaptive_false", "plotting/tests/test_series.py::test_complex_params_number_eval", "plotting/tests/test_series.py::test_complex_range_line_plot_1", "plotting/tests/test_series.py::test_complex_range_line_plot_2", "plotting/tests/test_series.py::test_force_real_eval", "plotting/tests/test_series.py::test_symbolic_plotting_ranges", "plotting/tests/test_series.py::test_exclude_points", "plotting/tests/test_series.py::test_unwrap", "plotting/tests/test_textplot.py::test_axes_alignment", "plotting/tests/test_textplot.py::test_singularity", "plotting/tests/test_textplot.py::test_sinc", "plotting/tests/test_textplot.py::test_imaginary", "polys/matrices/tests/test_domainmatrix.py::test_DomainMatrix_from_list_flat", "polys/matrices/tests/test_xxm.py::test_XDM_getitem[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XDM_setitem[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_extract_slice[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_extract[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_from_list[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_to_list[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_to_list_flat[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_from_list_flat[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_to_flat_nz[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_from_flat_nz[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_to_dod[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_from_dod[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_to_dok[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_from_dok[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_iter_values[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_iter_items[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_from_ddm[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_zeros[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_ones[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_eye[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_diag[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_transpose[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_add[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_sub[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_mul[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_matmul[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_mul_elementwise[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_neg[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_convert_to[DM_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_scc[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_hstack[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_vstack[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_applyfunc[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_is_upper[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_is_lower[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_is_diagonal[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_diagonal[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_is_zero_matrix[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_det_ZZ[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_det_QQ[DMQ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_inv_QQ[DMQ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_inv_ZZ[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_charpoly_ZZ[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_charpoly_QQ[DMQ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_lu_solve_ZZ[DMZ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_lu_solve_QQ[DMQ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_nullspace_QQ[DMQ_dfm]", "polys/matrices/tests/test_xxm.py::test_XXM_lll[DMZ_dfm]", "polys/numberfields/tests/test_galoisgroups.py::test__galois_group_degree_4_root_approx", "polys/numberfields/tests/test_galoisgroups.py::test__galois_group_degree_5_hybrid", "polys/numberfields/tests/test_utilities.py::test_isolate", "polys/tests/test_constructor.py::test_rootof_primitive_element", "polys/tests/test_factortools.py::test_dmp_zz_wang_fail", "polys/tests/test_fields.py::test_FracElement___call__", "polys/tests/test_partfrac.py::test_noncommutative_pseudomultivariate", "polys/tests/test_polytools.py::test_Poly_rootof_extension_primitive_element", "polys/tests/test_polytools.py::test_Poly_rootof_same_symbol_issue_26808", "polys/tests/test_rootoftools.py::test_eval_approx_relative", "printing/tests/test_aesaracode.py::test_example_symbols", "printing/tests/test_aesaracode.py::test_Symbol", "printing/tests/test_aesaracode.py::test_MatrixSymbol", "printing/tests/test_aesaracode.py::test_MatrixSymbol_wrong_dims", "printing/tests/test_aesaracode.py::test_AppliedUndef", "printing/tests/test_aesaracode.py::test_add", "printing/tests/test_aesaracode.py::test_trig", "printing/tests/test_aesaracode.py::test_many", "printing/tests/test_aesaracode.py::test_dtype", "printing/tests/test_aesaracode.py::test_broadcastables", "printing/tests/test_aesaracode.py::test_broadcasting", "printing/tests/test_aesaracode.py::test_MatMul", "printing/tests/test_aesaracode.py::test_Transpose", "printing/tests/test_aesaracode.py::test_MatAdd", "printing/tests/test_aesaracode.py::test_Rationals", "printing/tests/test_aesaracode.py::test_Integers", "printing/tests/test_aesaracode.py::test_factorial", "printing/tests/test_aesaracode.py::test_Derivative", "printing/tests/test_aesaracode.py::test_aesara_function_simple", "printing/tests/test_aesaracode.py::test_aesara_function_multi", "printing/tests/test_aesaracode.py::test_aesara_function_numpy", "printing/tests/test_aesaracode.py::test_aesara_function_matrix", "printing/tests/test_aesaracode.py::test_aesara_function_kwargs", "printing/tests/test_aesaracode.py::test_aesara_function_scalar", "printing/tests/test_aesaracode.py::test_slice", "printing/tests/test_aesaracode.py::test_MatrixSlice", "printing/tests/test_aesaracode.py::test_BlockMatrix", "printing/tests/test_aesaracode.py::test_BlockMatrix_Inverse_execution", "printing/tests/test_aesaracode.py::test_DenseMatrix", "printing/tests/test_aesaracode.py::test_cache_basic", "printing/tests/test_aesaracode.py::test_global_cache", "printing/tests/test_aesaracode.py::test_cache_types_distinct", "printing/tests/test_aesaracode.py::test_symbols_are_created_once", "printing/tests/test_aesaracode.py::test_cache_complex", "printing/tests/test_aesaracode.py::test_Piecewise", "printing/tests/test_aesaracode.py::test_Relationals", "printing/tests/test_aesaracode.py::test_complexfunctions", "printing/tests/test_aesaracode.py::test_constantfunctions", "printing/tests/test_c.py::test_C99CodePrinter__precision_f80", "printing/tests/test_conventions.py::test_requires_partial_unspecified_variables", "printing/tests/test_cupy.py::test_cupy_sum", "printing/tests/test_gtk.py::test_1", "printing/tests/test_jax.py::test_jax_sum", "printing/tests/test_jax.py::test_jax_multiple_sums", "printing/tests/test_jax.py::test_jax_codegen_einsum", "printing/tests/test_jax.py::test_jax_codegen_extra", "printing/tests/test_jax.py::test_jax_relational", "printing/tests/test_jax.py::test_jax_mod", "printing/tests/test_jax.py::test_jax_pow", "printing/tests/test_jax.py::test_jax_expm1", "printing/tests/test_jax.py::test_jax_log1p", "printing/tests/test_jax.py::test_jax_hypot", "printing/tests/test_jax.py::test_jax_log10", "printing/tests/test_jax.py::test_jax_exp2", "printing/tests/test_jax.py::test_jax_log2", "printing/tests/test_jax.py::test_jax_Sqrt", "printing/tests/test_jax.py::test_jax_sqrt", "printing/tests/test_jax.py::test_jax_matsolve", "printing/tests/test_jax.py::test_16857", "printing/tests/test_jax.py::test_issue_17006", "printing/tests/test_julia.py::test_Matrices_entries_not_hadamard", "printing/tests/test_lambdarepr.py::test_sum__1", "printing/tests/test_lambdarepr.py::test_sum__2", "printing/tests/test_lambdarepr.py::test_multiple_sums", "printing/tests/test_latex.py::test_latex_symbols_failing", "printing/tests/test_latex.py::test_builtin_without_args_mismatched_names", "printing/tests/test_llvmjit.py::test_simple_expr", "printing/tests/test_llvmjit.py::test_two_arg", "printing/tests/test_llvmjit.py::test_func", "printing/tests/test_llvmjit.py::test_two_func", "printing/tests/test_llvmjit.py::test_two_sqrt", "printing/tests/test_llvmjit.py::test_two_pow", "printing/tests/test_llvmjit.py::test_callback", "printing/tests/test_llvmjit.py::test_callback_cubature", "printing/tests/test_llvmjit.py::test_callback_two", "printing/tests/test_llvmjit.py::test_callback_alt_two", "printing/tests/test_llvmjit.py::test_multiple_statements", "printing/tests/test_llvmjit.py::test_cse", "printing/tests/test_llvmjit.py::test_cse_multiple", "printing/tests/test_llvmjit.py::test_callback_cubature_multiple", "printing/tests/test_llvmjit.py::test_symbol_not_found", "printing/tests/test_llvmjit.py::test_bad_callback", "printing/tests/test_numpy.py::test_sum", "printing/tests/test_numpy.py::test_multiple_sums", "printing/tests/test_numpy.py::test_codegen_einsum", "printing/tests/test_numpy.py::test_codegen_extra", "printing/tests/test_numpy.py::test_relational", "printing/tests/test_numpy.py::test_mod", "printing/tests/test_numpy.py::test_pow", "printing/tests/test_numpy.py::test_expm1", "printing/tests/test_numpy.py::test_log1p", "printing/tests/test_numpy.py::test_hypot", "printing/tests/test_numpy.py::test_log10", "printing/tests/test_numpy.py::test_exp2", "printing/tests/test_numpy.py::test_log2", "printing/tests/test_numpy.py::test_Sqrt", "printing/tests/test_numpy.py::test_sqrt", "printing/tests/test_numpy.py::test_matsolve", "printing/tests/test_numpy.py::test_16857", "printing/tests/test_numpy.py::test_issue_17006", "printing/tests/test_numpy.py::test_jax_tuple_compatibility", "printing/tests/test_octave.py::test_Matrices_entries_not_hadamard", "printing/tests/test_pycode.py::test_issue_18770", "printing/tests/test_python.py::test_python_functions_conjugates", "printing/tests/test_tensorflow.py::test_tensorflow_math", "printing/tests/test_tensorflow.py::test_tensorflow_relational", "printing/tests/test_tensorflow.py::test_tensorflow_matrices", "printing/tests/test_tensorflow.py::test_codegen_einsum", "printing/tests/test_tensorflow.py::test_codegen_extra", "printing/tests/test_tensorflow.py::test_tensorflow_isnan_isinf", "printing/tests/test_theanocode.py::test_example_symbols", "printing/tests/test_theanocode.py::test_Symbol", "printing/tests/test_theanocode.py::test_MatrixSymbol", "printing/tests/test_theanocode.py::test_MatrixSymbol_wrong_dims", "printing/tests/test_theanocode.py::test_AppliedUndef", "printing/tests/test_theanocode.py::test_add", "printing/tests/test_theanocode.py::test_trig", "printing/tests/test_theanocode.py::test_many", "printing/tests/test_theanocode.py::test_dtype", "printing/tests/test_theanocode.py::test_broadcastables", "printing/tests/test_theanocode.py::test_broadcasting", "printing/tests/test_theanocode.py::test_MatMul", "printing/tests/test_theanocode.py::test_Transpose", "printing/tests/test_theanocode.py::test_MatAdd", "printing/tests/test_theanocode.py::test_Rationals", "printing/tests/test_theanocode.py::test_Integers", "printing/tests/test_theanocode.py::test_factorial", "printing/tests/test_theanocode.py::test_Derivative", "printing/tests/test_theanocode.py::test_theano_function_simple", "printing/tests/test_theanocode.py::test_theano_function_multi", "printing/tests/test_theanocode.py::test_theano_function_numpy", "printing/tests/test_theanocode.py::test_theano_function_matrix", "printing/tests/test_theanocode.py::test_theano_function_kwargs", "printing/tests/test_theanocode.py::test_theano_function_scalar", "printing/tests/test_theanocode.py::test_slice", "printing/tests/test_theanocode.py::test_MatrixSlice", "printing/tests/test_theanocode.py::test_BlockMatrix", "printing/tests/test_theanocode.py::test_BlockMatrix_Inverse_execution", "printing/tests/test_theanocode.py::test_DenseMatrix", "printing/tests/test_theanocode.py::test_cache_basic", "printing/tests/test_theanocode.py::test_global_cache", "printing/tests/test_theanocode.py::test_cache_types_distinct", "printing/tests/test_theanocode.py::test_symbols_are_created_once", "printing/tests/test_theanocode.py::test_cache_complex", "printing/tests/test_theanocode.py::test_Piecewise", "printing/tests/test_theanocode.py::test_Relationals", "printing/tests/test_theanocode.py::test_complexfunctions", "printing/tests/test_theanocode.py::test_constantfunctions", "printing/tests/test_theanocode.py::test_Exp1", "printing/tests/test_tree.py::test_print_tree_MatAdd", "series/tests/test_formal.py::test_fps__logarithmic_singularity_fail", "series/tests/test_gruntz.py::test_gruntz_evaluation_slow", "series/tests/test_gruntz.py::test_gruntz_eval_special_slow", "series/tests/test_gruntz.py::test_grunts_eval_special_slow_sometimes_fail", "series/tests/test_gruntz.py::test_gruntz_eval_special_fail", "series/tests/test_gruntz.py::test_MrvTestCase_page47_ex3_21", "series/tests/test_gruntz.py::test_issue_5172", "series/tests/test_limits.py::test_doit2", "series/tests/test_limits.py::test_order_oo", "series/tests/test_limits.py::test_issue_5172", "series/tests/test_limitseq.py::test_limit_seq_fail", "series/tests/test_nseries.py::test_series1_failing", "series/tests/test_order.py::test_order_failing_due_to_solveset", "series/tests/test_residues.py::test_expressions_failing", "sets/tests/test_fancysets.py::test_halfcircle_fail", "sets/tests/test_fancysets.py::test_issue_16871b", "sets/tests/test_powerset.py::test_failing_powerset__contains__", "sets/tests/test_sets.py::test_Complement_as_relational_fail", "sets/tests/test_sets.py::test_image_Intersection", "sets/tests/test_sets.py::test_union_boundary_of_joining_sets", "sets/tests/test_sets.py::test_issue_16878b", "sets/tests/test_sets.py::test_intersection_symbolic_failing", "simplify/tests/test_cse.py::test_non_commutative_cse", "simplify/tests/test_cse.py::test_non_commutative_order", "simplify/tests/test_cse.py::test_issue_10228", "simplify/tests/test_cse.py::test_powers", "simplify/tests/test_cse.py::test_issue_11577", "simplify/tests/test_cse.py::test_cse_matrix_nested_matmul_collapsed", "simplify/tests/test_cse.py::test_cse_matrix_optimize_out_single_argument_mul_combined", "simplify/tests/test_cse.py::test_cse_matrix_optimize_out_single_argument_add_combined", "simplify/tests/test_hyperexpand.py::test_roach_fail", "simplify/tests/test_hyperexpand.py::test_meijerg_expand_fail", "simplify/tests/test_hyperexpand.py::test_prudnikov_3_slow", "simplify/tests/test_hyperexpand.py::test_prudnikov_fail_2F1", "simplify/tests/test_hyperexpand.py::test_prudnikov_fail_3F2", "simplify/tests/test_hyperexpand.py::test_prudnikov_fail_other", "simplify/tests/test_simplify.py::test_simplify_float_vs_integer", "simplify/tests/test_simplify.py::test_issue_18642", "simplify/tests/test_simplify.py::test_issue_18389", "simplify/tests/test_trigsimp.py::test_issue_6811_fail", "solvers/diophantine/tests/test_diophantine.py::test_fail_holzer", "solvers/diophantine/tests/test_diophantine.py::test_not_implemented", "solvers/ode/tests/test_lie_group.py::test_kamke", "solvers/ode/tests/test_lie_group.py::test_lie_group_issue15219", "solvers/ode/tests/test_ode.py::test_noncircularized_real_imaginary_parts", "solvers/ode/tests/test_ode.py::test_issue_25820", "solvers/ode/tests/test_systems.py::test_linear_new_order1_type2_de_lorentz_slow_check", "solvers/ode/tests/test_systems.py::test_linear_3eq_order1_type4_long_dsolve_slow_xfail", "solvers/ode/tests/test_systems.py::test_linear_3eq_order1_type4_long_dsolve_dotprodsimp", "solvers/ode/tests/test_systems.py::test_linear_3eq_order1_type4_long_check", "solvers/ode/tests/test_systems.py::test_nonlinear_3eq_order1_type1", "solvers/ode/tests/test_systems.py::test_nonlinear_3eq_order1_type4", "solvers/ode/tests/test_systems.py::test_nonlinear_3eq_order1_type3", "solvers/ode/tests/test_systems.py::test_nonlinear_3eq_order1_type5", "solvers/tests/test_constantsimp.py::test_nonlocal_simplification", "solvers/tests/test_decompogen.py::test_decompogen_fails", "solvers/tests/test_inequalities.py::test_slow_general_univariate", "solvers/tests/test_inequalities.py::test_isolve_Sets", "solvers/tests/test_numeric.py::test_nsolve_fail", "solvers/tests/test_numeric.py::test_nsolve_denominator", "solvers/tests/test_numeric.py::test_nsolve", "solvers/tests/test_numeric.py::test_issue_6408", "solvers/tests/test_numeric.py::test_issue_6408_integral", "solvers/tests/test_numeric.py::test_increased_dps", "solvers/tests/test_numeric.py::test_nsolve_precision", "solvers/tests/test_numeric.py::test_nsolve_complex", "solvers/tests/test_numeric.py::test_nsolve_dict_kwarg", "solvers/tests/test_numeric.py::test_nsolve_rational", "solvers/tests/test_numeric.py::test_issue_14950", "solvers/tests/test_recurr.py::test_rsolve_ratio_missed", "solvers/tests/test_solvers.py::test_linear_system_xfail", "solvers/tests/test_solvers.py::test_issue_24609_xfail", "solvers/tests/test_solvers.py::test_unrad_fail", "solvers/tests/test_solvers.py::test_other_lambert", "solvers/tests/test_solvers.py::test_rewrite_trigh", "solvers/tests/test_solvers.py::test_issue_7547", "solvers/tests/test_solveset.py::test_issue_18449", "solvers/tests/test_solveset.py::test_solve_sqrt_fail", "solvers/tests/test_solveset.py::test_solve_quintics", "solvers/tests/test_solveset.py::test_solve_trig_simplified", "solvers/tests/test_solveset.py::test_solve_lambert", "solvers/tests/test_solveset.py::test_other_lambert", "solvers/tests/test_solveset.py::test_conditionset_equality", "solvers/tests/test_solveset.py::test_trig_system_fail", "solvers/tests/test_solveset.py::test_solve_nonlinear_trans", "solvers/tests/test_solveset.py::test_issue_5114_solveset", "solvers/tests/test_solveset.py::test_issue_17933", "solvers/tests/test_solveset.py::test_exponential_complex", "solvers/tests/test_solveset.py::test_issue_10864", "solvers/tests/test_solveset.py::test_solve_only_exp_2", "solvers/tests/test_solveset.py::test_uselogcombine_2", "stats/sampling/tests/test_sample_continuous_rv.py::test_sample_numpy", "stats/sampling/tests/test_sample_continuous_rv.py::test_sample_scipy", "stats/sampling/tests/test_sample_continuous_rv.py::test_sample_pymc", "stats/sampling/tests/test_sample_continuous_rv.py::test_sampling_gamma_inverse", "stats/sampling/tests/test_sample_continuous_rv.py::test_lognormal_sampling", "stats/sampling/tests/test_sample_continuous_rv.py::test_sampling_gaussian_inverse", "stats/sampling/tests/test_sample_continuous_rv.py::test_prefab_sampling", "stats/sampling/tests/test_sample_continuous_rv.py::test_sample_continuous", "stats/sampling/tests/test_sample_discrete_rv.py::test_sample_numpy", "stats/sampling/tests/test_sample_discrete_rv.py::test_sample_scipy", "stats/sampling/tests/test_sample_discrete_rv.py::test_sample_pymc", "stats/sampling/tests/test_sample_discrete_rv.py::test_sample_discrete", "stats/sampling/tests/test_sample_finite_rv.py::test_given_sample", "stats/sampling/tests/test_sample_finite_rv.py::test_sample_numpy", "stats/sampling/tests/test_sample_finite_rv.py::test_sample_scipy", "stats/sampling/tests/test_sample_finite_rv.py::test_sample_pymc", "stats/tests/test_continuous_rv.py::test_uniform_P", "stats/tests/test_continuous_rv.py::test_precomputed_characteristic_functions", "stats/tests/test_discrete_rv.py::test_precomputed_characteristic_functions", "stats/tests/test_joint_rv.py::test_NegativeMultinomial", "stats/tests/test_joint_rv.py::test_joint_vector_expectation", "stats/tests/test_joint_rv.py::test_sample_numpy", "stats/tests/test_joint_rv.py::test_sample_scipy", "stats/tests/test_joint_rv.py::test_sample_pymc", "stats/tests/test_joint_rv.py::test_issue_21057_pymc", "stats/tests/test_matrix_distributions.py::test_sample_scipy", "stats/tests/test_matrix_distributions.py::test_sample_pymc", "stats/tests/test_rv.py::test_sample_iter", "stats/tests/test_rv.py::test_Sample", "stats/tests/test_rv.py::test_samplingE", "stats/tests/test_stochastic_process.py::test_sample_stochastic_process", "tensor/tests/test_tensor.py::test_div", "testing/tests/test_code_quality.py::test_files", "testing/tests/test_module_imports.py::test_module_imports_are_direct", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_no_paths", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_one_file[sympy/core/tests/test_basic.py]", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_one_file[_basic]", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_partial_path_from_root", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_multiple_paths_from_root", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_multiple_paths_from_non_root[paths0-expected_paths0]", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_string_as_keyword[paths0]", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_string_as_keyword[paths1]", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_string_as_keyword[paths2]", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_string_as_keyword[paths3]", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_string_as_keyword[paths4]", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_integer_as_keyword[paths0]", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_integer_as_keyword[paths1]", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_integer_as_keyword[paths2]", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_integer_as_keyword[paths3]", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_multiple_keywords", "testing/tests/test_runtests_pytest.py::TestUpdateArgsWithPaths::test_keyword_match_in_multiple_files", "utilities/_compilation/tests/test_compilation.py::test_compile_link_import_strings", "utilities/_compilation/tests/test_compilation.py::test_compile_sources", "utilities/tests/test_codegen_julia.py::test_jl_numbersymbol_no_inline", "utilities/tests/test_codegen_julia.py::test_jl_piecewise_no_inline", "utilities/tests/test_codegen_octave.py::test_m_numbersymbol_no_inline", "utilities/tests/test_codegen_octave.py::test_m_piecewise_no_inline", "utilities/tests/test_codegen_rust.py::test_numbersymbol_inline", "utilities/tests/test_codegen_rust.py::test_piecewise_inline", "utilities/tests/test_lambdify.py::test_no_args", "utilities/tests/test_lambdify.py::test_single_arg", "utilities/tests/test_lambdify.py::test_list_args", "utilities/tests/test_lambdify.py::test_nested_args", "utilities/tests/test_lambdify.py::test_str_args", "utilities/tests/test_lambdify.py::test_own_namespace_1", "utilities/tests/test_lambdify.py::test_own_namespace_2", "utilities/tests/test_lambdify.py::test_own_module", "utilities/tests/test_lambdify.py::test_atoms", "utilities/tests/test_lambdify.py::test_sympy_lambda", "utilities/tests/test_lambdify.py::test_math_lambda", "utilities/tests/test_lambdify.py::test_mpmath_lambda", "utilities/tests/test_lambdify.py::test_number_precision", "utilities/tests/test_lambdify.py::test_mpmath_precision", "utilities/tests/test_lambdify.py::test_numpy_transl", "utilities/tests/test_lambdify.py::test_scipy_transl", "utilities/tests/test_lambdify.py::test_numpy_translation_abs", "utilities/tests/test_lambdify.py::test_numexpr_printer", "utilities/tests/test_lambdify.py::test_issue_9334", "utilities/tests/test_lambdify.py::test_issue_12984", "utilities/tests/test_lambdify.py::test_empty_modules", "utilities/tests/test_lambdify.py::test_exponentiation", "utilities/tests/test_lambdify.py::test_sqrt", "utilities/tests/test_lambdify.py::test_trig", "utilities/tests/test_lambdify.py::test_integral", "utilities/tests/test_lambdify.py::test_double_integral", "utilities/tests/test_lambdify.py::test_spherical_bessel", "utilities/tests/test_lambdify.py::test_vector_simple", "utilities/tests/test_lambdify.py::test_vector_discontinuous", "utilities/tests/test_lambdify.py::test_trig_symbolic", "utilities/tests/test_lambdify.py::test_trig_float", "utilities/tests/test_lambdify.py::test_docs", "utilities/tests/test_lambdify.py::test_math", "utilities/tests/test_lambdify.py::test_sin", "utilities/tests/test_lambdify.py::test_matrix", "utilities/tests/test_lambdify.py::test_numpy_matrix", "utilities/tests/test_lambdify.py::test_numpy_transpose", "utilities/tests/test_lambdify.py::test_numpy_dotproduct", "utilities/tests/test_lambdify.py::test_numpy_inverse", "utilities/tests/test_lambdify.py::test_numpy_old_matrix", "utilities/tests/test_lambdify.py::test_scipy_sparse_matrix", "utilities/tests/test_lambdify.py::test_python_div_zero_issue_11306", "utilities/tests/test_lambdify.py::test_issue9474", "utilities/tests/test_lambdify.py::test_issue_9871", "utilities/tests/test_lambdify.py::test_numpy_piecewise", "utilities/tests/test_lambdify.py::test_numpy_logical_ops", "utilities/tests/test_lambdify.py::test_numpy_matmul", "utilities/tests/test_lambdify.py::test_numpy_numexpr", "utilities/tests/test_lambdify.py::test_numexpr_userfunctions", "utilities/tests/test_lambdify.py::test_tensorflow_basic_math", "utilities/tests/test_lambdify.py::test_tensorflow_placeholders", "utilities/tests/test_lambdify.py::test_tensorflow_variables", "utilities/tests/test_lambdify.py::test_tensorflow_logical_operations", "utilities/tests/test_lambdify.py::test_tensorflow_piecewise", "utilities/tests/test_lambdify.py::test_tensorflow_multi_max", "utilities/tests/test_lambdify.py::test_tensorflow_multi_min", "utilities/tests/test_lambdify.py::test_tensorflow_relational", "utilities/tests/test_lambdify.py::test_tensorflow_complexes", "utilities/tests/test_lambdify.py::test_tensorflow_array_arg", "utilities/tests/test_lambdify.py::test_sym_single_arg", "utilities/tests/test_lambdify.py::test_sym_list_args", "utilities/tests/test_lambdify.py::test_sym_integral", "utilities/tests/test_lambdify.py::test_namespace_order", "utilities/tests/test_lambdify.py::test_imps", "utilities/tests/test_lambdify.py::test_lambdify_imps", "utilities/tests/test_lambdify.py::test_dummification", "utilities/tests/test_lambdify.py::test_lambdify__arguments_with_invalid_python_identifiers", "utilities/tests/test_lambdify.py::test_curly_matrix_symbol", "utilities/tests/test_lambdify.py::test_python_keywords", "utilities/tests/test_lambdify.py::test_lambdify_docstring", "utilities/tests/test_lambdify.py::test_special_printers", "utilities/tests/test_lambdify.py::test_true_false", "utilities/tests/test_lambdify.py::test_issue_2790", "utilities/tests/test_lambdify.py::test_ITE", "utilities/tests/test_lambdify.py::test_Min_Max", "utilities/tests/test_lambdify.py::test_Indexed", "utilities/tests/test_lambdify.py::test_Idx", "utilities/tests/test_lambdify.py::test_issue_12173", "utilities/tests/test_lambdify.py::test_issue_13642", "utilities/tests/test_lambdify.py::test_sinc_mpmath", "utilities/tests/test_lambdify.py::test_lambdify_dummy_arg", "utilities/tests/test_lambdify.py::test_lambdify_mixed_symbol_dummy_args", "utilities/tests/test_lambdify.py::test_numpy_array_arg", "utilities/tests/test_lambdify.py::test_scipy_fns", "utilities/tests/test_lambdify.py::test_scipy_polys", "utilities/tests/test_lambdify.py::test_lambdify_inspect", "utilities/tests/test_lambdify.py::test_issue_14941", "utilities/tests/test_lambdify.py::test_lambdify_Derivative_arg_issue_16468", "utilities/tests/test_lambdify.py::test_lambdify_Derivative_zeta", "utilities/tests/test_lambdify.py::test_lambdify_Derivative_custom_printer", "utilities/tests/test_lambdify.py::test_lambdify_derivative_and_functions_as_arguments", "utilities/tests/test_lambdify.py::test_imag_real", "utilities/tests/test_lambdify.py::test_MatrixSymbol_issue_15578", "utilities/tests/test_lambdify.py::test_issue_15654", "utilities/tests/test_lambdify.py::test_issue_15827", "utilities/tests/test_lambdify.py::test_issue_16930", "utilities/tests/test_lambdify.py::test_issue_17898", "utilities/tests/test_lambdify.py::test_issue_13167_21411", "utilities/tests/test_lambdify.py::test_single_e", "utilities/tests/test_lambdify.py::test_issue_16536", "utilities/tests/test_lambdify.py::test_issue_22726", "utilities/tests/test_lambdify.py::test_issue_22739", "utilities/tests/test_lambdify.py::test_issue_22992", "utilities/tests/test_lambdify.py::test_issue_19764", "utilities/tests/test_lambdify.py::test_issue_20070", "utilities/tests/test_lambdify.py::test_fresnel_integrals_scipy", "utilities/tests/test_lambdify.py::test_beta_scipy", "utilities/tests/test_lambdify.py::test_beta_math", "utilities/tests/test_lambdify.py::test_betainc_scipy", "utilities/tests/test_lambdify.py::test_betainc_regularized_scipy", "utilities/tests/test_lambdify.py::test_numpy_special_math", "utilities/tests/test_lambdify.py::test_scipy_special_math", "utilities/tests/test_lambdify.py::test_scipy_bernoulli", "utilities/tests/test_lambdify.py::test_scipy_harmonic", "utilities/tests/test_lambdify.py::test_cupy_array_arg", "utilities/tests/test_lambdify.py::test_cupy_array_arg_using_numpy", "utilities/tests/test_lambdify.py::test_cupy_dotproduct", "utilities/tests/test_lambdify.py::test_jax_array_arg", "utilities/tests/test_lambdify.py::test_jax_array_arg_using_numpy", "utilities/tests/test_lambdify.py::test_jax_dotproduct", "utilities/tests/test_lambdify.py::test_lambdify_cse", "utilities/tests/test_lambdify.py::test_issue_25288", "utilities/tests/test_lambdify.py::test_deprecated_set", "utilities/tests/test_lambdify.py::test_issue_13881", "utilities/tests/test_lambdify.py::test_23536_lambdify_cse_dummy", "utilities/tests/test_lambdify.py::test_lambdify_docstring_size_limit_simple_symbol", "utilities/tests/test_lambdify.py::test_lambdify_docstring_size_limit_nested_expr", "utilities/tests/test_lambdify.py::test_lambdify_docstring_size_limit_matrix", "utilities/tests/test_lambdify.py::test_lambdify_empty_tuple", "utilities/tests/test_lambdify.py::test_Piecewise", "utilities/tests/test_lambdify.py::test_array_symbol", "utilities/tests/test_matchpy_connector.py::test_matchpy_connector", "utilities/tests/test_matchpy_connector.py::test_matchpy_optional", "utilities/tests/test_matchpy_connector.py::test_replacer", "utilities/tests/test_mathml.py::test_xxe", "utilities/tests/test_misc.py::test_debug_output", "utilities/tests/test_pickling.py::test_core_undefinedfunctions_fail", "utilities/tests/test_pickling.py::test_plotting", "utilities/tests/test_pickling.py::test_plotting2", "utilities/tests/test_pickling.py::test_pickling_polys_rings", "utilities/tests/test_pickling.py::test_printing1", "utilities/tests/test_pickling.py::test_printing2", "utilities/tests/test_pickling.py::test_printing3", "utilities/tests/test_wester.py::test_C19", "utilities/tests/test_wester.py::test_C22", "utilities/tests/test_wester.py::test_C24", "utilities/tests/test_wester.py::test_D5", "utilities/tests/test_wester.py::test_D6", "utilities/tests/test_wester.py::test_D7", "utilities/tests/test_wester.py::test_D8", "utilities/tests/test_wester.py::test_D9", "utilities/tests/test_wester.py::test_D10", "utilities/tests/test_wester.py::test_D11", "utilities/tests/test_wester.py::test_D12", "utilities/tests/test_wester.py::test_D13", "utilities/tests/test_wester.py::test_F3", "utilities/tests/test_wester.py::test_F4", "utilities/tests/test_wester.py::test_F5", "utilities/tests/test_wester.py::test_G2", "utilities/tests/test_wester.py::test_G3", "utilities/tests/test_wester.py::test_G19", "utilities/tests/test_wester.py::test_G20b", "utilities/tests/test_wester.py::test_H13", "utilities/tests/test_wester.py::test_H18", "utilities/tests/test_wester.py::test_H20", "utilities/tests/test_wester.py::test_H21", "utilities/tests/test_wester.py::test_H28", "utilities/tests/test_wester.py::test_H29", "utilities/tests/test_wester.py::test_H32", "utilities/tests/test_wester.py::test_I2", "utilities/tests/test_wester.py::test_I5", "utilities/tests/test_wester.py::test_I6", "utilities/tests/test_wester.py::test_I7", "utilities/tests/test_wester.py::test_I8", "utilities/tests/test_wester.py::test_I9", "utilities/tests/test_wester.py::test_I11", "utilities/tests/test_wester.py::test_I12", "utilities/tests/test_wester.py::test_J3", "utilities/tests/test_wester.py::test_J15", "utilities/tests/test_wester.py::test_J16", "utilities/tests/test_wester.py::test_J18", "utilities/tests/test_wester.py::test_K3", "utilities/tests/test_wester.py::test_L5", "utilities/tests/test_wester.py::test_L7", "utilities/tests/test_wester.py::test_L8", "utilities/tests/test_wester.py::test_L9", "utilities/tests/test_wester.py::test_M1", "utilities/tests/test_wester.py::test_M5", "utilities/tests/test_wester.py::test_M8", "utilities/tests/test_wester.py::test_M9", "utilities/tests/test_wester.py::test_M11", "utilities/tests/test_wester.py::test_M13", "utilities/tests/test_wester.py::test_M14", "utilities/tests/test_wester.py::test_M16", "utilities/tests/test_wester.py::test_M17", "utilities/tests/test_wester.py::test_M18", "utilities/tests/test_wester.py::test_M28", "utilities/tests/test_wester.py::test_M32", "utilities/tests/test_wester.py::test_M33", "utilities/tests/test_wester.py::test_M34", "utilities/tests/test_wester.py::test_N2", "utilities/tests/test_wester.py::test_N3", "utilities/tests/test_wester.py::test_N4", "utilities/tests/test_wester.py::test_N5", "utilities/tests/test_wester.py::test_N6", "utilities/tests/test_wester.py::test_N7", "utilities/tests/test_wester.py::test_N8", "utilities/tests/test_wester.py::test_N14", "utilities/tests/test_wester.py::test_N17", "utilities/tests/test_wester.py::test_O3", "utilities/tests/test_wester.py::test_O5", "utilities/tests/test_wester.py::test_P4", "utilities/tests/test_wester.py::test_P10", "utilities/tests/test_wester.py::test_P11", "utilities/tests/test_wester.py::test_P20", "utilities/tests/test_wester.py::test_P28", "utilities/tests/test_wester.py::test_P29", "utilities/tests/test_wester.py::test_P31", "utilities/tests/test_wester.py::test_P34", "utilities/tests/test_wester.py::test_P35", "utilities/tests/test_wester.py::test_P36", "utilities/tests/test_wester.py::test_P38", "utilities/tests/test_wester.py::test_P39", "utilities/tests/test_wester.py::test_R1", "utilities/tests/test_wester.py::test_R2", "utilities/tests/test_wester.py::test_R3", "utilities/tests/test_wester.py::test_R4", "utilities/tests/test_wester.py::test_R5", "utilities/tests/test_wester.py::test_R8", "utilities/tests/test_wester.py::test_R10", "utilities/tests/test_wester.py::test_R11", "utilities/tests/test_wester.py::test_R12", "utilities/tests/test_wester.py::test_R13", "utilities/tests/test_wester.py::test_R14", "utilities/tests/test_wester.py::test_R15", "utilities/tests/test_wester.py::test_R17", "utilities/tests/test_wester.py::test_R19", "utilities/tests/test_wester.py::test_R20", "utilities/tests/test_wester.py::test_R21", "utilities/tests/test_wester.py::test_R23", "utilities/tests/test_wester.py::test_S6", "utilities/tests/test_wester.py::test_S7", "utilities/tests/test_wester.py::test_S8", "utilities/tests/test_wester.py::test_S9", "utilities/tests/test_wester.py::test_S10", "utilities/tests/test_wester.py::test_T9", "utilities/tests/test_wester.py::test_T10", "utilities/tests/test_wester.py::test_T11", "utilities/tests/test_wester.py::test_U4", "utilities/tests/test_wester.py::test_U7", "utilities/tests/test_wester.py::test_U11", "utilities/tests/test_wester.py::test_U12", "utilities/tests/test_wester.py::test_U14", "utilities/tests/test_wester.py::test_U15", "utilities/tests/test_wester.py::test_U16", "utilities/tests/test_wester.py::test_U17", "utilities/tests/test_wester.py::test_V5", "utilities/tests/test_wester.py::test_V6", "utilities/tests/test_wester.py::test_V8_V9", "utilities/tests/test_wester.py::test_V13", "utilities/tests/test_wester.py::test_V14", "utilities/tests/test_wester.py::test_V16", "utilities/tests/test_wester.py::test_V17", "utilities/tests/test_wester.py::test_W1", "utilities/tests/test_wester.py::test_W2", "utilities/tests/test_wester.py::test_W3", "utilities/tests/test_wester.py::test_W4", "utilities/tests/test_wester.py::test_W5", "utilities/tests/test_wester.py::test_W6", "utilities/tests/test_wester.py::test_W8", "utilities/tests/test_wester.py::test_W9", "utilities/tests/test_wester.py::test_W10", "utilities/tests/test_wester.py::test_W11", "utilities/tests/test_wester.py::test_W13", "utilities/tests/test_wester.py::test_W15", "utilities/tests/test_wester.py::test_W19", "utilities/tests/test_wester.py::test_W20", "utilities/tests/test_wester.py::test_W24", "utilities/tests/test_wester.py::test_W25", "utilities/tests/test_wester.py::test_X5", "utilities/tests/test_wester.py::test_X12", "utilities/tests/test_wester.py::test_X14", "utilities/tests/test_wester.py::test_X15", "utilities/tests/test_wester.py::test_X17", "utilities/tests/test_wester.py::test_X18", "utilities/tests/test_wester.py::test_X19", "utilities/tests/test_wester.py::test_X20", "utilities/tests/test_wester.py::test_X22", "utilities/tests/test_wester.py::test_Y7", "utilities/tests/test_wester.py::test_Y8", "utilities/tests/test_wester.py::test_Y11", "utilities/tests/test_wester.py::test_Y12", "utilities/tests/test_wester.py::test_Y13", "utilities/tests/test_wester.py::test_Y14", "utilities/tests/test_wester.py::test_Z4", "utilities/tests/test_wester.py::test_Z5", "utilities/tests/test_wester.py::test_Z6", "vector/tests/test_printing.py::test_pretty_printing_ascii" ], "PASS_TO_PASS": null }
sympy__sympy-95
1.0
{ "code": "diff --git b/sympy/physics/quantum/spin.py a/sympy/physics/quantum/spin.py\nindex d13508f5ed..6c568d36c5 100644\n--- b/sympy/physics/quantum/spin.py\n+++ a/sympy/physics/quantum/spin.py\n@@ -2046,6 +2046,10 @@ def uncouple(expr, jn=None, jcoupling_list=None):\n Sum(CG(j1, m1, j2, m2, j, m)*|j1,m1>x|j2,m2>, (m1, -j1, j1), (m2, -j2, j2))\n \n \"\"\"\n+ a = expr.atoms(SpinState)\n+ for state in a:\n+ expr = expr.subs(state, _uncouple(state, jn, jcoupling_list))\n+ return expr\n \n \n def _uncouple(state, jn, jcoupling_list):\n", "test": null }
null
{ "code": "diff --git a/sympy/physics/quantum/spin.py b/sympy/physics/quantum/spin.py\nindex 6c568d36c5..d13508f5ed 100644\n--- a/sympy/physics/quantum/spin.py\n+++ b/sympy/physics/quantum/spin.py\n@@ -2046,10 +2046,6 @@ def uncouple(expr, jn=None, jcoupling_list=None):\n Sum(CG(j1, m1, j2, m2, j, m)*|j1,m1>x|j2,m2>, (m1, -j1, j1), (m2, -j2, j2))\n \n \"\"\"\n- a = expr.atoms(SpinState)\n- for state in a:\n- expr = expr.subs(state, _uncouple(state, jn, jcoupling_list))\n- return expr\n \n \n def _uncouple(state, jn, jcoupling_list):\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/physics/quantum/spin.py.\nHere is the description for the function:\ndef uncouple(expr, jn=None, jcoupling_list=None):\n \"\"\" Uncouple a coupled spin state\n\n Gives the uncoupled representation of a coupled spin state. Arguments must\n be either a spin state that is a subclass of CoupledSpinState or a spin\n state that is a subclass of SpinState and an array giving the j values\n of the spaces that are to be coupled\n\n Parameters\n ==========\n\n expr : Expr\n The expression containing states that are to be coupled. If the states\n are a subclass of SpinState, the ``jn`` and ``jcoupling`` parameters\n must be defined. If the states are a subclass of CoupledSpinState,\n ``jn`` and ``jcoupling`` will be taken from the state.\n\n jn : list or tuple\n The list of the j-values that are coupled. If state is a\n CoupledSpinState, this parameter is ignored. This must be defined if\n state is not a subclass of CoupledSpinState. The syntax of this\n parameter is the same as the ``jn`` parameter of JzKetCoupled.\n\n jcoupling_list : list or tuple\n The list defining how the j-values are coupled together. If state is a\n CoupledSpinState, this parameter is ignored. This must be defined if\n state is not a subclass of CoupledSpinState. The syntax of this\n parameter is the same as the ``jcoupling`` parameter of JzKetCoupled.\n\n Examples\n ========\n\n Uncouple a numerical state using a CoupledSpinState state:\n\n >>> from sympy.physics.quantum.spin import JzKetCoupled, uncouple\n >>> from sympy import S\n >>> uncouple(JzKetCoupled(1, 0, (S(1)/2, S(1)/2)))\n sqrt(2)*|1/2,-1/2>x|1/2,1/2>/2 + sqrt(2)*|1/2,1/2>x|1/2,-1/2>/2\n\n Perform the same calculation using a SpinState state:\n\n >>> from sympy.physics.quantum.spin import JzKet\n >>> uncouple(JzKet(1, 0), (S(1)/2, S(1)/2))\n sqrt(2)*|1/2,-1/2>x|1/2,1/2>/2 + sqrt(2)*|1/2,1/2>x|1/2,-1/2>/2\n\n Uncouple a numerical state of three coupled spaces using a CoupledSpinState state:\n\n >>> uncouple(JzKetCoupled(1, 1, (1, 1, 1), ((1,3,1),(1,2,1)) ))\n |1,-1>x|1,1>x|1,1>/2 - |1,0>x|1,0>x|1,1>/2 + |1,1>x|1,0>x|1,0>/2 - |1,1>x|1,1>x|1,-1>/2\n\n Perform the same calculation using a SpinState state:\n\n >>> uncouple(JzKet(1, 1), (1, 1, 1), ((1,3,1),(1,2,1)) )\n |1,-1>x|1,1>x|1,1>/2 - |1,0>x|1,0>x|1,1>/2 + |1,1>x|1,0>x|1,0>/2 - |1,1>x|1,1>x|1,-1>/2\n\n Uncouple a symbolic state using a CoupledSpinState state:\n\n >>> from sympy import symbols\n >>> j,m,j1,j2 = symbols('j m j1 j2')\n >>> uncouple(JzKetCoupled(j, m, (j1, j2)))\n Sum(CG(j1, m1, j2, m2, j, m)*|j1,m1>x|j2,m2>, (m1, -j1, j1), (m2, -j2, j2))\n\n Perform the same calculation using a SpinState state\n\n >>> uncouple(JzKet(j, m), (j1, j2))\n Sum(CG(j1, m1, j2, m2, j, m)*|j1,m1>x|j2,m2>, (m1, -j1, j1), (m2, -j2, j2))\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/physics/quantum/tests/test_spin.py::test_uncouple_2_coupled_states", "sympy/physics/quantum/tests/test_spin.py::test_uncouple_3_coupled_states", "sympy/physics/quantum/tests/test_spin.py::test_uncouple_2_coupled_states_numerical", "sympy/physics/quantum/tests/test_spin.py::test_uncouple_3_coupled_states_numerical", "sympy/physics/quantum/tests/test_spin.py::test_uncouple_4_coupled_states_numerical", "sympy/physics/quantum/tests/test_spin.py::test_uncouple_symbolic", "sympy/physics/quantum/tests/test_spin.py::test_couple_2_states", "sympy/physics/quantum/tests/test_spin.py::test_couple_3_states", "sympy/physics/quantum/tests/test_spin.py::test_couple_4_states" ], "PASS_TO_PASS": null }
sympy__sympy-96
1.0
{ "code": "diff --git b/sympy/solvers/solvers.py a/sympy/solvers/solvers.py\nindex 2df0ab3d98..b1210a2baa 100644\n--- b/sympy/solvers/solvers.py\n+++ a/sympy/solvers/solvers.py\n@@ -3370,6 +3370,311 @@ def unrad(eq, *syms, **flags):\n \n \"\"\"\n \n+ uflags = {\"check\": False, \"simplify\": False}\n+\n+ def _cov(p, e):\n+ if cov:\n+ # XXX - uncovered\n+ oldp, olde = cov\n+ if Poly(e, p).degree(p) in (1, 2):\n+ cov[:] = [p, olde.subs(oldp, _vsolve(e, p, **uflags)[0])]\n+ else:\n+ raise NotImplementedError\n+ else:\n+ cov[:] = [p, e]\n+\n+ def _canonical(eq, cov):\n+ if cov:\n+ # change symbol to vanilla so no solutions are eliminated\n+ p, e = cov\n+ rep = {p: Dummy(p.name)}\n+ eq = eq.xreplace(rep)\n+ cov = [p.xreplace(rep), e.xreplace(rep)]\n+\n+ # remove constants and powers of factors since these don't change\n+ # the location of the root; XXX should factor or factor_terms be used?\n+ eq = factor_terms(_mexpand(eq.as_numer_denom()[0], recursive=True), clear=True)\n+ if eq.is_Mul:\n+ args = []\n+ for f in eq.args:\n+ if f.is_number:\n+ continue\n+ if f.is_Pow:\n+ args.append(f.base)\n+ else:\n+ args.append(f)\n+ eq = Mul(*args) # leave as Mul for more efficient solving\n+\n+ # make the sign canonical\n+ margs = list(Mul.make_args(eq))\n+ changed = False\n+ for i, m in enumerate(margs):\n+ if m.could_extract_minus_sign():\n+ margs[i] = -m\n+ changed = True\n+ if changed:\n+ eq = Mul(*margs, evaluate=False)\n+\n+ return eq, cov\n+\n+ def _Q(pow):\n+ # return leading Rational of denominator of Pow's exponent\n+ c = pow.as_base_exp()[1].as_coeff_Mul()[0]\n+ if not c.is_Rational:\n+ return S.One\n+ return c.q\n+\n+ # define the _take method that will determine whether a term is of interest\n+ def _take(d):\n+ # return True if coefficient of any factor's exponent's den is not 1\n+ for pow in Mul.make_args(d):\n+ if not pow.is_Pow:\n+ continue\n+ if _Q(pow) == 1:\n+ continue\n+ if pow.free_symbols & syms:\n+ return True\n+ return False\n+ _take = flags.setdefault('_take', _take)\n+\n+ if isinstance(eq, Eq):\n+ eq = eq.lhs - eq.rhs # XXX legacy Eq as Eqn support\n+ elif not isinstance(eq, Expr):\n+ return\n+\n+ cov, nwas, rpt = [flags.setdefault(k, v) for k, v in\n+ sorted({\"cov\": [], \"n\": None, \"rpt\": 0}.items())]\n+\n+ # preconditioning\n+ eq = powdenest(factor_terms(eq, radical=True, clear=True))\n+ eq = eq.as_numer_denom()[0]\n+ eq = _mexpand(eq, recursive=True)\n+ if eq.is_number:\n+ return\n+\n+ # see if there are radicals in symbols of interest\n+ syms = set(syms) or eq.free_symbols # _take uses this\n+ poly = eq.as_poly()\n+ gens = [g for g in poly.gens if _take(g)]\n+ if not gens:\n+ return\n+\n+ # recast poly in terms of eigen-gens\n+ poly = eq.as_poly(*gens)\n+\n+ # not a polynomial e.g. 1 + sqrt(x)*exp(sqrt(x)) with gen sqrt(x)\n+ if poly is None:\n+ return\n+\n+ # - an exponent has a symbol of interest (don't handle)\n+ if any(g.exp.has(*syms) for g in gens):\n+ return\n+\n+ def _rads_bases_lcm(poly):\n+ # if all the bases are the same or all the radicals are in one\n+ # term, `lcm` will be the lcm of the denominators of the\n+ # exponents of the radicals\n+ lcm = 1\n+ rads = set()\n+ bases = set()\n+ for g in poly.gens:\n+ q = _Q(g)\n+ if q != 1:\n+ rads.add(g)\n+ lcm = ilcm(lcm, q)\n+ bases.add(g.base)\n+ return rads, bases, lcm\n+ rads, bases, lcm = _rads_bases_lcm(poly)\n+\n+ covsym = Dummy('p', nonnegative=True)\n+\n+ # only keep in syms symbols that actually appear in radicals;\n+ # and update gens\n+ newsyms = set()\n+ for r in rads:\n+ newsyms.update(syms & r.free_symbols)\n+ if newsyms != syms:\n+ syms = newsyms\n+ # get terms together that have common generators\n+ drad = dict(zip(rads, range(len(rads))))\n+ rterms = {(): []}\n+ args = Add.make_args(poly.as_expr())\n+ for t in args:\n+ if _take(t):\n+ common = set(t.as_poly().gens).intersection(rads)\n+ key = tuple(sorted([drad[i] for i in common]))\n+ else:\n+ key = ()\n+ rterms.setdefault(key, []).append(t)\n+ others = Add(*rterms.pop(()))\n+ rterms = [Add(*rterms[k]) for k in rterms.keys()]\n+\n+ # the output will depend on the order terms are processed, so\n+ # make it canonical quickly\n+ rterms = list(reversed(list(ordered(rterms))))\n+\n+ ok = False # we don't have a solution yet\n+ depth = sqrt_depth(eq)\n+\n+ if len(rterms) == 1 and not (rterms[0].is_Add and lcm > 2):\n+ eq = rterms[0]**lcm - ((-others)**lcm)\n+ ok = True\n+ else:\n+ if len(rterms) == 1 and rterms[0].is_Add:\n+ rterms = list(rterms[0].args)\n+ if len(bases) == 1:\n+ b = bases.pop()\n+ if len(syms) > 1:\n+ x = b.free_symbols\n+ else:\n+ x = syms\n+ x = list(ordered(x))[0]\n+ try:\n+ inv = _vsolve(covsym**lcm - b, x, **uflags)\n+ if not inv:\n+ raise NotImplementedError\n+ eq = poly.as_expr().subs(b, covsym**lcm).subs(x, inv[0])\n+ _cov(covsym, covsym**lcm - b)\n+ return _canonical(eq, cov)\n+ except NotImplementedError:\n+ pass\n+\n+ if len(rterms) == 2:\n+ if not others:\n+ eq = rterms[0]**lcm - (-rterms[1])**lcm\n+ ok = True\n+ elif not log(lcm, 2).is_Integer:\n+ # the lcm-is-power-of-two case is handled below\n+ r0, r1 = rterms\n+ if flags.get('_reverse', False):\n+ r1, r0 = r0, r1\n+ i0 = _rads0, _bases0, lcm0 = _rads_bases_lcm(r0.as_poly())\n+ i1 = _rads1, _bases1, lcm1 = _rads_bases_lcm(r1.as_poly())\n+ for reverse in range(2):\n+ if reverse:\n+ i0, i1 = i1, i0\n+ r0, r1 = r1, r0\n+ _rads1, _, lcm1 = i1\n+ _rads1 = Mul(*_rads1)\n+ t1 = _rads1**lcm1\n+ c = covsym**lcm1 - t1\n+ for x in syms:\n+ try:\n+ sol = _vsolve(c, x, **uflags)\n+ if not sol:\n+ raise NotImplementedError\n+ neweq = r0.subs(x, sol[0]) + covsym*r1/_rads1 + \\\n+ others\n+ tmp = unrad(neweq, covsym)\n+ if tmp:\n+ eq, newcov = tmp\n+ if newcov:\n+ newp, newc = newcov\n+ _cov(newp, c.subs(covsym,\n+ _vsolve(newc, covsym, **uflags)[0]))\n+ else:\n+ _cov(covsym, c)\n+ else:\n+ eq = neweq\n+ _cov(covsym, c)\n+ ok = True\n+ break\n+ except NotImplementedError:\n+ if reverse:\n+ raise NotImplementedError(\n+ 'no successful change of variable found')\n+ else:\n+ pass\n+ if ok:\n+ break\n+ elif len(rterms) == 3:\n+ # two cube roots and another with order less than 5\n+ # (so an analytical solution can be found) or a base\n+ # that matches one of the cube root bases\n+ info = [_rads_bases_lcm(i.as_poly()) for i in rterms]\n+ RAD = 0\n+ BASES = 1\n+ LCM = 2\n+ if info[0][LCM] != 3:\n+ info.append(info.pop(0))\n+ rterms.append(rterms.pop(0))\n+ elif info[1][LCM] != 3:\n+ info.append(info.pop(1))\n+ rterms.append(rterms.pop(1))\n+ if info[0][LCM] == info[1][LCM] == 3:\n+ if info[1][BASES] != info[2][BASES]:\n+ info[0], info[1] = info[1], info[0]\n+ rterms[0], rterms[1] = rterms[1], rterms[0]\n+ if info[1][BASES] == info[2][BASES]:\n+ eq = rterms[0]**3 + (rterms[1] + rterms[2] + others)**3\n+ ok = True\n+ elif info[2][LCM] < 5:\n+ # a*root(A, 3) + b*root(B, 3) + others = c\n+ a, b, c, d, A, B = [Dummy(i) for i in 'abcdAB']\n+ # zz represents the unraded expression into which the\n+ # specifics for this case are substituted\n+ zz = (c - d)*(A**3*a**9 + 3*A**2*B*a**6*b**3 -\n+ 3*A**2*a**6*c**3 + 9*A**2*a**6*c**2*d - 9*A**2*a**6*c*d**2 +\n+ 3*A**2*a**6*d**3 + 3*A*B**2*a**3*b**6 + 21*A*B*a**3*b**3*c**3 -\n+ 63*A*B*a**3*b**3*c**2*d + 63*A*B*a**3*b**3*c*d**2 -\n+ 21*A*B*a**3*b**3*d**3 + 3*A*a**3*c**6 - 18*A*a**3*c**5*d +\n+ 45*A*a**3*c**4*d**2 - 60*A*a**3*c**3*d**3 + 45*A*a**3*c**2*d**4 -\n+ 18*A*a**3*c*d**5 + 3*A*a**3*d**6 + B**3*b**9 - 3*B**2*b**6*c**3 +\n+ 9*B**2*b**6*c**2*d - 9*B**2*b**6*c*d**2 + 3*B**2*b**6*d**3 +\n+ 3*B*b**3*c**6 - 18*B*b**3*c**5*d + 45*B*b**3*c**4*d**2 -\n+ 60*B*b**3*c**3*d**3 + 45*B*b**3*c**2*d**4 - 18*B*b**3*c*d**5 +\n+ 3*B*b**3*d**6 - c**9 + 9*c**8*d - 36*c**7*d**2 + 84*c**6*d**3 -\n+ 126*c**5*d**4 + 126*c**4*d**5 - 84*c**3*d**6 + 36*c**2*d**7 -\n+ 9*c*d**8 + d**9)\n+ def _t(i):\n+ b = Mul(*info[i][RAD])\n+ return cancel(rterms[i]/b), Mul(*info[i][BASES])\n+ aa, AA = _t(0)\n+ bb, BB = _t(1)\n+ cc = -rterms[2]\n+ dd = others\n+ eq = zz.xreplace(dict(zip(\n+ (a, A, b, B, c, d),\n+ (aa, AA, bb, BB, cc, dd))))\n+ ok = True\n+ # handle power-of-2 cases\n+ if not ok:\n+ if log(lcm, 2).is_Integer and (not others and\n+ len(rterms) == 4 or len(rterms) < 4):\n+ def _norm2(a, b):\n+ return a**2 + b**2 + 2*a*b\n+\n+ if len(rterms) == 4:\n+ # (r0+r1)**2 - (r2+r3)**2\n+ r0, r1, r2, r3 = rterms\n+ eq = _norm2(r0, r1) - _norm2(r2, r3)\n+ ok = True\n+ elif len(rterms) == 3:\n+ # (r1+r2)**2 - (r0+others)**2\n+ r0, r1, r2 = rterms\n+ eq = _norm2(r1, r2) - _norm2(r0, others)\n+ ok = True\n+ elif len(rterms) == 2:\n+ # r0**2 - (r1+others)**2\n+ r0, r1 = rterms\n+ eq = r0**2 - _norm2(r1, others)\n+ ok = True\n+\n+ new_depth = sqrt_depth(eq) if ok else depth\n+ rpt += 1 # XXX how many repeats with others unchanging is enough?\n+ if not ok or (\n+ nwas is not None and len(rterms) == nwas and\n+ new_depth is not None and new_depth == depth and\n+ rpt > 3):\n+ raise NotImplementedError('Cannot remove all radicals')\n+\n+ flags.update({\"cov\": cov, \"n\": len(rterms), \"rpt\": rpt})\n+ neq = unrad(eq, *syms, **flags)\n+ if neq:\n+ eq, cov = neq\n+ eq, cov = _canonical(eq, cov)\n+ return eq, cov\n+\n \n # delayed imports\n from sympy.solvers.bivariate import (\n", "test": null }
null
{ "code": "diff --git a/sympy/solvers/solvers.py b/sympy/solvers/solvers.py\nindex b1210a2baa..2df0ab3d98 100644\n--- a/sympy/solvers/solvers.py\n+++ b/sympy/solvers/solvers.py\n@@ -3370,311 +3370,6 @@ def unrad(eq, *syms, **flags):\n \n \"\"\"\n \n- uflags = {\"check\": False, \"simplify\": False}\n-\n- def _cov(p, e):\n- if cov:\n- # XXX - uncovered\n- oldp, olde = cov\n- if Poly(e, p).degree(p) in (1, 2):\n- cov[:] = [p, olde.subs(oldp, _vsolve(e, p, **uflags)[0])]\n- else:\n- raise NotImplementedError\n- else:\n- cov[:] = [p, e]\n-\n- def _canonical(eq, cov):\n- if cov:\n- # change symbol to vanilla so no solutions are eliminated\n- p, e = cov\n- rep = {p: Dummy(p.name)}\n- eq = eq.xreplace(rep)\n- cov = [p.xreplace(rep), e.xreplace(rep)]\n-\n- # remove constants and powers of factors since these don't change\n- # the location of the root; XXX should factor or factor_terms be used?\n- eq = factor_terms(_mexpand(eq.as_numer_denom()[0], recursive=True), clear=True)\n- if eq.is_Mul:\n- args = []\n- for f in eq.args:\n- if f.is_number:\n- continue\n- if f.is_Pow:\n- args.append(f.base)\n- else:\n- args.append(f)\n- eq = Mul(*args) # leave as Mul for more efficient solving\n-\n- # make the sign canonical\n- margs = list(Mul.make_args(eq))\n- changed = False\n- for i, m in enumerate(margs):\n- if m.could_extract_minus_sign():\n- margs[i] = -m\n- changed = True\n- if changed:\n- eq = Mul(*margs, evaluate=False)\n-\n- return eq, cov\n-\n- def _Q(pow):\n- # return leading Rational of denominator of Pow's exponent\n- c = pow.as_base_exp()[1].as_coeff_Mul()[0]\n- if not c.is_Rational:\n- return S.One\n- return c.q\n-\n- # define the _take method that will determine whether a term is of interest\n- def _take(d):\n- # return True if coefficient of any factor's exponent's den is not 1\n- for pow in Mul.make_args(d):\n- if not pow.is_Pow:\n- continue\n- if _Q(pow) == 1:\n- continue\n- if pow.free_symbols & syms:\n- return True\n- return False\n- _take = flags.setdefault('_take', _take)\n-\n- if isinstance(eq, Eq):\n- eq = eq.lhs - eq.rhs # XXX legacy Eq as Eqn support\n- elif not isinstance(eq, Expr):\n- return\n-\n- cov, nwas, rpt = [flags.setdefault(k, v) for k, v in\n- sorted({\"cov\": [], \"n\": None, \"rpt\": 0}.items())]\n-\n- # preconditioning\n- eq = powdenest(factor_terms(eq, radical=True, clear=True))\n- eq = eq.as_numer_denom()[0]\n- eq = _mexpand(eq, recursive=True)\n- if eq.is_number:\n- return\n-\n- # see if there are radicals in symbols of interest\n- syms = set(syms) or eq.free_symbols # _take uses this\n- poly = eq.as_poly()\n- gens = [g for g in poly.gens if _take(g)]\n- if not gens:\n- return\n-\n- # recast poly in terms of eigen-gens\n- poly = eq.as_poly(*gens)\n-\n- # not a polynomial e.g. 1 + sqrt(x)*exp(sqrt(x)) with gen sqrt(x)\n- if poly is None:\n- return\n-\n- # - an exponent has a symbol of interest (don't handle)\n- if any(g.exp.has(*syms) for g in gens):\n- return\n-\n- def _rads_bases_lcm(poly):\n- # if all the bases are the same or all the radicals are in one\n- # term, `lcm` will be the lcm of the denominators of the\n- # exponents of the radicals\n- lcm = 1\n- rads = set()\n- bases = set()\n- for g in poly.gens:\n- q = _Q(g)\n- if q != 1:\n- rads.add(g)\n- lcm = ilcm(lcm, q)\n- bases.add(g.base)\n- return rads, bases, lcm\n- rads, bases, lcm = _rads_bases_lcm(poly)\n-\n- covsym = Dummy('p', nonnegative=True)\n-\n- # only keep in syms symbols that actually appear in radicals;\n- # and update gens\n- newsyms = set()\n- for r in rads:\n- newsyms.update(syms & r.free_symbols)\n- if newsyms != syms:\n- syms = newsyms\n- # get terms together that have common generators\n- drad = dict(zip(rads, range(len(rads))))\n- rterms = {(): []}\n- args = Add.make_args(poly.as_expr())\n- for t in args:\n- if _take(t):\n- common = set(t.as_poly().gens).intersection(rads)\n- key = tuple(sorted([drad[i] for i in common]))\n- else:\n- key = ()\n- rterms.setdefault(key, []).append(t)\n- others = Add(*rterms.pop(()))\n- rterms = [Add(*rterms[k]) for k in rterms.keys()]\n-\n- # the output will depend on the order terms are processed, so\n- # make it canonical quickly\n- rterms = list(reversed(list(ordered(rterms))))\n-\n- ok = False # we don't have a solution yet\n- depth = sqrt_depth(eq)\n-\n- if len(rterms) == 1 and not (rterms[0].is_Add and lcm > 2):\n- eq = rterms[0]**lcm - ((-others)**lcm)\n- ok = True\n- else:\n- if len(rterms) == 1 and rterms[0].is_Add:\n- rterms = list(rterms[0].args)\n- if len(bases) == 1:\n- b = bases.pop()\n- if len(syms) > 1:\n- x = b.free_symbols\n- else:\n- x = syms\n- x = list(ordered(x))[0]\n- try:\n- inv = _vsolve(covsym**lcm - b, x, **uflags)\n- if not inv:\n- raise NotImplementedError\n- eq = poly.as_expr().subs(b, covsym**lcm).subs(x, inv[0])\n- _cov(covsym, covsym**lcm - b)\n- return _canonical(eq, cov)\n- except NotImplementedError:\n- pass\n-\n- if len(rterms) == 2:\n- if not others:\n- eq = rterms[0]**lcm - (-rterms[1])**lcm\n- ok = True\n- elif not log(lcm, 2).is_Integer:\n- # the lcm-is-power-of-two case is handled below\n- r0, r1 = rterms\n- if flags.get('_reverse', False):\n- r1, r0 = r0, r1\n- i0 = _rads0, _bases0, lcm0 = _rads_bases_lcm(r0.as_poly())\n- i1 = _rads1, _bases1, lcm1 = _rads_bases_lcm(r1.as_poly())\n- for reverse in range(2):\n- if reverse:\n- i0, i1 = i1, i0\n- r0, r1 = r1, r0\n- _rads1, _, lcm1 = i1\n- _rads1 = Mul(*_rads1)\n- t1 = _rads1**lcm1\n- c = covsym**lcm1 - t1\n- for x in syms:\n- try:\n- sol = _vsolve(c, x, **uflags)\n- if not sol:\n- raise NotImplementedError\n- neweq = r0.subs(x, sol[0]) + covsym*r1/_rads1 + \\\n- others\n- tmp = unrad(neweq, covsym)\n- if tmp:\n- eq, newcov = tmp\n- if newcov:\n- newp, newc = newcov\n- _cov(newp, c.subs(covsym,\n- _vsolve(newc, covsym, **uflags)[0]))\n- else:\n- _cov(covsym, c)\n- else:\n- eq = neweq\n- _cov(covsym, c)\n- ok = True\n- break\n- except NotImplementedError:\n- if reverse:\n- raise NotImplementedError(\n- 'no successful change of variable found')\n- else:\n- pass\n- if ok:\n- break\n- elif len(rterms) == 3:\n- # two cube roots and another with order less than 5\n- # (so an analytical solution can be found) or a base\n- # that matches one of the cube root bases\n- info = [_rads_bases_lcm(i.as_poly()) for i in rterms]\n- RAD = 0\n- BASES = 1\n- LCM = 2\n- if info[0][LCM] != 3:\n- info.append(info.pop(0))\n- rterms.append(rterms.pop(0))\n- elif info[1][LCM] != 3:\n- info.append(info.pop(1))\n- rterms.append(rterms.pop(1))\n- if info[0][LCM] == info[1][LCM] == 3:\n- if info[1][BASES] != info[2][BASES]:\n- info[0], info[1] = info[1], info[0]\n- rterms[0], rterms[1] = rterms[1], rterms[0]\n- if info[1][BASES] == info[2][BASES]:\n- eq = rterms[0]**3 + (rterms[1] + rterms[2] + others)**3\n- ok = True\n- elif info[2][LCM] < 5:\n- # a*root(A, 3) + b*root(B, 3) + others = c\n- a, b, c, d, A, B = [Dummy(i) for i in 'abcdAB']\n- # zz represents the unraded expression into which the\n- # specifics for this case are substituted\n- zz = (c - d)*(A**3*a**9 + 3*A**2*B*a**6*b**3 -\n- 3*A**2*a**6*c**3 + 9*A**2*a**6*c**2*d - 9*A**2*a**6*c*d**2 +\n- 3*A**2*a**6*d**3 + 3*A*B**2*a**3*b**6 + 21*A*B*a**3*b**3*c**3 -\n- 63*A*B*a**3*b**3*c**2*d + 63*A*B*a**3*b**3*c*d**2 -\n- 21*A*B*a**3*b**3*d**3 + 3*A*a**3*c**6 - 18*A*a**3*c**5*d +\n- 45*A*a**3*c**4*d**2 - 60*A*a**3*c**3*d**3 + 45*A*a**3*c**2*d**4 -\n- 18*A*a**3*c*d**5 + 3*A*a**3*d**6 + B**3*b**9 - 3*B**2*b**6*c**3 +\n- 9*B**2*b**6*c**2*d - 9*B**2*b**6*c*d**2 + 3*B**2*b**6*d**3 +\n- 3*B*b**3*c**6 - 18*B*b**3*c**5*d + 45*B*b**3*c**4*d**2 -\n- 60*B*b**3*c**3*d**3 + 45*B*b**3*c**2*d**4 - 18*B*b**3*c*d**5 +\n- 3*B*b**3*d**6 - c**9 + 9*c**8*d - 36*c**7*d**2 + 84*c**6*d**3 -\n- 126*c**5*d**4 + 126*c**4*d**5 - 84*c**3*d**6 + 36*c**2*d**7 -\n- 9*c*d**8 + d**9)\n- def _t(i):\n- b = Mul(*info[i][RAD])\n- return cancel(rterms[i]/b), Mul(*info[i][BASES])\n- aa, AA = _t(0)\n- bb, BB = _t(1)\n- cc = -rterms[2]\n- dd = others\n- eq = zz.xreplace(dict(zip(\n- (a, A, b, B, c, d),\n- (aa, AA, bb, BB, cc, dd))))\n- ok = True\n- # handle power-of-2 cases\n- if not ok:\n- if log(lcm, 2).is_Integer and (not others and\n- len(rterms) == 4 or len(rterms) < 4):\n- def _norm2(a, b):\n- return a**2 + b**2 + 2*a*b\n-\n- if len(rterms) == 4:\n- # (r0+r1)**2 - (r2+r3)**2\n- r0, r1, r2, r3 = rterms\n- eq = _norm2(r0, r1) - _norm2(r2, r3)\n- ok = True\n- elif len(rterms) == 3:\n- # (r1+r2)**2 - (r0+others)**2\n- r0, r1, r2 = rterms\n- eq = _norm2(r1, r2) - _norm2(r0, others)\n- ok = True\n- elif len(rterms) == 2:\n- # r0**2 - (r1+others)**2\n- r0, r1 = rterms\n- eq = r0**2 - _norm2(r1, others)\n- ok = True\n-\n- new_depth = sqrt_depth(eq) if ok else depth\n- rpt += 1 # XXX how many repeats with others unchanging is enough?\n- if not ok or (\n- nwas is not None and len(rterms) == nwas and\n- new_depth is not None and new_depth == depth and\n- rpt > 3):\n- raise NotImplementedError('Cannot remove all radicals')\n-\n- flags.update({\"cov\": cov, \"n\": len(rterms), \"rpt\": rpt})\n- neq = unrad(eq, *syms, **flags)\n- if neq:\n- eq, cov = neq\n- eq, cov = _canonical(eq, cov)\n- return eq, cov\n-\n \n # delayed imports\n from sympy.solvers.bivariate import (\n", "test": null }
null
sympy/sympy
c870d17c2638f5061800e344b72ff80086a0b41d
2024-09-17T13:02:53-05:00
null
null
{ "code": "I want to add a new function in file in sympy/solvers/solvers.py.\nHere is the description for the function:\ndef unrad(eq, *syms, **flags):\n \"\"\"\n Remove radicals with symbolic arguments and return (eq, cov),\n None, or raise an error.\n\n Explanation\n ===========\n\n None is returned if there are no radicals to remove.\n\n NotImplementedError is raised if there are radicals and they cannot be\n removed or if the relationship between the original symbols and the\n change of variable needed to rewrite the system as a polynomial cannot\n be solved.\n\n Otherwise the tuple, ``(eq, cov)``, is returned where:\n\n *eq*, ``cov``\n *eq* is an equation without radicals (in the symbol(s) of\n interest) whose solutions are a superset of the solutions to the\n original expression. *eq* might be rewritten in terms of a new\n variable; the relationship to the original variables is given by\n ``cov`` which is a list containing ``v`` and ``v**p - b`` where\n ``p`` is the power needed to clear the radical and ``b`` is the\n radical now expressed as a polynomial in the symbols of interest.\n For example, for sqrt(2 - x) the tuple would be\n ``(c, c**2 - 2 + x)``. The solutions of *eq* will contain\n solutions to the original equation (if there are any).\n\n *syms*\n An iterable of symbols which, if provided, will limit the focus of\n radical removal: only radicals with one or more of the symbols of\n interest will be cleared. All free symbols are used if *syms* is not\n set.\n\n *flags* are used internally for communication during recursive calls.\n Two options are also recognized:\n\n ``take``, when defined, is interpreted as a single-argument function\n that returns True if a given Pow should be handled.\n\n Radicals can be removed from an expression if:\n\n * All bases of the radicals are the same; a change of variables is\n done in this case.\n * If all radicals appear in one term of the expression.\n * There are only four terms with sqrt() factors or there are less than\n four terms having sqrt() factors.\n * There are only two terms with radicals.\n\n Examples\n ========\n\n >>> from sympy.solvers.solvers import unrad\n >>> from sympy.abc import x\n >>> from sympy import sqrt, Rational, root\n\n >>> unrad(sqrt(x)*x**Rational(1, 3) + 2)\n (x**5 - 64, [])\n >>> unrad(sqrt(x) + root(x + 1, 3))\n (-x**3 + x**2 + 2*x + 1, [])\n >>> eq = sqrt(x) + root(x, 3) - 2\n >>> unrad(eq)\n (_p**3 + _p**2 - 2, [_p, _p**6 - x])\n\n \"\"\"\n", "test": null }
c870d17c2638f5061800e344b72ff80086a0b41d
{ "FAIL_TO_PASS": [ "sympy/stats/tests/test_continuous_rv.py::test_single_normal", "sympy/solvers/tests/test_solvers.py::test_guess_poly_cv", "sympy/solvers/tests/test_solvers.py::test_guess_rational_cv", "sympy/solvers/tests/test_solvers.py::test_guess_transcendental", "sympy/core/tests/test_relational.py::test_simplify_relational", "sympy/utilities/tests/test_wester.py::test_H15", "sympy/series/tests/test_order.py::test_order_at_infinity", "sympy/solvers/tests/test_solvers.py::test_solve_args", "sympy/series/tests/test_order.py::test_order_subs_limits", "sympy/core/tests/test_relational.py::test_issue_18188", "sympy/sets/tests/test_sets.py::test_image_interval", "sympy/sets/tests/test_sets.py::test_image_piecewise", "sympy/logic/tests/test_boolalg.py::test_bool_as_set", "sympy/solvers/tests/test_solvers.py::test_solve_polynomial_cv_1a", "sympy/sets/tests/test_sets.py::test_issue_10113", "sympy/solvers/tests/test_solvers.py::test_solve_polynomial_cv_1b", "sympy/core/tests/test_function.py::test_nfloat", "sympy/solvers/tests/test_solveset.py::test_invert_trig_hyp_real", "sympy/solvers/tests/test_solveset.py::test_issue_17479", "sympy/solvers/tests/test_solveset.py::test_issue_21047", "sympy/core/tests/test_function.py::test_issue_17382", "sympy/solvers/diophantine/tests/test_diophantine.py::test_quadratic_parabolic_case", "sympy/series/tests/test_limits.py::test_series_AccumBounds", "sympy/solvers/tests/test_solveset.py::test_solve_mul", "sympy/solvers/tests/test_solveset.py::test_solve_polynomial", "sympy/series/tests/test_series.py::test_issue_5223", "sympy/solvers/tests/test_solveset.py::test_return_root_of", "sympy/solvers/tests/test_solveset.py::test_solveset_sqrt_1", "sympy/solvers/ode/tests/test_ode.py::test_dsolve_all_hint", "sympy/solvers/tests/test_solveset.py::test_solveset_sqrt_2", "sympy/functions/elementary/tests/test_exponential.py::test_log_series", "sympy/solvers/ode/tests/test_ode.py::test_dsolve_ics", "sympy/solvers/tests/test_solveset.py::test_solve_polynomial_symbolic_param", "sympy/solvers/ode/tests/test_ode.py::test_classify_ode", "sympy/solvers/tests/test_solvers.py::test_solve_conjugate", "sympy/solvers/tests/test_solveset.py::test_solve_rational", "sympy/solvers/ode/tests/test_ode.py::test_classify_ode_ics", "sympy/functions/elementary/tests/test_piecewise.py::test_unevaluated_integrals", "sympy/solvers/tests/test_solvers.py::test_solve_nonlinear", "sympy/solvers/tests/test_solveset.py::test_no_sol", "sympy/solvers/diophantine/tests/test_diophantine.py::test_diophantine", "sympy/solvers/tests/test_inequalities.py::test_reduce_inequalities_errors", "sympy/solvers/tests/test_solvers.py::test_issue_7228", "sympy/solvers/ode/tests/test_ode.py::test_solve_ics", "sympy/matrices/tests/test_matrices.py::test_matrix_norm", "sympy/utilities/tests/test_wester.py::test_M2", "sympy/solvers/tests/test_solveset.py::test_no_sol_rational_extragenous", "sympy/solvers/tests/test_solvers.py::test_issue_7190", "sympy/functions/special/tests/test_error_functions.py::test_erf_series", "sympy/solvers/ode/tests/test_systems.py::test__classify_linear_system", "sympy/solvers/tests/test_solvers.py::test_issue_21004", "sympy/utilities/tests/test_wester.py::test_M6", "sympy/integrals/tests/test_integrals.py::test_evalf_issue_939", "sympy/solvers/tests/test_solveset.py::test_solveset_real_rational", "sympy/simplify/tests/test_simplify.py::test_Piecewise", "sympy/series/tests/test_series.py::test_issue_9549", "sympy/functions/special/tests/test_error_functions.py::test_erfc_series", "sympy/solvers/tests/test_inequalities.py::test_solve_univariate_inequality", "sympy/utilities/tests/test_wester.py::test_M10", "sympy/solvers/ode/tests/test_ode.py::test_issue_4785_22462", "sympy/functions/special/tests/test_gamma_functions.py::test_lowergamma", "sympy/solvers/tests/test_solveset.py::test_solveset_real_log", "sympy/functions/special/tests/test_error_functions.py::test_erfi_series", "sympy/utilities/tests/test_wester.py::test_M12", "sympy/solvers/tests/test_solveset.py::test_poly_gens", "sympy/utilities/tests/test_wester.py::test_M20", "sympy/functions/special/tests/test_error_functions.py::test_ei", "sympy/solvers/tests/test_solveset.py::test_solve_abs", "sympy/utilities/tests/test_wester.py::test_M21", "sympy/solvers/tests/test_solveset.py::test_issue_9824", "sympy/functions/special/tests/test_error_functions.py::test_expint", "sympy/utilities/tests/test_wester.py::test_M22", "sympy/series/tests/test_series.py::test_issue_15539", "sympy/solvers/tests/test_inequalities.py::test_integer_domain_relational_isolve", "sympy/integrals/tests/test_heurisch.py::test_heurisch_symbolic_coeffs_1130", "sympy/utilities/tests/test_wester.py::test_M23", "sympy/stats/tests/test_continuous_rv.py::test_beta", "sympy/solvers/diophantine/tests/test_diophantine.py::test_diopcoverage", "sympy/solvers/tests/test_solveset.py::test_issue_9565", "sympy/solvers/tests/test_inequalities.py::test_issue_10671_12466", "sympy/utilities/tests/test_wester.py::test_M24", "sympy/series/tests/test_series.py::test_issue_18008", "sympy/utilities/tests/test_wester.py::test_M25", "sympy/solvers/tests/test_inequalities.py::test__solve_inequality", "sympy/physics/control/tests/test_lti.py::test_TransferFunction_gain_margin", "sympy/solvers/tests/test_solveset.py::test_solve_only_exp_1", "sympy/geometry/tests/test_ellipse.py::test_parameter_value", "sympy/utilities/tests/test_wester.py::test_M26", "sympy/solvers/ode/tests/test_ode.py::test_issue_5095", "sympy/utilities/tests/test_wester.py::test_M27", "sympy/solvers/tests/test_solveset.py::test_piecewise_solveset", "sympy/solvers/tests/test_inequalities.py::test_issue_25983", "sympy/functions/special/tests/test_error_functions.py::test_si", "sympy/utilities/tests/test_wester.py::test_M30", "sympy/matrices/tests/test_matrixbase.py::test_matrix_norm", "sympy/sets/tests/test_setexpr.py::test_SetExpr_Interval_div", "sympy/solvers/ode/tests/test_ode.py::test_series", "sympy/calculus/tests/test_util.py::test_function_range", "sympy/solvers/tests/test_solveset.py::test_solveset_complex_polynomial", "sympy/functions/special/tests/test_bessel.py::test_besseli_series", "sympy/stats/tests/test_continuous_rv.py::test_Lomax", "sympy/utilities/tests/test_wester.py::test_M31", "sympy/sets/tests/test_setexpr.py::test_SetExpr_Interval_pow", "sympy/solvers/ode/tests/test_ode.py::test_2nd_power_series_regular", "sympy/functions/special/tests/test_error_functions.py::test_ci", "sympy/calculus/tests/test_util.py::test_continuous_domain", "sympy/solvers/tests/test_solveset.py::test_solveset_complex_rational", "sympy/integrals/tests/test_integrals.py::test_integrate_returns_piecewise", "sympy/utilities/tests/test_wester.py::test_M36", "sympy/solvers/ode/tests/test_single.py::test_linear_coefficients", "sympy/solvers/tests/test_solveset.py::test_solveset_complex_exp", "sympy/functions/special/tests/test_bessel.py::test_besselk_series", "sympy/utilities/tests/test_wester.py::test_N10", "sympy/integrals/tests/test_integrals.py::test_integrate_max_min", "sympy/solvers/tests/test_solveset.py::test_solve_complex_log", "sympy/solvers/ode/tests/test_single.py::test_Airy_equation", "sympy/solvers/tests/test_solveset.py::test_solve_complex_sqrt", "sympy/functions/special/tests/test_error_functions.py::test_fresnel_series", "sympy/solvers/ode/tests/test_ode.py::test_issue_13060", "sympy/solvers/tests/test_solveset.py::test_solveset_complex_tan", "sympy/solvers/ode/tests/test_ode.py::test_issue_22523", "sympy/calculus/tests/test_util.py::test_not_empty_in", "sympy/solvers/tests/test_solveset.py::test_solve_trig", "sympy/solvers/tests/test_solveset.py::test_solve_trig_hyp_by_inversion", "sympy/stats/tests/test_continuous_rv.py::test_trapezoidal", "sympy/solvers/ode/tests/test_ode.py::test_issue_22462", "sympy/solvers/tests/test_solveset.py::test_solve_hyperbolic", "sympy/solvers/tests/test_solvers.py::test_issue_4793", "sympy/solvers/ode/tests/test_ode.py::test_issue_23425", "sympy/calculus/tests/test_singularities.py::test_singularities", "sympy/integrals/tests/test_integrals.py::test_issue_4890", "sympy/solvers/tests/test_solvers.py::test_PR1964", "sympy/concrete/tests/test_sums_products.py::test_issue_14640", "sympy/solvers/tests/test_solveset.py::test_solve_trig_hyp_symbolic", "sympy/calculus/tests/test_singularities.py::test_is_increasing", "sympy/solvers/tests/test_solvers.py::test_issue_5197", "sympy/calculus/tests/test_singularities.py::test_is_strictly_increasing", "sympy/solvers/tests/test_solvers.py::test_issue_4671_4463_4467", "sympy/calculus/tests/test_singularities.py::test_is_decreasing", "sympy/solvers/tests/test_solvers.py::test_issue_5132", "sympy/calculus/tests/test_singularities.py::test_is_strictly_decreasing", "sympy/solvers/tests/test_solveset.py::test_issue_9616", "sympy/calculus/tests/test_singularities.py::test_is_monotonic", "sympy/calculus/tests/test_singularities.py::test_issue_23401", "sympy/functions/elementary/tests/test_trigonometric.py::test_issue_23843", "sympy/solvers/tests/test_solveset.py::test_solve_invalid_sol", "sympy/solvers/tests/test_solveset.py::test_solveset", "sympy/solvers/tests/test_solvers.py::test_issue_24609", "sympy/vector/tests/test_implicitregion.py::test_singular_points_and_multiplicty", "sympy/vector/tests/test_implicitregion.py::test_rational_parametrization", "sympy/solvers/tests/test_solveset.py::test__solveset_multi", "sympy/solvers/tests/test_solvers.py::test_issue_4463", "sympy/integrals/tests/test_integrals.py::test_issue_3940", "sympy/calculus/tests/test_util.py::test_stationary_points", "sympy/integrals/tests/test_heurisch.py::test_heurisch_issue_26922", "sympy/solvers/ode/tests/test_systems.py::test_sysode_linear_neq_order1_type3", "sympy/calculus/tests/test_util.py::test_maximum", "sympy/solvers/tests/test_pde.py::test_pdsolve_variable_coeff", "sympy/solvers/tests/test_solvers.py::test_issue_6056", "sympy/solvers/tests/test_solveset.py::test_conditionset", "sympy/calculus/tests/test_util.py::test_minimum", "sympy/solvers/tests/test_solveset.py::test_solveset_domain", "sympy/solvers/tests/test_solveset.py::test_improve_coverage", "sympy/calculus/tests/test_util.py::test_issue_19869", "sympy/solvers/tests/test_solveset.py::test_issue_9522", "sympy/solvers/ode/tests/test_single.py::test_nth_linear_constant_coeff_var_of_parameters", "sympy/geometry/tests/test_plane.py::test_parameter_value", "sympy/solvers/tests/test_solveset.py::test_solvify", "sympy/vector/tests/test_integrals.py::test_vector_integrate", "sympy/solvers/ode/tests/test_systems.py::test_higher_order_to_first_order", "sympy/solvers/tests/test_solveset.py::test_solvify_piecewise", "sympy/solvers/ode/tests/test_single.py::test_nth_order_reducible", "sympy/solvers/ode/tests/test_single.py::test_Riccati_special_minus2", "sympy/solvers/tests/test_solveset.py::test_solve_decomposition", "sympy/solvers/tests/test_solveset.py::test_nonlinsolve_basic", "sympy/solvers/ode/tests/test_single.py::test_Bernoulli", "sympy/integrals/tests/test_integrals.py::test_issue_4153", "sympy/stats/tests/test_continuous_rv.py::test_compute_density", "sympy/solvers/tests/test_solveset.py::test_nonlinsolve_abs", "sympy/solvers/tests/test_solveset.py::test_trig_system", "sympy/solvers/ode/tests/test_lie_group.py::test_user_infinitesimals", "sympy/solvers/ode/tests/test_single.py::test_1st_linear", "sympy/solvers/tests/test_solveset.py::test_nonlinsolve_positive_dimensional", "sympy/solvers/tests/test_solveset.py::test_nonlinsolve_polysys", "sympy/solvers/ode/tests/test_single.py::test_almost_linear", "sympy/solvers/tests/test_solveset.py::test_nonlinsolve_using_substitution", "sympy/solvers/tests/test_solveset.py::test_nonlinsolve_complex", "sympy/solvers/ode/tests/test_single.py::test_nth_order_linear_euler_eq_homogeneous", "sympy/solvers/tests/test_solveset.py::test_nonlinsolve_radical", "sympy/solvers/tests/test_solveset.py::test_nonlinsolve_inexact", "sympy/solvers/ode/tests/test_single.py::test_nth_order_linear_euler_eq_nonhomogeneous_undetermined_coefficients", "sympy/solvers/tests/test_solveset.py::test_nonlinsolve_issue_25182", "sympy/solvers/tests/test_solveset.py::test_issue_14642", "sympy/utilities/tests/test_wester.py::test_X13", "sympy/solvers/tests/test_solveset.py::test_issue_13961", "sympy/solvers/tests/test_solveset.py::test_issue_14541", "sympy/integrals/tests/test_transforms.py::test_issue_12591", "sympy/solvers/tests/test_solveset.py::test_issue_12032", "sympy/polys/numberfields/tests/test_minpoly.py::test_issue_18248", "sympy/solvers/tests/test_solveset.py::test_issue_10876", "sympy/integrals/tests/test_meijerint.py::test_issue_10211", "sympy/solvers/tests/test_solveset.py::test_issue_19050", "sympy/solvers/tests/test_solveset.py::test_issue_16618", "sympy/solvers/tests/test_solveset.py::test_issue_17566", "sympy/solvers/tests/test_solveset.py::test_issue_19587", "sympy/solvers/tests/test_solveset.py::test_issue_5132_1", "sympy/solvers/tests/test_solveset.py::test_issue_5132_2", "sympy/solvers/tests/test_solvers.py::test_issue_6605", "sympy/solvers/tests/test_solvers.py::test_issue_6644", "sympy/solvers/tests/test_solveset.py::test_issue_6752", "sympy/solvers/tests/test_solveset.py::test_issue_2777", "sympy/solvers/tests/test_solveset.py::test_issue_8828", "sympy/solvers/tests/test_solvers.py::test_issues_6819_6820_6821_6248_8692_25777_25779", "sympy/solvers/tests/test_solveset.py::test_nonlinsolve_conditionset", "sympy/solvers/tests/test_solvers.py::test_issue_17638", "sympy/solvers/tests/test_solveset.py::test_substitution_basic", "sympy/integrals/tests/test_manual.py::test_issue_23566", "sympy/solvers/tests/test_solveset.py::test_substitution_incorrect", "sympy/solvers/tests/test_solveset.py::test_substitution_redundant", "sympy/solvers/tests/test_solvers.py::test_lambert_multivariate", "sympy/solvers/tests/test_solveset.py::test_issue_5132_substitution", "sympy/solvers/tests/test_solvers.py::test_rewrite_trig", "sympy/solvers/tests/test_solveset.py::test_issue_21022", "sympy/solvers/tests/test_solvers.py::test_uselogcombine", "sympy/solvers/tests/test_solvers.py::test_atan2", "sympy/solvers/tests/test_solveset.py::test_issue_17906", "sympy/solvers/tests/test_solvers.py::test_errorinverses", "sympy/solvers/tests/test_solveset.py::test_issue_17933_bis", "sympy/solvers/ode/tests/test_systems.py::test_second_order_to_first_order_2", "sympy/solvers/tests/test_solvers.py::test_issue_2725", "sympy/solvers/tests/test_solveset.py::test_issue_14565", "sympy/solvers/ode/tests/test_systems.py::test_second_order_to_first_order_slow4", "sympy/solvers/tests/test_solveset.py::test_issue_9913", "sympy/solvers/tests/test_solvers.py::test_real_imag_splitting", "sympy/solvers/tests/test_solveset.py::test_integer_domain_relational", "sympy/solvers/tests/test_solvers.py::test_issue_7895", "sympy/solvers/tests/test_solvers.py::test_issue_2777", "sympy/solvers/tests/test_solveset.py::test_issue_10555", "sympy/solvers/tests/test_solvers.py::test_base_0_exp_0", "sympy/solvers/tests/test_solvers.py::test_issue_2840_8155", "sympy/solvers/tests/test_solveset.py::test_issue_11534", "sympy/solvers/tests/test_solveset.py::test_issue_10477", "sympy/solvers/tests/test_solveset.py::test_issue_11064", "sympy/solvers/tests/test_solveset.py::test_issue_12429", "sympy/solvers/tests/test_solveset.py::test_issue_19506", "sympy/solvers/tests/test_solveset.py::test_issue_13550", "sympy/solvers/tests/test_solvers.py::test_issue_14779", "sympy/solvers/tests/test_solveset.py::test_issue_13849", "sympy/solvers/tests/test_solveset.py::test_issue_10158", "sympy/solvers/tests/test_solvers.py::test_issue_17452", "sympy/integrals/tests/test_integrals.py::test_issue_15285", "sympy/solvers/tests/test_solvers.py::test_issue_17799", "sympy/solvers/tests/test_solvers.py::test_issue_17882", "sympy/solvers/tests/test_solvers.py::test_issue_17949", "sympy/solvers/tests/test_solveset.py::test_issue_17882", "sympy/solvers/tests/test_solvers.py::test_issue_19113_19102", "sympy/solvers/tests/test_solveset.py::test_issue_21276", "sympy/solvers/tests/test_solvers.py::test_issue_20747", "sympy/solvers/tests/test_solveset.py::test_exponential_real", "sympy/solvers/tests/test_solveset.py::test_expo_conditionset", "sympy/solvers/tests/test_solveset.py::test_exponential_symbols", "sympy/solvers/ode/tests/test_systems.py::test_linodesolve", "sympy/solvers/tests/test_solveset.py::test_ignore_assumptions", "sympy/solvers/tests/test_solvers.py::test_issue_6819", "sympy/solvers/tests/test_solveset.py::test_solve_exponential", "sympy/solvers/tests/test_solvers.py::test_issue_21852", "sympy/solvers/tests/test_solveset.py::test_logarithmic", "sympy/solvers/tests/test_solvers.py::test_issue_21942", "sympy/solvers/tests/test_solvers.py::test_issue_22717", "sympy/solvers/tests/test_solveset.py::test_issue_17276", "sympy/solvers/tests/test_solvers.py::test_solve_undetermined_coeffs_issue_23927", "sympy/solvers/tests/test_solveset.py::test_issue_18208", "sympy/solvers/tests/test_solveset.py::test_substitution_with_infeasible_solution", "sympy/solvers/tests/test_solvers.py::test_issue_24368", "sympy/solvers/tests/test_solveset.py::test_issue_20097", "sympy/solvers/ode/tests/test_systems.py::test_nonlinear_2eq_order1", "sympy/solvers/tests/test_solveset.py::test_issue_15350", "sympy/solvers/tests/test_solveset.py::test_issue_17604", "sympy/solvers/tests/test_solveset.py::test_issue_17566_actual", "sympy/integrals/tests/test_integrals.py::test_li_integral", "sympy/solvers/tests/test_solveset.py::test_issue_17565", "sympy/solvers/tests/test_solveset.py::test_issue_15024", "sympy/solvers/tests/test_solveset.py::test_issue_16877", "sympy/solvers/tests/test_solveset.py::test_issue_16876", "sympy/solvers/tests/test_solveset.py::test_issue_21236", "sympy/solvers/tests/test_solveset.py::test_issue_21908", "sympy/solvers/tests/test_solveset.py::test_issue_19144", "sympy/solvers/tests/test_solveset.py::test_issue_22413", "sympy/solvers/tests/test_solveset.py::test_issue_23318", "sympy/solvers/tests/test_solveset.py::test_issue_19814", "sympy/solvers/tests/test_solveset.py::test_issue_22058", "sympy/solvers/tests/test_solveset.py::test_issue_11184", "sympy/solvers/tests/test_solveset.py::test_issue_21890", "sympy/solvers/tests/test_solveset.py::test_issue_22628", "sympy/solvers/tests/test_solveset.py::test_issue_25781", "sympy/solvers/tests/test_solveset.py::test_issue_26077", "sympy/integrals/tests/test_integrals.py::test_issue_21831", "sympy/integrals/tests/test_integrals.py::test_issue_23566", "sympy/integrals/tests/test_integrals.py::test_issue_22863" ], "PASS_TO_PASS": null }