documents/analysis/ds_sympy.ipynb
{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "code", "execution_count": 2, "id": "efd6143b", "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import sympy\n", "from sympy import exp\n", "\n", "t = sympy.Symbol('t')\n", "twp = sympy.Symbol('twp')\n", "tref = sympy.Symbol('tref')\n", "E = sympy.Symbol('E')\n", "c2 = sympy.Symbol('c2')\n", "p = sympy.Symbol('p')\n", "dE = sympy.Symbol('dE')\n", "El = sympy.Symbol('El')\n", "\n" ] }, { "cell_type": "code", "execution_count": 3, "id": "515e621e", "metadata": {}, "outputs": [], "source": [ "def f(E,t):\n", " return exp(- c2*E*(t-tref))" ] }, { "cell_type": "code", "execution_count": 4, "id": "c6e796f9", "metadata": {}, "outputs": [], "source": [ "E1 = El - p*dE\n", "E2 = El + (1-p)*dE\n", "xl = f(El, twp)\n", "x1 = f(E1, twp)\n", "x2 = f(E2, twp)" ] }, { "cell_type": "code", "execution_count": 5, "id": "ada4205a", "metadata": {}, "outputs": [], "source": [ "xpl = sympy.diff(xl,twp)\n", "xp1 = sympy.diff(x1,twp)\n", "xp2 = sympy.diff(x2,twp)" ] }, { "cell_type": "code", "execution_count": 6, "id": "a3a0dc8a", "metadata": {}, "outputs": [], "source": [ "w1 = (x2 - xl)/(x2 - x1)\n", "w2 = (xl - x1)/(x2 - x1)" ] }, { "cell_type": "code", "execution_count": 7, "id": "f24f64f6", "metadata": {}, "outputs": [], "source": [ "wp1 = sympy.diff(w1,twp)\n", "wp2 = sympy.diff(w2,twp)" ] }, { "cell_type": "code", "execution_count": 8, "id": "ba18354c", "metadata": {}, "outputs": [], "source": [ "Stilde = w1*f(E1,t)+w2*f(E2,t) + f(E1,t)*wp1*(t - tref) + f(E2,t)*wp2*(t - tref)\n", "S = f(El,t)" ] }, { "cell_type": "code", "execution_count": 9, "id": "dce54f7a", "metadata": {}, "outputs": [], "source": [ "dq=sympy.simplify(sympy.diff(Stilde - S,p))" ] }, { "cell_type": "code", "execution_count": 10, "id": "c20e358c", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\frac{c_{2} dE \\left(c_{2} \\left(t - tref\\right)^{2} \\left(\\left(El e^{El c_{2} \\left(tref - twp\\right)} + \\left(- El + dE p\\right) e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)}\\right) \\left(e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)} - e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)}\\right) + \\left(\\left(- El + dE \\left(p - 1\\right)\\right) e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)} + \\left(El - dE p\\right) e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)}\\right) \\left(- e^{El c_{2} \\left(tref - twp\\right)} + e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)}\\right)\\right) e^{c_{2} \\left(t - tref\\right) \\left(7 El - 4 dE p - 3 dE \\left(p - 1\\right)\\right)} - c_{2} \\left(t - tref\\right)^{2} \\left(\\left(El e^{El c_{2} \\left(tref - twp\\right)} + \\left(- El + dE \\left(p - 1\\right)\\right) e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)}\\right) \\left(e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)} - e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)}\\right) - \\left(\\left(- El + dE \\left(p - 1\\right)\\right) e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)} + \\left(El - dE p\\right) e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)}\\right) \\left(e^{El c_{2} \\left(tref - twp\\right)} - e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)}\\right)\\right) e^{c_{2} \\left(t - tref\\right) \\left(7 El - 3 dE p - 4 dE \\left(p - 1\\right)\\right)} + \\left(t - tref\\right) \\left(c_{2} \\left(tref - twp\\right) \\left(El e^{El c_{2} \\left(tref - twp\\right)} + \\left(- El + dE p\\right) e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)}\\right) \\left(e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)} - e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)}\\right) - 2 c_{2} \\left(tref - twp\\right) \\left(\\left(- El + dE \\left(p - 1\\right)\\right) e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)} + \\left(El - dE p\\right) e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)}\\right) \\left(e^{El c_{2} \\left(tref - twp\\right)} - e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)}\\right) - c_{2} \\left(tref - twp\\right) \\left(\\left(- El + dE \\left(p - 1\\right)\\right) e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)} + \\left(El - dE p\\right) e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)}\\right) e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)} + \\left(c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right) + 1\\right) \\left(e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)} - e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)}\\right) e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)} + \\left(e^{El c_{2} \\left(tref - twp\\right)} - e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)}\\right) \\left(c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right) e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)} - c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right) e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)} + e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)} - e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)}\\right)\\right) e^{c_{2} \\left(t - tref\\right) \\left(7 El - 4 dE p - 3 dE \\left(p - 1\\right)\\right)} + \\left(t - tref\\right) \\left(- c_{2} \\left(tref - twp\\right) \\left(El e^{El c_{2} \\left(tref - twp\\right)} + \\left(- El + dE \\left(p - 1\\right)\\right) e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)}\\right) \\left(e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)} - e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)}\\right) + 2 c_{2} \\left(tref - twp\\right) \\left(\\left(- El + dE \\left(p - 1\\right)\\right) e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)} + \\left(El - dE p\\right) e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)}\\right) \\left(e^{El c_{2} \\left(tref - twp\\right)} - e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)}\\right) + c_{2} \\left(tref - twp\\right) \\left(\\left(- El + dE \\left(p - 1\\right)\\right) e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)} + \\left(El - dE p\\right) e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)}\\right) e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)} - \\left(c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right) + 1\\right) \\left(e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)} - e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)}\\right) e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)} + \\left(e^{El c_{2} \\left(tref - twp\\right)} - e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)}\\right) \\left(- c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right) e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)} + c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right) e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)} - e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)} + e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)}\\right)\\right) e^{c_{2} \\left(t - tref\\right) \\left(7 El - 3 dE p - 4 dE \\left(p - 1\\right)\\right)} - \\left(tref - twp\\right) \\left(e^{El c_{2} \\left(tref - twp\\right)} - e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)}\\right) \\left(e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)} - e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)}\\right) e^{c_{2} \\left(t - tref\\right) \\left(7 El - 4 dE p - 3 dE \\left(p - 1\\right)\\right)} + \\left(tref - twp\\right) \\left(e^{El c_{2} \\left(tref - twp\\right)} - e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)}\\right) \\left(e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)} - e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)}\\right) e^{c_{2} \\left(t - tref\\right) \\left(7 El - 3 dE p - 4 dE \\left(p - 1\\right)\\right)} + \\left(- \\left(t - tref\\right) \\left(e^{El c_{2} \\left(tref - twp\\right)} - e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)}\\right) + \\left(- tref + twp\\right) e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)}\\right) \\left(e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)} - e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)}\\right) e^{c_{2} \\left(t - tref\\right) \\left(7 El - 4 dE p - 3 dE \\left(p - 1\\right)\\right)} + \\left(\\left(t - tref\\right) \\left(e^{El c_{2} \\left(tref - twp\\right)} - e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)}\\right) + \\left(tref - twp\\right) e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)}\\right) \\left(e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)} - e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)}\\right) e^{c_{2} \\left(t - tref\\right) \\left(7 El - 3 dE p - 4 dE \\left(p - 1\\right)\\right)}\\right) e^{4 c_{2} \\left(t - tref\\right) \\left(- 2 El + dE p + dE \\left(p - 1\\right)\\right)}}{\\left(e^{c_{2} \\left(El - dE p\\right) \\left(tref - twp\\right)} - e^{c_{2} \\left(El - dE \\left(p - 1\\right)\\right) \\left(tref - twp\\right)}\\right)^{2}}$" ], "text/plain": [ "c2*dE*(c2*(t - tref)**2*((El*exp(El*c2*(tref - twp)) + (-El + dE*p)*exp(c2*(El - dE*p)*(tref - twp)))*(exp(c2*(El - dE*p)*(tref - twp)) - exp(c2*(El - dE*(p - 1))*(tref - twp))) + ((-El + dE*(p - 1))*exp(c2*(El - dE*(p - 1))*(tref - twp)) + (El - dE*p)*exp(c2*(El - dE*p)*(tref - twp)))*(-exp(El*c2*(tref - twp)) + exp(c2*(El - dE*p)*(tref - twp))))*exp(c2*(t - tref)*(7*El - 4*dE*p - 3*dE*(p - 1))) - c2*(t - tref)**2*((El*exp(El*c2*(tref - twp)) + (-El + dE*(p - 1))*exp(c2*(El - dE*(p - 1))*(tref - twp)))*(exp(c2*(El - dE*p)*(tref - twp)) - exp(c2*(El - dE*(p - 1))*(tref - twp))) - ((-El + dE*(p - 1))*exp(c2*(El - dE*(p - 1))*(tref - twp)) + (El - dE*p)*exp(c2*(El - dE*p)*(tref - twp)))*(exp(El*c2*(tref - twp)) - exp(c2*(El - dE*(p - 1))*(tref - twp))))*exp(c2*(t - tref)*(7*El - 3*dE*p - 4*dE*(p - 1))) + (t - tref)*(c2*(tref - twp)*(El*exp(El*c2*(tref - twp)) + (-El + dE*p)*exp(c2*(El - dE*p)*(tref - twp)))*(exp(c2*(El - dE*p)*(tref - twp)) - exp(c2*(El - dE*(p - 1))*(tref - twp))) - 2*c2*(tref - twp)*((-El + dE*(p - 1))*exp(c2*(El - dE*(p - 1))*(tref - twp)) + (El - dE*p)*exp(c2*(El - dE*p)*(tref - twp)))*(exp(El*c2*(tref - twp)) - exp(c2*(El - dE*p)*(tref - twp))) - c2*(tref - twp)*((-El + dE*(p - 1))*exp(c2*(El - dE*(p - 1))*(tref - twp)) + (El - dE*p)*exp(c2*(El - dE*p)*(tref - twp)))*exp(c2*(El - dE*p)*(tref - twp)) + (c2*(El - dE*p)*(tref - twp) + 1)*(exp(c2*(El - dE*p)*(tref - twp)) - exp(c2*(El - dE*(p - 1))*(tref - twp)))*exp(c2*(El - dE*p)*(tref - twp)) + (exp(El*c2*(tref - twp)) - exp(c2*(El - dE*p)*(tref - twp)))*(c2*(El - dE*p)*(tref - twp)*exp(c2*(El - dE*p)*(tref - twp)) - c2*(El - dE*(p - 1))*(tref - twp)*exp(c2*(El - dE*(p - 1))*(tref - twp)) + exp(c2*(El - dE*p)*(tref - twp)) - exp(c2*(El - dE*(p - 1))*(tref - twp))))*exp(c2*(t - tref)*(7*El - 4*dE*p - 3*dE*(p - 1))) + (t - tref)*(-c2*(tref - twp)*(El*exp(El*c2*(tref - twp)) + (-El + dE*(p - 1))*exp(c2*(El - dE*(p - 1))*(tref - twp)))*(exp(c2*(El - dE*p)*(tref - twp)) - exp(c2*(El - dE*(p - 1))*(tref - twp))) + 2*c2*(tref - twp)*((-El + dE*(p - 1))*exp(c2*(El - dE*(p - 1))*(tref - twp)) + (El - dE*p)*exp(c2*(El - dE*p)*(tref - twp)))*(exp(El*c2*(tref - twp)) - exp(c2*(El - dE*(p - 1))*(tref - twp))) + c2*(tref - twp)*((-El + dE*(p - 1))*exp(c2*(El - dE*(p - 1))*(tref - twp)) + (El - dE*p)*exp(c2*(El - dE*p)*(tref - twp)))*exp(c2*(El - dE*(p - 1))*(tref - twp)) - (c2*(El - dE*(p - 1))*(tref - twp) + 1)*(exp(c2*(El - dE*p)*(tref - twp)) - exp(c2*(El - dE*(p - 1))*(tref - twp)))*exp(c2*(El - dE*(p - 1))*(tref - twp)) + (exp(El*c2*(tref - twp)) - exp(c2*(El - dE*(p - 1))*(tref - twp)))*(-c2*(El - dE*p)*(tref - twp)*exp(c2*(El - dE*p)*(tref - twp)) + c2*(El - dE*(p - 1))*(tref - twp)*exp(c2*(El - dE*(p - 1))*(tref - twp)) - exp(c2*(El - dE*p)*(tref - twp)) + exp(c2*(El - dE*(p - 1))*(tref - twp))))*exp(c2*(t - tref)*(7*El - 3*dE*p - 4*dE*(p - 1))) - (tref - twp)*(exp(El*c2*(tref - twp)) - exp(c2*(El - dE*p)*(tref - twp)))*(exp(c2*(El - dE*p)*(tref - twp)) - exp(c2*(El - dE*(p - 1))*(tref - twp)))*exp(c2*(t - tref)*(7*El - 4*dE*p - 3*dE*(p - 1))) + (tref - twp)*(exp(El*c2*(tref - twp)) - exp(c2*(El - dE*(p - 1))*(tref - twp)))*(exp(c2*(El - dE*p)*(tref - twp)) - exp(c2*(El - dE*(p - 1))*(tref - twp)))*exp(c2*(t - tref)*(7*El - 3*dE*p - 4*dE*(p - 1))) + (-(t - tref)*(exp(El*c2*(tref - twp)) - exp(c2*(El - dE*p)*(tref - twp))) + (-tref + twp)*exp(c2*(El - dE*p)*(tref - twp)))*(exp(c2*(El - dE*p)*(tref - twp)) - exp(c2*(El - dE*(p - 1))*(tref - twp)))*exp(c2*(t - tref)*(7*El - 4*dE*p - 3*dE*(p - 1))) + ((t - tref)*(exp(El*c2*(tref - twp)) - exp(c2*(El - dE*(p - 1))*(tref - twp))) + (tref - twp)*exp(c2*(El - dE*(p - 1))*(tref - twp)))*(exp(c2*(El - dE*p)*(tref - twp)) - exp(c2*(El - dE*(p - 1))*(tref - twp)))*exp(c2*(t - tref)*(7*El - 3*dE*p - 4*dE*(p - 1))))*exp(4*c2*(t - tref)*(-2*El + dE*p + dE*(p - 1)))/(exp(c2*(El - dE*p)*(tref - twp)) - exp(c2*(El - dE*(p - 1))*(tref - twp)))**2" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dq" ] }, { "cell_type": "code", "execution_count": 11, "id": "be786709", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle - \\frac{c_{2} dE \\left(t e^{c_{2} dE \\left(p tref + t + twp\\right)} - t e^{c_{2} dE \\left(p tref + tref + twp\\right)} - t e^{c_{2} dE \\left(p twp + t + tref\\right)} + t e^{c_{2} dE \\left(p twp + tref + twp\\right)} + tref e^{c_{2} dE \\left(p twp + t + tref\\right)} - tref e^{c_{2} dE \\left(p twp + tref + twp\\right)} - twp e^{c_{2} dE \\left(p tref + t + twp\\right)} + twp e^{c_{2} dE \\left(p tref + tref + twp\\right)}\\right) e^{- c_{2} \\left(El t - El tref - dE p t + dE p tref + dE p twp + dE t\\right)}}{e^{c_{2} dE tref} - e^{c_{2} dE twp}}$" ], "text/plain": [ "-c2*dE*(t*exp(c2*dE*(p*tref + t + twp)) - t*exp(c2*dE*(p*tref + tref + twp)) - t*exp(c2*dE*(p*twp + t + tref)) + t*exp(c2*dE*(p*twp + tref + twp)) + tref*exp(c2*dE*(p*twp + t + tref)) - tref*exp(c2*dE*(p*twp + tref + twp)) - twp*exp(c2*dE*(p*tref + t + twp)) + twp*exp(c2*dE*(p*tref + tref + twp)))*exp(-c2*(El*t - El*tref - dE*p*t + dE*p*tref + dE*p*twp + dE*t))/(exp(c2*dE*tref) - exp(c2*dE*twp))" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "\n", "ww= sympy.simplify(dq)\n", "ww" ] }, { "cell_type": "code", "execution_count": 12, "id": "135dd1f7", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle - \\frac{c_{2} dE \\left(t e^{c_{2} dE \\left(tref + 1.5 twp\\right)} - t e^{c_{2} dE \\left(1.5 tref + twp\\right)} + t e^{c_{2} dE \\left(t + 0.5 tref + twp\\right)} - t e^{c_{2} dE \\left(t + tref + 0.5 twp\\right)} - tref e^{c_{2} dE \\left(tref + 1.5 twp\\right)} + tref e^{c_{2} dE \\left(t + tref + 0.5 twp\\right)} + twp e^{c_{2} dE \\left(1.5 tref + twp\\right)} - twp e^{c_{2} dE \\left(t + 0.5 tref + twp\\right)}\\right) e^{- c_{2} \\left(El t - El tref + 0.5 dE t + 0.5 dE tref + 0.5 dE twp\\right)}}{e^{c_{2} dE tref} - e^{c_{2} dE twp}}$" ], "text/plain": [ "-c2*dE*(t*exp(c2*dE*(tref + 1.5*twp)) - t*exp(c2*dE*(1.5*tref + twp)) + t*exp(c2*dE*(t + 0.5*tref + twp)) - t*exp(c2*dE*(t + tref + 0.5*twp)) - tref*exp(c2*dE*(tref + 1.5*twp)) + tref*exp(c2*dE*(t + tref + 0.5*twp)) + twp*exp(c2*dE*(1.5*tref + twp)) - twp*exp(c2*dE*(t + 0.5*tref + twp)))*exp(-c2*(El*t - El*tref + 0.5*dE*t + 0.5*dE*tref + 0.5*dE*twp))/(exp(c2*dE*tref) - exp(c2*dE*twp))" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sympy.simplify(ww.subs([(p,1/2)]))" ] }, { "cell_type": "code", "execution_count": 11, "id": "bffe59dd", "metadata": {}, "outputs": [ { "ename": "KeyboardInterrupt", "evalue": "", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", "\u001b[0;32m/tmp/ipykernel_4558/1805557983.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mans\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msympy\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msolve\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msympy\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mEq\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdq\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mp\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;32m~/anaconda3/lib/python3.8/site-packages/sympy/solvers/solvers.py\u001b[0m in \u001b[0;36msolve\u001b[0;34m(f, *symbols, **flags)\u001b[0m\n\u001b[1;32m 1093\u001b[0m \u001b[0;31m###########################################################################\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1094\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mbare_f\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1095\u001b[0;31m \u001b[0msolution\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_solve\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mf\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0msymbols\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mflags\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1096\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1097\u001b[0m \u001b[0msolution\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_solve_system\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mf\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msymbols\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mflags\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/anaconda3/lib/python3.8/site-packages/sympy/solvers/solvers.py\u001b[0m in \u001b[0;36m_solve\u001b[0;34m(f, *symbols, **flags)\u001b[0m\n\u001b[1;32m 1704\u001b[0m \u001b[0mflags\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'tsolve'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m# allow tsolve to be used on next pass\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1705\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1706\u001b[0;31m \u001b[0msoln\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_tsolve\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mf_num\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msymbol\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mflags\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1707\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0msoln\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1708\u001b[0m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msoln\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/anaconda3/lib/python3.8/site-packages/sympy/solvers/solvers.py\u001b[0m in \u001b[0;36m_tsolve\u001b[0;34m(eq, sym, **flags)\u001b[0m\n\u001b[1;32m 2743\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mpos\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mhas\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mu\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2744\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2745\u001b[0;31m \u001b[0msoln\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_solve\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpos\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mu\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mflags\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2746\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mlist\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mordered\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0ms\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msubs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mreps\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0ms\u001b[0m \u001b[0;32min\u001b[0m \u001b[0msoln\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2747\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mNotImplementedError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/anaconda3/lib/python3.8/site-packages/sympy/solvers/solvers.py\u001b[0m in \u001b[0;36m_solve\u001b[0;34m(f, *symbols, **flags)\u001b[0m\n\u001b[1;32m 1381\u001b[0m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mset\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1382\u001b[0m \u001b[0;32mbreak\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1383\u001b[0;31m \u001b[0msoln\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_solve\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mm\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msymbol\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mflags\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1384\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mupdate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mset\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msoln\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1385\u001b[0m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mlist\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mresult\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/anaconda3/lib/python3.8/site-packages/sympy/solvers/solvers.py\u001b[0m in \u001b[0;36m_solve\u001b[0;34m(f, *symbols, **flags)\u001b[0m\n\u001b[1;32m 1715\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1716\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mflags\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'simplify'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1717\u001b[0;31m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mlist\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmap\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msimplify\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1718\u001b[0m \u001b[0;31m# we just simplified the solution so we now set the flag to\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1719\u001b[0m \u001b[0;31m# False so the simplification doesn't happen again in checksol()\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/anaconda3/lib/python3.8/site-packages/sympy/simplify/simplify.py\u001b[0m in \u001b[0;36msimplify\u001b[0;34m(expr, ratio, measure, rational, inverse, doit, **kwargs)\u001b[0m\n\u001b[1;32m 721\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 722\u001b[0m \u001b[0mshort\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mshorter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpowsimp\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mexpr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcombine\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'exp'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdeep\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpowsimp\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mexpr\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexpr\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 723\u001b[0;31m \u001b[0mshort\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mshorter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mshort\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcancel\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mshort\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 724\u001b[0m \u001b[0mshort\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mshorter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mshort\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfactor_terms\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mshort\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexpand_power_exp\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mexpand_mul\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mshort\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 725\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mshort\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mhas\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mTrigonometricFunction\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mHyperbolicFunction\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mExpBase\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexp\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/anaconda3/lib/python3.8/site-packages/sympy/simplify/simplify.py\u001b[0m in \u001b[0;36mshorter\u001b[0;34m(*choices)\u001b[0m\n\u001b[1;32m 571\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mhas_variety\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mchoices\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 572\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mchoices\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 573\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mchoices\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mmeasure\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 574\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 575\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mdone\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/anaconda3/lib/python3.8/site-packages/sympy/core/function.py\u001b[0m in \u001b[0;36mcount_ops\u001b[0;34m(expr, visual)\u001b[0m\n\u001b[1;32m 3221\u001b[0m \u001b[0mo\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mSymbol\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ma\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__name__\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mupper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3222\u001b[0m \u001b[0;31m# count the args\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3223\u001b[0;31m \u001b[0mops\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mo\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ma\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m-\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3224\u001b[0m elif a.args and (\n\u001b[1;32m 3225\u001b[0m \u001b[0ma\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mis_Pow\u001b[0m \u001b[0;32mor\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/anaconda3/lib/python3.8/site-packages/sympy/core/decorators.py\u001b[0m in \u001b[0;36m_func\u001b[0;34m(self, other)\u001b[0m\n\u001b[1;32m 264\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mother\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexpectedcls\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 265\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mretval\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 266\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mother\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 267\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 268\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0m_func\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/anaconda3/lib/python3.8/site-packages/sympy/core/decorators.py\u001b[0m in \u001b[0;36mbinary_op_wrapper\u001b[0;34m(self, other)\u001b[0m\n\u001b[1;32m 134\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mf\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 135\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 136\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mother\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 137\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mbinary_op_wrapper\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 138\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mpriority_decorator\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mKeyboardInterrupt\u001b[0m: " ] } ], "source": [ "ans = sympy.solve(sympy.Eq(dq,0),p)" ] }, { "cell_type": "code", "execution_count": 16, "id": "fac86abd", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[(c2*dE*tref - c2*dE*twp - log((t*exp(c2*dE*t) - t*exp(c2*dE*tref) - twp*exp(c2*dE*t) + twp*exp(c2*dE*tref))/(t*exp(c2*dE*t) - t*exp(c2*dE*twp) - tref*exp(c2*dE*t) + tref*exp(c2*dE*twp))))/(c2*dE*(tref - twp))]" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ans" ] }, { "cell_type": "code", "execution_count": 15, "id": "a36a4594", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle - \\frac{c_{2} dE \\left(t e^{c_{2} dE \\left(p tref + t + twp\\right)} - t e^{c_{2} dE \\left(p tref + tref + twp\\right)} - t e^{c_{2} dE \\left(p twp + t + tref\\right)} + t e^{c_{2} dE \\left(p twp + tref + twp\\right)} + tref e^{c_{2} dE \\left(p twp + t + tref\\right)} - tref e^{c_{2} dE \\left(p twp + tref + twp\\right)} - twp e^{c_{2} dE \\left(p tref + t + twp\\right)} + twp e^{c_{2} dE \\left(p tref + tref + twp\\right)}\\right) e^{- c_{2} \\left(El t - El tref - dE p t + dE p tref + dE p twp + dE t\\right)}}{e^{c_{2} dE tref} - e^{c_{2} dE twp}}$" ], "text/plain": [ "-c2*dE*(t*exp(c2*dE*(p*tref + t + twp)) - t*exp(c2*dE*(p*tref + tref + twp)) - t*exp(c2*dE*(p*twp + t + tref)) + t*exp(c2*dE*(p*twp + tref + twp)) + tref*exp(c2*dE*(p*twp + t + tref)) - tref*exp(c2*dE*(p*twp + tref + twp)) - twp*exp(c2*dE*(p*tref + t + twp)) + twp*exp(c2*dE*(p*tref + tref + twp)))*exp(-c2*(El*t - El*tref - dE*p*t + dE*p*tref + dE*p*twp + dE*t))/(exp(c2*dE*tref) - exp(c2*dE*twp))" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ww" ] }, { "cell_type": "code", "execution_count": null, "id": "03631072", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3.8.5 ('base')", "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.8" }, "vscode": { "interpreter": { "hash": "72bc7f8b1808a6f5ada3c6a20601509b8b1843160436d276d47f2ba819b3753b" } } }, "nbformat": 4, "nbformat_minor": 5}