Skip to content

Conversation

smichr
Copy link
Member

@smichr smichr commented Jan 1, 2022

Code was dead because f.length is a method that can never equal 2. Code has now been corrected and updated to handle the re-factoring of the constant term that is expanded when the Poly is made.

References to other Issues or PRs

fixes #22768
closes #22770

Brief description of what is fixed or changed

Other comments

Release Notes

  • solvers
    • solve will give more factored results automatically when solving binomial expressions with similar powers in the constant term -- like when solving x**3 - (1 - y)**6 for x.

@sympy-bot
Copy link

sympy-bot commented Jan 1, 2022

Hi, I am the SymPy bot (v163). I'm here to help you write a release notes entry. Please read the guide on how to write release notes.

Your release notes are in good order.

Here is what the release notes will look like:

  • solvers
    • solve will give more factored results automatically when solving binomial expressions with similar powers in the constant term -- like when solving x**3 - (1 - y)**6 for x. (#22781 by @smichr)

This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.11.

Click here to see the pull request description that was parsed.
Code was dead because `f.length` is a method that can never equal 2. Code has now been corrected and updated to handle the re-factoring of the constant term that is expanded when the Poly is made.
<!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->

#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more information). Also, please
write a comment on that issue linking back to this pull request once it is
open. -->
fixes #22768
closes #22770 

#### Brief description of what is fixed or changed


#### Other comments


#### Release Notes

<!-- Write the release notes for this release below between the BEGIN and END
statements. The basic format is a bulleted list with the name of the subpackage
and the release note for this PR. For example:

* solvers
  * Added a new solver for logarithmic equations.

* functions
  * Fixed a bug with log of integers.

or if no release note(s) should be included use:

NO ENTRY

See https://github.com/sympy/sympy/wiki/Writing-Release-Notes for more
information on how to write release notes. The bot will check your release
notes automatically to see if they are formatted correctly. -->

<!-- BEGIN RELEASE NOTES -->
* solvers
    * solve will give more factored results automatically when solving binomial expressions with similar powers in the constant term -- like when solving `x**3 - (1 - y)**6` for `x`.
<!-- END RELEASE NOTES -->

Update

The release notes on the wiki have been updated.

@smichr smichr changed the title move binomial handling to _solve activate dead code to factor constant term when solving binomial equation Jan 1, 2022
@smichr smichr force-pushed the foon branch 3 times, most recently from b26dbba to f2f6f17 Compare March 28, 2022 17:58
@github-actions
Copy link

github-actions bot commented Mar 28, 2022

Benchmark results from GitHub Actions

Lower numbers are good, higher numbers are bad. A ratio less than 1
means a speed up and greater than 1 means a slowdown. Green lines
beginning with + are slowdowns (the PR is slower then master or
master is slower than the previous release). Red lines beginning
with - are speedups.

Significantly changed benchmark results (PR vs master)

Significantly changed benchmark results (master vs previous release)

       before           after         ratio
     [907895ac]       [306c0f2c]
-       215±0.7ms        132±0.6ms     0.61  large_exprs.TimeLargeExpressionOperations.time_subs
-     15.0±0.01ms      9.81±0.04ms     0.65  matrices.TimeMatrixExpression.time_MatAdd_doit
-       227±0.8μs        104±0.2μs     0.46  matrices.TimeMatrixExpression.time_MatMul
-     14.4±0.04ms      7.49±0.09ms     0.52  matrices.TimeMatrixExpression.time_MatMul_doit
-      4.18±0.03s          306±2ms     0.07  polygon.PolygonArbitraryPoint.time_bench01
+     3.32±0.01ms      5.54±0.02ms     1.67  solve.TimeMatrixOperations.time_det(4, 2)
+     3.33±0.01ms      5.56±0.02ms     1.67  solve.TimeMatrixOperations.time_det_bareiss(4, 2)
+      37.2±0.2ms       65.5±0.3ms     1.76  solve.TimeMatrixSolvePyDySlow.time_linsolve(1)
+      37.6±0.1ms       66.0±0.3ms     1.75  solve.TimeMatrixSolvePyDySlow.time_solve(1)

Full benchmark results can be found as artifacts in GitHub Actions
(click on checks at the top of the PR).

This might be cheating the simplify=False flag. But unless
solve would preserve this structure, the expansion step
of the solve process is destroyed and with the check that the
symbol dependent part contain powers, this is perhaps targeted
enough to be warranted.
@smichr smichr marked this pull request as draft March 29, 2022 13:14
@smichr smichr marked this pull request as ready for review March 29, 2022 16:16
@smichr smichr merged commit b1cbf2c into sympy:master Mar 29, 2022
@smichr smichr deleted the foon branch March 29, 2022 18:03
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.

Dead code in sympy.polys.polyroots.roots() function
3 participants