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

Solve matrix equation--documentation guide #23951

Merged
merged 26 commits into from
Oct 25, 2022

Conversation

bertiewooster
Copy link
Contributor

References to other Issues or PRs

Brief description of what is fixed or changed

Other comments

Release Notes

  • other
    • A new, user-friendly page on solving a matrix equation algebraically was added to the Guides section.

Main page: use symbolic example
@sympy-bot
Copy link

sympy-bot commented Aug 21, 2022

Hi, I am the SymPy bot (v167). 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:

  • other
    • A new, user-friendly page on solving a matrix equation algebraically was added to the Guides section. (#23951 by @bertiewooster)

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

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.

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 -->
* other
  * A new, user-friendly page on solving a matrix equation algebraically was added to the Guides section.
<!-- END RELEASE NOTES -->

Update

The release notes on the wiki have been updated.

@sympy-bot
Copy link

sympy-bot commented Aug 21, 2022

🟠

Hi, I am the SymPy bot (v167). I've noticed that some of your commits add or delete files. Since this is sometimes done unintentionally, I wanted to alert you about it.

This is an experimental feature of SymPy Bot. If you have any feedback on it, please comment at sympy/sympy-bot#75.

The following commits add new files:

  • cdd7581:
    • doc/src/guides/solving/solve-matrix-equation.md

If these files were added/deleted on purpose, you can ignore this message.

@github-actions
Copy link

github-actions bot commented Aug 23, 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
     [41d90958]       [b1de2706]
     <sympy-1.11.1^0>                 
-     1.26±0.03ms         837±20μs     0.66  solve.TimeSparseSystem.time_linear_eq_to_matrix(10)
-      3.65±0.1ms      1.59±0.05ms     0.44  solve.TimeSparseSystem.time_linear_eq_to_matrix(20)
-      7.23±0.3ms       2.25±0.1ms     0.31  solve.TimeSparseSystem.time_linear_eq_to_matrix(30)

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

Remove inapplicable no-solution sections
@bertiewooster
Copy link
Contributor Author

Note to self: Just waiting on #23802 to be merged, then will link to solve-system-of-equations-algebraically.md in Alternatives to Consider

@bertiewooster bertiewooster marked this pull request as ready for review October 1, 2022 01:49
⎢ ⎥
⎣c⋅e d ⎦
>>> b = Matrix([2, 0])
>>> A.LUsolve(b)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you introduced this above? Probably should explain the difference in .solve() somewhere before.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per your other comment about LUsolve, I now introduce LUsolve earlier.

Probably should explain the difference in .solve() somewhere before.

I added a section Methods for Solving Matrix Equations, noting that Gauss-Jordan elimination is the default method, and another method is LU decomposition (via solve with method='LU', or LUsolve).

I think my earlier query to you, which method is best for a given kind of matrix (hermitian, symmetric, or triangular), will address this question?

that inverse can be much slower than LUsolve
with the same number of unknowns as equations. If not, SymPy will give the error
``ShapeError: `self` and `rhs` must have the same number of rows.``

The exception to the requirement that a matrix be square comes from SymPy's use
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@moorepants If there's a concise explanation of what circumstances the Moore-Penrose pseudoinverse allows for a non-square matrix under, I would appreciate you sharing it. (That's beyond my math knowledge.) Thanks!

- If matrix elements are zero, ensure that they are recognized as zero. You can
do this by either making them zero or by applying
[assumptions](assumptions_module).
- Selecting a solve method suited to the properties of the matrix, for example
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@moorepants Are there specific solving functions, or flags for solving functions, that we should recommend to users who have those kinds of matrix (hermitian, symmetric, triangular, etc.)?

Add section Methods for Solving Matrix Equations
@sylee957 sylee957 merged commit 6b4c61c into sympy:master Oct 25, 2022
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.

6 participants