# [Maxima] simple question

Andrej Vodopivec andrej.vodopivec at gmail.com
Sat May 17 09:01:26 CDT 2008

```2008/5/17 ahmet alper parker <aaparker at gmail.com>:
> Dear all,
> I have a very simple question. If you can answer, I really appreciate. How
> can I build a matrix with all its elements zero with a simple command?
> In example I want to build a matrix like
>
> A=matrix(
>  [0,0,0],
>  [0,0,0],
>  [0,0,0]
> );
>
> but it is very hard to make it if you define all the elements and if you
> have say a 100*100 matrix.
> There should be a simple command but I cannot find it in the manual. Also
> its elements are not forced to be zero. I want to make A a matrix with
> 100*100 elements in example. Then I will define myself its elements with a
> for next like loop...

You are looking for zeromatrix:

(%i1) ?! zeromatrix;
-- Function: zeromatrix (<m>, <n>)
Returns an <m> by <n> matrix, all elements of which are zero.
There are also some inexact matches for `zeromatrix'.
Try `?? zeromatrix' to see them.
(%o1) true
(%i2) zeromatrix(4,4);
(%o2) matrix([0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0])

--
Andrej
```