Post Reply 
HP 40gs how to get a submartix from a matrix
09-01-2023, 06:15 AM
Post: #6
RE: HP 40gs how to get a submartix from a matrix
(08-31-2023 11:56 PM)Anthony The Koala Wrote:  In python, I learned a way of multiplying matrices:
To illustrate:
result = U @ M @ V
Is not the same as
result = U * M * V

In the first statement, the "@" does matrix multiplication.
But in the second statement, the "*" does element-by-element multiplication.

The @ operator only works on objects of type array from numpy.
While you can multiply a list by an integer the result is probably not what you expected.

For objects of type Matrix from sympy you have to use the ordinary * operator:
Code:
P = U * M * V

This library allows to use fractions and return the result in LaTeX:
Code:
from sympy import latex

print(latex(P.inv()))

Code:
\left[\begin{matrix}-3 & 2\\\frac{8}{3} & - \frac{5}{3}\end{matrix}\right]

Or then:

\(
\left[\begin{matrix}-3 & 2\\\frac{8}{3} & - \frac{5}{3}\end{matrix}\right]
\)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP 40gs how to get a submartix from a matrix - Thomas Klemm - 09-01-2023 06:15 AM



User(s) browsing this thread: 2 Guest(s)