{ "cells": [ { "cell_type": "code", "execution_count": 63, "id": "ad74460d", "metadata": {}, "outputs": [], "source": [ "from sympy import simplify, expand, dsolve, Function , Derivative, Eq, sqrt, sin, I, exp, pi, \\\n", " expand_power_exp, symbols, integrate, oo, diff, powsimp, solveset\n", "from sympy.abc import k,A,B" ] }, { "cell_type": "code", "execution_count": 2, "id": "87551240", "metadata": {}, "outputs": [], "source": [ "x,t,m,E = symbols(\"x t m E\", positive=True, real=True)\n", "C3 = symbols(\"C_3\")" ] }, { "cell_type": "code", "execution_count": 3, "id": "c0560e4e", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\hbar$" ], "text/plain": [ "hbar" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "hbar = symbols(\"hbar\")\n", "hbar" ] }, { "cell_type": "code", "execution_count": 4, "id": "019d8c59", "metadata": {}, "outputs": [], "source": [ "Psi = Function(\"Psi\")\n", "psi = Function(\"psi\")\n", "phi= Function(\"phi\")\n", "v = Function(\"V\")" ] }, { "cell_type": "code", "execution_count": 5, "id": "ce39b2a5", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle i \\hbar \\frac{\\partial}{\\partial t} \\Psi{\\left(x,t \\right)} = - \\frac{\\hbar^{2} \\frac{\\partial^{2}}{\\partial x^{2}} \\Psi{\\left(x,t \\right)}}{2 m} + \\Psi{\\left(x,t \\right)} V{\\left(x \\right)}$" ], "text/plain": [ "Eq(I*hbar*Derivative(Psi(x, t), t), -hbar**2*Derivative(Psi(x, t), (x, 2))/(2*m) + Psi(x, t)*V(x))" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "seqn = Eq(I*hbar*Derivative(Psi(x,t),t), -hbar**2/(2*m)*Derivative(Psi(x,t),x,x) + Psi(x,t)*v(x))\n", "seqn" ] }, { "cell_type": "markdown", "id": "0cd0d925", "metadata": {}, "source": [ "Subsitute $ \\Psi(x,t) $ with $ \\psi(x) \\phi(t) $ and then perform the differentiation and divide through by the same functions." ] }, { "cell_type": "code", "execution_count": 6, "id": "c8eb2d2a", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle i \\hbar \\frac{\\partial}{\\partial t} \\phi{\\left(t \\right)} \\psi{\\left(x \\right)} = - \\frac{\\hbar^{2} \\frac{\\partial^{2}}{\\partial x^{2}} \\phi{\\left(t \\right)} \\psi{\\left(x \\right)}}{2 m} + V{\\left(x \\right)} \\phi{\\left(t \\right)} \\psi{\\left(x \\right)}$" ], "text/plain": [ "Eq(I*hbar*Derivative(phi(t)*psi(x), t), -hbar**2*Derivative(phi(t)*psi(x), (x, 2))/(2*m) + V(x)*phi(t)*psi(x))" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sseqn = seqn.subs(Psi(x,t), psi(x)*phi(t))\n", "sseqn" ] }, { "cell_type": "code", "execution_count": 7, "id": "f04910ba", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle i \\hbar \\psi{\\left(x \\right)} \\frac{d}{d t} \\phi{\\left(t \\right)} = - \\frac{\\hbar^{2} \\phi{\\left(t \\right)} \\frac{d^{2}}{d x^{2}} \\psi{\\left(x \\right)}}{2 m} + V{\\left(x \\right)} \\phi{\\left(t \\right)} \\psi{\\left(x \\right)}$" ], "text/plain": [ "Eq(I*hbar*psi(x)*Derivative(phi(t), t), -hbar**2*phi(t)*Derivative(psi(x), (x, 2))/(2*m) + V(x)*phi(t)*psi(x))" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "seqn2 = sseqn.doit()\n", "seqn2" ] }, { "cell_type": "code", "execution_count": 8, "id": "6e8cad71", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\frac{i \\hbar \\frac{d}{d t} \\phi{\\left(t \\right)}}{\\phi{\\left(t \\right)}}$" ], "text/plain": [ "I*hbar*Derivative(phi(t), t)/phi(t)" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "slhs = seqn2.args[0]/(phi(t)*psi(x))\n", "slhs" ] }, { "cell_type": "code", "execution_count": 9, "id": "bc71359e", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle - \\frac{\\hbar^{2} \\frac{d^{2}}{d x^{2}} \\psi{\\left(x \\right)}}{2 m \\psi{\\left(x \\right)}}$" ], "text/plain": [ "-hbar**2*Derivative(psi(x), (x, 2))/(2*m*psi(x))" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "srhs = seqn2.args[1]/(phi(t)*psi(x))\n", "srhs = srhs.simplify()\n", "# assume v(x) == 0 for a free particle\n", "srhs = srhs.subs(v(x),0)\n", "srhs" ] }, { "cell_type": "code", "execution_count": 10, "id": "d9b8ed96", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\phi{\\left(t \\right)} = C_{1} e^{- \\frac{i k^{2} t}{\\hbar}}$" ], "text/plain": [ "Eq(phi(t), C1*exp(-I*k**2*t/hbar))" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# dsolve seems to need phi(t) not just phi otherwise an obscure error occurs\n", "d1 = dsolve(Eq(slhs, k**2), phi(t))\n", "d1" ] }, { "cell_type": "code", "execution_count": 11, "id": "c4f41dcc", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle - \\frac{i C_{1} k^{2} e^{- \\frac{i k^{2} t}{\\hbar}}}{\\hbar}$" ], "text/plain": [ "-I*C1*k**2*exp(-I*k**2*t/hbar)/hbar" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "diff(d1.args[1],t)" ] }, { "cell_type": "code", "execution_count": 12, "id": "20436c84", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\phi{\\left(t \\right)} = C_{1} e^{- \\frac{i E t}{\\hbar}}$" ], "text/plain": [ "Eq(phi(t), C1*exp(-I*E*t/hbar))" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "d1 = d1.subs(k**2, E)\n", "d1" ] }, { "cell_type": "code", "execution_count": 13, "id": "29ec466d", "metadata": {}, "outputs": [], "source": [ "def get_symbol(name, symset):\n", " syms = list(symset)\n", " for sym in syms:\n", " if sym.name == name:\n", " return sym\n", " return None\n" ] }, { "cell_type": "code", "execution_count": 14, "id": "0d9cea11", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle C_{1}$" ], "text/plain": [ "C1" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "C1 = get_symbol(\"C1\", d1.free_symbols)\n", "C1" ] }, { "cell_type": "code", "execution_count": 15, "id": "eba588f5", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\phi{\\left(t \\right)} = C_{3} e^{- \\frac{i E t}{\\hbar}}$" ], "text/plain": [ "Eq(phi(t), C_3*exp(-I*E*t/hbar))" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "d1 = d1.subs(C1, C3)\n", "d1" ] }, { "cell_type": "code", "execution_count": 16, "id": "77e3ea67", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\psi{\\left(x \\right)} = C_{1} e^{- \\frac{\\sqrt{2} i k \\sqrt{m} x}{\\hbar}} + C_{2} e^{\\frac{\\sqrt{2} i k \\sqrt{m} x}{\\hbar}}$" ], "text/plain": [ "Eq(psi(x), C1*exp(-sqrt(2)*I*k*sqrt(m)*x/hbar) + C2*exp(sqrt(2)*I*k*sqrt(m)*x/hbar))" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "d2 = dsolve(Eq(srhs, k**2), psi(x))\n", "d2" ] }, { "cell_type": "code", "execution_count": 17, "id": "7745f005", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\psi{\\left(x \\right)} = C_{1} e^{- \\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar}} + C_{2} e^{\\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar}}$" ], "text/plain": [ "Eq(psi(x), C1*exp(-sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar) + C2*exp(sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar))" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "d2 = d2.subs(k, sqrt(E))\n", "d2" ] }, { "cell_type": "code", "execution_count": 18, "id": "9097959c", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\psi{\\left(x \\right)} = C_{1} e^{\\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar}} + C_{2} e^{- \\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar}}$" ], "text/plain": [ "Eq(psi(x), C1*exp(sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar) + C2*exp(-sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar))" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "d2i = d2.subs(I, -I)\n", "d2i" ] }, { "cell_type": "code", "execution_count": 19, "id": "cc8300ca", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle - \\frac{2 E m \\left(C_{1} e^{\\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar}} + C_{2} e^{- \\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar}}\\right)}{\\hbar^{2}}$" ], "text/plain": [ "-2*E*m*(C1*exp(sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar) + C2*exp(-sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar))/hbar**2" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "diff(d2i.args[1], x, x)" ] }, { "cell_type": "code", "execution_count": 20, "id": "9af2e36b", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\phi{\\left(t \\right)} = C_{3} e^{\\frac{i E t}{\\hbar}}$" ], "text/plain": [ "Eq(phi(t), C_3*exp(I*E*t/hbar))" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "d1i = d1.subs(I, -I)\n", "d1i" ] }, { "cell_type": "code", "execution_count": 21, "id": "a32cc1c6", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle C_{3}^{2}$" ], "text/plain": [ "C_3**2" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "d1conj = d1i.args[1]*d1.args[1]\n", "d1conj" ] }, { "cell_type": "code", "execution_count": 22, "id": "dcb7496b", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle C_{1}^{2} + C_{1} C_{2} e^{\\frac{2 \\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar}} + C_{1} C_{2} e^{- \\frac{2 \\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar}} + C_{2}^{2}$" ], "text/plain": [ "C1**2 + C1*C2*exp(2*sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar) + C1*C2*exp(-2*sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar) + C2**2" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "d2conj = (d2.args[1]*d2i.args[1]).expand()\n", "d2conj" ] }, { "cell_type": "code", "execution_count": 23, "id": "0549e14d", "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle C_{1}^{2} + 2 C_{1} C_{2} \\cos{\\left(\\frac{2 \\sqrt{2} \\sqrt{E} \\sqrt{m} x}{\\hbar} \\right)} + C_{2}^{2}$" ], "text/plain": [ "C1**2 + 2*C1*C2*cos(2*sqrt(2)*sqrt(E)*sqrt(m)*x/hbar) + C2**2" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "d2expand = d2conj.rewrite(sin).simplify()\n", "d2expand" ] }, { "cell_type": "code", "execution_count": 24, "id": "aaaae1a9", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle i \\hbar \\psi{\\left(x \\right)} \\frac{d}{d t} \\phi{\\left(t \\right)} = - \\frac{\\hbar^{2} \\phi{\\left(t \\right)} \\frac{d^{2}}{d x^{2}} \\psi{\\left(x \\right)}}{2 m} + V{\\left(x \\right)} \\phi{\\left(t \\right)} \\psi{\\left(x \\right)}$" ], "text/plain": [ "Eq(I*hbar*psi(x)*Derivative(phi(t), t), -hbar**2*phi(t)*Derivative(psi(x), (x, 2))/(2*m) + V(x)*phi(t)*psi(x))" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "seqn2" ] }, { "cell_type": "code", "execution_count": 25, "id": "296ecf28", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle C_{3} E \\left(C_{1} e^{- \\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar}} + C_{2} e^{\\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar}}\\right) e^{- \\frac{i E t}{\\hbar}} = C_{3} E \\left(C_{1} e^{- \\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar}} + C_{2} e^{\\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar}}\\right) e^{- \\frac{i E t}{\\hbar}} + C_{3} \\left(C_{1} e^{- \\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar}} + C_{2} e^{\\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar}}\\right) V{\\left(x \\right)} e^{- \\frac{i E t}{\\hbar}}$" ], "text/plain": [ "Eq(C_3*E*(C1*exp(-sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar) + C2*exp(sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar))*exp(-I*E*t/hbar), C_3*E*(C1*exp(-sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar) + C2*exp(sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar))*exp(-I*E*t/hbar) + C_3*(C1*exp(-sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar) + C2*exp(sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar))*V(x)*exp(-I*E*t/hbar))" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "seqnsubs = seqn2.subs([(phi(t),d1.args[1]), (psi(x), d2.args[1])]).doit()\n", "seqnsubs" ] }, { "cell_type": "code", "execution_count": 29, "id": "cb97387b", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle C_{1} C_{3} E e^{- \\frac{i E t}{\\hbar}} e^{- \\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar}} + C_{2} C_{3} E e^{- \\frac{i E t}{\\hbar}} e^{\\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar}} = C_{1} C_{3} E e^{- \\frac{i E t}{\\hbar}} e^{- \\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar}} + C_{1} C_{3} V{\\left(x \\right)} e^{- \\frac{i E t}{\\hbar}} e^{- \\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar}} + C_{2} C_{3} E e^{- \\frac{i E t}{\\hbar}} e^{\\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar}} + C_{2} C_{3} V{\\left(x \\right)} e^{- \\frac{i E t}{\\hbar}} e^{\\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar}}$" ], "text/plain": [ "Eq(C1*C_3*E*exp(-I*E*t/hbar)*exp(-sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar) + C2*C_3*E*exp(-I*E*t/hbar)*exp(sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar), C1*C_3*E*exp(-I*E*t/hbar)*exp(-sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar) + C1*C_3*V(x)*exp(-I*E*t/hbar)*exp(-sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar) + C2*C_3*E*exp(-I*E*t/hbar)*exp(sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar) + C2*C_3*V(x)*exp(-I*E*t/hbar)*exp(sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar))" ] }, "execution_count": 29, "metadata": {}, "output_type": "execute_result" } ], "source": [ "seqnsubs2 = seqnsubs.simplify().expand()\n", "seqnsubs2" ] }, { "cell_type": "code", "execution_count": 44, "id": "f6402f39", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle C_{1} C_{3} E e^{- \\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar} - \\frac{i E t}{\\hbar}} + C_{2} C_{3} E e^{\\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar} - \\frac{i E t}{\\hbar}}$" ], "text/plain": [ "C1*C_3*E*exp(-sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar - I*E*t/hbar) + C2*C_3*E*exp(sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar - I*E*t/hbar)" ] }, "execution_count": 44, "metadata": {}, "output_type": "execute_result" } ], "source": [ "rhs = powsimp(seqnsubs2.args[1].subs(v(x),0))\n", "rhs" ] }, { "cell_type": "code", "execution_count": 43, "id": "6dfc69a7", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle C_{1} C_{3} E e^{- \\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar} - \\frac{i E t}{\\hbar}} + C_{2} C_{3} E e^{\\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar} - \\frac{i E t}{\\hbar}}$" ], "text/plain": [ "C1*C_3*E*exp(-sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar - I*E*t/hbar) + C2*C_3*E*exp(sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar - I*E*t/hbar)" ] }, "execution_count": 43, "metadata": {}, "output_type": "execute_result" } ], "source": [ "lhs = powsimp(seqnsubs.args[0].expand())\n", "lhs" ] }, { "cell_type": "markdown", "id": "1224c0e2", "metadata": {}, "source": [ "Both the left hand side and right hand sides of the equation are in agreement showing that our result is consistent with getting a valid expression for the solution of the Schrodinger equation." ] }, { "cell_type": "code", "execution_count": 45, "id": "1e197055", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{C1, C2, C_3, E, hbar, m, t, x}" ] }, "execution_count": 45, "metadata": {}, "output_type": "execute_result" } ], "source": [ "lhs.free_symbols" ] }, { "cell_type": "code", "execution_count": 67, "id": "92c01e07", "metadata": {}, "outputs": [], "source": [ "c1 = get_symbol(\"C1\", lhs.free_symbols)\n", "c2 = get_symbol(\"C2\", lhs.free_symbols)\n", "c3 = get_symbol(\"C_3\", lhs.free_symbols)\n", "A,B,L = symbols(\"A B L\")" ] }, { "cell_type": "code", "execution_count": 68, "id": "582f2760", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle A E e^{- \\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar} - \\frac{i E t}{\\hbar}} + B E e^{\\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar} - \\frac{i E t}{\\hbar}}$" ], "text/plain": [ "A*E*exp(-sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar - I*E*t/hbar) + B*E*exp(sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar - I*E*t/hbar)" ] }, "execution_count": 68, "metadata": {}, "output_type": "execute_result" } ], "source": [ "psieqn = lhs.subs([(c1*c3, A ), (c2*c3, B)])\n", "psieqn" ] }, { "cell_type": "code", "execution_count": 69, "id": "a42e36ad", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\frac{\\sqrt{2} i \\sqrt{E} \\hbar \\left(A e^{\\frac{4 \\sqrt{2} i \\sqrt{E} L \\sqrt{m}}{\\hbar}} - B\\right) e^{- \\frac{i \\left(2 \\sqrt{2} \\sqrt{E} L \\sqrt{m} + E t\\right)}{\\hbar}}}{2 \\sqrt{m}} = 1$" ], "text/plain": [ "Eq(sqrt(2)*I*sqrt(E)*hbar*(A*exp(4*sqrt(2)*I*sqrt(E)*L*sqrt(m)/hbar) - B)*exp(-I*(2*sqrt(2)*sqrt(E)*L*sqrt(m) + E*t)/hbar)/(2*sqrt(m)), 1)" ] }, "execution_count": 69, "metadata": {}, "output_type": "execute_result" } ], "source": [ "psiint = Eq( integrate(psieqn, (x, -L- L)).simplify(), 1)\n", "psiint" ] }, { "cell_type": "code", "execution_count": 73, "id": "f2193e9c", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle A e^{\\frac{4 \\sqrt{2} i \\sqrt{E} L \\sqrt{m}}{\\hbar}} + \\frac{\\sqrt{2} i \\sqrt{m} e^{\\frac{i \\left(2 \\sqrt{2} \\sqrt{E} L \\sqrt{m} + E t\\right)}{\\hbar}}}{\\sqrt{E} \\hbar}$" ], "text/plain": [ "A*exp(4*sqrt(2)*I*sqrt(E)*L*sqrt(m)/hbar) + sqrt(2)*I*sqrt(m)*exp(I*(2*sqrt(2)*sqrt(E)*L*sqrt(m) + E*t)/hbar)/(sqrt(E)*hbar)" ] }, "execution_count": 73, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bval = solveset(psiint,B).args[0]\n", "bval" ] }, { "cell_type": "code", "execution_count": 83, "id": "1051089c", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\Psi{\\left(x,t \\right)} = A E e^{- \\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar} - \\frac{i E t}{\\hbar}} + A E e^{\\frac{4 \\sqrt{2} i \\sqrt{E} L \\sqrt{m}}{\\hbar} + \\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar} - \\frac{i E t}{\\hbar}} + \\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} e^{\\frac{2 \\sqrt{2} i \\sqrt{E} L \\sqrt{m}}{\\hbar} + \\frac{\\sqrt{2} i \\sqrt{E} \\sqrt{m} x}{\\hbar}}}{\\hbar}$" ], "text/plain": [ "Eq(Psi(x, t), A*E*exp(-sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar - I*E*t/hbar) + A*E*exp(4*sqrt(2)*I*sqrt(E)*L*sqrt(m)/hbar + sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar - I*E*t/hbar) + sqrt(2)*I*sqrt(E)*sqrt(m)*exp(2*sqrt(2)*I*sqrt(E)*L*sqrt(m)/hbar + sqrt(2)*I*sqrt(E)*sqrt(m)*x/hbar)/hbar)" ] }, "execution_count": 83, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Eq(Psi(x,t), powsimp(psieqn.subs(B, bval).expand()))" ] }, { "cell_type": "code", "execution_count": null, "id": "115b642e", "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": 5 }