diff --git a/1_Array_creation_routines.ipynb b/1_Array_creation_routines.ipynb index 71790b6..d631bf7 100644 --- a/1_Array_creation_routines.ipynb +++ b/1_Array_creation_routines.ipynb @@ -16,7 +16,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "metadata": { "collapsed": true }, @@ -34,7 +34,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 3, "metadata": { "collapsed": false }, @@ -43,15 +43,17 @@ "data": { "text/plain": [ "array([[0, 0],\n", - " [0, 0]])" + " [0, 0]], dtype=int32)" ] }, - "execution_count": 27, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], - "source": [] + "source": [ + "np.zeros((2,2), np.int32)" + ] }, { "cell_type": "markdown", @@ -63,7 +65,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 4, "metadata": { "collapsed": false }, @@ -72,16 +74,18 @@ "data": { "text/plain": [ "array([[1, 2, 3],\n", - " [4, 5, 6]])" + " [4, 5, 6]], dtype=int32)" ] }, - "execution_count": 32, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "X = np.array([[1,2,3], [4,5,6]], np.int32)\n" + "X = np.array([[1,2,3], [4,5,6]], np.int32)\n", + "\n", + "np.array(X)" ] }, { @@ -93,7 +97,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 5, "metadata": { "collapsed": false }, @@ -101,38 +105,27 @@ { "data": { "text/plain": [ - "array([[ 1., 0., 0.],\n", - " [ 0., 1., 0.],\n", - " [ 0., 0., 1.]])" + "array([[1., 0., 0.],\n", + " [0., 1., 0.],\n", + " [0., 0., 1.]])" ] }, - "execution_count": 33, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], - "source": [] + "source": [ + "np.eye(3)" + ] }, { "cell_type": "code", - "execution_count": 35, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "text/plain": [ - "array([[ 1., 0., 0.],\n", - " [ 0., 1., 0.],\n", - " [ 0., 0., 1.]])" - ] - }, - "execution_count": 35, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [] }, { @@ -144,7 +137,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 16, "metadata": { "collapsed": false }, @@ -152,17 +145,19 @@ { "data": { "text/plain": [ - "array([[ 1., 1.],\n", - " [ 1., 1.],\n", - " [ 1., 1.]])" + "array([[1., 1.],\n", + " [1., 1.],\n", + " [1., 1.]])" ] }, - "execution_count": 36, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], - "source": [] + "source": [ + "np.ones((3,2), dtype=float)" + ] }, { "cell_type": "markdown", @@ -173,7 +168,7 @@ }, { "cell_type": "code", - "execution_count": 59, + "execution_count": null, "metadata": { "collapsed": false }, @@ -181,16 +176,17 @@ { "data": { "text/plain": [ - "array([1, 1, 1, 1], dtype=int64)" + "array([[1, 1, 1, 1]])" ] }, - "execution_count": 59, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "x = np.arange(4, dtype=np.int64)\n" + "x = np.arange(4, dtype=np.int64)\n", + "np.ones_like(x)" ] }, { @@ -202,7 +198,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 20, "metadata": { "collapsed": false }, @@ -210,17 +206,19 @@ { "data": { "text/plain": [ - "array([[ 0., 0.],\n", - " [ 0., 0.],\n", - " [ 0., 0.]])" + "array([[0., 0.],\n", + " [0., 0.],\n", + " [0., 0.]])" ] }, - "execution_count": 45, + "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], - "source": [] + "source": [ + "np.zeros((3,2), dtype=float)" + ] }, { "cell_type": "markdown", @@ -231,7 +229,7 @@ }, { "cell_type": "code", - "execution_count": 58, + "execution_count": 21, "metadata": { "collapsed": false }, @@ -239,16 +237,17 @@ { "data": { "text/plain": [ - "array([0, 0, 0, 0], dtype=int64)" + "array([0, 0, 0, 0])" ] }, - "execution_count": 58, + "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "x = np.arange(4, dtype=np.int64)\n" + "x = np.arange(4, dtype=np.int64)\n", + "np.zeros_like(x)" ] }, { @@ -260,7 +259,7 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 23, "metadata": { "collapsed": false }, @@ -269,15 +268,17 @@ "data": { "text/plain": [ "array([[6, 6, 6, 6, 6],\n", - " [6, 6, 6, 6, 6]], dtype=uint32)" + " [6, 6, 6, 6, 6]], dtype=uint64)" ] }, - "execution_count": 49, + "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], - "source": [] + "source": [ + "np.full((2,5), 6, dtype= np.uint)" + ] }, { "cell_type": "markdown", @@ -288,7 +289,7 @@ }, { "cell_type": "code", - "execution_count": 79, + "execution_count": 25, "metadata": { "collapsed": false }, @@ -296,16 +297,17 @@ { "data": { "text/plain": [ - "array([6, 6, 6, 6], dtype=int64)" + "array([6, 6, 6, 6])" ] }, - "execution_count": 79, + "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "x = np.arange(4, dtype=np.int64)\n" + "x = np.arange(4, dtype=np.int64)\n", + "np.full_like(x,6)" ] }, { @@ -324,7 +326,7 @@ }, { "cell_type": "code", - "execution_count": 53, + "execution_count": 27, "metadata": { "collapsed": false }, @@ -335,12 +337,14 @@ "array([1, 2, 3])" ] }, - "execution_count": 53, + "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], - "source": [] + "source": [ + "np.array([1,2,3])" + ] }, { "cell_type": "markdown", @@ -351,7 +355,7 @@ }, { "cell_type": "code", - "execution_count": 60, + "execution_count": 28, "metadata": { "collapsed": false }, @@ -362,13 +366,14 @@ "array([1, 2])" ] }, - "execution_count": 60, + "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "x = [1,2]\n" + "x = [1,2]\n", + "np.asarray(x)" ] }, { @@ -380,7 +385,7 @@ }, { "cell_type": "code", - "execution_count": 62, + "execution_count": 30, "metadata": { "collapsed": false }, @@ -392,13 +397,14 @@ " [3, 4]])" ] }, - "execution_count": 62, + "execution_count": 30, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "X = np.array([[1, 2], [3, 4]])\n" + "X = np.array([[1, 2], [3, 4]])\n", + "np.asmatrix(X)" ] }, { @@ -410,24 +416,27 @@ }, { "cell_type": "code", - "execution_count": 63, + "execution_count": null, "metadata": { "collapsed": false }, "outputs": [ { - "data": { - "text/plain": [ - "array([ 1., 2.])" - ] - }, - "execution_count": 63, - "metadata": {}, - "output_type": "execute_result" + "ename": "AttributeError", + "evalue": "`np.asfarray` was removed in the NumPy 2.0 release. Use `np.asarray` with a proper dtype instead.", + "output_type": "error", + "traceback": [ + "\u001b[31m---------------------------------------------------------------------------\u001b[39m", + "\u001b[31mAttributeError\u001b[39m Traceback (most recent call last)", + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[32]\u001b[39m\u001b[32m, line 2\u001b[39m\n\u001b[32m 1\u001b[39m x = [\u001b[32m1\u001b[39m, \u001b[32m2\u001b[39m]\n\u001b[32m----> \u001b[39m\u001b[32m2\u001b[39m \u001b[43mnp\u001b[49m\u001b[43m.\u001b[49m\u001b[43masfarray\u001b[49m(x)\n", + "\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\Emmi\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\numpy\\__init__.py:794\u001b[39m, in \u001b[36m__getattr__\u001b[39m\u001b[34m(attr)\u001b[39m\n\u001b[32m 791\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mAttributeError\u001b[39;00m(__former_attrs__[attr], name=\u001b[38;5;28;01mNone\u001b[39;00m)\n\u001b[32m 793\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m attr \u001b[38;5;129;01min\u001b[39;00m __expired_attributes__:\n\u001b[32m--> \u001b[39m\u001b[32m794\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mAttributeError\u001b[39;00m(\n\u001b[32m 795\u001b[39m \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33m`np.\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mattr\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m` was removed in the NumPy 2.0 release. \u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 796\u001b[39m \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00m__expired_attributes__[attr]\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m\"\u001b[39m,\n\u001b[32m 797\u001b[39m name=\u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[32m 798\u001b[39m )\n\u001b[32m 800\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m attr == \u001b[33m\"\u001b[39m\u001b[33mchararray\u001b[39m\u001b[33m\"\u001b[39m:\n\u001b[32m 801\u001b[39m warnings.warn(\n\u001b[32m 802\u001b[39m \u001b[33m\"\u001b[39m\u001b[33m`np.chararray` is deprecated and will be removed from \u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 803\u001b[39m \u001b[33m\"\u001b[39m\u001b[33mthe main namespace in the future. Use an array with a string \u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 804\u001b[39m \u001b[33m\"\u001b[39m\u001b[33mor bytes dtype instead.\u001b[39m\u001b[33m\"\u001b[39m, \u001b[38;5;167;01mDeprecationWarning\u001b[39;00m, stacklevel=\u001b[32m2\u001b[39m)\n", + "\u001b[31mAttributeError\u001b[39m: `np.asfarray` was removed in the NumPy 2.0 release. Use `np.asarray` with a proper dtype instead." + ] } ], "source": [ - "x = [1, 2]\n" + "x = [1, 2]\n", + "np.asfarr" ] }, { @@ -439,22 +448,11 @@ }, { "cell_type": "code", - "execution_count": 67, + "execution_count": 12, "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "text/plain": [ - "30" - ] - }, - "execution_count": 67, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "x = np.array([30])\n" ] @@ -468,20 +466,11 @@ }, { "cell_type": "code", - "execution_count": 76, + "execution_count": 13, "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "70140352 [1 2 3]\n", - "70140752 [1 2 3]\n" - ] - } - ], + "outputs": [], "source": [ "x = np.array([1, 2, 3])\n" ] @@ -502,25 +491,11 @@ }, { "cell_type": "code", - "execution_count": 85, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "text/plain": [ - "array([ 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26,\n", - " 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52,\n", - " 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78,\n", - " 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100])" - ] - }, - "execution_count": 85, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [] }, { @@ -532,34 +507,11 @@ }, { "cell_type": "code", - "execution_count": 86, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "text/plain": [ - "array([ 3. , 3.14285714, 3.28571429, 3.42857143,\n", - " 3.57142857, 3.71428571, 3.85714286, 4. ,\n", - " 4.14285714, 4.28571429, 4.42857143, 4.57142857,\n", - " 4.71428571, 4.85714286, 5. , 5.14285714,\n", - " 5.28571429, 5.42857143, 5.57142857, 5.71428571,\n", - " 5.85714286, 6. , 6.14285714, 6.28571429,\n", - " 6.42857143, 6.57142857, 6.71428571, 6.85714286,\n", - " 7. , 7.14285714, 7.28571429, 7.42857143,\n", - " 7.57142857, 7.71428571, 7.85714286, 8. ,\n", - " 8.14285714, 8.28571429, 8.42857143, 8.57142857,\n", - " 8.71428571, 8.85714286, 9. , 9.14285714,\n", - " 9.28571429, 9.42857143, 9.57142857, 9.71428571,\n", - " 9.85714286, 10. ])" - ] - }, - "execution_count": 86, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [] }, { @@ -571,38 +523,11 @@ }, { "cell_type": "code", - "execution_count": 88, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "text/plain": [ - "array([ 1.00000000e+03, 1.38038426e+03, 1.90546072e+03,\n", - " 2.63026799e+03, 3.63078055e+03, 5.01187234e+03,\n", - " 6.91830971e+03, 9.54992586e+03, 1.31825674e+04,\n", - " 1.81970086e+04, 2.51188643e+04, 3.46736850e+04,\n", - " 4.78630092e+04, 6.60693448e+04, 9.12010839e+04,\n", - " 1.25892541e+05, 1.73780083e+05, 2.39883292e+05,\n", - " 3.31131121e+05, 4.57088190e+05, 6.30957344e+05,\n", - " 8.70963590e+05, 1.20226443e+06, 1.65958691e+06,\n", - " 2.29086765e+06, 3.16227766e+06, 4.36515832e+06,\n", - " 6.02559586e+06, 8.31763771e+06, 1.14815362e+07,\n", - " 1.58489319e+07, 2.18776162e+07, 3.01995172e+07,\n", - " 4.16869383e+07, 5.75439937e+07, 7.94328235e+07,\n", - " 1.09647820e+08, 1.51356125e+08, 2.08929613e+08,\n", - " 2.88403150e+08, 3.98107171e+08, 5.49540874e+08,\n", - " 7.58577575e+08, 1.04712855e+09, 1.44543977e+09,\n", - " 1.99526231e+09, 2.75422870e+09, 3.80189396e+09,\n", - " 5.24807460e+09, 7.24435960e+09])" - ] - }, - "execution_count": 88, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [] }, { @@ -624,22 +549,11 @@ }, { "cell_type": "code", - "execution_count": 93, + "execution_count": 14, "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "text/plain": [ - "array([ 0, 5, 10])" - ] - }, - "execution_count": 93, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "X = np.array([[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11]])\n" ] @@ -653,25 +567,11 @@ }, { "cell_type": "code", - "execution_count": 95, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "text/plain": [ - "array([[1, 0, 0, 0],\n", - " [0, 2, 0, 0],\n", - " [0, 0, 3, 0],\n", - " [0, 0, 0, 4]])" - ] - }, - "execution_count": 95, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [] }, { @@ -686,24 +586,11 @@ }, { "cell_type": "code", - "execution_count": 97, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "text/plain": [ - "array([[ 0., 0., 0., 0., 0.],\n", - " [ 1., 0., 0., 0., 0.],\n", - " [ 1., 1., 0., 0., 0.]])" - ] - }, - "execution_count": 97, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [] }, { @@ -719,25 +606,11 @@ }, { "cell_type": "code", - "execution_count": 101, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "text/plain": [ - "array([[ 0, 0, 0],\n", - " [ 4, 0, 0],\n", - " [ 7, 8, 0],\n", - " [10, 11, 12]])" - ] - }, - "execution_count": 101, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [] }, { @@ -752,45 +625,31 @@ }, { "cell_type": "code", - "execution_count": 102, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "data": { - "text/plain": [ - "array([[ 1, 2, 3],\n", - " [ 4, 5, 6],\n", - " [ 0, 8, 9],\n", - " [ 0, 0, 12]])" - ] - }, - "execution_count": 102, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [] } ], "metadata": { "kernelspec": { - "display_name": "Python 2", + "display_name": "Python 3", "language": "python", - "name": "python2" + "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", - "version": 2 + "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.6" + "pygments_lexer": "ipython3", + "version": "3.13.0" } }, "nbformat": 4, diff --git a/emmitest.md b/emmitest.md new file mode 100644 index 0000000..cce19ed --- /dev/null +++ b/emmitest.md @@ -0,0 +1 @@ +sdSDSA diff --git a/test.md b/test.md new file mode 100644 index 0000000..e69de29