sympy icon indicating copy to clipboard operation
sympy copied to clipboard

[GSOC 1.4.1] Refactor Pole Zero Plot to use Algebraic methods

Open faze-geek opened this issue 2 years ago • 5 comments

References to other Issues or PRs

Brief description of what is fixed or changed

Other comments

Release Notes

NO ENTRY

faze-geek avatar Jun 30 '23 03:06 faze-geek

:white_check_mark:

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

  • No release notes entry will be added for this pull request.
Click here to see the pull request description that was parsed.
<!-- 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. -->


#### 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. Formerly, `log(-x)` incorrectly gave `-log(x)`.

* physics.units
  * Corrected a semantical error in the conversion between volt and statvolt which
    reported the volt as being larger than the statvolt.

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 -->
NO ENTRY
<!-- END RELEASE NOTES -->

sympy-bot avatar Jun 30 '23 03:06 sympy-bot

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
     [8059df73]       [3236f743]
     <sympy-1.12^0>                 
-       102±0.7ms       67.1±0.4ms     0.66  integrate.TimeIntegrationRisch02.time_doit(10)
-        2.46±0ms          787±3μs     0.32  polys.TimePREM_LinearDenseQuadraticGCD.time_op(3, 'sparse')
-     12.0±0.06ms      2.35±0.01ms     0.20  polys.TimePREM_LinearDenseQuadraticGCD.time_op(5, 'sparse')
-       439±0.8μs       97.1±0.4μs     0.22  polys.TimePREM_QuadraticNonMonicGCD.time_op(1, 'sparse')
-     5.54±0.01ms        433±0.8μs     0.08  polys.TimePREM_QuadraticNonMonicGCD.time_op(3, 'sparse')
-     12.1±0.06ms      1.30±0.01ms     0.11  polys.TimePREM_QuadraticNonMonicGCD.time_op(5, 'sparse')
-      7.86±0.7ms      4.74±0.03ms     0.60  polys.TimeSUBRESULTANTS_LinearDenseQuadraticGCD.time_op(2, 'sparse')
-      31.9±0.1ms       14.3±0.1ms     0.45  polys.TimeSUBRESULTANTS_LinearDenseQuadraticGCD.time_op(3, 'sparse')
-     8.34±0.02ms         1.39±0ms     0.17  polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(1, 'sparse')
-      19.1±0.1ms      11.0±0.05ms     0.58  polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(2, 'sparse')
-       244±0.6ms       84.4±0.2ms     0.35  polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(3, 'sparse')
-     7.40±0.06ms          640±2μs     0.09  polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(3, 'sparse')
-        31.7±1ms         1.02±0ms     0.03  polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(5, 'sparse')
-         720±4μs          233±6μs     0.32  polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(1, 'sparse')
-     7.46±0.04ms          236±2μs     0.03  polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(3, 'sparse')
-        19.5±1ms          244±1μs     0.01  polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(5, 'sparse')
-         196±5μs          110±5μs     0.56  solve.TimeMatrixOperations.time_rref(3, 0)
-       369±0.5μs        129±0.8μs     0.35  solve.TimeMatrixOperations.time_rref(4, 0)
-      38.6±0.9ms       16.6±0.3ms     0.43  solve.TimeSolveLinSys189x49.time_solve_lin_sys

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

github-actions[bot] avatar Jun 30 '23 05:06 github-actions[bot]

Hi @moorepants All methods for roots now use Sympy. But as discussed about the lack of implementations in another pr, to eliminate Matplotlib we would need support for Sympy scatter plot. An issue is raised since quite sometime. Should we go ahead an merge this? Refactoring other plots will then follow. Since we are not sure when the implementation will be made, I suggest we continue refactoring and eliminating the numerical methods as much as possible. If and when we have a scatter plot, replacing them in the current code would not be difficult.

faze-geek avatar Aug 04 '23 04:08 faze-geek

The general procedure for adding new plotting methods/functions should be:

  1. Utilize sympy plot commands to make the plot.
  2. If there are missing sympy plot features, then add them.

If the features aren't present in sympy.plot and you don't want to add them, then you should postpone adding a new plot.

When working with existing plot functions/methods in sympy...control, try to move them to using sympy.plot features.

We should "eat our own dog food" anytime we need plots in SymPy.

moorepants avatar Aug 04 '23 05:08 moorepants

Thanks !

The general procedure for adding new plotting methods/functions should be:

  1. Utilize sympy plot commands to make the plot.
  2. If there are missing sympy plot features, then add them.

If the features aren't present in sympy.plot and you don't want to add them, then you should postpone adding a new plot.

Okay sure. All 6 plots in control module use numpy for sampling and matplotlib for plotting as of now. Maybe this was not followed in last GSOC for the control package. I intend to stick to the control module for the time being of the project. As and when, the plot features are added I will update the prs 👍

When working with existing plot functions/methods in sympy...control, try to move them to using sympy.plot features.

I will investigate where this replacement is feasible.

faze-geek avatar Aug 04 '23 05:08 faze-geek