small heading changes

This commit is contained in:
lda committed 2025-02-01 00:27:46 +07:00
1 parent cb493759a0
commit c5bc4a5754
2 files changed
+229 -17

No files matched your search

+11
View File
@@ -11,3 +11,14 @@ it is an approximation method for some of the harder problems that would be hard
it gets the job done for some people
doesnt for others
it idk
## this document
working with all the modules
also this document might not work as is, because i am working with vscode: it is handling a lot and it gives me a lot more flexibility on what language the code can be
HUGE! its called Kernels. jupyter notebook is incredibly versatile, as you can install kernels from whatever language you care, from [here](https://github.com/jupyter/jupyter/wiki/Jupyter-kernels)
> [!NOTE]
> writing rust
+218 -17
View File
@@ -18,7 +18,7 @@
"\n",
"## import steps. use for import\n",
"\n",
"you may need to:"
"you may need to:\n"
]
},
{
@@ -36,13 +36,11 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"%matplotlib inline"
"import numpy as np"
]
},
{
@@ -58,14 +56,27 @@
"1. with same size: `all(len(i) == len(j) for i in pyarray for j in pyarray) == True`\n",
"2. all elements have same type `all(type(i) == type(r[0]) for i in r for r in pyarray) == True`\n",
"\n",
"then you will be able to harness the peak of numpy. Or else goodbye"
"then you will be able to harness the peak of numpy. Or else goodbye\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"([[1, 2, 3], [4, 5, 6]],\n",
" array([[1, 2, 3],\n",
" [4, 5, 6]]))"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pyarray = [\n",
" [1, 2, 3],\n",
@@ -84,16 +95,28 @@
"source": [
"the 3:11:2 notation in python is called a slice object. numpy (probably) modified its `array.__index__` to yk accommodate to dimensions\n",
"\n",
"so normally you wouldnt fit more than one thing in that bracket: now you can! pretty great"
"so normally you wouldnt fit more than one thing in that bracket: now you can! pretty great\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"array([[2, 3],\n",
" [5, 6]])"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"newarr = numpy_array[:,1:3]\n",
"newarr = numpy_array[:, 1:3]\n",
"newarr"
]
},
@@ -101,16 +124,27 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"kinda cool. normally it would be:"
"kinda cool. normally it would be:\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"[[2, 3], [5, 6]]"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"[i[1:3] for i in pyarray[:]] #uh why so complicated"
"[i[1:3] for i in pyarray[:]] # uh why so complicated"
]
},
{
@@ -120,7 +154,7 @@
"remember this: Python lists count from zero. Everything related to computer memory counts from 0. only Maniacs count from 1.\n",
"\n",
"also a tip for me actually, for i struggle with matrix rows and columns: `m2d[0,:]` is first Row. `m2d[:, 0]` is first Column. \n",
"row goes across. row number x is counted top down. Column goes top down. column number x is counted left to right "
"row goes across. row number x is counted top down. Column goes top down. column number x is counted left to right\n"
]
},
{
@@ -141,10 +175,177 @@
"def function(x):\n",
" return 3*x + 2\n",
"```\n",
"\n",
"this WILL work with ndarrays as they do have `__mul__` `__rmul__` and `__add__`\n",
"\n",
"as opposed to matlab with its cumbersome ahh syms\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# ahh\n",
"\n",
"## ones a 3\\*3\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[1., 1., 1.],\n",
" [1., 1., 1.],\n",
" [1., 1., 1.]])"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ones3x3 = np.ones((3, 3))\n",
"ex6_A = ones3x3\n",
"ex6_A"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## transpose can be accessible by default with .T, but i use transpose for a new one.\n",
"\n",
"why does this exist. transpose of ones is a ones. why do you do this.\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[1., 1., 1.],\n",
" [1., 1., 1.],\n",
" [1., 1., 1.]])"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ex6_B = np.transpose(ex6_A)\n",
"ex6_B"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## sum is just + lmao\n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[2., 2., 2.],\n",
" [2., 2., 2.],\n",
" [2., 2., 2.]])"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ex6_sum = ex6_A + ex6_B\n",
"ex6_sum"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## mat mul\n"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(array([[3., 3., 3.],\n",
" [3., 3., 3.],\n",
" [3., 3., 3.]]),\n",
" array([[3., 3., 3.],\n",
" [3., 3., 3.],\n",
" [3., 3., 3.]]))"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ex6_AxB = ex6_A @ ex6_B\n",
"ex6_BxA = ex6_B @ ex6_A\n",
"ex6_AxB, ex6_BxA"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## A += 2\n"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[3., 3., 3.],\n",
" [3., 3., 3.],\n",
" [3., 3., 3.]])"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ex6_Aplus = ex6_A + 2\n",
"ex6_Aplus"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"shit example be fr\n"
]
}
],
"metadata": {