Know the Matrix and Its Operations in Java

in #science7 years ago

pertama.png
An array in Java can be formed by defining a two-dimensional array. Then we can fill each element manually by accessing each element. Here is an example:
kedua.png
In this tutorial, we will only discuss basic matrix operations such as addition, subtraction, and multiplication.

Accessing Matrix Elements

We can use nested loop for to access an element at a certain coordinate. For example let's look at the following source code:ketiga.png
Here is the output of the source code:
ke empat.png

Reducing Two Matrices

To perform the matrix reduction, each element of the two matrices we subtract then the result into a new element of a matrix. The following example is the source code in Java:ke lima.pngIf the source code we run, then the output will appear as follows:terakhir.png

source of :
https://www.codepolitan.com/tutorial/mengenal-matriks-dan-operasinya-di-java

Follow Me :Erikaa