added invert-matrix to /science/mathematics/linear_algebra (#508)

* added invert-matrix to /science/mathematics/linear_algebra

* added nalgebra as dependency

* added nalgebra to dictionary

* fixed link to nalgebra

* Remove statistics file only includes the header
This commit is contained in:
Stefan Mesken 2019-04-12 17:17:46 +02:00 committed by Andrew Gauger
parent 35daea8254
commit 539183c86b
6 changed files with 32 additions and 0 deletions

View file

@ -51,6 +51,7 @@ toml = "0.4"
url = "1.6" url = "1.6"
walkdir = "2.0" walkdir = "2.0"
ansi_term = "0.11.0" ansi_term = "0.11.0"
nalgebra = "0.16.12"
[target.'cfg(target_os = "linux")'.dependencies] [target.'cfg(target_os = "linux")'.dependencies]
syslog = "4.0" syslog = "4.0"

View file

@ -193,6 +193,7 @@ NaiveDate
NaiveDateTime NaiveDateTime
NaiveTime NaiveTime
ndarray ndarray
nalgebra
nFun nFun
NotFound NotFound
NulError NulError

View file

@ -92,6 +92,8 @@ Keep lines sorted.
[memmap]: https://docs.rs/memmap/ [memmap]: https://docs.rs/memmap/
[mime-badge]: https://badge-cache.kominick.com/crates/v/csv.svg?label=mime [mime-badge]: https://badge-cache.kominick.com/crates/v/csv.svg?label=mime
[mime]: https://docs.rs/mime/ [mime]: https://docs.rs/mime/
[nalgebra-badge]: https://badge-cache.kominick.com/crate/nalgebra.svg?label=nalgebra
[nalgebra]: https://docs.rs/nalgebra
[ndarray-badge]: https://badge-cache.kominick.com/crate/ndarray.svg?label=ndarray [ndarray-badge]: https://badge-cache.kominick.com/crate/ndarray.svg?label=ndarray
[ndarray]: https://docs.rs/ndarray [ndarray]: https://docs.rs/ndarray
[num-badge]: https://badge-cache.kominick.com/crates/v/num.svg?label=num [num-badge]: https://badge-cache.kominick.com/crates/v/num.svg?label=num

View file

@ -7,6 +7,7 @@
| [Adding matrices][add-matrices] | [![ndarray-badge]][ndarray] | [![cat-science-badge]][cat-science] | | [Adding matrices][add-matrices] | [![ndarray-badge]][ndarray] | [![cat-science-badge]][cat-science] |
| [Multiplying matrices][multiply-matrices] | [![ndarray-badge]][ndarray] | [![cat-science-badge]][cat-science] | | [Multiplying matrices][multiply-matrices] | [![ndarray-badge]][ndarray] | [![cat-science-badge]][cat-science] |
| [Multiply a scalar with a vector with a matrix][multiply-scalar-vector-matrix] | [![ndarray-badge]][ndarray] | [![cat-science-badge]][cat-science] | | [Multiply a scalar with a vector with a matrix][multiply-scalar-vector-matrix] | [![ndarray-badge]][ndarray] | [![cat-science-badge]][cat-science] |
| [Invert marix][invert-matrix] | [![nalgebra-badge]][nalgebra] | [![cat-science-badge]][cat-science] |
| [Calculating the side length of a triangle][side-length] | [![std-badge]][std] | [![cat-science-badge]][cat-science] | | [Calculating the side length of a triangle][side-length] | [![std-badge]][std] | [![cat-science-badge]][cat-science] |
| [Verifying tan is equal to sin divided by cos][tan-sin-cos] | [![std-badge]][std] | [![cat-science-badge]][cat-science] | | [Verifying tan is equal to sin divided by cos][tan-sin-cos] | [![std-badge]][std] | [![cat-science-badge]][cat-science] |
| [Distance between two points on the Earth][latitude-longitude] | [![std-badge]][std] | [![cat-science-badge]][cat-science] | | [Distance between two points on the Earth][latitude-longitude] | [![std-badge]][std] | [![cat-science-badge]][cat-science] |
@ -22,6 +23,7 @@
[add-matrices]: science/mathematics/linear_algebra.html#adding-matrices [add-matrices]: science/mathematics/linear_algebra.html#adding-matrices
[multiply-matrices]: science/mathematics/linear_algebra.html#multiplying-matrices [multiply-matrices]: science/mathematics/linear_algebra.html#multiplying-matrices
[multiply-scalar-vector-matrix]: science/mathematics/linear_algebra.html#multiply-a-scalar-with-a-vector-with-a-matrix [multiply-scalar-vector-matrix]: science/mathematics/linear_algebra.html#multiply-a-scalar-with-a-vector-with-a-matrix
[invert-matrix]: science/mathematics/linear_algebra.html#invert-matrix
[side-length]: science/mathematics/trigonometry.html#calculating-the-side-length-of-a-triangle [side-length]: science/mathematics/trigonometry.html#calculating-the-side-length-of-a-triangle
[tan-sin-cos]: science/mathematics/trigonometry.html#verifying-tan-is-equal-to-sin-divided-by-cos [tan-sin-cos]: science/mathematics/trigonometry.html#verifying-tan-is-equal-to-sin-divided-by-cos
[latitude-longitude]: science/mathematics/trigonometry.html#distance-between-two-points-on-the-earth [latitude-longitude]: science/mathematics/trigonometry.html#distance-between-two-points-on-the-earth

View file

@ -5,5 +5,6 @@
{{#include linear_algebra/add-matrices.md}} {{#include linear_algebra/add-matrices.md}}
{{#include linear_algebra/multiply-matrices.md}} {{#include linear_algebra/multiply-matrices.md}}
{{#include linear_algebra/multiply-scalar-vector-matrix.md}} {{#include linear_algebra/multiply-scalar-vector-matrix.md}}
{{#include linear_algebra/invert-matrix.md}}
{{#include ../../links.md}} {{#include ../../links.md}}

View file

@ -0,0 +1,25 @@
## Invert matrix
[![nalgebra-badge]][nalgebra] [![cat-science-badge]][cat-science]
Creates a 3x3 matrix with [`nalgebra::Matrix3`] and inverts it, if possible.
```rust
extern crate nalgebra;
use nalgebra::Matrix3;
fn main() {
let m1 = Matrix3::new(2.0, 1.0, 1.0, 3.0, 2.0, 1.0, 2.0, 1.0, 2.0);
println!("m1 = {}", m1);
match m1.try_inverse() {
Some(inv) => {
println!("The inverse of m1 is: {}", inv);
}
None => {
println!("m1 is not invertible!");
}
}
}
```
[`nalgebra::Matrix3`]: https://docs.rs/nalgebra/*/nalgebra/base/type.Matrix3.html