repository stringclasses 11
values | repo_id stringlengths 1 3 | target_module_path stringlengths 16 72 | prompt stringlengths 298 21.7k | relavent_test_path stringlengths 50 99 | full_function stringlengths 336 33.8k | function_name stringlengths 2 51 | content_class stringclasses 3
values | external_dependencies stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|
sympy | 17 | sympy/integrals/integrals.py | def as_sum(self, n=None, method="midpoint", evaluate=True):
"""
Approximates a definite integral by a sum.
Parameters
==========
n :
The number of subintervals to use, optional.
method :
One of: 'left', 'right', 'midpoint', 'trapezoid'.
... | /usr/src/app/target_test_cases/failed_tests_Integral.as_sum.txt | def as_sum(self, n=None, method="midpoint", evaluate=True):
"""
Approximates a definite integral by a sum.
Parameters
==========
n :
The number of subintervals to use, optional.
method :
One of: 'left', 'right', 'midpoint', 'trapezoid'.
... | Integral.as_sum | repository-level | non_external |
sympy | 18 | sympy/physics/mechanics/pathway.py | def to_loads(self, force):
"""Loads required by the equations of motion method classes.
Explanation
===========
``KanesMethod`` requires a list of ``Point``-``Vector`` tuples to be
passed to the ``loads`` parameters of its ``kanes_equations`` method
when constructin... | /usr/src/app/target_test_cases/failed_tests_ObstacleSetPathway.to_loads.txt | def to_loads(self, force):
"""Loads required by the equations of motion method classes.
Explanation
===========
``KanesMethod`` requires a list of ``Point``-``Vector`` tuples to be
passed to the ``loads`` parameters of its ``kanes_equations`` method
when constructin... | ObstacleSetPathway.to_loads | repository-level | non_external |
sympy | 19 | sympy/logic/boolalg.py | def POSform(variables, minterms, dontcares=None):
"""
The POSform function uses simplified_pairs and a redundant-group
eliminating algorithm to convert the list of all input combinations
that generate '1' (the minterms) into the smallest product-of-sums form.
The variables must be given as the firs... | /usr/src/app/target_test_cases/failed_tests_POSform.txt | def POSform(variables, minterms, dontcares=None):
"""
The POSform function uses simplified_pairs and a redundant-group
eliminating algorithm to convert the list of all input combinations
that generate '1' (the minterms) into the smallest product-of-sums form.
The variables must be given as the firs... | POSform | repository-level | non_external |
sympy | 20 | sympy/combinatorics/perm_groups.py | def schreier_sims_incremental(self, base=None, gens=None, slp_dict=False):
"""Extend a sequence of points and generating set to a base and strong
generating set.
Parameters
==========
base
The sequence of points to be extended to a base. Optional
par... | /usr/src/app/target_test_cases/failed_tests_PermutationGroup.schreier_sims_incremental.txt | def schreier_sims_incremental(self, base=None, gens=None, slp_dict=False):
"""Extend a sequence of points and generating set to a base and strong
generating set.
Parameters
==========
base
The sequence of points to be extended to a base. Optional
par... | PermutationGroup.schreier_sims_incremental | repository-level | non_external |
sympy | 21 | sympy/polys/polytools.py | def which_all_roots(f, candidates):
"""
Find roots of a square-free polynomial ``f`` from ``candidates``.
Explanation
===========
If ``f`` is a square-free polynomial and ``candidates`` is a superset
of the roots of ``f``, then ``f.which_all_roots(candidates)`` retu... | /usr/src/app/target_test_cases/failed_tests_Poly.which_all_roots.txt | def which_all_roots(f, candidates):
"""
Find roots of a square-free polynomial ``f`` from ``candidates``.
Explanation
===========
If ``f`` is a square-free polynomial and ``candidates`` is a superset
of the roots of ``f``, then ``f.which_all_roots(candidates)`` retu... | Poly.which_all_roots | repository-level | non_external |
sympy | 22 | sympy/combinatorics/polyhedron.py | def rotate(self, perm):
"""
Apply a permutation to the polyhedron *in place*. The permutation
may be given as a Permutation instance or an integer indicating
which permutation from pgroup of the Polyhedron should be
applied.
This is an operation that is analogous to ... | /usr/src/app/target_test_cases/failed_tests_Polyhedron.rotate.txt | def rotate(self, perm):
"""
Apply a permutation to the polyhedron *in place*. The permutation
may be given as a Permutation instance or an integer indicating
which permutation from pgroup of the Polyhedron should be
applied.
This is an operation that is analogous to ... | Polyhedron.rotate | repository-level | non_external |
sympy | 23 | sympy/physics/hydrogen.py | def Psi_nlm(n, l, m, r, phi, theta, Z=1):
"""
Returns the Hydrogen wave function psi_{nlm}. It's the product of
the radial wavefunction R_{nl} and the spherical harmonic Y_{l}^{m}.
Parameters
==========
n : integer
Principal Quantum Number which is
an integer with possible valu... | /usr/src/app/target_test_cases/failed_tests_Psi_nlm.txt | def Psi_nlm(n, l, m, r, phi, theta, Z=1):
"""
Returns the Hydrogen wave function psi_{nlm}. It's the product of
the radial wavefunction R_{nl} and the spherical harmonic Y_{l}^{m}.
Parameters
==========
n : integer
Principal Quantum Number which is
an integer with possible valu... | Psi_nlm | repository-level | non_external |
sympy | 24 | sympy/physics/vector/frame.py | def orient_body_fixed(self, parent, angles, rotation_order):
"""Rotates this reference frame relative to the parent reference frame
by right hand rotating through three successive body fixed simple axis
rotations. Each subsequent axis of rotation is about the "body fixed"
unit vector... | /usr/src/app/target_test_cases/failed_tests_ReferenceFrame.orient_body_fixed.txt | def orient_body_fixed(self, parent, angles, rotation_order):
"""Rotates this reference frame relative to the parent reference frame
by right hand rotating through three successive body fixed simple axis
rotations. Each subsequent axis of rotation is about the "body fixed"
unit vector... | ReferenceFrame.orient_body_fixed | repository-level | non_external |
sympy | 25 | sympy/physics/vector/frame.py | def orient_explicit(self, parent, dcm):
"""Sets the orientation of this reference frame relative to another (parent) reference frame
using a direction cosine matrix that describes the rotation from the parent to the child.
Parameters
==========
parent : ReferenceFrame
... | /usr/src/app/target_test_cases/failed_tests_ReferenceFrame.orient_explicit.txt | def orient_explicit(self, parent, dcm):
"""Sets the orientation of this reference frame relative to another (parent) reference frame
using a direction cosine matrix that describes the rotation from the parent to the child.
Parameters
==========
parent : ReferenceFrame
... | ReferenceFrame.orient_explicit | repository-level | non_external |
sympy | 26 | sympy/physics/vector/frame.py | def orient_space_fixed(self, parent, angles, rotation_order):
"""Rotates this reference frame relative to the parent reference frame
by right hand rotating through three successive space fixed simple axis
rotations. Each subsequent axis of rotation is about the "space fixed"
unit vec... | /usr/src/app/target_test_cases/failed_tests_ReferenceFrame.orient_space_fixed.txt | def orient_space_fixed(self, parent, angles, rotation_order):
"""Rotates this reference frame relative to the parent reference frame
by right hand rotating through three successive space fixed simple axis
rotations. Each subsequent axis of rotation is about the "space fixed"
unit vec... | ReferenceFrame.orient_space_fixed | repository-level | non_external |
sympy | 27 | sympy/logic/boolalg.py | def SOPform(variables, minterms, dontcares=None):
"""
The SOPform function uses simplified_pairs and a redundant group-
eliminating algorithm to convert the list of all input combos that
generate '1' (the minterms) into the smallest sum-of-products form.
The variables must be given as the first arg... | /usr/src/app/target_test_cases/failed_tests_SOPform.txt | def SOPform(variables, minterms, dontcares=None):
"""
The SOPform function uses simplified_pairs and a redundant group-
eliminating algorithm to convert the list of all input combos that
generate '1' (the minterms) into the smallest sum-of-products form.
The variables must be given as the first arg... | SOPform | repository-level | non_external |
sympy | 28 | sympy/physics/mechanics/wrapping_geometry.py | def geodesic_length(self, point_1, point_2):
"""The shortest distance between two points on a geometry's surface.
Explanation
===========
The geodesic length, i.e. the shortest arc along the surface of a
cylinder, connecting two points. It can be calculated using Pythagoras... | /usr/src/app/target_test_cases/failed_tests_WrappingCylinder.geodesic_length.txt | def geodesic_length(self, point_1, point_2):
"""The shortest distance between two points on a geometry's surface.
Explanation
===========
The geodesic length, i.e. the shortest arc along the surface of a
cylinder, connecting two points. It can be calculated using Pythagoras... | WrappingCylinder.geodesic_length | repository-level | non_external |
sympy | 29 | sympy/physics/mechanics/pathway.py | def to_loads(self, force):
"""Loads required by the equations of motion method classes.
Explanation
===========
``KanesMethod`` requires a list of ``Point``-``Vector`` tuples to be
passed to the ``loads`` parameters of its ``kanes_equations`` method
when constructin... | /usr/src/app/target_test_cases/failed_tests_WrappingPathway.to_loads.txt | def to_loads(self, force):
"""Loads required by the equations of motion method classes.
Explanation
===========
``KanesMethod`` requires a list of ``Point``-``Vector`` tuples to be
passed to the ``loads`` parameters of its ``kanes_equations`` method
when constructin... | WrappingPathway.to_loads | repository-level | non_external |
sympy | 30 | sympy/calculus/finite_diff.py | def _as_finite_diff(derivative, points=1, x0=None, wrt=None):
"""
Returns an approximation of a derivative of a function in
the form of a finite difference formula. The expression is a
weighted sum of the function at a number of discrete values of
(one of) the independent variable(s).
Parameter... | /usr/src/app/target_test_cases/failed_tests__as_finite_diff.txt | def _as_finite_diff(derivative, points=1, x0=None, wrt=None):
"""
Returns an approximation of a derivative of a function in
the form of a finite difference formula. The expression is a
weighted sum of the function at a number of discrete values of
(one of) the independent variable(s).
Parameter... | _as_finite_diff | repository-level | non_external |
sympy | 31 | sympy/core/exprtools.py | def _mask_nc(eq, name=None):
"""
Return ``eq`` with non-commutative objects replaced with Dummy
symbols. A dictionary that can be used to restore the original
values is returned: if it is None, the expression is noncommutative
and cannot be made commutative. The third value returned is a list
of... | /usr/src/app/target_test_cases/failed_tests__mask_nc.txt | def _mask_nc(eq, name=None):
"""
Return ``eq`` with non-commutative objects replaced with Dummy
symbols. A dictionary that can be used to restore the original
values is returned: if it is None, the expression is noncommutative
and cannot be made commutative. The third value returned is a list
of... | _mask_nc | repository-level | non_external |
sympy | 32 | sympy/solvers/simplex.py | def _primal_dual(M, factor=True):
"""return primal and dual function and constraints
assuming that ``M = Matrix([[A, b], [c, d]])`` and the
function ``c*x - d`` is being minimized with ``Ax >= b``
for nonnegative values of ``x``. The dual and its
constraints will be for maximizing `b.T*y - d` subjec... | /usr/src/app/target_test_cases/failed_tests__primal_dual.txt | def _primal_dual(M, factor=True):
"""return primal and dual function and constraints
assuming that ``M = Matrix([[A, b], [c, d]])`` and the
function ``c*x - d`` is being minimized with ``Ax >= b``
for nonnegative values of ``x``. The dual and its
constraints will be for maximizing `b.T*y - d` subjec... | _primal_dual | repository-level | non_external |
sympy | 33 | sympy/solvers/simplex.py | def _simplex(A, B, C, D=None, dual=False):
"""Return ``(o, x, y)`` obtained from the two-phase simplex method
using Bland's rule: ``o`` is the minimum value of primal,
``Cx - D``, under constraints ``Ax <= B`` (with ``x >= 0``) and
the maximum of the dual, ``y^{T}B - D``, under constraints
``A^{T}*y... | /usr/src/app/target_test_cases/failed_tests__simplex.txt | def _simplex(A, B, C, D=None, dual=False):
"""Return ``(o, x, y)`` obtained from the two-phase simplex method
using Bland's rule: ``o`` is the minimum value of primal,
``Cx - D``, under constraints ``Ax <= B`` (with ``x >= 0``) and
the maximum of the dual, ``y^{T}B - D``, under constraints
``A^{T}*y... | _simplex | repository-level | non_external |
sympy | 34 | sympy/solvers/inequalities.py | def _solve_inequality(ie, s, linear=False):
"""Return the inequality with s isolated on the left, if possible.
If the relationship is non-linear, a solution involving And or Or
may be returned. False or True are returned if the relationship
is never True or always True, respectively.
If `linear` is... | /usr/src/app/target_test_cases/failed_tests__solve_inequality.txt | def _solve_inequality(ie, s, linear=False):
"""Return the inequality with s isolated on the left, if possible.
If the relationship is non-linear, a solution involving And or Or
may be returned. False or True are returned if the relationship
is never True or always True, respectively.
If `linear` is... | _solve_inequality | repository-level | non_external |
sympy | 35 | sympy/combinatorics/util.py | def _strip(g, base, orbits, transversals):
"""
Attempt to decompose a permutation using a (possibly partial) BSGS
structure.
Explanation
===========
This is done by treating the sequence ``base`` as an actual base, and
the orbits ``orbits`` and transversals ``transversals`` as basic orbits... | /usr/src/app/target_test_cases/failed_tests__strip.txt | def _strip(g, base, orbits, transversals):
"""
Attempt to decompose a permutation using a (possibly partial) BSGS
structure.
Explanation
===========
This is done by treating the sequence ``base`` as an actual base, and
the orbits ``orbits`` and transversals ``transversals`` as basic orbits... | _strip | repository-level | non_external |
sympy | 36 | sympy/calculus/finite_diff.py | def apply_finite_diff(order, x_list, y_list, x0=S.Zero):
"""
Calculates the finite difference approximation of
the derivative of requested order at ``x0`` from points
provided in ``x_list`` and ``y_list``.
Parameters
==========
order: int
order of derivative to approximate. 0 corre... | /usr/src/app/target_test_cases/failed_tests_apply_finite_diff.txt | def apply_finite_diff(order, x_list, y_list, x0=S.Zero):
"""
Calculates the finite difference approximation of
the derivative of requested order at ``x0`` from points
provided in ``x_list`` and ``y_list``.
Parameters
==========
order: int
order of derivative to approximate. 0 corre... | apply_finite_diff | repository-level | non_external |
sympy | 37 | sympy/assumptions/ask.py | def ask(proposition, assumptions=True, context=global_assumptions):
"""
Function to evaluate the proposition with assumptions.
Explanation
===========
This function evaluates the proposition to ``True`` or ``False`` if
the truth value can be determined. If not, it returns ``None``.
It sho... | /usr/src/app/target_test_cases/failed_tests_ask.txt | def ask(proposition, assumptions=True, context=global_assumptions):
"""
Function to evaluate the proposition with assumptions.
Explanation
===========
This function evaluates the proposition to ``True`` or ``False`` if
the truth value can be determined. If not, it returns ``None``.
It sho... | ask | repository-level | non_external |
sympy | 38 | sympy/matrices/sparsetools.py | def banded(*args, **kwargs):
"""Returns a SparseMatrix from the given dictionary describing
the diagonals of the matrix. The keys are positive for upper
diagonals and negative for those below the main diagonal. The
values may be:
* expressions or single-argument functions,
* lists or tuples of... | /usr/src/app/target_test_cases/failed_tests_banded.txt | def banded(*args, **kwargs):
"""Returns a SparseMatrix from the given dictionary describing
the diagonals of the matrix. The keys are positive for upper
diagonals and negative for those below the main diagonal. The
values may be:
* expressions or single-argument functions,
* lists or tuples of... | banded | repository-level | non_external |
sympy | 39 | sympy/combinatorics/tensor_can.py | def canonicalize(g, dummies, msym, *v):
"""
canonicalize tensor formed by tensors
Parameters
==========
g : permutation representing the tensor
dummies : list representing the dummy indices
it can be a list of dummy indices of the same type
or a list of lists of dummy indices, one... | /usr/src/app/target_test_cases/failed_tests_canonicalize.txt | def canonicalize(g, dummies, msym, *v):
"""
canonicalize tensor formed by tensors
Parameters
==========
g : permutation representing the tensor
dummies : list representing the dummy indices
it can be a list of dummy indices of the same type
or a list of lists of dummy indices, one... | canonicalize | repository-level | non_external |
sympy | 40 | sympy/printing/codeprinter.py | def ccode(expr, assign_to=None, standard='c99', **settings):
"""Converts an expr to a string of c code
Parameters
==========
expr : Expr
A SymPy expression to be converted.
assign_to : optional
When given, the argument is used as the name of the variable to which
the expres... | /usr/src/app/target_test_cases/failed_tests_ccode.txt | def ccode(expr, assign_to=None, standard='c99', **settings):
"""Converts an expr to a string of c code
Parameters
==========
expr : Expr
A SymPy expression to be converted.
assign_to : optional
When given, the argument is used as the name of the variable to which
the expres... | ccode | repository-level | non_external |
sympy | 41 | sympy/utilities/codegen.py | def codegen(name_expr, language=None, prefix=None, project="project",
to_files=False, header=True, empty=True, argument_sequence=None,
global_vars=None, standard=None, code_gen=None, printer=None):
"""Generate source code for expressions in a given language.
Parameters
==========
... | /usr/src/app/target_test_cases/failed_tests_codegen.txt | def codegen(name_expr, language=None, prefix=None, project="project",
to_files=False, header=True, empty=True, argument_sequence=None,
global_vars=None, standard=None, code_gen=None, printer=None):
"""Generate source code for expressions in a given language.
Parameters
==========
... | codegen | file-level | non_external |
sympy | 42 | sympy/discrete/convolutions.py | def convolution(a, b, cycle=0, dps=None, prime=None, dyadic=None, subset=None):
"""
Performs convolution by determining the type of desired
convolution using hints.
Exactly one of ``dps``, ``prime``, ``dyadic``, ``subset`` arguments
should be specified explicitly for identifying the type of convolu... | /usr/src/app/target_test_cases/failed_tests_convolution.txt | def convolution(a, b, cycle=0, dps=None, prime=None, dyadic=None, subset=None):
"""
Performs convolution by determining the type of desired
convolution using hints.
Exactly one of ``dps``, ``prime``, ``dyadic``, ``subset`` arguments
should be specified explicitly for identifying the type of convolu... | convolution | repository-level | non_external |
sympy | 43 | sympy/combinatorics/coset_table.py | def coset_enumeration_r(fp_grp, Y, max_cosets=None, draft=None,
incomplete=False, modified=False):
"""
This is easier of the two implemented methods of coset enumeration.
and is often called the HLT method, after Hazelgrove, Leech, Trotter
The idea is that we make use... | /usr/src/app/target_test_cases/failed_tests_coset_enumeration_r.txt | def coset_enumeration_r(fp_grp, Y, max_cosets=None, draft=None,
incomplete=False, modified=False):
"""
This is easier of the two implemented methods of coset enumeration.
and is often called the HLT method, after Hazelgrove, Leech, Trotter
The idea is that we make use... | coset_enumeration_r | file-level | non_external |
sympy | 44 | sympy/simplify/cse_main.py | def cse(exprs, symbols=None, optimizations=None, postprocess=None,
order='canonical', ignore=(), list=True):
""" Perform common subexpression elimination on an expression.
Parameters
==========
exprs : list of SymPy expressions, or a single SymPy expression
The expressions to reduce.
... | /usr/src/app/target_test_cases/failed_tests_cse.txt | def cse(exprs, symbols=None, optimizations=None, postprocess=None,
order='canonical', ignore=(), list=True):
""" Perform common subexpression elimination on an expression.
Parameters
==========
exprs : list of SymPy expressions, or a single SymPy expression
The expressions to reduce.
... | cse | repository-level | non_external |
sympy | 45 | sympy/polys/matrices/dense.py | def ddm_irref_den(a, K):
"""a <-- rref(a); return (den, pivots)
Compute the fraction-free reduced row echelon form (RREF) of $a$. Modifies
$a$ in place and returns a tuple containing the denominator of the RREF and
a list of the pivot columns.
Explanation
===========
The algorithm used ... | /usr/src/app/target_test_cases/failed_tests_ddm_irref_den.txt | def ddm_irref_den(a, K):
"""a <-- rref(a); return (den, pivots)
Compute the fraction-free reduced row echelon form (RREF) of $a$. Modifies
$a$ in place and returns a tuple containing the denominator of the RREF and
a list of the pivot columns.
Explanation
===========
The algorithm used ... | ddm_irref_den | self-contained | non_external |
sympy | 46 | sympy/core/sorting.py | def default_sort_key(item, order=None):
"""Return a key that can be used for sorting.
The key has the structure:
(class_key, (len(args), args), exponent.sort_key(), coefficient)
This key is supplied by the sort_key routine of Basic objects when
``item`` is a Basic object or an object (other than ... | /usr/src/app/target_test_cases/failed_tests_default_sort_key.txt | def default_sort_key(item, order=None):
"""Return a key that can be used for sorting.
The key has the structure:
(class_key, (len(args), args), exponent.sort_key(), coefficient)
This key is supplied by the sort_key routine of Basic objects when
``item`` is a Basic object or an object (other than ... | default_sort_key | repository-level | non_external |
sympy | 47 | sympy/solvers/diophantine/diophantine.py | def diophantine(eq, param=symbols("t", integer=True), syms=None,
permute=False):
"""
Simplify the solution procedure of diophantine equation ``eq`` by
converting it into a product of terms which should equal zero.
Explanation
===========
For example, when solving, `x^2 - y^2 = ... | /usr/src/app/target_test_cases/failed_tests_diophantine.txt | def diophantine(eq, param=symbols("t", integer=True), syms=None,
permute=False):
"""
Simplify the solution procedure of diophantine equation ``eq`` by
converting it into a product of terms which should equal zero.
Explanation
===========
For example, when solving, `x^2 - y^2 = ... | diophantine | repository-level | non_external |
sympy | 48 | sympy/printing/dot.py | def dotprint(expr,
styles=default_styles, atom=lambda x: not isinstance(x, Basic),
maxdepth=None, repeat=True, labelfunc=str, **kwargs):
"""DOT description of a SymPy expression tree
Parameters
==========
styles : list of lists composed of (Class, mapping), optional
Styles for differen... | /usr/src/app/target_test_cases/failed_tests_dotprint.txt | def dotprint(expr,
styles=default_styles, atom=lambda x: not isinstance(x, Basic),
maxdepth=None, repeat=True, labelfunc=str, **kwargs):
"""DOT description of a SymPy expression tree
Parameters
==========
styles : list of lists composed of (Class, mapping), optional
Styles for differen... | dotprint | repository-level | non_external |
sympy | 49 | sympy/ntheory/egyptian_fraction.py | def egyptian_fraction(r, algorithm="Greedy"):
"""
Return the list of denominators of an Egyptian fraction
expansion [1]_ of the said rational `r`.
Parameters
==========
r : Rational or (p, q)
a positive rational number, ``p/q``.
algorithm : { "Greedy", "Graham Jewett", "Takenouchi"... | /usr/src/app/target_test_cases/failed_tests_egyptian_fraction.txt | def egyptian_fraction(r, algorithm="Greedy"):
"""
Return the list of denominators of an Egyptian fraction
expansion [1]_ of the said rational `r`.
Parameters
==========
r : Rational or (p, q)
a positive rational number, ``p/q``.
algorithm : { "Greedy", "Graham Jewett", "Takenouchi"... | egyptian_fraction | repository-level | non_external |
sympy | 50 | sympy/crypto/crypto.py | def encipher_shift(msg, key, symbols=None):
"""
Performs shift cipher encryption on plaintext msg, and returns the
ciphertext.
Parameters
==========
key : int
The secret key.
msg : str
Plaintext of upper-case letters.
Returns
=======
str
Ciphertext of... | /usr/src/app/target_test_cases/failed_tests_encipher_shift.txt | def encipher_shift(msg, key, symbols=None):
"""
Performs shift cipher encryption on plaintext msg, and returns the
ciphertext.
Parameters
==========
key : int
The secret key.
msg : str
Plaintext of upper-case letters.
Returns
=======
str
Ciphertext of... | encipher_shift | repository-level | non_external |
sympy | 51 | sympy/crypto/crypto.py | def encipher_vigenere(msg, key, symbols=None):
"""
Performs the Vigenere cipher encryption on plaintext ``msg``, and
returns the ciphertext.
Examples
========
>>> from sympy.crypto.crypto import encipher_vigenere, AZ
>>> key = "encrypt"
>>> msg = "meet me on monday"
>>> encipher_vi... | /usr/src/app/target_test_cases/failed_tests_encipher_vigenere.txt | def encipher_vigenere(msg, key, symbols=None):
"""
Performs the Vigenere cipher encryption on plaintext ``msg``, and
returns the ciphertext.
Examples
========
>>> from sympy.crypto.crypto import encipher_vigenere, AZ
>>> key = "encrypt"
>>> msg = "meet me on monday"
>>> encipher_vi... | encipher_vigenere | file-level | non_external |
sympy | 52 | sympy/physics/secondquant.py | def evaluate_deltas(e):
"""
We evaluate KroneckerDelta symbols in the expression assuming Einstein summation.
Explanation
===========
If one index is repeated it is summed over and in effect substituted with
the other one. If both indices are repeated we substitute according to what
is the... | /usr/src/app/target_test_cases/failed_tests_evaluate_deltas.txt | def evaluate_deltas(e):
"""
We evaluate KroneckerDelta symbols in the expression assuming Einstein summation.
Explanation
===========
If one index is repeated it is summed over and in effect substituted with
the other one. If both indices are repeated we substitute according to what
is the... | evaluate_deltas | repository-level | non_external |
sympy | 53 | sympy/core/function.py | def expand_power_base(expr, deep=True, force=False):
"""
Wrapper around expand that only uses the power_base hint.
A wrapper to expand(power_base=True) which separates a power with a base
that is a Mul into a product of powers, without performing any other
expansions, provided that assumptions abou... | /usr/src/app/target_test_cases/failed_tests_expand_power_base.txt | def expand_power_base(expr, deep=True, force=False):
"""
Wrapper around expand that only uses the power_base hint.
A wrapper to expand(power_base=True) which separates a power with a base
that is a Mul into a product of powers, without performing any other
expansions, provided that assumptions abou... | expand_power_base | repository-level | non_external |
sympy | 54 | sympy/printing/codeprinter.py | def fcode(expr, assign_to=None, **settings):
"""Converts an expr to a string of fortran code
Parameters
==========
expr : Expr
A SymPy expression to be converted.
assign_to : optional
When given, the argument is used as the name of the variable to which
the expression is as... | /usr/src/app/target_test_cases/failed_tests_fcode.txt | def fcode(expr, assign_to=None, **settings):
"""Converts an expr to a string of fortran code
Parameters
==========
expr : Expr
A SymPy expression to be converted.
assign_to : optional
When given, the argument is used as the name of the variable to which
the expression is as... | fcode | repository-level | non_external |
sympy | 55 | sympy/calculus/finite_diff.py | def finite_diff_weights(order, x_list, x0=S.One):
"""
Calculates the finite difference weights for an arbitrarily spaced
one-dimensional grid (``x_list``) for derivatives at ``x0`` of order
0, 1, ..., up to ``order`` using a recursive formula. Order of accuracy
is at least ``len(x_list) - order``, i... | /usr/src/app/target_test_cases/failed_tests_finite_diff_weights.txt | def finite_diff_weights(order, x_list, x0=S.One):
"""
Calculates the finite difference weights for an arbitrarily spaced
one-dimensional grid (``x_list``) for derivatives at ``x0`` of order
0, 1, ..., up to ``order`` using a recursive formula. Order of accuracy
is at least ``len(x_list) - order``, i... | finite_diff_weights | repository-level | non_external |
sympy | 56 | sympy/series/formal.py | def fps(f, x=None, x0=0, dir=1, hyper=True, order=4, rational=True, full=False):
"""
Generates Formal Power Series of ``f``.
Explanation
===========
Returns the formal series expansion of ``f`` around ``x = x0``
with respect to ``x`` in the form of a ``FormalPowerSeries`` object.
Formal P... | /usr/src/app/target_test_cases/failed_tests_fps.txt | def fps(f, x=None, x0=0, dir=1, hyper=True, order=4, rational=True, full=False):
"""
Generates Formal Power Series of ``f``.
Explanation
===========
Returns the formal series expansion of ``f`` around ``x = x0``
with respect to ``x`` in the form of a ``FormalPowerSeries`` object.
Formal P... | fps | repository-level | non_external |
sympy | 57 | sympy/simplify/fu.py | def fu(rv, measure=lambda x: (L(x), x.count_ops())):
"""Attempt to simplify expression by using transformation rules given
in the algorithm by Fu et al.
:func:`fu` will try to minimize the objective function ``measure``.
By default this first minimizes the number of trig terms and then minimizes
th... | /usr/src/app/target_test_cases/failed_tests_fu.txt | def fu(rv, measure=lambda x: (L(x), x.count_ops())):
"""Attempt to simplify expression by using transformation rules given
in the algorithm by Fu et al.
:func:`fu` will try to minimize the objective function ``measure``.
By default this first minimizes the number of trig terms and then minimizes
th... | fu | repository-level | non_external |
sympy | 58 | sympy/utilities/iterables.py | def generate_bell(n):
"""Return permutations of [0, 1, ..., n - 1] such that each permutation
differs from the last by the exchange of a single pair of neighbors.
The ``n!`` permutations are returned as an iterator. In order to obtain
the next permutation from a random starting permutation, use the
... | /usr/src/app/target_test_cases/failed_tests_generate_bell.txt | def generate_bell(n):
"""Return permutations of [0, 1, ..., n - 1] such that each permutation
differs from the last by the exchange of a single pair of neighbors.
The ``n!`` permutations are returned as an iterator. In order to obtain
the next permutation from a random starting permutation, use the
... | generate_bell | repository-level | non_external |
sympy | 59 | sympy/physics/quantum/identitysearch.py | def generate_gate_rules(gate_seq, return_as_muls=False):
"""Returns a set of gate rules. Each gate rules is represented
as a 2-tuple of tuples or Muls. An empty tuple represents an arbitrary
scalar value.
This function uses the four operations (LL, LR, RL, RR)
to generate the gate rules.
A g... | /usr/src/app/target_test_cases/failed_tests_generate_gate_rules.txt | def generate_gate_rules(gate_seq, return_as_muls=False):
"""Returns a set of gate rules. Each gate rules is represented
as a 2-tuple of tuples or Muls. An empty tuple represents an arbitrary
scalar value.
This function uses the four operations (LL, LR, RL, RR)
to generate the gate rules.
A g... | generate_gate_rules | repository-level | external |
sympy | 60 | sympy/tensor/index_methods.py | def get_contraction_structure(expr):
"""Determine dummy indices of ``expr`` and describe its structure
By *dummy* we mean indices that are summation indices.
The structure of the expression is determined and described as follows:
1) A conforming summation of Indexed objects is described with a dict w... | /usr/src/app/target_test_cases/failed_tests_get_contraction_structure.txt | def get_contraction_structure(expr):
"""Determine dummy indices of ``expr`` and describe its structure
By *dummy* we mean indices that are summation indices.
The structure of the expression is determined and described as follows:
1) A conforming summation of Indexed objects is described with a dict w... | get_contraction_structure | repository-level | non_external |
sympy | 61 | sympy/physics/vector/functions.py | def get_motion_params(frame, **kwargs):
"""
Returns the three motion parameters - (acceleration, velocity, and
position) as vectorial functions of time in the given frame.
If a higher order differential function is provided, the lower order
functions are used as boundary conditions. For example, gi... | /usr/src/app/target_test_cases/failed_tests_get_motion_params.txt | def get_motion_params(frame, **kwargs):
"""
Returns the three motion parameters - (acceleration, velocity, and
position) as vectorial functions of time in the given frame.
If a higher order differential function is provided, the lower order
functions are used as boundary conditions. For example, gi... | get_motion_params | repository-level | non_external |
sympy | 62 | sympy/printing/glsl.py | def glsl_code(expr,assign_to=None,**settings):
"""Converts an expr to a string of GLSL code
Parameters
==========
expr : Expr
A SymPy expression to be converted.
assign_to : optional
When given, the argument is used for naming the variable or variables
to which the expressi... | /usr/src/app/target_test_cases/failed_tests_glsl_code.txt | def glsl_code(expr,assign_to=None,**settings):
"""Converts an expr to a string of GLSL code
Parameters
==========
expr : Expr
A SymPy expression to be converted.
assign_to : optional
When given, the argument is used for naming the variable or variables
to which the expressi... | glsl_code | file-level | non_external |
sympy | 63 | sympy/integrals/heurisch.py | def heurisch(f, x, rewrite=False, hints=None, mappings=None, retries=3,
degree_offset=0, unnecessary_permutations=None,
_try_heurisch=None):
"""
Compute indefinite integral using heuristic Risch algorithm.
Explanation
===========
This is a heuristic approach to indefinite... | /usr/src/app/target_test_cases/failed_tests_heurisch.txt | def heurisch(f, x, rewrite=False, hints=None, mappings=None, retries=3,
degree_offset=0, unnecessary_permutations=None,
_try_heurisch=None):
"""
Compute indefinite integral using heuristic Risch algorithm.
Explanation
===========
This is a heuristic approach to indefinite... | heurisch | repository-level | external |
sympy | 64 | sympy/integrals/integrals.py | def integrate(*args, meijerg=None, conds='piecewise', risch=None, heurisch=None, manual=None, **kwargs):
"""integrate(f, var, ...)
.. deprecated:: 1.6
Using ``integrate()`` with :class:`~.Poly` is deprecated. Use
:meth:`.Poly.integrate` instead. See :ref:`deprecated-integrate-poly`.
Explana... | /usr/src/app/target_test_cases/failed_tests_integrate.txt | def integrate(*args, meijerg=None, conds='piecewise', risch=None, heurisch=None, manual=None, **kwargs):
"""integrate(f, var, ...)
.. deprecated:: 1.6
Using ``integrate()`` with :class:`~.Poly` is deprecated. Use
:meth:`.Poly.integrate` instead. See :ref:`deprecated-integrate-poly`.
Explana... | integrate | file-level | non_external |
sympy | 65 | sympy/integrals/intpoly.py | def integration_reduction_dynamic(facets, index, a, b, expr, degree, dims,
x_index, y_index, max_index, x0,
monomial_values, monom_index, vertices=None,
hp_param=None):
"""The same integration_reduction function wh... | /usr/src/app/target_test_cases/failed_tests_integration_reduction_dynamic.txt | def integration_reduction_dynamic(facets, index, a, b, expr, degree, dims,
x_index, y_index, max_index, x0,
monomial_values, monom_index, vertices=None,
hp_param=None):
"""The same integration_reduction function wh... | integration_reduction_dynamic | repository-level | non_external |
sympy | 66 | sympy/geometry/util.py | def intersection(*entities, pairwise=False, **kwargs):
"""The intersection of a collection of GeometryEntity instances.
Parameters
==========
entities : sequence of GeometryEntity
pairwise (keyword argument) : Can be either True or False
Returns
=======
intersection : list of GeometryE... | /usr/src/app/target_test_cases/failed_tests_intersection.txt | def intersection(*entities, pairwise=False, **kwargs):
"""The intersection of a collection of GeometryEntity instances.
Parameters
==========
entities : sequence of GeometryEntity
pairwise (keyword argument) : Can be either True or False
Returns
=======
intersection : list of GeometryE... | intersection | repository-level | external |
sympy | 67 | sympy/printing/jscode.py | def jscode(expr, assign_to=None, **settings):
"""Converts an expr to a string of javascript code
Parameters
==========
expr : Expr
A SymPy expression to be converted.
assign_to : optional
When given, the argument is used as the name of the variable to which
the expression i... | /usr/src/app/target_test_cases/failed_tests_jscode.txt | def jscode(expr, assign_to=None, **settings):
"""Converts an expr to a string of javascript code
Parameters
==========
expr : Expr
A SymPy expression to be converted.
assign_to : optional
When given, the argument is used as the name of the variable to which
the expression i... | jscode | file-level | non_external |
sympy | 68 | sympy/utilities/iterables.py | def kbins(l, k, ordered=None):
"""
Return sequence ``l`` partitioned into ``k`` bins.
Examples
========
The default is to give the items in the same order, but grouped
into k partitions without any reordering:
>>> from sympy.utilities.iterables import kbins
>>> for p in kbins(list(ran... | /usr/src/app/target_test_cases/failed_tests_kbins.txt | def kbins(l, k, ordered=None):
"""
Return sequence ``l`` partitioned into ``k`` bins.
Examples
========
The default is to give the items in the same order, but grouped
into k partitions without any reordering:
>>> from sympy.utilities.iterables import kbins
>>> for p in kbins(list(ran... | kbins | file-level | non_external |
sympy | 69 | sympy/matrices/expressions/kronecker.py | def kronecker_product(*matrices):
"""
The Kronecker product of two or more arguments.
This computes the explicit Kronecker product for subclasses of
``MatrixBase`` i.e. explicit matrices. Otherwise, a symbolic
``KroneckerProduct`` object is returned.
Examples
========
For ``MatrixSym... | /usr/src/app/target_test_cases/failed_tests_kronecker_product.txt | def kronecker_product(*matrices):
"""
The Kronecker product of two or more arguments.
This computes the explicit Kronecker product for subclasses of
``MatrixBase`` i.e. explicit matrices. Otherwise, a symbolic
``KroneckerProduct`` object is returned.
Examples
========
For ``MatrixSym... | kronecker_product | file-level | non_external |
sympy | 70 | sympy/utilities/lambdify.py | def lambdify(args, expr, modules=None, printer=None, use_imps=True,
dummify=False, cse=False, docstring_limit=1000):
"""Convert a SymPy expression into a function that allows for fast
numeric evaluation.
.. warning::
This function uses ``exec``, and thus should not be used on
uns... | /usr/src/app/target_test_cases/failed_tests_lambdify.txt | def lambdify(args, expr, modules=None, printer=None, use_imps=True,
dummify=False, cse=False, docstring_limit=1000):
"""Convert a SymPy expression into a function that allows for fast
numeric evaluation.
.. warning::
This function uses ``exec``, and thus should not be used on
uns... | lambdify | repository-level | external |
sympy | 71 | sympy/crypto/crypto.py | def lfsr_connection_polynomial(s):
"""
This function computes the LFSR connection polynomial.
Parameters
==========
s
A sequence of elements of even length, with entries in a finite
field.
Returns
=======
C(x)
The connection polynomial of a minimal LFSR yieldi... | /usr/src/app/target_test_cases/failed_tests_lfsr_connection_polynomial.txt | def lfsr_connection_polynomial(s):
"""
This function computes the LFSR connection polynomial.
Parameters
==========
s
A sequence of elements of even length, with entries in a finite
field.
Returns
=======
C(x)
The connection polynomial of a minimal LFSR yieldi... | lfsr_connection_polynomial | repository-level | non_external |
sympy | 72 | sympy/utilities/iterables.py | def multiset_partitions(multiset, m=None):
"""
Return unique partitions of the given multiset (in list form).
If ``m`` is None, all multisets will be returned, otherwise only
partitions with ``m`` parts will be returned.
If ``multiset`` is an integer, a range [0, 1, ..., multiset - 1]
will be s... | /usr/src/app/target_test_cases/failed_tests_multiset_partitions.txt | def multiset_partitions(multiset, m=None):
"""
Return unique partitions of the given multiset (in list form).
If ``m`` is None, all multisets will be returned, otherwise only
partitions with ``m`` parts will be returned.
If ``multiset`` is an integer, a range [0, 1, ..., multiset - 1]
will be s... | multiset_partitions | repository-level | non_external |
sympy | 73 | sympy/utilities/enumerative.py | def multiset_partitions_taocp(multiplicities):
"""Enumerates partitions of a multiset.
Parameters
==========
multiplicities
list of integer multiplicities of the components of the multiset.
Yields
======
state
Internal data structure which encodes a particular partition.... | /usr/src/app/target_test_cases/failed_tests_multiset_partitions_taocp.txt | def multiset_partitions_taocp(multiplicities):
"""Enumerates partitions of a multiset.
Parameters
==========
multiplicities
list of integer multiplicities of the components of the multiset.
Yields
======
state
Internal data structure which encodes a particular partition.... | multiset_partitions_taocp | file-level | non_external |
sympy | 74 | sympy/codegen/algorithms.py | def newtons_method(expr, wrt, atol=1e-12, delta=None, *, rtol=4e-16, debug=False,
itermax=None, counter=None, delta_fn=lambda e, x: -e/e.diff(x),
cse=False, handle_nan=None,
bounds=None):
""" Generates an AST for Newton-Raphson method (a root-finding algorith... | /usr/src/app/target_test_cases/failed_tests_newtons_method.txt | def newtons_method(expr, wrt, atol=1e-12, delta=None, *, rtol=4e-16, debug=False,
itermax=None, counter=None, delta_fn=lambda e, x: -e/e.diff(x),
cse=False, handle_nan=None,
bounds=None):
""" Generates an AST for Newton-Raphson method (a root-finding algorith... | newtons_method | repository-level | non_external |
sympy | 75 | sympy/utilities/iterables.py | def partitions(n, m=None, k=None, size=False):
"""Generate all partitions of positive integer, n.
Each partition is represented as a dictionary, mapping an integer
to the number of copies of that integer in the partition. For example,
the first partition of 4 returned is {4: 1}, "4: one of them".
... | /usr/src/app/target_test_cases/failed_tests_partitions.txt | def partitions(n, m=None, k=None, size=False):
"""Generate all partitions of positive integer, n.
Each partition is represented as a dictionary, mapping an integer
to the number of copies of that integer in the partition. For example,
the first partition of 4 returned is {4: 1}, "4: one of them".
... | partitions | repository-level | non_external |
sympy | 76 | sympy/solvers/pde.py | def pdsolve(eq, func=None, hint='default', dict=False, solvefun=None, **kwargs):
"""
Solves any (supported) kind of partial differential equation.
**Usage**
pdsolve(eq, f(x,y), hint) -> Solve partial differential equation
eq for function f(x,y), using method hint.
**Details**
... | /usr/src/app/target_test_cases/failed_tests_pdsolve.txt | def pdsolve(eq, func=None, hint='default', dict=False, solvefun=None, **kwargs):
"""
Solves any (supported) kind of partial differential equation.
**Usage**
pdsolve(eq, f(x,y), hint) -> Solve partial differential equation
eq for function f(x,y), using method hint.
**Details**
... | pdsolve | repository-level | non_external |
sympy | 77 | sympy/calculus/util.py | def periodicity(f, symbol, check=False):
"""
Tests the given function for periodicity in the given symbol.
Parameters
==========
f : :py:class:`~.Expr`
The concerned function.
symbol : :py:class:`~.Symbol`
The variable for which the period is to be determined.
check : bool,... | /usr/src/app/target_test_cases/failed_tests_periodicity.txt | def periodicity(f, symbol, check=False):
"""
Tests the given function for periodicity in the given symbol.
Parameters
==========
f : :py:class:`~.Expr`
The concerned function.
symbol : :py:class:`~.Symbol`
The variable for which the period is to be determined.
check : bool,... | periodicity | repository-level | non_external |
sympy | 78 | sympy/functions/elementary/piecewise.py | def piecewise_exclusive(expr, *, skip_nan=False, deep=True):
"""
Rewrite :class:`Piecewise` with mutually exclusive conditions.
Explanation
===========
SymPy represents the conditions of a :class:`Piecewise` in an
"if-elif"-fashion, allowing more than one condition to be simultaneously
Tru... | /usr/src/app/target_test_cases/failed_tests_piecewise_exclusive.txt | def piecewise_exclusive(expr, *, skip_nan=False, deep=True):
"""
Rewrite :class:`Piecewise` with mutually exclusive conditions.
Explanation
===========
SymPy represents the conditions of a :class:`Piecewise` in an
"if-elif"-fashion, allowing more than one condition to be simultaneously
Tru... | piecewise_exclusive | repository-level | non_external |
sympy | 79 | sympy/plotting/plot.py | def plot(*args, show=True, **kwargs):
"""Plots a function of a single variable as a curve.
Parameters
==========
args :
The first argument is the expression representing the function
of single variable to be plotted.
The last argument is a 3-tuple denoting the range of the fre... | /usr/src/app/target_test_cases/failed_tests_plot.txt | def plot(*args, show=True, **kwargs):
"""Plots a function of a single variable as a curve.
Parameters
==========
args :
The first argument is the expression representing the function
of single variable to be plotted.
The last argument is a 3-tuple denoting the range of the fre... | plot | repository-level | non_external |
sympy | 80 | sympy/ntheory/factor_.py | def pollard_pm1(n, B=10, a=2, retries=0, seed=1234):
"""
Use Pollard's p-1 method to try to extract a nontrivial factor
of ``n``. Either a divisor (perhaps composite) or ``None`` is returned.
The value of ``a`` is the base that is used in the test gcd(a**M - 1, n).
The default is 2. If ``retries``... | /usr/src/app/target_test_cases/failed_tests_pollard_pm1.txt | def pollard_pm1(n, B=10, a=2, retries=0, seed=1234):
"""
Use Pollard's p-1 method to try to extract a nontrivial factor
of ``n``. Either a divisor (perhaps composite) or ``None`` is returned.
The value of ``a`` is the base that is used in the test gcd(a**M - 1, n).
The default is 2. If ``retries``... | pollard_pm1 | repository-level | non_external |
sympy | 81 | sympy/simplify/powsimp.py | def powsimp(expr, deep=False, combine='all', force=False, measure=count_ops):
"""
Reduce expression by combining powers with similar bases and exponents.
Explanation
===========
If ``deep`` is ``True`` then powsimp() will also simplify arguments of
functions. By default ``deep`` is set to ``Fa... | /usr/src/app/target_test_cases/failed_tests_powsimp.txt | def powsimp(expr, deep=False, combine='all', force=False, measure=count_ops):
"""
Reduce expression by combining powers with similar bases and exponents.
Explanation
===========
If ``deep`` is ``True`` then powsimp() will also simplify arguments of
functions. By default ``deep`` is set to ``Fa... | powsimp | repository-level | external |
sympy | 82 | sympy/series/formal.py | def rational_algorithm(f, x, k, order=4, full=False):
"""
Rational algorithm for computing
formula of coefficients of Formal Power Series
of a function.
Explanation
===========
Applicable when f(x) or some derivative of f(x)
is a rational function in x.
:func:`rational_algorithm` ... | /usr/src/app/target_test_cases/failed_tests_rational_algorithm.txt | def rational_algorithm(f, x, k, order=4, full=False):
"""
Rational algorithm for computing
formula of coefficients of Formal Power Series
of a function.
Explanation
===========
Applicable when f(x) or some derivative of f(x)
is a rational function in x.
:func:`rational_algorithm` ... | rational_algorithm | repository-level | non_external |
sympy | 83 | sympy/utilities/misc.py | def rawlines(s):
"""Return a cut-and-pastable string that, when printed, is equivalent
to the input. Use this when there is more than one line in the
string. The string returned is formatted so it can be indented
nicely within tests; in some cases it is wrapped in the dedent
function which has to be... | /usr/src/app/target_test_cases/failed_tests_rawlines.txt | def rawlines(s):
"""Return a cut-and-pastable string that, when printed, is equivalent
to the input. Use this when there is more than one line in the
string. The string returned is formatted so it can be indented
nicely within tests; in some cases it is wrapped in the dedent
function which has to be... | rawlines | self-contained | non_external |
sympy | 84 | sympy/printing/rcode.py | def rcode(expr, assign_to=None, **settings):
"""Converts an expr to a string of r code
Parameters
==========
expr : Expr
A SymPy expression to be converted.
assign_to : optional
When given, the argument is used as the name of the variable to which
the expression is assigned... | /usr/src/app/target_test_cases/failed_tests_rcode.txt | def rcode(expr, assign_to=None, **settings):
"""Converts an expr to a string of r code
Parameters
==========
expr : Expr
A SymPy expression to be converted.
assign_to : optional
When given, the argument is used as the name of the variable to which
the expression is assigned... | rcode | file-level | non_external |
sympy | 85 | sympy/physics/optics/utils.py | def refraction_angle(incident, medium1, medium2, normal=None, plane=None):
"""
This function calculates transmitted vector after refraction at planar
surface. ``medium1`` and ``medium2`` can be ``Medium`` or any sympifiable object.
If ``incident`` is a number then treated as angle of incidence (in radia... | /usr/src/app/target_test_cases/failed_tests_refraction_angle.txt | def refraction_angle(incident, medium1, medium2, normal=None, plane=None):
"""
This function calculates transmitted vector after refraction at planar
surface. ``medium1`` and ``medium2`` can be ``Medium`` or any sympifiable object.
If ``incident`` is a number then treated as angle of incidence (in radia... | refraction_angle | repository-level | non_external |
sympy | 86 | sympy/printing/codeprinter.py | def rust_code(expr, assign_to=None, **settings):
"""Converts an expr to a string of Rust code
Parameters
==========
expr : Expr
A SymPy expression to be converted.
assign_to : optional
When given, the argument is used as the name of the variable to which
the expression is a... | /usr/src/app/target_test_cases/failed_tests_rust_code.txt | def rust_code(expr, assign_to=None, **settings):
"""Converts an expr to a string of Rust code
Parameters
==========
expr : Expr
A SymPy expression to be converted.
assign_to : optional
When given, the argument is used as the name of the variable to which
the expression is a... | rust_code | repository-level | non_external |
sympy | 87 | sympy/polys/matrices/sdm.py | def sdm_irref(A):
"""RREF and pivots of a sparse matrix *A*.
Compute the reduced row echelon form (RREF) of the matrix *A* and return a
list of the pivot columns. This routine does not work in place and leaves
the original matrix *A* unmodified.
The domain of the matrix must be a field.
Examp... | /usr/src/app/target_test_cases/failed_tests_sdm_irref.txt | def sdm_irref(A):
"""RREF and pivots of a sparse matrix *A*.
Compute the reduced row echelon form (RREF) of the matrix *A* and return a
list of the pivot columns. This routine does not work in place and leaves
the original matrix *A* unmodified.
The domain of the matrix must be a field.
Examp... | sdm_irref | file-level | external |
sympy | 88 | sympy/calculus/singularities.py | def singularities(expression, symbol, domain=None):
"""
Find singularities of a given function.
Parameters
==========
expression : Expr
The target function in which singularities need to be found.
symbol : Symbol
The symbol over the values of which the singularity in
ex... | /usr/src/app/target_test_cases/failed_tests_singularities.txt | def singularities(expression, symbol, domain=None):
"""
Find singularities of a given function.
Parameters
==========
expression : Expr
The target function in which singularities need to be found.
symbol : Symbol
The symbol over the values of which the singularity in
ex... | singularities | repository-level | non_external |
sympy | 89 | sympy/ntheory/factor_.py | def smoothness_p(n, m=-1, power=0, visual=None):
"""
Return a list of [m, (p, (M, sm(p + m), psm(p + m)))...]
where:
1. p**M is the base-p divisor of n
2. sm(p + m) is the smoothness of p + m (m = -1 by default)
3. psm(p + m) is the power smoothness of p + m
The list is sorted according to... | /usr/src/app/target_test_cases/failed_tests_smoothness_p.txt | def smoothness_p(n, m=-1, power=0, visual=None):
"""
Return a list of [m, (p, (M, sm(p + m), psm(p + m)))...]
where:
1. p**M is the base-p divisor of n
2. sm(p + m) is the smoothness of p + m (m = -1 by default)
3. psm(p + m) is the power smoothness of p + m
The list is sorted according to... | smoothness_p | repository-level | non_external |
sympy | 90 | sympy/solvers/polysys.py | def solve_generic(polys, opt, strict=False):
"""
Solve a generic system of polynomial equations.
Returns all possible solutions over C[x_1, x_2, ..., x_m] of a
set F = { f_1, f_2, ..., f_n } of polynomial equations, using
Groebner basis approach. For now only zero-dimensional systems
are suppor... | /usr/src/app/target_test_cases/failed_tests_solve_generic.txt | def solve_generic(polys, opt, strict=False):
"""
Solve a generic system of polynomial equations.
Returns all possible solutions over C[x_1, x_2, ..., x_m] of a
set F = { f_1, f_2, ..., f_n } of polynomial equations, using
Groebner basis approach. For now only zero-dimensional systems
are suppor... | solve_generic | repository-level | non_external |
sympy | 91 | sympy/polys/solvers.py | def solve_lin_sys(eqs, ring, _raw=True):
"""Solve a system of linear equations from a PolynomialRing
Explanation
===========
Solves a system of linear equations given as PolyElement instances of a
PolynomialRing. The basic arithmetic is carried out using instance of
DomainElement which is more... | /usr/src/app/target_test_cases/failed_tests_solve_lin_sys.txt | def solve_lin_sys(eqs, ring, _raw=True):
"""Solve a system of linear equations from a PolynomialRing
Explanation
===========
Solves a system of linear equations given as PolyElement instances of a
PolynomialRing. The basic arithmetic is carried out using instance of
DomainElement which is more... | solve_lin_sys | file-level | non_external |
sympy | 92 | sympy/physics/quantum/operatorset.py | def state_to_operators(state, **options):
""" Returns the operator or set of operators corresponding to the
given eigenstate
A global function for mapping state classes to their associated
operators or sets of operators. It takes either a state class
or instance.
This function can handle both ... | /usr/src/app/target_test_cases/failed_tests_state_to_operators.txt | def state_to_operators(state, **options):
""" Returns the operator or set of operators corresponding to the
given eigenstate
A global function for mapping state classes to their associated
operators or sets of operators. It takes either a state class
or instance.
This function can handle both ... | state_to_operators | repository-level | non_external |
sympy | 93 | sympy/physics/secondquant.py | def substitute_dummies(expr, new_indices=False, pretty_indices={}):
"""
Collect terms by substitution of dummy variables.
Explanation
===========
This routine allows simplification of Add expressions containing terms
which differ only due to dummy variables.
The idea is to substitute all ... | /usr/src/app/target_test_cases/failed_tests_substitute_dummies.txt | def substitute_dummies(expr, new_indices=False, pretty_indices={}):
"""
Collect terms by substitution of dummy variables.
Explanation
===========
This routine allows simplification of Add expressions containing terms
which differ only due to dummy variables.
The idea is to substitute all ... | substitute_dummies | repository-level | non_external |
sympy | 94 | sympy/core/sympify.py | def sympify(a, locals=None, convert_xor=True, strict=False, rational=False,
evaluate=None):
"""
Converts an arbitrary expression to a type that can be used inside SymPy.
Explanation
===========
It will convert Python ints into instances of :class:`~.Integer`, floats
into instances of :... | /usr/src/app/target_test_cases/failed_tests_sympify.txt | def sympify(a, locals=None, convert_xor=True, strict=False, rational=False,
evaluate=None):
"""
Converts an arbitrary expression to a type that can be used inside SymPy.
Explanation
===========
It will convert Python ints into instances of :class:`~.Integer`, floats
into instances of :... | sympify | repository-level | external |
sympy | 95 | sympy/physics/quantum/spin.py | def uncouple(expr, jn=None, jcoupling_list=None):
""" Uncouple a coupled spin state
Gives the uncoupled representation of a coupled spin state. Arguments must
be either a spin state that is a subclass of CoupledSpinState or a spin
state that is a subclass of SpinState and an array giving the j values
... | /usr/src/app/target_test_cases/failed_tests_uncouple.txt | def uncouple(expr, jn=None, jcoupling_list=None):
""" Uncouple a coupled spin state
Gives the uncoupled representation of a coupled spin state. Arguments must
be either a spin state that is a subclass of CoupledSpinState or a spin
state that is a subclass of SpinState and an array giving the j values
... | uncouple | file-level | non_external |
sympy | 96 | sympy/solvers/solvers.py | def unrad(eq, *syms, **flags):
"""
Remove radicals with symbolic arguments and return (eq, cov),
None, or raise an error.
Explanation
===========
None is returned if there are no radicals to remove.
NotImplementedError is raised if there are radicals and they cannot be
removed or if t... | /usr/src/app/target_test_cases/failed_tests_unrad.txt | def unrad(eq, *syms, **flags):
"""
Remove radicals with symbolic arguments and return (eq, cov),
None, or raise an error.
Explanation
===========
None is returned if there are no radicals to remove.
NotImplementedError is raised if there are radicals and they cannot be
removed or if t... | unrad | repository-level | non_external |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.