Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| documentation:language_reference:objects:matrix:operations:div [2024/12/12 14:27] – created Maurits W. Haverkort | documentation:language_reference:objects:matrix:operations:div [2025/11/20 04:20] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| ### | ### | ||
| - | alligned paragraph text | + | One can divide a matrix by a number, but also a number by a matrix or a matrix by a matrix. A matrix divided by a number is done element wise. A number divided by a matrix yields the matrix inverse and a matrix divided by a matrix yields the product of the first matrix times the matrix inverse of the second matrix. |
| ### | ### | ||
| - | ===== Example ===== | + | ===== Example |
| - | ### | + | ==== Input ==== |
| - | description text | + | <code Quanty Example.Quanty> |
| - | ### | + | A = Matrix.New({{1, |
| + | B = A / 2 | ||
| + | print(B) | ||
| + | </ | ||
| + | |||
| + | ==== Result ==== | ||
| + | <file Quanty_Output> | ||
| + | { { 0.5 , 1 } , | ||
| + | { 1.5 , 2 } } | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Example c / M ===== | ||
| ==== Input ==== | ==== Input ==== | ||
| <code Quanty Example.Quanty> | <code Quanty Example.Quanty> | ||
| - | -- some example code | + | A = Matrix.New({{1, |
| + | B = 2 / A | ||
| + | print(B) | ||
| </ | </ | ||
| ==== Result ==== | ==== Result ==== | ||
| <file Quanty_Output> | <file Quanty_Output> | ||
| - | text produced as output | + | { { -4 , 2 } , |
| + | { 3 , -1 } } | ||
| </ | </ | ||
| + | |||
| + | and | ||
| + | |||
| + | ==== Input ==== | ||
| + | <code Quanty Example.Quanty> | ||
| + | A = Matrix.New({{1, | ||
| + | B = 2 / A | ||
| + | print(B * A) | ||
| + | </ | ||
| + | |||
| + | ==== Result ==== | ||
| + | <file Quanty_Output> | ||
| + | { { 2 , 0 } , | ||
| + | { 0 , 2 } } | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Example M1 / M2 ===== | ||
| + | |||
| + | ==== Input ==== | ||
| + | <code Quanty Example.Quanty> | ||
| + | A = Matrix.New({{1, | ||
| + | B = Matrix.New({{5, | ||
| + | C = B / A | ||
| + | print(C) | ||
| + | </ | ||
| + | |||
| + | ==== Result ==== | ||
| + | <file Quanty_Output> | ||
| + | { { -1 , 2 } , | ||
| + | { -2 , 3 } } | ||
| + | </ | ||
| + | |||
| ===== Table of contents ===== | ===== Table of contents ===== | ||
| - | {{indexmenu> | + | {{indexmenu> |