diff options
| author | marcellus <msimon_fr@hotmail.com> | 2025-06-22 21:49:40 +0200 |
|---|---|---|
| committer | marcellus <msimon_fr@hotmail.com> | 2025-06-22 21:49:40 +0200 |
| commit | 86f1ed1a4f122eb7dd2db0c312252224de0e222d (patch) | |
| tree | 534dfa5b6503c2bb127f69e532fd2be6defe8787 /PVCM/cama/fr/ma26 Vecteurs propres -- Exercices.ipynb | |
| parent | 65cbf8872e84efd5d03930a8a7ad51e290be730b (diff) | |
notes: 2025-06-22 21:49:40 from w11
Diffstat (limited to 'PVCM/cama/fr/ma26 Vecteurs propres -- Exercices.ipynb')
| -rw-r--r-- | PVCM/cama/fr/ma26 Vecteurs propres -- Exercices.ipynb | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/PVCM/cama/fr/ma26 Vecteurs propres -- Exercices.ipynb b/PVCM/cama/fr/ma26 Vecteurs propres -- Exercices.ipynb index c62c0b1..c9682db 100644 --- a/PVCM/cama/fr/ma26 Vecteurs propres -- Exercices.ipynb +++ b/PVCM/cama/fr/ma26 Vecteurs propres -- Exercices.ipynb @@ -9,7 +9,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -73,7 +73,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -83,7 +83,7 @@ " [1, 1]])" ] }, - "execution_count": 3, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -147,28 +147,28 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 11, "metadata": {}, "outputs": [], "source": [ "def fibo(n):\n", " F = np.array([[0,1],[1,1]], dtype=int)\n", " D, P = lin.eig(F)\n", - " return (P @ lin.matrix_power(np.diag(D),n) @ lin.inv(P))[0]" + " return (P @ lin.matrix_power(np.diag(D),n) @ lin.inv(P))[1,0]" ] }, { "cell_type": "code", - "execution_count": 48, + "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "array([5., 8.])" + "np.float64(8.0)" ] }, - "execution_count": 48, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -187,15 +187,15 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": 13, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "84.8 μs ± 7.75 μs per loop (mean ± std. dev. of 7 runs, 10,000 loops each)\n", - "109 μs ± 6.71 μs per loop (mean ± std. dev. of 7 runs, 10,000 loops each)\n" + "128 μs ± 71 μs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)\n", + "102 μs ± 6.96 μs per loop (mean ± std. dev. of 7 runs, 10,000 loops each)\n" ] } ], @@ -224,7 +224,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -237,10 +237,10 @@ " [1, 1, 1, 0, 0, 0, 0, 0],\n", " [0, 0, 1, 1, 1, 0, 1, 0],\n", " [1, 1, 0, 1, 0, 1, 0, 1],\n", - " [1, 0, 0, 0, 0, 0, 0, 0]])" + " [1, 0, 0, 0, 0, 0, 0, 0]], dtype=int32)" ] }, - "execution_count": 2, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } @@ -281,21 +281,21 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 15, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "[[0.774 0.387 1.419 1.419 1.032 1.29 1.548 0.129]]\n", - "[[0.542 0.5 1.25 1.583 0.833 1.75 1.292 0.25 ]]\n", - "[[0.742 0.426 1.127 1.608 0.756 1.636 1.526 0.179]]\n", - "[[0.672 0.497 1.183 1.527 0.748 1.635 1.496 0.242]]\n", - "[[0.694 0.487 1.19 1.542 0.766 1.613 1.489 0.219]]\n", - "[[0.683 0.484 1.189 1.545 0.771 1.622 1.481 0.226]]\n", - "[[0.686 0.482 1.187 1.546 0.767 1.624 1.485 0.222]]\n", - "[[0.686 0.484 1.186 1.546 0.767 1.624 1.485 0.223]]\n", + "[[0.615 0.308 1.538 1.538 0.923 1.231 1.538 0.308]]\n", + "[[0.513 0.513 1.231 1.538 0.821 1.846 1.333 0.205]]\n", + "[[0.776 0.439 1.114 1.62 0.743 1.62 1.519 0.169]]\n", + "[[0.668 0.493 1.184 1.523 0.756 1.622 1.501 0.252]]\n", + "[[0.689 0.489 1.196 1.539 0.764 1.618 1.486 0.218]]\n", + "[[0.685 0.483 1.186 1.547 0.772 1.621 1.481 0.224]]\n", + "[[0.685 0.482 1.187 1.546 0.767 1.624 1.485 0.223]]\n", + "[[0.686 0.484 1.186 1.545 0.767 1.624 1.485 0.223]]\n", "[[0.686 0.484 1.187 1.545 0.767 1.623 1.485 0.223]]\n", "[[0.686 0.484 1.187 1.545 0.767 1.623 1.485 0.223]]\n", "[[0.686 0.484 1.187 1.545 0.767 1.623 1.485 0.223]]\n", @@ -311,8 +311,8 @@ "\n", "while (np.absolute(np.max(vprime - v)) > 1e-5): # which norm is used here?\n", " v = vprime\n", - " vprime = \n", - " vprime *= \n", + " vprime = A @ v\n", + " vprime *= N / vprime.sum()\n", " print(vprime.T)\n" ] }, @@ -333,7 +333,9 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "val" + ] }, { "cell_type": "code", |
