{"id":91479,"date":"2022-10-11T21:40:36","date_gmt":"2022-10-12T02:40:36","guid":{"rendered":"https:\/\/blogging-techies.com\/sw\/hur-man-lagger-till-och-subtraherar-tva-matriser-i-c-python-och-javascript\/"},"modified":"2022-10-11T21:40:36","modified_gmt":"2022-10-12T02:40:36","slug":"hur-man-lagger-till-och-subtraherar-tva-matriser-i-c-python-och-javascript","status":"publish","type":"post","link":"https:\/\/blogging-techies.com\/sw\/hur-man-lagger-till-och-subtraherar-tva-matriser-i-c-python-och-javascript\/","title":{"rendered":"Hur man l\u00e4gger till och subtraherar tv\u00e5 matriser i C++, Python och JavaScript"},"content":{"rendered":"<div>\n<p>En matris \u00e4r en rektangul\u00e4r matris av tal, symboler eller uttryck ordnade i rader och kolumner.  Detta rektangul\u00e4ra rutn\u00e4t av siffror anv\u00e4nds ofta inom matematik, elektroteknik och datavetenskap.  Matriser skapades ursprungligen f\u00f6r att beskriva systemet med linj\u00e4ra ekvationer.<\/p>\n<p>Nu anv\u00e4nds matriser i stor utstr\u00e4ckning inom bildbehandling, genetisk analys, big data och programmering.  Addering och subtraktion av matriser \u00e4r de tv\u00e5 vanligaste matrisoperationerna.  I den h\u00e4r artikeln f\u00e5r du l\u00e4ra dig hur du adderar och subtraherar tv\u00e5 matriser.<\/p>\n<h2 id=\"rules-for-matrix-addition\"><span class=\"ez-toc-section\" id=\"Regler_for_Matrix_Addition\"><\/span>  Regler f\u00f6r Matrix Addition<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>F\u00f6lj dessa regler f\u00f6r att l\u00e4gga till tv\u00e5 matriser:<\/p>\n<p>  Tv\u00e5 matriser kan bara l\u00e4ggas till om de \u00e4r av samma ordning.  Om de tv\u00e5 matriserna \u00e4r av samma ordning, l\u00e4gg till motsvarande element i de tv\u00e5 matriserna, dvs l\u00e4gg till de element som har samma positioner.  <\/p>\n<figure>\n<\/figure>\n<p>I exempel 1 kan matriserna l\u00e4ggas till eftersom de har samma ordning.  I exempel 2 kan matriserna inte l\u00e4ggas till eftersom de inte har samma ordning.<\/p>\n<h2 id=\"c-program-to-add-two-matrices\"><span class=\"ez-toc-section\" id=\"C-program_for_att_lagga_till_tva_matriser\"><\/span>  C++-program f\u00f6r att l\u00e4gga till tv\u00e5 matriser<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Nedan \u00e4r C++-programmet f\u00f6r att l\u00e4gga till tv\u00e5 matriser:<\/p>\n<pre>\/\/ C++ program for addition of two matrices<br\/>#include &lt;bits\/stdc++.h&gt;<br\/>using namespace std;<br\/>\/\/ The order of the matrix is 3 x 3<br\/>#define size1 3<br\/>#define size2 3<br\/>\/\/ Function to add matrices mat1[][] &amp; mat2[][],<br\/>\/\/ and store the result in matrix result[][]<br\/>void addMatrices(int mat1[][size2], int mat2[][size2], int result[][size2])<br\/>{<br\/>for (int i = 0; i &lt; size1; i++)<br\/>{<br\/>for (int j = 0; j &lt; size2; j++)<br\/>{<br\/>result[i][j] = mat1[i][j] + mat2[i][j];<br\/>}<br\/>}<br\/>}<br\/>\/\/ Driver code<br\/>int main()<br\/>{<br\/>\/\/ 1st Matrix<br\/>int mat1[size1][size2] = { {9, 8, 7},<br\/>{6, 8, 0},<br\/>{5, 9, 2} };<br\/>\/\/ 2nd Matrix<br\/>int mat2[size1][size2] = { {4, 7, 6},<br\/>{8, 8, 2},<br\/>{7, 3, 5} };<p>\/\/ Matrix to store the result<br\/>int result[size1][size2];<br\/>\/\/ Calling the addMatrices() function<br\/>addMatrices(mat1, mat2, result);<br\/>cout &lt;&lt; \"mat1 + mat2 = \" &lt;&lt; endl;<br\/>\/\/ Printing the sum of the 2 matrices<br\/>for (int i = 0; i &lt; size1; i++)<br\/>{<br\/>for (int j = 0; j &lt; size2; j++)<br\/>{<br\/>cout &lt;&lt; result[i][j] &lt;&lt; \" \";<br\/>}<br\/>cout &lt;&lt; endl;<br\/>}<br\/>return 0;<br\/>}<br\/><\/p><\/pre>\n<p>Produktion:<\/p>\n<pre>mat1 + mat2 = <br\/>13 15 13 <br\/>14 16 2 <br\/>12 12 7<\/pre>\n<h2 id=\"python-program-to-add-two-matrices\"><span class=\"ez-toc-section\" id=\"Python-program_for_att_lagga_till_tva_matriser\"><\/span>  Python-program f\u00f6r att l\u00e4gga till tv\u00e5 matriser<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Nedan \u00e4r Python-programmet f\u00f6r att l\u00e4gga till tv\u00e5 matriser:<\/p>\n<pre># Python program for addition of two matrices<br\/># The order of the matrix is 3 x 3<br\/>size1 = 3<br\/>size2 = 3<br\/># Function to add matrices mat1[][] &amp; mat2[][],<br\/># and store the result in matrix result[][]<br\/>def addMatrices(mat1,mat2,result):<br\/>for i in range(size1):<br\/>for j in range(size2):<br\/>result[i][j] = mat1[i][j] + mat2[i][j]<br\/># driver code<br\/># 1st Matrix<br\/>mat1 = [ [9, 8, 7],<br\/>[6, 8, 0],<br\/>[5, 9, 2] ]<br\/># 2nd Matrix<br\/>mat2 = [ [4, 7, 6],<br\/>[8, 8, 2],<br\/>[7, 3, 5] ]<br\/># Matrix to store the result<br\/>result = mat1[:][:]<br\/># Calling the addMatrices function<br\/>addMatrices(mat1, mat2, result)<br\/># Printing the sum of the 2 matrices<br\/>print(\"mat1 + mat2 = \")<br\/>for i in range(size1):<br\/>for j in range(size2):<br\/>print(result[i][j], \" \", end='')<br\/>print()<br\/><\/pre>\n<p>Produktion:<\/p>\n<pre>mat1 + mat2 =<br\/>13 15 13<br\/>14 16 2<br\/>12 12 7<\/pre>\n<h2 id=\"c-program-to-add-two-matrices\"><span class=\"ez-toc-section\" id=\"C_Program_for_att_lagga_till_tva_matriser\"><\/span>  C Program f\u00f6r att l\u00e4gga till tv\u00e5 matriser<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Nedan \u00e4r C-programmet f\u00f6r att l\u00e4gga till tv\u00e5 matriser:<\/p>\n<pre>\/\/ C program for addition of two matrices<br\/>#include &lt;stdio.h&gt;<br\/>\/\/ The order of the matrix is 3 x 3<br\/>#define size1 3<br\/>#define size2 3<br\/>\/\/ Function to add matrices mat1[][] &amp; mat2[][],<br\/>\/\/ and store the result in matrix result[][]<br\/>void addMatrices(int mat1[][size2], int mat2[][size2], int result[][size2])<br\/>{<br\/>for (int i = 0; i &lt; size1; i++)<br\/>{<br\/>for (int j = 0; j &lt; size2; j++)<br\/>{<br\/>result[i][j] = mat1[i][j] + mat2[i][j];<br\/>}<br\/>}<br\/>}<br\/>\/\/ Driver code<br\/>int main()<br\/>{<br\/>\/\/ 1st Matrix<br\/>int mat1[size1][size2] = { {9, 8, 7},<br\/>{6, 8, 0},<br\/>{5, 9, 2} };<br\/>\/\/ 2nd Matrix<br\/>int mat2[size1][size2] = { {4, 7, 6},<br\/>{8, 8, 2},<br\/>{7, 3, 5} };<p>\/\/ Matrix to store the result<br\/>int result[size1][size2];<br\/>\/\/ Calling the addMatrices function<br\/>addMatrices(mat1, mat2, result);<br\/>printf(\"mat1 + mat2 = \u2060n\");<br\/>\/\/ Printing the sum of the 2 matrices<br\/>for (int i = 0; i &lt; size1; i++)<br\/>{<br\/>for (int j = 0; j &lt; size2; j++)<br\/>{<br\/>printf(\"%d \", result[i][j]);<br\/>}<br\/>printf(\"\u2060n\");<br\/>}<br\/>return 0;<br\/>}<\/p><\/pre>\n<p>Produktion:<\/p>\n<pre>mat1 + mat2 = <br\/>13 15 13 <br\/>14 16 2 <br\/>12 12 7<\/pre>\n<h2 id=\"javascript-program-to-add-two-matrices\"><span class=\"ez-toc-section\" id=\"JavaScript-program_for_att_lagga_till_tva_matriser\"><\/span>  JavaScript-program f\u00f6r att l\u00e4gga till tv\u00e5 matriser<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Nedan finns JavaScript-programmet f\u00f6r att l\u00e4gga till tv\u00e5 matriser:<\/p>\n<pre>&lt;script&gt;<br\/>\/\/ JavaScript program for addition of two matrices<br\/>\/\/ The order of the matrix is 3 x 3<br\/>let size1 = 3;<br\/>let size2 = 3;<br\/>\/\/ Function to add matrices mat1[][] &amp; mat2[][],<br\/>\/\/ and store the result in matrix result[][]<br\/>function addMatrices(mat1, mat2, result) {<br\/>for (let i = 0; i &lt; size1; i++) {<br\/>for (let j = 0; j &lt; size2; j++) {<br\/>result[i][j] = mat1[i][j] + mat2[i][j];<br\/>}<br\/>}<br\/>}<br\/>\/\/ Driver code<br\/>\/\/ 1st Matrix<br\/>mat1 = [ [9, 8, 7],<br\/>[6, 8, 0],<br\/>[5, 9, 2] ]<br\/>\/\/ 2nd Matrix<br\/>mat2 = [ [4, 7, 6],<br\/>[8, 8, 2],<br\/>[7, 3, 5] ]<br\/>\/\/ Matrix to store the result<br\/>let result = new Array(size1);<br\/>for (let k = 0; k &lt; size1; k++) {<br\/>result[k] = new Array(size2);<br\/>}<br\/>\/\/ Calling the addMatrices function<br\/>addMatrices(mat1, mat2, result);<br\/>document.write(\"mat1 + mat2 = &lt;br&gt;\")<br\/>\/\/ Printing the sum of the 2 matrices<br\/>for (let i = 0; i &lt; size1; i++) {<br\/>for (let j = 0; j &lt; size2; j++) {<br\/>document.write(result[i][j] + \" \");<br\/>}<br\/>document.write(\"&lt;br&gt;\");<br\/>}<br\/>&lt;\/script&gt;<\/pre>\n<p>Produktion:<\/p>\n<pre>mat1 + mat2 =<br\/>13 15 13<br\/>14 16 2<br\/>12 12 7<\/pre>\n<h2 id=\"rules-for-matrix-subtraction\"><span class=\"ez-toc-section\" id=\"Regler_for_matrissubtraktion\"><\/span>  Regler f\u00f6r matrissubtraktion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>F\u00f6lj dessa regler f\u00f6r att subtrahera tv\u00e5 matriser:<\/p>\n<p>  Tv\u00e5 matriser kan endast subtraheras om de \u00e4r av samma ordning.  Om de tv\u00e5 matriserna \u00e4r av samma ordning, subtrahera de motsvarande elementen i de tv\u00e5 matriserna, dvs subtrahera de element som har samma positioner.  <\/p>\n<figure>\n<\/figure>\n<p>I exempel 1 kan matriserna subtraheras eftersom de har samma ordning.  I exempel 2 kan matriserna inte subtraheras eftersom de inte har samma ordning.<\/p>\n<h2 id=\"c-program-to-subtract-two-matrices\"><span class=\"ez-toc-section\" id=\"C-program_for_att_subtrahera_tva_matriser\"><\/span>  C++-program f\u00f6r att subtrahera tv\u00e5 matriser<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Nedan \u00e4r C++-programmet f\u00f6r att subtrahera tv\u00e5 matriser:<\/p>\n<pre>\/\/ C++ program for subtraction of two matrices<br\/>#include &lt;bits\/stdc++.h&gt;<br\/>using namespace std;<br\/>\/\/ The order of the matrix is 3 x 3<br\/>#define size1 3<br\/>#define size2 3<br\/>\/\/ Function to subtract matrices mat1[][] &amp; mat2[][],<br\/>\/\/ and store the result in matrix result[][]<br\/>void subtractMatrices(int mat1[][size2], int mat2[][size2], int result[][size2])<br\/>{<br\/>for (int i = 0; i &lt; size1; i++)<br\/>{<br\/>for (int j = 0; j &lt; size2; j++)<br\/>{<br\/>result[i][j] = mat1[i][j] - mat2[i][j];<br\/>}<br\/>}<br\/>}<br\/>\/\/ Driver code<br\/>int main()<br\/>{<br\/>\/\/ 1st Matrix<br\/>int mat1[size1][size2] = { {9, 8, 7},<br\/>{6, 8, 0},<br\/>{5, 9, 2} };<br\/>\/\/ 2nd Matrix<br\/>int mat2[size1][size2] = { {4, 7, 6},<br\/>{8, 8, 2},<br\/>{7, 3, 5} };<p>\/\/ Matrix to store the result<br\/>int result[size1][size2];<br\/>\/\/ Calling the subtractMatrices() function<br\/>subtractMatrices(mat1, mat2, result);<br\/>cout &lt;&lt; \"mat1 - mat2 = \" &lt;&lt; endl;<br\/>\/\/ Printing the difference of the 2 matrices (mat1 - mat2)<br\/>for (int i = 0; i &lt; size1; i++)<br\/>{<br\/>for (int j = 0; j &lt; size2; j++)<br\/>{<br\/>cout &lt;&lt; result[i][j] &lt;&lt; \" \";<br\/>}<br\/>cout &lt;&lt; endl;<br\/>}<br\/>return 0;<br\/>}<\/p><\/pre>\n<p>Produktion:<\/p>\n<pre>mat1 - mat2 = <br\/>5 1 1 <br\/>-2 0 -2 <br\/>-2 6 -3<\/pre>\n<h2 id=\"python-program-to-subtract-two-matrices\"><span class=\"ez-toc-section\" id=\"Python-program_for_att_subtrahera_tva_matriser\"><\/span>  Python-program f\u00f6r att subtrahera tv\u00e5 matriser<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Nedan \u00e4r Python-programmet f\u00f6r att subtrahera tv\u00e5 matriser:<\/p>\n<pre># Python program for subtraction of two matrices<br\/># The order of the matrix is 3 x 3<br\/>size1 = 3<br\/>size2 = 3<br\/># Function to subtract matrices mat1[][] &amp; mat2[][],<br\/># and store the result in matrix result[][]<br\/>def subtractMatrices(mat1,mat2,result):<br\/>for i in range(size1):<br\/>for j in range(size2):<br\/>result[i][j] = mat1[i][j] - mat2[i][j]<br\/># driver code<br\/># 1st Matrix<br\/>mat1 = [ [9, 8, 7],<br\/>[6, 8, 0],<br\/>[5, 9, 2] ]<br\/># 2nd Matrix<br\/>mat2 = [ [4, 7, 6],<br\/>[8, 8, 2],<br\/>[7, 3, 5] ]<br\/># Matrix to store the result<br\/>result = mat1[:][:]<br\/># Calling the subtractMatrices function<br\/>subtractMatrices(mat1, mat2, result)<br\/># Printing the difference of the 2 matrices (mat1 - mat2)<br\/>print(\"mat1 - mat2 = \")<br\/>for i in range(size1):<br\/>for j in range(size2):<br\/>print(result[i][j], \" \", end='')<br\/>print()<br\/><\/pre>\n<p>Produktion:<\/p>\n<pre>mat1 - mat2 =<br\/>5 1 1<br\/>-2 0 -2<br\/>-2 6 -3<\/pre>\n<h2 id=\"c-program-to-subtract-two-matrices\"><span class=\"ez-toc-section\" id=\"C_Program_for_att_subtrahera_tva_matriser\"><\/span>  C Program f\u00f6r att subtrahera tv\u00e5 matriser<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Nedan \u00e4r C-programmet f\u00f6r att subtrahera tv\u00e5 matriser:<\/p>\n<pre>\/\/ C program for subtraction of two matrices<br\/>#include &lt;stdio.h&gt;<br\/>\/\/ The order of the matrix is 3 x 3<br\/>#define size1 3<br\/>#define size2 3<br\/>\/\/ Function to subtract matrices mat1[][] &amp; mat2[][],<br\/>\/\/ and store the result in matrix result[][]<br\/>void subtractMatrices(int mat1[][size2], int mat2[][size2], int result[][size2])<br\/>{<br\/>for (int i = 0; i &lt; size1; i++)<br\/>{<br\/>for (int j = 0; j &lt; size2; j++)<br\/>{<br\/>result[i][j] = mat1[i][j] - mat2[i][j];<br\/>}<br\/>}<br\/>}<br\/>\/\/ Driver code<br\/>int main()<br\/>{<br\/>\/\/ 1st Matrix<br\/>int mat1[size1][size2] = { {9, 8, 7},<br\/>{6, 8, 0},<br\/>{5, 9, 2} };<br\/>\/\/ 2nd Matrix<br\/>int mat2[size1][size2] = { {4, 7, 6},<br\/>{8, 8, 2},<br\/>{7, 3, 5} };<p>\/\/ Matrix to store the result<br\/>int result[size1][size2];<br\/>\/\/ Calling the subtractMatrices() function<br\/>subtractMatrices(mat1, mat2, result);<br\/>printf(\"mat1 - mat2 = \u2060n\");<br\/>\/\/ Printing the difference of the 2 matrices (mat1 - mat2)<br\/>for (int i = 0; i &lt; size1; i++)<br\/>{<br\/>for (int j = 0; j &lt; size2; j++)<br\/>{<br\/>printf(\"%d \", result[i][j]);<br\/>}<br\/>printf(\"\u2060n\");<br\/>}<br\/>return 0;<br\/>}<\/p><\/pre>\n<p>Produktion:<\/p>\n<pre>mat1 - mat2 = <br\/>5 1 1 <br\/>-2 0 -2 <br\/>-2 6 -3<\/pre>\n<h2 id=\"javascript-program-to-subtract-two-matrices\"><span class=\"ez-toc-section\" id=\"JavaScript-program_for_att_subtrahera_tva_matriser\"><\/span>  JavaScript-program f\u00f6r att subtrahera tv\u00e5 matriser<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Nedan \u00e4r JavaScript-programmet f\u00f6r att subtrahera tv\u00e5 matriser:<\/p>\n<pre>&lt;script&gt;<br\/>\/\/ JavaScript program for subtraction of two matrices<br\/>\/\/ The order of the matrix is 3 x 3<br\/>let size1 = 3;<br\/>let size2 = 3;<br\/>\/\/ Function to subtract matrices mat1[][] &amp; mat2[][],<br\/>\/\/ and store the result in matrix result[][]<br\/>function subtractMatrices(mat1, mat2, result) {<br\/>for (let i = 0; i &lt; size1; i++) {<br\/>for (let j = 0; j &lt; size2; j++) {<br\/>result[i][j] = mat1[i][j] - mat2[i][j];<br\/>}<br\/>}<br\/>}<br\/>\/\/ Driver code<br\/>\/\/ 1st Matrix<br\/>mat1 = [ [9, 8, 7],<br\/>[6, 8, 0],<br\/>[5, 9, 2] ]<br\/>\/\/ 2nd Matrix<br\/>mat2 = [ [4, 7, 6],<br\/>[8, 8, 2],<br\/>[7, 3, 5]]<br\/>\/\/ Matrix to store the result<br\/>let result = new Array(size1);<br\/>for (let k = 0; k &lt; size1; k++) {<br\/>result[k] = new Array(size2);<br\/>}<br\/>\/\/ Calling the subtractMatrices function<br\/>subtractMatrices(mat1, mat2, result);<br\/>document.write(\"mat1 - mat2 = &lt;br&gt;\")<br\/>\/\/ Printing the difference of the 2 matrices (mat1 - mat2)<br\/>for (let i = 0; i &lt; size1; i++) {<br\/>for (let j = 0; j &lt; size2; j++) {<br\/>document.write(result[i][j] + \" \");<br\/>}<br\/>document.write(\"&lt;br&gt;\");<br\/>}<br\/>&lt;\/script&gt;<\/pre>\n<p>Produktion:<\/p>\n<pre>mat1 - mat2 =<br\/>5 1 1<br\/>-2 0 -2<br\/>-2 6 -3<\/pre>\n<p>Om du vill ta en titt p\u00e5 den fullst\u00e4ndiga k\u00e4llkoden som anv\u00e4nds i den h\u00e4r artikeln, h\u00e4r \u00e4r GitHub-f\u00f6rvaret.<\/p>\n<h2 id=\"increase-your-programming-capability\"><span class=\"ez-toc-section\" id=\"Oka_din_programmeringsformaga\"><\/span>  \u00d6ka din programmeringsf\u00f6rm\u00e5ga<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Du kan \u00f6ka din programmeringsf\u00f6rm\u00e5ga genom att \u00f6va p\u00e5 en m\u00e4ngd olika programmeringsproblem.  Att l\u00f6sa dessa programmeringsproblem hj\u00e4lper dig att utveckla grundl\u00e4ggande programmeringsprinciper.  Dessa \u00e4r ett m\u00e5ste att veta om du ska bli en effektiv programmerare.<\/p>\n<p>    <strong class=\"section-sub-title\">Om f\u00f6rfattaren<\/strong><\/p>\n<p>            <strong class=\"bio-title\">Yuvraj Chandra (80 artiklar publicerade)<br \/><\/strong><\/p>\n<p>Yuvraj \u00e4r en datavetenskapsstudent vid University of Delhi, Indien.  Han brinner f\u00f6r Full Stack Web Development.  N\u00e4r han inte skriver unders\u00f6ker han djupet i olika teknologier.<\/p>\n<p>                            Mer fr\u00e5n Yuvraj Chandra<\/p>\n<h4><span class=\"ez-toc-section\" id=\"Prenumerera_pa_vart_nyhetsbrev\"><\/span>Prenumerera p\u00e5 v\u00e5rt nyhetsbrev<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>G\u00e5 med i v\u00e5rt nyhetsbrev f\u00f6r tekniska tips, recensioner, free e-b\u00f6cker och exklusiva erbjudanden!<\/p>\n<p>Klicka h\u00e4r f\u00f6r att prenumerera<\/p>\n<\/p><\/div>\n  <div id=\"ez-toc-container\" class=\"ez-toc-v2_0_88 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/blogging-techies.com\/sw\/hur-man-lagger-till-och-subtraherar-tva-matriser-i-c-python-och-javascript\/#Regler_for_Matrix_Addition\" >Regler f\u00f6r Matrix Addition<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/blogging-techies.com\/sw\/hur-man-lagger-till-och-subtraherar-tva-matriser-i-c-python-och-javascript\/#C-program_for_att_lagga_till_tva_matriser\" >C++-program f\u00f6r att l\u00e4gga till tv\u00e5 matriser<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/blogging-techies.com\/sw\/hur-man-lagger-till-och-subtraherar-tva-matriser-i-c-python-och-javascript\/#Python-program_for_att_lagga_till_tva_matriser\" >Python-program f\u00f6r att l\u00e4gga till tv\u00e5 matriser<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/blogging-techies.com\/sw\/hur-man-lagger-till-och-subtraherar-tva-matriser-i-c-python-och-javascript\/#C_Program_for_att_lagga_till_tva_matriser\" >C Program f\u00f6r att l\u00e4gga till tv\u00e5 matriser<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/blogging-techies.com\/sw\/hur-man-lagger-till-och-subtraherar-tva-matriser-i-c-python-och-javascript\/#JavaScript-program_for_att_lagga_till_tva_matriser\" >JavaScript-program f\u00f6r att l\u00e4gga till tv\u00e5 matriser<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/blogging-techies.com\/sw\/hur-man-lagger-till-och-subtraherar-tva-matriser-i-c-python-och-javascript\/#Regler_for_matrissubtraktion\" >Regler f\u00f6r matrissubtraktion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/blogging-techies.com\/sw\/hur-man-lagger-till-och-subtraherar-tva-matriser-i-c-python-och-javascript\/#C-program_for_att_subtrahera_tva_matriser\" >C++-program f\u00f6r att subtrahera tv\u00e5 matriser<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/blogging-techies.com\/sw\/hur-man-lagger-till-och-subtraherar-tva-matriser-i-c-python-och-javascript\/#Python-program_for_att_subtrahera_tva_matriser\" >Python-program f\u00f6r att subtrahera tv\u00e5 matriser<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/blogging-techies.com\/sw\/hur-man-lagger-till-och-subtraherar-tva-matriser-i-c-python-och-javascript\/#C_Program_for_att_subtrahera_tva_matriser\" >C Program f\u00f6r att subtrahera tv\u00e5 matriser<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/blogging-techies.com\/sw\/hur-man-lagger-till-och-subtraherar-tva-matriser-i-c-python-och-javascript\/#JavaScript-program_for_att_subtrahera_tva_matriser\" >JavaScript-program f\u00f6r att subtrahera tv\u00e5 matriser<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/blogging-techies.com\/sw\/hur-man-lagger-till-och-subtraherar-tva-matriser-i-c-python-och-javascript\/#Oka_din_programmeringsformaga\" >\u00d6ka din programmeringsf\u00f6rm\u00e5ga<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/blogging-techies.com\/sw\/hur-man-lagger-till-och-subtraherar-tva-matriser-i-c-python-och-javascript\/#Prenumerera_pa_vart_nyhetsbrev\" >Prenumerera p\u00e5 v\u00e5rt nyhetsbrev<\/a><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n ","protected":false},"excerpt":{"rendered":"<p>En matris \u00e4r en rektangul\u00e4r matris av tal, symboler eller uttryck ordnade i rader och kolumner. Detta rektangul\u00e4ra rutn\u00e4t av siffror anv\u00e4nds ofta inom matematik, elektroteknik och datavetenskap. Matriser skapades ursprungligen f\u00f6r att beskriva systemet med linj\u00e4ra ekvationer. Nu anv\u00e4nds matriser i stor utstr\u00e4ckning inom bildbehandling, genetisk analys, big data och programmering. Addering och subtraktion [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":91480,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","footnotes":""},"categories":[5],"tags":[27,27490,182,163,30990,26,36048,39441,1007],"class_list":["post-91479","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bloggar","tag-hur","tag-javascript","tag-lagger","tag-man","tag-matriser","tag-och","tag-python","tag-subtraherar","tag-tva"],"_links":{"self":[{"href":"https:\/\/blogging-techies.com\/sw\/wp-json\/wp\/v2\/posts\/91479","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogging-techies.com\/sw\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogging-techies.com\/sw\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogging-techies.com\/sw\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogging-techies.com\/sw\/wp-json\/wp\/v2\/comments?post=91479"}],"version-history":[{"count":0,"href":"https:\/\/blogging-techies.com\/sw\/wp-json\/wp\/v2\/posts\/91479\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogging-techies.com\/sw\/wp-json\/wp\/v2\/media\/91480"}],"wp:attachment":[{"href":"https:\/\/blogging-techies.com\/sw\/wp-json\/wp\/v2\/media?parent=91479"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogging-techies.com\/sw\/wp-json\/wp\/v2\/categories?post=91479"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogging-techies.com\/sw\/wp-json\/wp\/v2\/tags?post=91479"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}