 # Documentation about calculations and arithmetics

Hey guys, maybe I’m just blind, but I haven’t found an overview of all the kinds of arithmetics and how to express them with nalgebra, apart from the obvious ones.

I am talking about all possible pairings like:
Adding scalar to existing matrix
I came up with the following:
`the_matrix.iter_mut().for_each(|e| *e = *e + the_scalar);`
Adding scalar to matrix, producing new matrix
I came up with the following:
`the_matrix.map(|e| e + the_scalar);`
after having tested many, many horrible things, such as:
`&the_matrix + na::DMatrix::from_element(the_matrix.nrows(), the_matrixncols(), 1.0) * the_scalar;`

And then I accidentially found `add_scalar()` in the changelog…

Adding a column-vector to each column of an existing matrix
I came up with the following:
`the_matrix.column_iter_mut().for_each(|mut col| col += &the_vector);`
Adding a column-vector to each column of a matrix, producing a new matrix
…??

Adding a row-vector to each row of a matrix
`the_matrix.row_iter_mut().for_each(|mut row| row += &the_vector);`
Adding a row-vector to each row of a matrix, producing a new matrix
…??
Multiplying a column-vector with each column of a matrix, producing a new matrix
etc.

Is there an overview for these arithmetics?

Hi! Sorry for the late response.

The only overview we currently have is provided by the quick reference. Though it does lacks some methods (like the `add_scalar` you mentioned).

Note that for adding a scalar to existing matrix, you can simply use `.add_scalar_mut(the_scalar)`.

I agree it would be great to have those kind of little recipes listed somewhere. I’ve created an issue about this: https://github.com/rustsim/nalgebra.org/issues/28