From 24ecfd8204fa9f4214e37184c6f4b0efdddcbd3c Mon Sep 17 00:00:00 2001
From: Cookedbrick <75474393+Cookedbrick@users.noreply.github.com>
Date: Thu, 2 Feb 2023 19:41:37 +0300
Subject: [PATCH] Add files via upload
---
mpl.ipynb | 6079 ++++++++++++++++++++++++++++++++++++++++++++++++++
povtor.ipynb | 775 +++++++
2 files changed, 6854 insertions(+)
create mode 100644 mpl.ipynb
create mode 100644 povtor.ipynb
diff --git a/mpl.ipynb b/mpl.ipynb
new file mode 100644
index 0000000..e24c15d
--- /dev/null
+++ b/mpl.ipynb
@@ -0,0 +1,6079 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 39,
+ "id": "c558aa62",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import numpy as np\n",
+ "import pandas as pd\n",
+ "import matplotlib.pyplot as plt\n",
+ "from itertools import chain"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "id": "39b9a0fc",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "%matplotlib inline\n",
+ "%config InlineBackend.figure_format = 'svg'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "79572e97",
+ "metadata": {},
+ "source": [
+ "# Задание №1"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "id": "73309424",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "x = [1, 2, 3, 4, 5, 6, 7]\n",
+ "y = [3.5, 3.8, 4.2, 4.5, 5, 5.5, 7]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "id": "2004df88",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "image/svg+xml": [
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "plt.plot(x,y)\n",
+ "plt.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "id": "aacbdc42",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "image/svg+xml": [
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "plt.scatter(x,y)\n",
+ "plt.show()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "cc834501",
+ "metadata": {},
+ "source": [
+ "# Задание №2"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "id": "03bddf80",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "t = np.linspace(start = 0,stop = 10, num = 51)\n",
+ "f = np.sin(t)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 22,
+ "id": "46e6743b",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "image/svg+xml": [
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "plt.plot(t,f)\n",
+ "plt.xlabel('Значения t')\n",
+ "plt.ylabel('Значения f')\n",
+ "plt.title('График f(t)')\n",
+ "plt.axis([0.5, 9.5,-2.5, 2.5])\n",
+ "#plt.xlim(0.5, 9.5)\n",
+ "#plt.ylim(-2.5, 2.5)\n",
+ "plt.show()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "38cdd0c3",
+ "metadata": {},
+ "source": [
+ "# Задание №3"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 31,
+ "id": "14c61b9c",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "x = np.linspace(start = -3,stop = 3, num = 51)\n",
+ "y1 = x**2\n",
+ "y2 = 2 * x + 0.5\n",
+ "y3 = -3 * x - 1.5\n",
+ "y4 = np.sin(x)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 68,
+ "id": "2d29e4ae",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "image/svg+xml": [
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "fig, ax = plt.subplots(2, 2)\n",
+ "#ax1, ax2, ax3, ax4 = list(chain.from_iterable(ax))\n",
+ "ax1, ax2, ax3, ax4 = ax.flatten()\n",
+ "ax1.plot(x,y1)\n",
+ "ax1.set_title('График y1')\n",
+ "ax1.set_xlim(-5, 5)\n",
+ "\n",
+ "ax2.plot(x,y2)\n",
+ "ax2.set_title('График y2')\n",
+ "\n",
+ "ax3.plot(x,y3)\n",
+ "ax3.set_title('График y3')\n",
+ "\n",
+ "ax4.plot(x,y4)\n",
+ "ax4.set_title('График y4')\n",
+ "\n",
+ "fig.set_size_inches(8, 6)\n",
+ "plt.subplots_adjust(wspace = 0.3, hspace = 0.3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "bfd67ab2",
+ "metadata": {},
+ "source": [
+ "# Задание №4"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 72,
+ "id": "ebf666f0",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "cc = pd.read_csv('creditcard.csv')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 73,
+ "id": "84739970",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "plt.style.use('fivethirtyeight')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 104,
+ "id": "80a4af19",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "vc = cc['Class'].value_counts()\n",
+ "vc.rename({0:'Транзакций',1: 'Мошеничеств'}, inplace=True)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 110,
+ "id": "2528f5b8",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ ""
+ ]
+ },
+ "execution_count": 110,
+ "metadata": {},
+ "output_type": "execute_result"
+ },
+ {
+ "data": {
+ "image/svg+xml": [
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "vc.plot(kind = 'barh')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 109,
+ "id": "4f7fa708",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ ""
+ ]
+ },
+ "execution_count": 109,
+ "metadata": {},
+ "output_type": "execute_result"
+ },
+ {
+ "data": {
+ "image/svg+xml": [
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "vc.plot(kind = 'barh', logx = True)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 157,
+ "id": "ed8dddc8",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "#вариант №1\n",
+ "cc0 = cc.loc[cc['Class'] == 0, ['V1']]\n",
+ "cc1 = cc.loc[cc['Class'] == 1, ['V1']]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 167,
+ "id": "1742c074",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "#вариант №2\n",
+ "cc_class = cc.set_index('V1')['Class']\n",
+ "cc0 = cc_class[cc_class == 0].index\n",
+ "cc1 = cc_class[cc_class == 1].index"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 170,
+ "id": "e2a32675",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ ""
+ ]
+ },
+ "execution_count": 170,
+ "metadata": {},
+ "output_type": "execute_result"
+ },
+ {
+ "data": {
+ "image/svg+xml": [
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "plt.hist(cc0, bins=20, density=True, ec = 'black', alpha=0.5, label='Class 0', color='grey')\n",
+ "plt.hist(cc1, bins=20, density=True, ec = 'black', alpha=0.5, label='Class 1', color='red')\n",
+ "plt.legend()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "ec42963b",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.10.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
diff --git a/povtor.ipynb b/povtor.ipynb
new file mode 100644
index 0000000..57091c2
--- /dev/null
+++ b/povtor.ipynb
@@ -0,0 +1,775 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "id": "9ef957e5",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "68d1eceb",
+ "metadata": {},
+ "source": [
+ "# #1"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "id": "40543041",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "a = np.arange(12, 24)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "b726f249",
+ "metadata": {},
+ "source": [
+ "# #2"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "id": "1ba1ef15",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([[12, 13, 14, 15, 16, 17],\n",
+ " [18, 19, 20, 21, 22, 23]])"
+ ]
+ },
+ "execution_count": 16,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "a.reshape(2, 6)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "id": "d32fe6e4",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([[12, 13, 14, 15],\n",
+ " [16, 17, 18, 19],\n",
+ " [20, 21, 22, 23]])"
+ ]
+ },
+ "execution_count": 5,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "a.reshape(3, 4)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "id": "6ee2f752",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([[12, 13],\n",
+ " [14, 15],\n",
+ " [16, 17],\n",
+ " [18, 19],\n",
+ " [20, 21],\n",
+ " [22, 23]])"
+ ]
+ },
+ "execution_count": 6,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "a.reshape(6, 2)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "id": "da9f9555",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([[12, 13, 14],\n",
+ " [15, 16, 17],\n",
+ " [18, 19, 20],\n",
+ " [21, 22, 23]])"
+ ]
+ },
+ "execution_count": 8,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "a.reshape(4, 3)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "id": "96c94f76",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([[12],\n",
+ " [13],\n",
+ " [14],\n",
+ " [15],\n",
+ " [16],\n",
+ " [17],\n",
+ " [18],\n",
+ " [19],\n",
+ " [20],\n",
+ " [21],\n",
+ " [22],\n",
+ " [23]])"
+ ]
+ },
+ "execution_count": 10,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "a.reshape(12, 1)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "92b31b75",
+ "metadata": {},
+ "source": [
+ "# #3"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "id": "da6b04f6",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([[12, 13],\n",
+ " [14, 15],\n",
+ " [16, 17],\n",
+ " [18, 19],\n",
+ " [20, 21],\n",
+ " [22, 23]])"
+ ]
+ },
+ "execution_count": 11,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "a.reshape(-1, 2)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "id": "29edc930",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([[12, 13, 14],\n",
+ " [15, 16, 17],\n",
+ " [18, 19, 20],\n",
+ " [21, 22, 23]])"
+ ]
+ },
+ "execution_count": 12,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "a.reshape(-1, 3)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "id": "c33750be",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([[12, 13, 14, 15],\n",
+ " [16, 17, 18, 19],\n",
+ " [20, 21, 22, 23]])"
+ ]
+ },
+ "execution_count": 13,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "a.reshape(-1, 4)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "id": "f9673a6f",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([[12, 13, 14, 15],\n",
+ " [16, 17, 18, 19],\n",
+ " [20, 21, 22, 23]])"
+ ]
+ },
+ "execution_count": 15,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "a.reshape(3, -1)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "f656e30c",
+ "metadata": {},
+ "source": [
+ "# #4"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "4003afc1",
+ "metadata": {},
+ "source": [
+ "Можно ли массив Numpy, состоящий из одного столбца и 12 строк, назвать одномерным?\n",
+ "\n",
+ "Нет"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "53120e53",
+ "metadata": {},
+ "source": [
+ "# #5"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 26,
+ "id": "ff99495b",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([[ 0.5804361 , 0.74110053, 0.43027102, 1.06437406],\n",
+ " [-0.29485388, 0.85863536, 0.04019047, 0.28289197],\n",
+ " [-0.55183697, -2.36092725, -0.24548491, 1.16633344]])"
+ ]
+ },
+ "execution_count": 26,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "r = np.random.randn(3, 4)\n",
+ "r"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 28,
+ "id": "3253af98",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([ 0.5804361 , 0.74110053, 0.43027102, 1.06437406, -0.29485388,\n",
+ " 0.85863536, 0.04019047, 0.28289197, -0.55183697, -2.36092725,\n",
+ " -0.24548491, 1.16633344])"
+ ]
+ },
+ "execution_count": 28,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "rf = r.flatten()\n",
+ "rf"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "6a68158c",
+ "metadata": {},
+ "source": [
+ "# #6"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 29,
+ "id": "befbd705",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([20, 18, 16, 14, 12, 10, 8, 6, 4, 2])"
+ ]
+ },
+ "execution_count": 29,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "a = np.arange(20, 0, -2)\n",
+ "a"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "f942a96d",
+ "metadata": {},
+ "source": [
+ "# #7"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 34,
+ "id": "fd1deb71",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([20, 18, 16, 14, 12, 10, 8, 6, 4, 2])"
+ ]
+ },
+ "execution_count": 34,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "b = np.linspace(20, 1, 10, endpoint = False, dtype = int)\n",
+ "b"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "03012fc3",
+ "metadata": {},
+ "source": [
+ "Масивы а и b ничем не отличаются"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "5c1191c6",
+ "metadata": {},
+ "source": [
+ "# #8"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 44,
+ "id": "04fe8273",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([[0., 0.],\n",
+ " [0., 0.],\n",
+ " [0., 0.],\n",
+ " [1., 1.],\n",
+ " [1., 1.]])"
+ ]
+ },
+ "execution_count": 44,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "a = np.zeros((3, 2))\n",
+ "b = np.ones((2, 2))\n",
+ "v = np.vstack([a, b])\n",
+ "v"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 45,
+ "id": "f6af5ccd",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "10"
+ ]
+ },
+ "execution_count": 45,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "v.size"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "38d765ba",
+ "metadata": {},
+ "source": [
+ "# #9"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 46,
+ "id": "4723c74e",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([[ 0, 1, 2],\n",
+ " [ 3, 4, 5],\n",
+ " [ 6, 7, 8],\n",
+ " [ 9, 10, 11]])"
+ ]
+ },
+ "execution_count": 46,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "a = np.arange(0, 12)\n",
+ "A = a.reshape(4, 3)\n",
+ "A"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 48,
+ "id": "effeae86",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([[ 0, 3, 6, 9],\n",
+ " [ 1, 4, 7, 10],\n",
+ " [ 2, 5, 8, 11]])"
+ ]
+ },
+ "execution_count": 48,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "At = A.T\n",
+ "At"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 50,
+ "id": "2a7afb5c",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([[ 5, 14, 23, 32],\n",
+ " [ 14, 50, 86, 122],\n",
+ " [ 23, 86, 149, 212],\n",
+ " [ 32, 122, 212, 302]])"
+ ]
+ },
+ "execution_count": 50,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "B = np.dot(A,At)\n",
+ "B"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "17e8c729",
+ "metadata": {},
+ "source": [
+ "Число строк матрици, являющейся результатом умножений двух матриц, равно числу сток первой матрци, а число столбцов равно числу столбцов второй матрици."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 52,
+ "id": "54874361",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "0.0"
+ ]
+ },
+ "execution_count": 52,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "np.linalg.det(B)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "e59e5db1",
+ "metadata": {},
+ "source": [
+ "Определитель равен 0, значит найти обратную матрицу невозможно"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "b20370df",
+ "metadata": {},
+ "source": [
+ "# #10"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 56,
+ "id": "c05f2ea1",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "np.random.seed(42)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "d48a1f50",
+ "metadata": {},
+ "source": [
+ "# #11"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "507b0edd",
+ "metadata": {},
+ "source": [
+ "Я не понял как создать массив \"с\" с заданными условиями, по этому просто создам массив от 0 до 16 для дальнейших заданий"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 78,
+ "id": "dab908f8",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])"
+ ]
+ },
+ "execution_count": 78,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "c = np.linspace(0, 16, 16, endpoint = False, dtype = int)\n",
+ "c"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "8f3810f4",
+ "metadata": {},
+ "source": [
+ "# #12"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 79,
+ "id": "93303b73",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([[ 0, 1, 2, 3],\n",
+ " [ 4, 5, 6, 7],\n",
+ " [ 8, 9, 10, 11],\n",
+ " [12, 13, 14, 15]])"
+ ]
+ },
+ "execution_count": 79,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "C = c.reshape((4, 4))\n",
+ "C"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 88,
+ "id": "6ae5c668",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([[ 5, 24, 43, 62],\n",
+ " [ 54, 100, 146, 192],\n",
+ " [103, 176, 249, 322],\n",
+ " [152, 252, 352, 452]])"
+ ]
+ },
+ "execution_count": 88,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "D = 10 * C + B\n",
+ "D"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 90,
+ "id": "1dfa49e6",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "2"
+ ]
+ },
+ "execution_count": 90,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "np.linalg.matrix_rank(D)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 91,
+ "id": "72bd64d8",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "0.0"
+ ]
+ },
+ "execution_count": 91,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "np.linalg.det(D)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "8e9b265e",
+ "metadata": {},
+ "source": [
+ "Определитель 0, найти обратную матрицу невозможно"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.10.7"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}