Skip to content

Commit 9b6b025

Browse files
author
Amogh Singhal
authored
Add files via upload
1 parent 618910b commit 9b6b025

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed

bits_wilp/Ex2_Numpy_Q6.ipynb

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"id": "6fbe566f",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"import numpy as np\n",
11+
"import pandas as pd"
12+
]
13+
},
14+
{
15+
"cell_type": "markdown",
16+
"id": "a0d6b1f1",
17+
"metadata": {},
18+
"source": [
19+
"### Matrix Multiplication"
20+
]
21+
},
22+
{
23+
"cell_type": "code",
24+
"execution_count": 14,
25+
"id": "77a499e1",
26+
"metadata": {},
27+
"outputs": [
28+
{
29+
"name": "stdout",
30+
"output_type": "stream",
31+
"text": [
32+
"First matrix:\n",
33+
" [[4 3 3]\n",
34+
" [2 4 2]\n",
35+
" [0 1 4]]\n",
36+
"\n",
37+
"Second matrix:\n",
38+
" [[4 8 1]\n",
39+
" [0 2 3]\n",
40+
" [6 6 2]]\n",
41+
"\n",
42+
"Product of the two matrix\n",
43+
"[[34 56 19]\n",
44+
" [20 36 18]\n",
45+
" [24 26 11]]\n"
46+
]
47+
}
48+
],
49+
"source": [
50+
"def matgen3d():\n",
51+
" \"\"\"\n",
52+
" Function to generate a random integer 3x3 matrix\n",
53+
" Min value: 1, Max value: 9\n",
54+
" \"\"\"\n",
55+
" return np.random.randint(low=0, high=10, size=(3,3))\n",
56+
"\n",
57+
"mat1 = matgen3d()\n",
58+
"mat2 = matgen3d()\n",
59+
"\n",
60+
"print(\"First matrix:\\n\", mat1)\n",
61+
"print()\n",
62+
"print(\"Second matrix:\\n\", mat2)\n",
63+
"print()\n",
64+
"print(\"Product of the two matrix\")\n",
65+
"print(np.matmul(mat1, mat2))"
66+
]
67+
},
68+
{
69+
"cell_type": "code",
70+
"execution_count": null,
71+
"id": "2b277c10",
72+
"metadata": {},
73+
"outputs": [],
74+
"source": []
75+
}
76+
],
77+
"metadata": {
78+
"kernelspec": {
79+
"display_name": "Python 3",
80+
"language": "python",
81+
"name": "python3"
82+
},
83+
"language_info": {
84+
"codemirror_mode": {
85+
"name": "ipython",
86+
"version": 3
87+
},
88+
"file_extension": ".py",
89+
"mimetype": "text/x-python",
90+
"name": "python",
91+
"nbconvert_exporter": "python",
92+
"pygments_lexer": "ipython3",
93+
"version": "3.8.5"
94+
}
95+
},
96+
"nbformat": 4,
97+
"nbformat_minor": 5
98+
}

0 commit comments

Comments
 (0)