Uzupełnienie materiałów do lab. 1

This commit is contained in:
Paweł Skórzewski 2021-03-19 19:33:27 +01:00
parent a9ee16e88b
commit 663c79ba3c
2 changed files with 1686 additions and 1634 deletions

View File

@ -728,7 +728,9 @@
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
@ -1556,48 +1558,111 @@
},
{
"cell_type": "code",
"execution_count": 57,
"execution_count": 158,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[1, 2, 3],\n",
" [4, 5, 6],\n",
" [7, 8, 9]])"
]
},
"execution_count": 57,
"metadata": {},
"output_type": "execute_result"
"name": "stdout",
"output_type": "stream",
"text": [
"[[1 2 3]\n",
" [4 5 6]\n",
" [7 8 9]]\n"
]
}
],
"source": [
"x = np.array([1,2,3,4,5,6,7,8,9]).reshape(3,3)\n",
"x"
"print(x)"
]
},
{
"cell_type": "code",
"execution_count": 58,
"execution_count": 159,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"matrix([[1, 2, 3],\n",
" [4, 5, 6],\n",
" [7, 8, 9]])"
]
},
"execution_count": 58,
"metadata": {},
"output_type": "execute_result"
"name": "stdout",
"output_type": "stream",
"text": [
"[[4 6 3]\n",
" [8 7 1]\n",
" [3 0 3]]\n"
]
}
],
"source": [
"y = np.array([4,6,3,8,7,1,3,0,3]).reshape(3,3)\n",
"print(y)"
]
},
{
"cell_type": "code",
"execution_count": 160,
"metadata": {},
"outputs": [],
"source": [
"X = np.matrix(x)\n",
"X"
"Y = np.matrix(y)"
]
},
{
"cell_type": "code",
"execution_count": 161,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[ 4 12 9]\n",
" [32 35 6]\n",
" [21 0 27]]\n"
]
}
],
"source": [
"print(x * y) # Tablice np.array mnożone są element po elemencie"
]
},
{
"cell_type": "code",
"execution_count": 162,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[ 29 20 14]\n",
" [ 74 59 35]\n",
" [119 98 56]]\n"
]
}
],
"source": [
"print(X * Y) # Macierze np.matrix mnożone są macierzowo"
]
},
{
"cell_type": "code",
"execution_count": 164,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[ 29 20 14]\n",
" [ 74 59 35]\n",
" [119 98 56]]\n"
]
}
],
"source": [
"print(np.matmul(x, y))"
]
},
{

File diff suppressed because it is too large Load Diff