# Question:is it possible to map a function on rows or columns of a matrix?

## Question:is it possible to map a function on rows or columns of a matrix?

Maple 2020

I needed to normalize the eigenvectors of a matrix. (I did not see an option to do this so far in LinearAlgebra). So I figured I just need to map LinearAlgebra:-VectorNorm(x,'Euclidean')  of each vector of the generated eigenvectors matrix,. Where here means the vector in the matrix. But do not see a way to do it.

I ended up just using seq, which works fine. But was wondering if there is a way to do it? map function on each column (or each row) and have the result be matrix ofcourse.

Will show my attempt using map, and then using seq

```Sx:=1/sqrt(2)*Matrix([[0,1,0],[1,0,1],[0,1,0]]);
lam,v:=LinearAlgebra:-Eigenvectors(Sx);
```

Just doing the following does not work ofcourse

```map( x->x/LinearAlgebra:-VectorNorm(x,'Euclidean'), v)
```

So I used seq

```Sx:=1/sqrt(2)*Matrix([[0,1,0],[1,0,1],[0,1,0]]);
lam,v:=LinearAlgebra:-Eigenvectors(Sx);
normalized:=[seq( v(..,i)/LinearAlgebra:-VectorNorm(v(..,i),'Euclidean'),i=1..LinearAlgebra:-RowDimension(v) )];
```

Will be nice if one can use map or variation of it, which works on either columns or rows at a time.

Maple 2021.2

﻿