{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from sympy import *\n", "import numpy as np\n", "import scipy\n", "init_printing()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If we think about a differential operator D which is basically subracting two adjacent entries in a functional vector and dividing by the distance between them." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "h, f1, f2, f3, f4 = symbols('h f_1 f_2 f_3 f_4')" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}\\frac{1}{h} & - \\frac{1}{h} & 0 & 0\\\\0 & \\frac{1}{h} & - \\frac{1}{h} & 0\\\\0 & 0 & \\frac{1}{h} & - \\frac{1}{h}\\\\0 & 0 & 0 & \\frac{1}{h}\\end{matrix}\\right]$" ], "text/plain": [ "⎡1 -1 ⎤\n", "⎢─ ─── 0 0 ⎥\n", "⎢h h ⎥\n", "⎢ ⎥\n", "⎢ 1 -1 ⎥\n", "⎢0 ─ ─── 0 ⎥\n", "⎢ h h ⎥\n", "⎢ ⎥\n", "⎢ 1 -1 ⎥\n", "⎢0 0 ─ ───⎥\n", "⎢ h h ⎥\n", "⎢ ⎥\n", "⎢ 1 ⎥\n", "⎢0 0 0 ─ ⎥\n", "⎣ h ⎦" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a = Matrix([[1,-1,0,0],[0, 1, -1,0],[0,0,1,-1],[0,0,0,1]]); a/h" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPCAYAAAA/I0V3AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAABJ0AAASdAHeZh94AAAAi0lEQVR4nO3SIQoCYRQE4E+xajYbxObewGjdYBTMRmGj8PgP4zkM3kMQjEb7Wv6wrC6sxeTACzO8YSbMoK5r32LUJCmlDVYosMQYp4jYdppwzM9P3LH4lDRs8QPmmGDfq15EnBtVuzxvSb3wN/3cNGgONqVUosx0ijWuuGTtERFVe3sFdi1tlg9uqF5xyRu/uhi7owAAAABJRU5ErkJggg==\n", "text/latex": [ "$\\displaystyle 1$" ], "text/plain": [ "1" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a.det()" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}1 & 1 & 1 & 1\\\\0 & 1 & 1 & 1\\\\0 & 0 & 1 & 1\\\\0 & 0 & 0 & 1\\end{matrix}\\right]$" ], "text/plain": [ "⎡1 1 1 1⎤\n", "⎢ ⎥\n", "⎢0 1 1 1⎥\n", "⎢ ⎥\n", "⎢0 0 1 1⎥\n", "⎢ ⎥\n", "⎣0 0 0 1⎦" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a**-1" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The invertible matrix, which should represent the opposite of differencing, seems to have too much dependence on the later elements. I am going to see if I can better define the end points." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAG4AAAAUCAYAAABs4ghcAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAABJ0AAASdAHeZh94AAAE0UlEQVR4nO2ZW6jVRRTGf1tLlLwEBoaRlYTmoeh0NDAyMdMs0vLoQ0QZpyCKyECQ4PTy+VmZ9OClqEB6UEGpyEpLxahMu5jlpYthFF4oSDJSrCPZRU8PM1v3/u//vpx9OWn4wWb+rJlZ69uzZs2smcl0dnZyFmcezkkT2l4G3ApcJulovY3a7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6btmQXXYMlzXPamYBL1R+qmf5qhIo62FwBjgOmJA3QubiaciVfHPhlgKrBF0s8Jfb2AK4GvJf2doqsgGtMcdxC4txTxKvG/cJzthcBdwHhJe4u0GUBw0tuSfoziUcDFFN5NAlxFeH0oZnckifvLTPI9Lqa984AWSd2+rNnuAB6p5DjQ3bC9GLgTuLHU9ZftmcCzwA2SPoqyeUA7MFTSvmJ9K0Xa68BC4CFCujulVgOVID5/ZPfVHsAQ283AIUk/dAeHcrD9POG5aypw2PaFsapDUkdOuz4EB63KOi2ilXB5XLPTIOU9Lp7mZwDb4jVYd2AUISHYSTj7OH7P7Sb7leBhQuLyHiEDz/5mJ9pdCixJyiWNkNRcLzIFS+VZnBn4FyDKsSrKmaFvAAAAAElFTkSuQmCC\n", "text/latex": [ "$\\displaystyle \\frac{- f_{1} + f_{2}}{h}$" ], "text/plain": [ "-f₁ + f₂\n", "────────\n", " h " ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "d21 = (f2-f1)/h; d21" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAG4AAAAVCAYAAACnvtv5AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAABJ0AAASdAHeZh94AAAFKUlEQVR4nO2Zb4iUVRTGf5slSv4DA6WoTEJzUdrWJCMTK81ELVeJorKkCPuDgRCF9eHxKTPpg38KK6QPGSkVbakVYqSmlWapmSZWpgaGUpFiraSWbh/uHZ19553Z2dmZNcEHhjtz7n3PeeY995x77r1VjY2NnMWZh3PThLYXAqOAyyQdLrdR212AGcCtwIXAecA0SbPKbatUlMrR9kBgI/CgpNdKsDsVmA3cLWlxvnHnpDw4CJgIzKqE0yIWAVOA7cALgIFlFbJVKkriKGkTsAR41nanfONs97B93PZLia6Bsd1cyE5axD0H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44D1kn7NHmi7PdAf2CbpnxRdOdGYPDmpJ6x19wLz8xAqFc06zvYc4E7gBkm7y2y/GBTkKOkY8FP8uSkeyE8FHsgeZ7srwUkfStobxVcDFxMKqiQGEG4f8r2bgSTOL6uS93GxNJ8J1EoqJq2VBbbnAXcQnHbaj7+Kge1VwL7ktsf2FOBF4HpJn0fZTGAa0FvSnhxlLUTa7cAc4CFCST62tQaKge35hKukccBB2z1jV4Okhrbg0BxszyKU8HsJ6+BdhG3M6MS4jgQH1WecFlFHODxutdMg5T4u7uYnAhvjMVhb4BHCy1hJqG4zn8fbyH4x6Am8SVjnVgKDgFEpm+VewAIS3CX1k1RTLjI5qfIszgzkuys6i/85/gOG381TfAEQCQAAAABJRU5ErkJggg==\n", "text/latex": [ "$\\displaystyle \\frac{- f_{2} + f_{3}}{h}$" ], "text/plain": [ "-f₂ + f₃\n", "────────\n", " h " ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "d32 = (f3-f2)/h; d32" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAG4AAAAVCAYAAACnvtv5AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAABJ0AAASdAHeZh94AAAFIklEQVR4nO2afYhVVRTFf9OUKX6CglFUFuKkKI1OkkKIlFaSlWP/hKUNhmn0AUIWVrBcZSYRJYQUEuRESoWWSiEGZVpZlpr5gZWZgpFUZFpKaun0xzlP39x5986bN++Zguuf89jn3r3X3H332eucO1VNTU2cw9mH8wsZbTcCY4ArJB0ud1Db3YDZwG3AxcAFwExJc8sdq1SUytF2HbABmCLp1RLiTgdeAO6StDjtuvMK3DgUmAjMrUTSIhYBDwHbgecAAysqFKtUlMRR0kZgGfC07S5p19nubfu47ZcSU3Vx3JQVp1DFPQP8CbzcGslSYPs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LzMRJOgb8kCMYD7unA/eWmUcW0jgOB3oB2/OUajUwwvY0oLOko7mJ2AvHAe9J2hvN1wCXEgRVEoMIXx/SXuo6EueXzRIn6ZjtecAc24MlFVzWSoGkGcCMNtxyHnBhCXEWAgvbel+8N43jMsJJRj5eI6jgOQSVmI9JBHX+fJ6tPo4t+lv8olCVwat/0lbo68CLwDTgKYICqjhszyXI472EHjMBGAmcEV8PJB0ADuTbbB8G9kvalrB3AmYCSyV9mjdVTzg83k0Z0OLkOu7mJwIb4jHY6cBFwBuEPvchMBQYk7IRPdPRh6A+H8k3SuovqbZcQarO/evC2Ym0b0XncIbjP3ppxoWpgLXuAAAAAElFTkSuQmCC\n", "text/latex": [ "$\\displaystyle \\frac{- f_{3} + f_{4}}{h}$" ], "text/plain": [ "-f₃ + f₄\n", "────────\n", " h " ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "d43 = (f4-f3)/h; d43" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAHkAAAAVCAYAAABizEFoAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAABJ0AAASdAHeZh94AAAFsUlEQVR4nO2Za4hVVRTHfzNWKJkVBYWWWYSVJU2jQUGJpFZmr7H8UplWRC8TpUgs4t/fzPyUFvRAgmaipCJ7SNkD0uxhWY2O9n4qGlpWhmVklk4f9r56PPecO3dm7p1M/H/Z966zWOt/ztp77bXXrmltbWUv9mzskyW03QSMBI6W9EelndruBUwHLgR6A/sCUyXNrLSvjqKjHG0PAj4CrpX0aBfwnAzcB1wuaW6WTlGQbZ8KjAVurUaAI54EzgcWAE8A/wDzq+Sro+gQR0nNtl8A7rb9lKTNWXq2DwPWAQ8BdwENwChgINAH2Ap8DDwGPCZpe47LQXFclscpayXfA/wGPNzG+3Q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HdCSU52h5oezPwF/AI0CDp4xxbp8VxUULWAGwH0lkB23cSAtxMWMGlAgxhJf9FWPFp7NLqTJ+T5xG6K+cA37ThpL3ILGh2M7TF8UvCnn8gcCnQZHuopKwPfTah5/Ai7MgSFwPvSfoxqWh7HDAt6r8NTMwoGlcXilHb+xGq7hWS/k4rklrlWUHeQDibPZjzoh3F/z7Ikrayc/I3x8ucycA1ST3bBxIC+pKktVE8GDiSUCymcXQcuwGTcrgtBhrj74GEW7G8bzmIRD+7Jn2fbHsqoaleL6nLU2tMhxPKOUL917C9EFiXPiravhl4ADhT0jtRNgOYChwjaVWRsSoi6xZqFnA9IX1c0BUkbPcECnVALdDXdh2wUdKaruDQFmzPJBx71hL27csI/eRRKb0ehGDOKwQ4ooGQXrs0wJC6hQKIXZixwEex1dkVGEwodpYTzpaOv6d1kf9ycDjhXvlLQo/4VGBkRiOiHzCH0NzZAUknSKqrPs1iFKXrvdjzkHfXuRd7EP4Fq9MHBT4X7uoAAAAASUVORK5CYII=\n", "text/latex": [ "$\\displaystyle \\frac{- f_{1} + f_{3}}{2 h}$" ], "text/plain": [ "-f₁ + f₃\n", "────────\n", " 2⋅h " ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# The averaged first order difference\n", "f321 = (d21 + d32)/2\n", "simplify(f321)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAFEAAAAjCAYAAADsZeb8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAABJ0AAASdAHeZh94AAAD6ElEQVR4nO2ZW2gcZRiGn42BgK1YKthetIKiKEXaLYo3Rq0ggiBSxXooSBHUC/XCi3qRevH6VsF60zZCPRVLseKFii0WvLHVaq0VVExqEA9FPFASIaaH0IDYEi9mNp1Mdmd3NjuZCcwDy+7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pDizZgZFEVZl+ikfwGrmNkncNrmbaPtigrOL72NVpYkpWBl+TyVabV8GLKM0sWWqwK+xs+PVwH/Aj7koSkkhnhPnO0UYifOe0sQO8D88hq6M2AyWsAAAAABJRU5ErkJggg==\n", "text/latex": [ "$\\displaystyle \\frac{f_{1} - 2 f_{2} + f_{3}}{h^{2}}$" ], "text/plain": [ "f₁ - 2⋅f₂ + f₃\n", "──────────────\n", " 2 \n", " h " ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# The second order difference\n", "d2132 = (d32 - d21)/h\n", "simplify(d2132)" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAFEAAAAjCAYAAADsZeb8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAABJ0AAASdAHeZh94AAAD6ElEQVR4nO2ZW2gcZRiGn42BgK1YKthetIKiKEXaLYo3Rq0ggiBSxXooSBHUC/XCi3qRevH6VsF60zZCPRVLseKFii0WvLHVaq0VVExqEA9FPFASIaaH0IDYEi9mNp1Mdmd3NjuZCcwDy+7+h/neefkPM99fmZycpGR2dMcLbD8O9AFXALskPTHnqmLkoSlNzGkm2r4OeA1YB3wNjGcosg+4D7gW+DeM1ydpKC9N7caMj8R7gCFJe7ORN401wKvAN0AF2AwcsL1C0lgnNdneDfwu6fkWu6SKWamtibZ/Aa6J1O2TdG/rUmeH7YXAaWCtpP2d1JTGxHZiRkdiL3AYeBt4C5hIK3aWXAJ0ASdz1pQ6ZtTEM8BVwBFJI7b32l4DHJR0f+e1zqAfGACOJmhabvsj4HLgHPCCpPc7rCMec5Htbwm86gb6Je2MdoiaeH34fyByU7uADUkRbb8IPNdE2O2SDiVcYyvBCOiVdD5B0zngGUkDtpcC39n+WNLZ2PU2AZsiRT3ApO2NkbK7JB2uIycecxy4VdKE7QXAkO0PJf1T6xA1sQr8IekUgKRD4UhsxnbgnSZt/mxUYXsb8BCB0b/FquOahoHh8PeI7VFgMXA21u914L3I/5eBE8ArkbITDSTFY57nwpTuIdgEK9EOcRMHGly4IZJGgdG0/QBs9wMPEhj4U50mDTXZvgG4SNJfdTSNAWORtuPAmKTjLciaEdP2IuBzgg3n2fCep+hqRXAW2N4BPAqsB07aXhp+FjbTZHsxwcKfxUP3jJiSTklaBVwJrLe9JFrfFYqqACvrCc6QJwl25IMEU7T22ZikyXYPsA/YIumrTgpq5oOkv4FB4JZoeSXp3TlcE5+eo925KeFNvgv8nOLBebYxlwATksZtXwocAR6W9EOtTUMTbR8AVgELCNaXdZKO1m08R9juBb4AjkWKH4neUAYxbwLe5MKGskPSG9E2iSOxpDW6mjcpaUZpYgcoTewA3QC2y4WxTSRV5sXGYns5sIdsEw9tM1+mcy3xsAK4E9geJgMKQWFGou0twI2S7mih7SBwd7335jwo0kis0sJrZ1LiIS+KZuJgUoOMEw9tU4jpHCZYhwnyihuA24AR4DFJn4VteoBPgJ2S9uSltR5FGYnV8PspYBvBO/sQsBWmEg+7gU+LZiDUObzPiSrBSd8DkkYAbH8AvBTW30yQvD1me21YlmniIQ1FMnF/zcCQq4HjAJK+pDizZgZFEVZl+ikfwGrmNkncNrmbaPtigrOL72NVpYkpWBl+TyVabV8GLKM0sWWqwK+xs+PVwH/Aj7koSkkhnhPnO0UYifOe0sQO8D88hq6M2AyWsAAAAABJRU5ErkJggg==\n", "text/latex": [ "$\\displaystyle \\frac{f_{1} - 2 f_{2} + f_{3}}{h^{2}}$" ], "text/plain": [ "f₁ - 2⋅f₂ + f₃\n", "──────────────\n", " 2 \n", " h " ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# The second order difference\n", "d2132 = (d32 - d21)/h\n", "simplify(d2132)" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEU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WnK9llETxJ3S/quTfHvA1bU253jXEW0Vh2wvTa03dMusXW4EHg5/JNLwHMF0JSeiV1ao6fxkC6N6JqYA10Tc6AXwHZ3YZwlkkoLYmOxfT6wG2hnQaRpFsrtfJKoILIcuBHYEQoQhaAwmWh7K3C5pBuaGDsC3Jz1Pt9uipSJZTJe8eI0Koh0gqKZOFJvwHwWROZCIW7nUPg9RlRXvBe4FjgOPCDp4zCmD3gf2Clpd6e0plGUTCyH74eB7cAqYBTYBv8XRHYBHxXNQMguQLSbMtFJ352Vcw3bbwFPhf6iFkSAYpk4FD8YAi4BDgJI+ozi3DU1FEVYmepTPoDVNLFbF4GOmxiOIvuBbxNdXRNbYGX4PlBpsH02cB5dE5umDPycONNeDfwDfN8RRS1SiOfEhU4RMnHB0zUxB/4Dt3qoNMjiWvAAAAAASUVORK5CYII=\n", "text/latex": [ "$\\displaystyle \\frac{f_{2} - 2 f_{3} + f_{4}}{h^{2}}$" ], "text/plain": [ "f₂ - 2⋅f₃ + f₄\n", "──────────────\n", " 2 \n", " h " ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "d3243 = (d43 - d32)/h\n", "simplify(d3243)" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAALAAAAAVCAYAAADmZmQDAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAABJ0AAASdAHeZh94AAAHV0lEQVR4nO2afayWZR3HPwfM4USowYLpMnUESbGOHNyoiChAQ7Q4GqtVJNXMMmWyWA5b+/o1RfpHxOXLGJtA6axFkiVqKaQZhnmA1HxNQW2gGDgL5iue/vjdD97nOvfznPM85zkvz3a+29n1nOvt/l739bt/b9fV1N7eziAG0ag4oqjS9lpgDnCipIN9S6kYtkcAVwBfBI4F3gcslbS8X4n1EI2wrlo42m4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0vV54c3QSrgIPRJeyAVxJWQnIguAh7Pj5YGKKUSAsZ3IMzr7fXl/kqoDLiCE4l4iM1T6W9KfpBKMJe4FP0XwPBWYkxw6nACsooC3pJMlNdeDSCcXYhCDaCR00sCDGEQj4f9Wi887TDj9gwAAAABJRU5ErkJggg==\n", "text/latex": [ "$\\displaystyle \\frac{- 2 f_{1} + 3 f_{2} - f_{3}}{h}$" ], "text/plain": [ "-2⋅f₁ + 3⋅f₂ - f₃\n", "─────────────────\n", " h " ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Lets assume the 2nd order difference is constant for invisible terms to the left\n", "# and the 3rd order \n", "# difference is zero everywhere. Then we can approximate d01\n", "d10= d21 - h*d2132\n", "simplify(d10)\n" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAKAAAAAVCAYAAADByOXrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAABJ0AAASdAHeZh94AAAHXElEQVR4nO2af6yWZRnHP4A5GCFssGDaD3UGymKdQDcsIlLQSEyO5nIVyWyomTJZLIfVvnxLkf4RcWGOsQGWTpskWf4qg1DDMEFS8QemYDZQFNSCKSrSH9fzHp73fp/nfQ/wHs6hne92dp/3uu/7uu/v+17PdV/XdT899u7dSze60Vk4okhoeykwEThO0q6k7yjgGuBrwNHAR4BZkuZ28F47FN28quaMAh4HpkladIDrzgCuB74l6baycTUGaPsUYAowMzW+DLcCk4B7gV8DHwB3H8gmmw3bPwdOBoYCg4B3gJeB5cAvJG2vM71L8rI9EGgFzgJGAMcA7wFPAYuBxZI+rKNiv3lJWmt7OfAz27dL2llnf4OBLcBNkq7IdY3K2nX11irygNcC/wF+WbDYiQSZBySdVU9xJ2EGQfhPwDagLzAamA1cbHu0pFfSSV2c1/nEb7EVWAn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₂ - 3⋅f₃ + 2⋅f₄\n", "────────────────\n", " h " ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Lets assume the 2nd order difference is constant for invisible terms to the left\n", "# and the 3rd order \n", "# difference is zero everywhere. Then we can approximate d01\n", "d54= d43 + d3243*h\n", "simplify(d54)\n" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "scrolled": true }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAALwAAAAVCAYAAAD8WoSNAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAABJ0AAASdAHeZh94AAAH20lEQVR4nO2af5CVVRnHPwvm4MiPZnSC0dHUMQgmxnXBiYqIAjQC05WYmpKkH2aZMTAxOdjYl68/kP5IxFFrkEbAdKyJJEvUMggiDJUfqalkCmIDgoFjwQgqbn8858Ld97737l727i6L+53ZOXfPOe95v897nvOc53nOqWtqaqIb3Xiv4Li8StuLgfHAmZL2dSylfNjuC9wAfB44BXgfMEvS3E4l1kZ0BbmOhKPtYcCTwOWSFnYQzxnAzcBXJN2b16dE4W2fB0wBZtZa2W3/GBgODAROBt4EXgaWAbdJ2l3h8XuAicBy4BfAO8ADteRXK9i+FLg7/dvShHcFuarmKGm97WXA9bbvk7S3XF/b/YHtwB3AbKARmAAMBU4F3gKeBu4C7pL0bpmhhqVyQ7l35Vn4G4H/Aj+tIM+RYkYi80dgF3AiMIIQ8lu2R0h6JfuQ7Q8TH/wRSRPagVfNYPs04DZgL9C7hb5HvVxt5HgTsA6YBsyp0O8ioAfwG2AyoXs7gJXANqA/cAmwEBhve7KkPF+8gfju/yz3omYKb3sgMBZYKOnN1slUFfpK2p+ttH0jcA0wC7gy57nPpHJpO3DC9lTCenxa0p/bME5dGmc3MXkzW3ikXeWqEY6Yo6THbT8PXGF7bgXL3Eh8s9VAHeE6PVjc3/Y1w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7EsmKFcntKYHt6cA8wrCNkbQrrx+HF+b6nDH6EHO0SlJTscLvICLyQWUGbW+cksqDhYqU1z4HeEHS/zqFVWUcAH5epq2B8OvXAJuBQ+5OlXL1IaxorqvZXmgtx6S4k4nFvzanyyBip9qUqR9FGNdcd8b21YSruwkYlzGCWRQC1hKFJ+agrtB2SOElNdleDUyyfbakf1V4QdVIh1o7s6s5WYDrgQ8AayUVT+xAYsKX15JLrZAC1G/mtdmeTXzsxTlXC6qRaz4x6dXEB7VARY62hxKcehGnm42Sns7pOiKVKzP1jcC7QHa3wPa1hCu3nkhmVHLlIIzLAWInyKLZdYPswdNS4iTrAqCmCg98DrjJ9hpie9tNBDKfIoKKV4HLM8/kBk3HAFoll+2biSzWyHQo05FoieNmIvbpB3wBWGx7dE5wfT6xax9S7LR7XEyciu4s7mz7MkLZDwJ/AabluIpbCwkK28cTcd/fJb2d7UjG+ucp/C4i33l7GUGPFI8CZxMTeC7h1+0jAr67gVtzVvJ7VuFtzwO+RFx3eKlDWDVHRY6S3uKwUVyfLh3OAL5R6GO7H6HYv8/ckRoOnEYkELI4M5U9ibR1HlYBi9LvocTtzXLfchhF92vqsvfhU1psDtAgKRudH5WwvRe4qjVpya4A2/OBLxLK3unXDFoD2yuA7cWpTtvfA24FPilpTVH9HOLe1FmStpQM1o7Iuy05D/g2sa1cmNN+VMB2b2LHgAjqTrddD+yRtK3TiLURtm8ncs0XA6/bHpCa9la6YtuRsD2XSCW+Qvj5XybSqROK+pxAKPXSYmVPaCRckA5VdghFaYZ04jUFeDJdNzhaMZzID28k8rxOv6/rTFI1wJWEEv2JyJwV/lq6edmRGEDci99M8DwPGJ859DkDWEAOb0mDJdW3P81SlLg03ejGsYwSC9+NbhzL+D91FgU0ZWTGwQAAAABJRU5ErkJggg==\n", "text/latex": [ "$\\displaystyle \\frac{- 3 f_{1} + 4 f_{2} - f_{3}}{2 h}$" ], "text/plain": [ "-3⋅f₁ + 4⋅f₂ - f₃\n", "─────────────────\n", " 2⋅h " ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Then take an average of d10 and d21 to compute the approximate slope of the first element\n", "simplify((d21 + d10)/2)" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "scrolled": true }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAKsAAAAVCAYAAAA5KB4cAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAABJ0AAASdAHeZh94AAAH10lEQVR4nO2af6yWZRnHP0fIwRBh0wXTLHUGwWKdQBcWESloJCZIrFaSzELNjMFiOWz25ZuK9EciTqohjR+lsyZJlqhlEEQYKmgqKpqC2kAwUAsmqEh/XPd7eM5znud9D3A4vLTz3d7d73v/eq7ve1/39VzXdd8N+/btowMdOBrQuajS9kJgJHCapF25tuOBG4AvAScBHwCmSZp5mGU9rOjg1WzMIOAxYKKkee0k5xTgZuDrku4s6tNCWW2fBYwHpuYVNeEOYBSwFPgV8B5wb1sJ3ZawfQnwy/Sz1h9ft7xs/xg4E+gDnAi8DbwMLAFuk7S9yvAD5iVpre0lwPW275K0s4psvYDNwE+B6cAY4AJgAHAy8A7wFDAfmC/p/ZKpBqVyXdmziizrjcB/gJ8VCPYxgviDki4om7QeYPsU4DZgJ3Bcjb71zmsKsYh/ArYB3YDBhHJcbnuwpFfzgw6R103AGmASMKNKv4uAY4DfAuMIvdkCLAdeAXoBFwPzgJG2x0kq8j0HEmv1fNmDmimr7T7AcGCepLcL+p+TysVVhD/isN1A7OTtxJ84tcaQw8rL9oQkz+cl/eUgpjhe0u6CeW8ErgWmAVcVjDtoXpIesf0ccIXtmVUs4hjif14JNBDuxn3Z/ravBR4BxhKK20we292AvsDDVZ7TwrJelh7469xkY4G7M1Vzbc9N3/tLerbsAUcIk4iFGsb+BWuBo4VXkaIm/IZQ1o9mK9uQ112E9R4BPJhvTP7wO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uVldCFBloq/FDCqBW6ALavIVyUJ4ARuU2URyW4aqGsxLo1VNqalFXSPtsrgbG2z5D0z8ygPoQSLq3y0ApmJyEPxG88JKRg6ltFbbanE6QXFhy3VuVlewDBowtxujJG0lNtJHarkA5qtuYtWLJ61wMfBFZLyhqHUl62JwJnAIW+fw6DU7k8Vz8GeB/Iv32wfR3hCq4lgr9aruBAwtgUxTjNjmDzhwKLiVOG84GsstZ01pOgNxNR6pCUJK531OK1gfA3ewBfBhbaHtaa4LEN8UXgJturiNfxdiLg+RwRfLwGTMyNKQsa+xIB1RBJ71Ib5xEWu0kpk9UeTZw2bc3NfymhqHuBvwKTClyyTZIWpP7HEr72P0rkaWZ1i5R1G5ETm5Opb01kOQv4KnGk+FJZvzpDVV6S3mH/pl2bLvlMAb7ZDrJV8BBhCYcQb4ieRG7zeSKnfGuB9SrjdTZxEWZ9Rok6AUNtXwl0k7QHmvza0cAfcvcOzgROIQLJPE7LzDm5hM8KYEH6PoC4BVamV4PI3BdoyN9nzaQzBkoqjCTzsD0b+AqhqHVxRHk4YHsZsLksfVbvsN0T+FCuej6R8ZgBrK9cMrH9XeBW4LOSVmXmmEHcRThd0kbaEUW3rmYBVxLm/MKC9mawPYfIn40G3rDdOzXtrHa1rN5heyaRlnmV8P++RqTp6vFWVqsg6U3gzWyd7V3AjqxrY7sroZCLs4qaMIZ4bberokJE7c2QTiPGA4+lI9hauIpYzD8TGYXKp9ZNp3pHb+L+5waC21nAyJLE9f8bTiUyBi3WUFI/SY3tLRAUuAEd6EC9ooVl7UAH6hX/A8zTD0pZn1sZAAAAAElFTkSuQmCC\n", "text/latex": [ "$\\displaystyle \\frac{f_{2} - 4 f_{3} + 3 f_{4}}{2 h}$" ], "text/plain": [ "f₂ - 4⋅f₃ + 3⋅f₄\n", "────────────────\n", " 2⋅h " ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Then take an average of d10 and d21 to compute the approximate slope of the first element\n", "simplify((d43+d54)/2)" ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}- \\frac{3}{2} & 2 & - \\frac{1}{2} & 0\\\\-1 & 0 & 1 & 0\\\\0 & -1 & 0 & 1\\\\0 & \\frac{1}{2} & -2 & \\frac{3}{2}\\end{matrix}\\right]$" ], "text/plain": [ "⎡-3/2 2 -1/2 0 ⎤\n", "⎢ ⎥\n", "⎢ -1 0 1 0 ⎥\n", "⎢ ⎥\n", "⎢ 0 -1 0 1 ⎥\n", "⎢ ⎥\n", "⎣ 0 1/2 -2 3/2⎦" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a = Matrix([[-Rational(3,2),2, -Rational(1,2), 0],[-1,0,1,0],[0,-1,0,1], [0, Rational(1,2), -2, Rational(3,2)]]); a" ] }, { "cell_type": "code", "execution_count": 39, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}- \\frac{3}{2} & 2 & - \\frac{1}{2} & 0\\\\-1 & 0 & 1 & 0\\\\0 & -1 & 0 & 1\\\\0 & \\frac{1}{2} & -2 & \\frac{3}{2}\\end{matrix}\\right]$" ], "text/plain": [ "⎡-3/2 2 -1/2 0 ⎤\n", "⎢ ⎥\n", "⎢ -1 0 1 0 ⎥\n", "⎢ ⎥\n", "⎢ 0 -1 0 1 ⎥\n", "⎢ ⎥\n", "⎣ 0 1/2 -2 3/2⎦" ] }, "execution_count": 39, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a" ] }, { "cell_type": "code", "execution_count": 35, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([[-3, 4, -1, 0],\n", " [-2, 0, 2, 0],\n", " [ 0, -2, 0, 2],\n", " [ 0, 1, -4, 3]])" ] }, "execution_count": 35, "metadata": {}, "output_type": "execute_result" } ], "source": [ "aa = np.array(a*2, dtype=int)\n", "aa" ] }, { "cell_type": "code", "execution_count": 37, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAACEAAAAQCAYAAACYwhZnAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAABJ0AAASdAHeZh94AAABZklEQVR4nM3VsWoVQRSH8d+9aGMIEQQrQeUS9QFEA6mCEHwJ+6AQCJYWhyPYCipaC76AtgGxUnwDTSRgl0pUJJZeizuRuYtLdizUaf4we863386wM6PpdOpfj2Pdicw8g7u4jlPYx3NkRHxugQ9ljeqVyMwJ3uA0XuA9rmANO1iNiE8DBQazuivxpDRtRsSjCngfW7iHjSESLaxxx3wdH/G4Awwc4EZmLhz19lbWuHq4VnI7In7MdUV8w2ucwMpREq2sWuJiyd0e8IeSFwZINLFqiaWSX3saD+dPDpBoYo17iv7qqCUO7ZZ+V1jNfxnAbWLVEjsl+/Z8uWTfPtejiVVLvCq5nplz25SZi1jFd7wdINHE+lUQEXvYxjnc6kATC3gWEQcVcJKZlzLzeF3cyuqemDfNjtqHmXkN73DV7L/fxZ1O/UucxXmzg+mPWHNLVb7gMp6WhtuY4AFWht4brazR/3CV/wTkupu37oWhFwAAAABJRU5ErkJggg==\n", "text/latex": [ "$\\displaystyle 0.0$" ], "text/plain": [ "0.0" ] }, "execution_count": 37, "metadata": {}, "output_type": "execute_result" } ], "source": [ "np.linalg.det(aa)" ] }, { "cell_type": "code", "execution_count": 31, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[ \\left[\\begin{matrix}1\\\\1\\\\1\\\\1\\end{matrix}\\right]\\right]$" ], "text/plain": [ "⎡⎡1⎤⎤\n", "⎢⎢ ⎥⎥\n", "⎢⎢1⎥⎥\n", "⎢⎢ ⎥⎥\n", "⎢⎢1⎥⎥\n", "⎢⎢ ⎥⎥\n", "⎣⎣1⎦⎦" ] }, "execution_count": 31, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a.nullspace()\n" ] }, { "cell_type": "code", "execution_count": 30, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAA0AAAAQCAYAAADNo/U5AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAABJ0AAASdAHeZh94AAABEElEQVR4nJXSsUqcURCG4cfFKosYCKRSECR6BzFgJcLiTdiLQsA6xTCCrYVibiAXkNjapFK8A90Vwc5KVMSUroVn5fjrBp3mg5l5Z4ZzvpF+v++9MdpMZOYENrCET7jAH2REXMFIvSkzp3GIz9jDCb5iAV3MR8Rlc9PPAnyPiJ1q2BbWsYmVVmNLB+fYbQwL3GE5M9utqrBQdD8i7p8REbc4wAd8q6HZor3m45Q4LTpTQ+NFb4ZAg/zH1pCG/0YNDSaNv9ZY5a9rqFt0Zgj0pWivhv4W7WTms7Mzcwzz+Iejp2JEnGEfU1hrbEm08Ssi7pqOWPVoo+3MXMQx5jz+YQ8/aHivnDLppWF/G2bYt8YDKpZR3A7SAGIAAAAASUVORK5CYII=\n", "text/latex": [ "$\\displaystyle 0$" ], "text/plain": [ "0" ] }, "execution_count": 30, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(a.T*a).det()" ] }, { "cell_type": "code", "execution_count": 26, "metadata": { "scrolled": true }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAATYAAAAaCAYAAAA9pXBQAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAABJ0AAASdAHeZh94AAAHYUlEQVR4nO2de7Bd0x3HP4lHDNVQBqUPrkG9RoZ0qqNVaSraispF/vFmOt5Nk6LoY379dtLSmQphKBMj1xjaqVE6EyEZYhAJRkjHszREqxIdSkeRoXH7x1o7zj13r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B7SZOjMLM3JR1b4pYJuAbUyAAfrxi9AlzQhn3CfsBmjBzOTMT9kb8rU+xb1apVJlC+XpW1i6hby0yghXpJ2hm4EDgz7wHBf+biCzoIt4l2rZn9oJDLPYCkbXD74C43sx/X7M5GhaRf44ZeA2b2ct3+lOGT3C76WTcASbOBL+H+kcuyPPvMdA8zWwFM913bfuLruK0gc+p2ZCNkEPhLP345+GS3i37WDWB2mZXnzB5bJBKJ9CPxT4NHIpGNjv8DJeraDl8Kku0AAAAASUVORK5CYII=\n", "text/latex": [ "$\\displaystyle \\left\\{ 0 : 2, \\ - \\frac{\\sqrt{11} i}{2} : 1, \\ \\frac{\\sqrt{11} i}{2} : 1\\right\\}$" ], "text/plain": [ "⎧ -√11⋅ⅈ √11⋅ⅈ ⎫\n", "⎨0: 2, ───────: 1, ─────: 1⎬\n", "⎩ 2 2 ⎭" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a.eigenvals()" ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAA0AAAAQCAYAAADNo/U5AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAABJ0AAASdAHeZh94AAABEElEQVR4nJXSsUqcURCG4cfFKosYCKRSECR6BzFgJcLiTdiLQsA6xTCCrYVibiAXkNjapFK8A90Vwc5KVMSUroVn5fjrBp3mg5l5Z4ZzvpF+v++9MdpMZOYENrCET7jAH2REXMFIvSkzp3GIz9jDCb5iAV3MR8Rlc9PPAnyPiJ1q2BbWsYmVVmNLB+fYbQwL3GE5M9utqrBQdD8i7p8REbc4wAd8q6HZor3m45Q4LTpTQ+NFb4ZAg/zH1pCG/0YNDSaNv9ZY5a9rqFt0Zgj0pWivhv4W7WTms7Mzcwzz+Iejp2JEnGEfU1hrbEm08Ssi7pqOWPVoo+3MXMQx5jz+YQ8/aHivnDLppWF/G2bYt8YDKpZR3A7SAGIAAAAASUVORK5CYII=\n", "text/latex": [ "$\\displaystyle 0$" ], "text/plain": [ "0" ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a.det()" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAACEAAAAQCAYAAACYwhZnAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAABJ0AAASdAHeZh94AAAB8UlEQVR4nM3Vz4vNURjH8ZeJqEmU0izE6ObXQjZiasokNSk2VkpkK4qYpcXjUXbS+Bkrij+AEqXGlJC1lF8RK0lCZiwUY3HPnb5z597cieLZfL7n+T7nnPd5zjnPmTUxMeFf2+xmR2YuwXFsxSK8w3VkRHzqdODMfINlbX6/j4ielhCZWcNDLMYNPMMGHMLWzOyPiI+dguALhlv4x6qN5kxcKAAHI+JsBe4UDuME9s0A4nNEHPtdUFdlohoG8Qbnm+IC49iTmd0zgOjIqpnYXPRORPycQhDxNTMfFMg+jHQ4/tzM3I2l6ot4jHsR8aMa1FX5XlX0RZsBXxZd2SEA9OCq+jYO4y5eZuZAO4gFRb+0GbDhX9ghwGVsKSDdWItL6MXtzFzXCJx2Rf+WRUQ2uZ5gX2aOYQjHsIOpmWisdIHW1vB//kO+i0U3NRxViOdF2+35iqLtzkyn9qHo5C2rQowWHczMql9mzkc/vuHRH0L0FX09DSIiXuGO+sE50NQx1cmvRsR4Ba6Wmaszc04T9JpW9SQze3GuNK81/M0Hc7962T6TmVvwFBvVa8gLHG2KH1F/H5arF7mG7cRQZt7DW3xFDdswD7dwclommMzGelwpkw+VzqfRN4N3YxQ3S99dOIIB3MdebI+I743gWf/DU/4LUNaOYHXxMs0AAAAASUVORK5CYII=\n", "text/latex": [ "$\\displaystyle 0.5$" ], "text/plain": [ "0.4999999999999999" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "np.sin(np.pi/6)\n" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[ \\left( 1, \\ 3, \\ \\left[ \\left[\\begin{matrix}1\\\\0\\\\0\\end{matrix}\\right]\\right]\\right)\\right]$" ], "text/plain": [ "⎡⎛ ⎡⎡1⎤⎤⎞⎤\n", "⎢⎜ ⎢⎢ ⎥⎥⎟⎥\n", "⎢⎜1, 3, ⎢⎢0⎥⎥⎟⎥\n", "⎢⎜ ⎢⎢ ⎥⎥⎟⎥\n", "⎣⎝ ⎣⎣0⎦⎦⎠⎦" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a.eigenvects()" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPCAYAAAA/I0V3AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAABJ0AAASdAHeZh94AAAAi0lEQVR4nO3SIQoCYRQE4E+xajYbxObewGjdYBTMRmGj8PgP4zkM3kMQjEb7Wv6wrC6sxeTACzO8YSbMoK5r32LUJCmlDVYosMQYp4jYdppwzM9P3LH4lDRs8QPmmGDfq15EnBtVuzxvSb3wN/3cNGgONqVUosx0ijWuuGTtERFVe3sFdi1tlg9uqF5xyRu/uhi7owAAAABJRU5ErkJggg==\n", "text/latex": [ "$\\displaystyle 1$" ], "text/plain": [ "1" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a.det()" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}1 & 1 & 1\\\\0 & 1 & 1\\\\0 & 0 & 1\\end{matrix}\\right]$" ], "text/plain": [ "⎡1 1 1⎤\n", "⎢ ⎥\n", "⎢0 1 1⎥\n", "⎢ ⎥\n", "⎣0 0 1⎦" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a**-1" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}\\frac{\\sqrt{3}}{2}\\\\- \\frac{1}{2}\\\\0\\end{matrix}\\right]$" ], "text/plain": [ "⎡ √3 ⎤\n", "⎢ ── ⎥\n", "⎢ 2 ⎥\n", "⎢ ⎥\n", "⎢-1/2⎥\n", "⎢ ⎥\n", "⎣ 0 ⎦" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "b = Matrix([sqrt(3)/2, -Rational(1,2), 0]); b" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}- \\frac{\\sqrt{3}}{2}\\\\- \\frac{1}{2}\\\\0\\end{matrix}\\right]$" ], "text/plain": [ "⎡-√3 ⎤\n", "⎢────⎥\n", "⎢ 2 ⎥\n", "⎢ ⎥\n", "⎢-1/2⎥\n", "⎢ ⎥\n", "⎣ 0 ⎦" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "c = Matrix([-sqrt(3)/2, -Rational(1,2), 0]); c" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAFgAAAAUCAYAAAAJD/ojAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAABJ0AAASdAHeZh94AAABg0lEQVR4nO2YsUrDQByHv4qDi+Lg4CY4iIva1UH0ETo4CuroKDgKv/4fQJ+hi08gztbHcFNws+CgdFGog5caQ1qTJudRuQ9KrknvvsuPy5H+G4PBgIg/ZkJP4L8zmzTMbA+4TV27l7T+1xOaRsxsCXhOn5PUgFTAKe6ALtDLDLIP7AJNYAuYB64kHdQ+48DeCZx9wFz7CFhJLuQF3JXUzjl/7mRvwBPwV6s7hLeUU1IfaMNwJxgGXGYPPgXWgAXgpES/qoTw1ubMW8G5SBruz2Y27qe1EsJbpzO+RXgmBuyZGLBnYsCeiQF7JgbsmRiwZwq/B0+CmXWAQ+BYUsenK6RzHIUDNrMW0HJfl91x290QQE/SWaZb8oR8TDi/SbwhnCMps4KbfK2MNKvuA/AIZKUbwCtwU8JT1RvCOZIyf5XbuIJGEcxsEdgELiS9FO1XxRvC+Rt5AcvMRPV68A7wDlxWGGManLn14IR0wA981zQhUw8ui6RrYK7KGNPgdKTrwT/4BNfojjzfrlMVAAAAAElFTkSuQmCC\n", "text/latex": [ "$\\displaystyle \\left[ 1, \\ 1, \\ 1\\right]$" ], "text/plain": [ "[1, 1, 1]" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "[a.norm(), b.norm(), c.norm()]" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0\\\\0\\\\h\\end{matrix}\\right]$" ], "text/plain": [ "⎡0⎤\n", "⎢ ⎥\n", "⎢0⎥\n", "⎢ ⎥\n", "⎣h⎦" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "h1=Matrix([0, 0, h]); h1" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAN0AAAAeCAYAAACouBsAAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAABJ0AAASdAHeZh94AAA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GmrHgTtpmka7VJ1OkkXgYtmdg54FjfsVwrXRb4k2XWRPx8klLfjbpD+kKONNOwDllXsK+EieweoXtg57NmfXATtmk+7muZ0ksbM7BPcm9hTUfwgbuFjVsqXJ2cqC6IJ+GrguKSpyvIikbQvpv0e3HseyBh2bjhBu+bRLkv0cghoM7NV5R1mdhPws6S/cvhSnohXCQfcAbQklAXSE7RrArJ2OnCXKWWKWH/Vjssoj8sk95VetNAI2jUBNd8cl3TBzIZxwr0U7d6Cu4mZCTO7CrgNOCfpUswhc51Jmx4z62bmi14Of28ws4Ho/98kxUbmomN2AE9JGog7Ji1Bu9rJo10SWTNSBnHh5xXAJLA4mrBnZS2wmOSzYQd+cvrqRYmZR7KVWclMVO8CyeHw8tXIREG+DBK0q4US2bWLJWunGwL6cAmyE8D7Ge0AIOkM7ro/qXxNHvt5iUaYgRz1+3CfVxbWAn+S8zOeRdCutvp9ZNculkxpYJKGcT28m/zh5kACZrYMuB14TVIhy1qCdo0nT+7lEC6hdZWkrwryJ/B/7sE9bbu/YLtBuwaSZ5XBILATl6oT8ICkQ6RPnaqFQYJ2DSNPpzsBjFL78zSORdvfc7Tt095CIGjXQFoSfkBkEpe2MyppZ1JlM9sKHJFUVGQtUCeCdv4ws07g6ejlaip+QOQ//nZ/DRPlE/0AAAAASUVORK5CYII=\n", "text/latex": [ "$\\displaystyle \\left[ \\sqrt{\\left|{h}\\right|^{2} + 1}, \\ \\sqrt{\\left|{h}\\right|^{2} + 1}\\right]$" ], "text/plain": [ "⎡ __________ __________⎤\n", "⎢ ╱ 2 ╱ 2 ⎥\n", "⎣╲╱ │h│ + 1 , ╲╱ │h│ + 1 ⎦" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "[(a-h1).norm(), (b-h1).norm()]" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAADoAAAAmCAYAAACVr4jIAAAAOXRFWHRTb2Z0d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qRv3QpsI7byC7PF2WG+E7Wl+C+DXapkBLyplIadnF9pTtTuQQUfpSD4UZjdGScjhDl11K6EtAXOm20/s6YBPwHPAGiZY01ofTJNkFiA90kJZ0HsrILguF2ED7aknzge2NwMagaRTo2g5/Sz4g6ev5jhUbaF1aUhbbgQ+C768BxzLjHathnMGB1q0lZSFpFpgNxvudRDaZd7VkUZTRRmhJeSjSl7L9izaMNs3QkvJQpC+di263e87V6XTGO53OTLZ90FWFs9BXo46AYWJRBzpD8pdCGVThLCgWjQr4L4NaEz5AQQPMAAAAAElFTkSuQmCC\n", "text/latex": [ "$\\displaystyle \\frac{h^{2} - \\frac{1}{2}}{\\left|{h}\\right|^{2} + 1}$" ], "text/plain": [ " 2 1 \n", " h - ─ \n", " 2 \n", "────────\n", " 2 \n", "│h│ + 1" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "eqn1 = (a-h1).dot(b-h1) /((a-h1).norm()*(b-h1).norm()); eqn1" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAIMAAAAjCAYAAAC3gbmIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAABJ0AAASdAHeZh94AAAGDUlEQVR4nO2aachUVRjHf27ZYpFG2mYblrSPaBQlti+Spa+2fbEFog8VJSSEVvz9t5D1IbOo3g9BvhkF7eFSikuLLbTgSkSrGZWGC5KSlWYfzh27Xme5M3PndUbnB8Nl7jnnf5+Z+9xznvPcp8v27dtJg+3+wHSgL7AVeFDSq6kGt2gKulTgDIcD/SQtsX0Y8CVwoqTN9TRwT8V2uj8+JZK61KqxkzPYngwMkXRxuYG2lwIjJP1cqxF7G7YHA2dKat/dtsTpnvieA5aUGxT9mG5ZO4LtYcB4YDBwBHCzpGlF+rYDW4A1wGhgIPAX8CkwQ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4H3pG0pRrNpnKGeiHp2DrIziRM2/OBi4F5lQrYvhO4G/iaECSX4hLCu52SS0QpzVRJpBZVMZOwv4cQpC0s3nVXbN9ByKZ+Rdgyry8zZDQhh1A0Limnmc8zZFpo0YiUCjSzjBlifAj0tT0Q6Jli6k7aM4XwbugiSb+X6d+NsNNaIGljtZr53USjReSdzTgyjBkAJG21PQe4j+AYqbB9D2FNXwJcEiXwyjEMOIQiS0RazUxihmavj6xTzABhqegAJqTpbPt+4AFCSeGlKZaGPG3Av8DbtWimroEsRas+sjBRFneupMEp+t5IKBHYBjxFeIOcZGWy8isqLfgJWCVpaC2aqWeGUvWRkn4j5L/z2a21QB+q307tEUhaZ3tMyu7HRcduhGWrEO8Tbm6cIUB/wsvBmjQrWSZyNEl9ZCMhaWXKfpOoLn3eFh13iRcq1axka5mjDvWRtqfZnpSia6r6yL2QNmCppB9rFUo1MzRZfeRehaSTstJKOzPkomMz1Ee2qJK0MUOO5qmPbFEllThDVvWRE4GJsVM9ge22x8fODZeUOlHTIhsqcYas6iPbgVdi3x8Ffkno/1KFbosaKesMdaiPXA/syILZ/oNQ1vZdpVotsiXNzNAU9ZGdZceeTJp1Pkfj1Ecujj77EWocFxPy7i0yIJN3Ey32DFrFLS128B9xAJu9EVSa/QAAAABJRU5ErkJggg==\n", "text/latex": [ "$\\displaystyle \\frac{h^{2} - \\frac{1}{2}}{h^{2} + 1} = \\frac{\\sqrt{2}}{2}$" ], "text/plain": [ " 2 1 \n", "h - ─ \n", " 2 √2\n", "────── = ──\n", " 2 2 \n", "h + 1 " ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "eqn2 = Eq((h**2-Rational(1,2))/(h**2+1),1/sqrt(2)); eqn2" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAScAAAAjCAYAAADWvMzjAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24z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qrt{2 + \\frac{3 \\sqrt{2}}{2}}, \\sqrt{2 + \\frac{3 \\sqrt{2}}{2}}\\right\\}$" ], "text/plain": [ "⎧ __________ __________⎫\n", "⎪ ╱ 3⋅√2 ╱ 3⋅√2 ⎪\n", "⎨- ╱ 2 + ──── , ╱ 2 + ──── ⎬\n", "⎪ ╲╱ 2 ╲╱ 2 ⎪\n", "⎩ ⎭" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ss=solveset(eqn2, h); ss" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAMYAAAAQCAYAAABN/ABvAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAABJ0AAASdAHeZh94AAAGjklEQVR4nO2aaWwVVRTHf0UImopoQCAqyqI1uEEjCrgAhYgGlIBi/AIiCRiCpGCAGFE8PRoCGkE2jQQMS+ULxiUSEBEkIIKSYA0YFRBoCUZQqyhbRaB+OHfK9HXmvZl5Uz/1n7zcd2fumf/5330rqK2tpQlNaEJ9NPf+qGobYDgwBLgduBY4C+wBlgHLRORCnI+r6nXAy8BDQBvgF+AjQEXkz4y0rwI9gSKgLXAGqHLpF4lIdb4cLv0IoB/QA+gOtAJWicjINHQk1aKqlcANIS4cE5EOKfHEKZNEdSKJFp/tQGAi0Ae4Cqh2fPNFZF0Wu5FAuYuOE5GlYWmj2DTzpXscWAL0Ar4G5gHvA7cBS4HVqlqQi8xH2hXYBYwBdgJvAAeBScAOl+l+PAsUAp8B84FVwDmgDNitqh1T4AB4Ecv4HsDPjaAjkRaHvwAN+L0ekj4WTwIt+dSJuFpQ1deAjVhj/xiYA6wFrgb6Z7HrCCwCToaliWvT3Pd/HzAUWOvvBVR1OpaJjwGPYhkTBW8B7YBSEVno+95crEBnAuN96a8QkZoAATOB6cD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m4C3GDwH/AO+E/Cpcum0u7k2ZYtvUW2Oo6gzsusAubPGWdah0e+MtgAP+fWYROaCqG7Ah/Rmsp6kzw3qMxSJyyn2nCLsqUG9h6DLpFWxxtt1/ZSEuRxIk4UiixW0hHs70VVU7YaezAO9mvIvFkzS/EtSJ2FpEpEpV12CHiZOwRujZDQIexEaT9W7RPDaEuwxbXK/wX+9IYuO/KzUay4DzwBdAqWrmGopKEVnui2/C7sR0xg6O/JgAbAcWqN1/+QG7WlCCDdcv+NIOBmap6jasV6gG2mMn012Ao8C4AF1xODydw4BhLurd2emjqp6u30XEfxIalyOJlieAKW5bsgo4AXTF7ihdCqyj4VWKJDyxtCSsE0m0gDXWYmCuO8eowOrVMMc/NrMTaEz4R4zOLrwE2/YLwhZgeZQPux6qJxcvrA3GLqzNp+GFtY3AjdhWYzG2ZXgKK6xyYEFQTxWTw0MPYHTGsy7uB1aYdQ0jAUcSLZuxc4ZibEpTiPWQ25xNecBJfWyeBFqS1IkkWhCRI6p6J7alOhRboP8NrAFmicjOEP5GQUHTtfMmNKEh/gP5n0lZyFGgpAAAAABJRU5ErkJggg==\n", "text/latex": [ "$\\displaystyle 2.03010353025644$" ], "text/plain": [ "2.03010353025644" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(ss.args[0]).evalf()\n" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAMYAAAAQCAYAAABN/ABvAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAABJ0AAASdAHeZh94AAAHn0lEQVR4nO2afZBXVRnHPwvrKyoWlPSqYlFk5tI4aIkKoaSAJRnFNKA2o+SYgygMEWUPXxtjmZIErQR1oNCpaVKxSSVQGY2snMmcapAg5UVMUEBpEQgD+uM5l72cvff3u/f+dnLc2e/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48ScPxe09n4mcca4BvRfTLJe3GXXUbMBC/o7MbuNjM/pWhI0ESEsWn1rVQiKfCfP0KP6c4H3hO0gP4HA3Ew6wmYHre/bKC+DKepzyJ31lrw8vBo4Aj8XzpB42+i6TLcaPYhxv8pIxQb72ZLUp3lNETe4wWPLlMoz/tNfsN1L4K0IissvSP4vd8huC71/HAG/jiXgzMy9pFgtc4g/ZLhCPxOzdzybhEiC+ocfiZwlF4kroAmGVmm7JeHA7unkMol3SX4WmhxHyZ2X5JI3FPOQ7PJ44Gtgdd88xsWZFx1sAK/KxoEO6BeuGFjJX4N1mccX+p9LvQfq7UEy/RZ+EJYFFVPU3d18670Y2O+B81CTleU8a7aQAAAABJRU5ErkJggg==\n", "text/latex": [ "$\\displaystyle 1.11309771845121$" ], "text/plain": [ "1.11309771845121" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(atan(ss.args[0])).evalf()" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAMQAAAAQCAYAAABJCdBSAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAABJ0AAASdAHeZh94AAAIs0lEQVR4nO2ae7BXVRXHP1cRNEQgTOnli6LUVBgNIZGHJCkISWo5DYjOADnKICqSWbb41hiXSgR8FD4GTJ2aMr1KIoHISGTFjOJoAwghD6FAgVAQCAX6Y+3DPXdzzv2d87vX/+535jf7d/ZZa++91tlr77XW3jUHDx6kBS1ogaNVVqWkAcBYoBfQEdgGvAFMN7O5KbopwHlAV+B4YA+wHqgD7jOzbZUGIOlaYFYFsgNmdmQ19Kl+1gEn59BvMbPOOeMbDNwEnAF0Av4DvAJMNbO/ZdB/DvgJcEmKvg6Qmf03g/5KoC/QDTgHaAc8YWbDK8iYbmM48Fh4HG1mD2fQrKOg/JI6Ac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XUDfoF7JbWp+mrkKMUTX924EVfq1HAOsQxPiV2Or8KjUgYwCJgsaQm+a2zDj/f74mmyzXimIcZC/BDnVPwQK43E/ck7aY5RlP47uP+6GL9rtRNPBw4GjsZjj19GPE8CL+AB3gpJT+MynY67BzXA7dFVjBvwDz5Dfh9sBXA+fkaxCvhhPDBJl+P6hfq8fC9Js8P/rWZW6QS6EkrJL2kkbgz78Yk+LsM9W2dms1PP1egLYIGkPbhLtjPQD8bvxQ0xs39XK0c1PA0Mwsw2SjoXT+sNxYON94E5wGQzW5oifwG/p9IbN6IO+IHHKjzfO6PAqnIIwZJ7UzyYLkO/CD8n6I6vVG3x3W5JGOtj8UmxmR2QNAhfJK7G/d9PANtDfzPMbH7Es0bSedRf7huE3weaTs7lPvxS38io7jTq8/DrqXwloxLKyp+cCxyJp9Kz8BIwO3moRl8BTwb64Xh8uglf4Cab2cYmylGap6bl+ncLWlCP/wO/ulUqT3TG0QAAAABJRU5ErkJggg==\n", "text/latex": [ "$\\displaystyle 63.7758014528955$" ], "text/plain": [ "63.7758014528955" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(1.11309771845121*180/pi).evalf()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To get a camera viewport $ (c-h) \\times (b-h) $" ] }, { "cell_type": "code", "execution_count": null, "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.8.10" } }, "nbformat": 4, "nbformat_minor": 4 }