Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New set of sympy's fixes #275

Merged
merged 80 commits into from
Jul 18, 2016
Merged

Conversation

skirpichev
Copy link
Member

@skirpichev skirpichev commented May 13, 2016

// stuff from 2015, previous pr: #116

Also

@skirpichev skirpichev force-pushed the sympy-backports4 branch 3 times, most recently from f28f7b4 to f1ff3cb Compare May 22, 2016 11:32
@skirpichev skirpichev force-pushed the sympy-backports4 branch 2 times, most recently from 9380e83 to 429bc1f Compare June 26, 2016 07:48
@skirpichev skirpichev modified the milestone: First public release Jul 4, 2016
oliverlee and others added 17 commits July 16, 2016 00:46
Speedup differentiation of expressions by using xreplace
instead of subs.

// minor edits by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
// minor edits by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
Also added test for issue sympy/sympy#9908

// minor edits by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
// minor edits by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
// minor edits by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
Fractions with integer one in either the numerator or the denominator
would make it possible to cancelled out any common factor from the
numerator and the denominator.  However, in the current implementation,
there is no special treatment for this situation.  The computation of
the GCD with integer one would take a long time by using the Euclidean
algorithm, as in the issue sympy/sympy#9341.

As a result, in this commit, when called with expressions, the cancel
function will directly return the quotient when an integer unity is
found.  This could solve issue #9314.  And when the function is called
with polynomials directly or called with tuples, this short-cut will not
be invoked to better preserve its original behaviour in internal use.

Add one as special case in computing GCD of DMP

In the GCD computation of dense multivariate polynomials, previously in
function `sympy.polys.euclidtools._dmp_rr_trivial_gcd`, only the special
cases with one of the polynomials being zero is specially treated as
trivial case.  However, the polynomial of constant unity is the unit of
the multiplication operation in the ring, so it cannot possibly have
other GCD with any polynomial.  So now one is being handled as a special
case as well to skip the later expensive operations.

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
0.125 is 1/8 and not 1/4

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
// edited by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
When one cannot determine it is an integer, it should
return None, and not False.  This closes issue sympy/sympy#10024.

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
Removing this line beacause the logic behind this line is
wrong, beacause no subclasses return None for _contain.
it seems that this should check for every finite set but
simpify return none for this line to be tested, but for finite
set simpify does not return none.so both statement are controductory
to each other.

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
The comment in the last code sample was wrong.

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
megh1241 and others added 26 commits July 17, 2016 17:33
// edited by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
// edited by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
// edited by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
Closes sympy/sympy#10092

// edited by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
This example uses, as of now, the old pyglet plotting module
which is not working right now.
Changed so that it uses the new plot API.

Fixes sympy/sympy#10243

// edited by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
Remove unused variables, and fix a potential nondeterminism issue.

// edited by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
Previously, this did not work, because it could not recognize x**x as
exp(x*log(x)) unless there already was a log(x) in the expression
somewhere. Now, we manually add log(x) to the extension as soon as we see a
nonelementary monomial of this form (with a symbolic base).

Of course, x**x has no elementary integral, but now risch_integrate is capable
of determining this without explicitly rewriting it as exp(x*log(x)). I don't
know of any examples of integrands that have elementary integrals of this form
with symbolic bases that don't also include the log of the base, but I haven't
looked very hard.

Also update the doctest in risch_integrate() to use this, because that's what
I wanted to use in the first place (I just never got around to fixing this).

// edited by skirpichev: added filtering for symlogs

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
Closes sympy/sympy#10274

// edited by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
docs fixes, `in` operator now works correctly for PermutationGroup

.elements for PermutationGroup introduced

equality of two PermutationGroups

Two Permutation Groups are equal if the set of elements generated
by the generators of two groups are equal

// edited by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
// edited by skirpichev: fix hashing

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
// edited by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
Now
>>> init_printing(use_unicode=True)
>>> Cycle(1, 2, 4)(5, 6)
(1 2 4)(5 6)
>>> latex(Cycle(1, 2, 4)(5, 6))
'\\left( 1\\; 2\\; 4\\right)\\left( 5\\; 6\\right)'

same printing for Permutation
tests fixes

fixes sympy/sympy#10210

// edited by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
Quadratic equations with nonsquare discriminant are solved by
transforming to generalized Pell equations ``X**2 - D*Y**2 = N``.
The rational solutions of the two equations correspond to each other.
In addition, the transformation can be chosen such that all integer-
valued solutions of the original equation correspond to integer-valued
solutions of the Pell equation.
However, not all integer-valued solutions of the Pell equation
correspond to integer-valued solutions of the original equation,
because the rational coefficients of the inverse transformation are
not integers, in general.

The integer-valued solutions of the generalized Pell equation are as
follows. There is a finite number of fundamental solutions ``(X, Y)``,
and all solutions are obtained as coefficients of 1 and ``d = sqrt(D)``
in ``(X + d*Y)*(U + d*V)`` for all solutions of the Pell equation
``U**2 - D*V**2 = 1``. On the other hand, the solutions of the
Pell equation are given by the powers ``U_i + d*V_i = (U + d*V)**i``
of a single primitive solution ``(U, V)`` and their negatives.

The integer solutions of the original equation are then found with
the following steps.

    1. Find the fundamental solutions of the generalized Pell equation.

    2. Find the primitive solution ``(U, V)`` of Pell's equation.

    3. Find the least positive integer ``k`` such that ``(U_k, V_k)``
       is congruent to ``(1, 0)`` modulo the lcm ``L`` of the
       denominators of the coefficients of the inverse transformation.

    4. For each fundamental solution ``(X, Y)`` find the solutions
       ``(x_i, y_i)`` of the original equation corresponding to
       ``X_i + d*Y_i = (X + d*Y)*(U + d*V)**i for i in range(k)``.

    5. For each pair ``(x_i, y_i)`` of integer-valued solutions
       add all solutions corresponding to
       ``(X_i + d*Y_i)*(U_k + d*V_k)**t`` for all integers ``t``.

// edited by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
1) fix runtime error (closes sympy/sympy#9539)
2) always return a valid solution when a solution exists.

// edited by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
// edited by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
There was a small grammatical error.

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
Drop untested and/or inaccessible code, add some
trivial tests.
@skirpichev skirpichev merged commit b2c204f into diofant:master Jul 18, 2016
@skirpichev skirpichev deleted the sympy-backports4 branch July 18, 2016 04:03
@skirpichev skirpichev mentioned this pull request Dec 7, 2016
99 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.