{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Solutions Q15 - 30" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# import all python add-ons etc that will be needed later on\n", "%matplotlib inline\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from sympy import *\n", "init_printing() # allows printing of SymPy results in typeset maths format\n", "plt.rcParams.update({'font.size': 16}) # set font size for plots" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Q15 answer\n", "(a) $I=\\int\\cos^3(x)dx$. Trying $u=\\sin(x)$, then $du=\\cos(x) dx$ producing \n", "\n", "$$\\displaystyle I=\\int\\cos^2(x)du=\\int(1-u^2)du=u-u^3/3=\\sin(x)-\\sin^3(x)/2+c$$\n", "\n", "where $c$ is a constant and $\\cos^2+\\sin^2=1$ was used. \n", "\n", "(b) $\\displaystyle I=\\int\\frac{3x}{(5+3x)^4}dx$. Guessing $u=5+3x$ then $du=dx/3$ and substituting gives\n", "\n", "$$\\displaystyle I=\\int\\frac{u-5}{3u^4}du =-\\frac{1}{6u^2}+\\frac{5}{9u^3}=-\\frac{9x+5}{18(5+3x)}+c$$\n", "\n", "and eqn 6 was used.\n", "\n", "(c) $\\displaystyle I=\\int\\frac{e^\\sqrt{x}}{\\sqrt{x}}dx$. It seems obvious to try $u=\\sqrt{x}$ and $du=dx/(2\\sqrt{x})$. Substituting gives \n", "\n", "$$\\displaystyle I=\\int \\frac{e^u}{2} du= 2e^\\sqrt{x}+c$$\n", "\n", "(d) $I=\\int\\cot(ax)dx$. Recognising that $\\cot=1/\\tan=\\cos/\\sin$ gives $\\displaystyle I=\\int\\frac{\\cos(x)}{\\sin(x)}dx$ and the numerator (on top) is $1/a$ times the derivative of $\\sin(ax)$. Therefore, using equation 12, \n", "\n", "$$\\displaystyle I=\\int\\cot(ax)dx = \\frac{1}{a}\\ln\\left(\\sin(ax)\\right)+c$$ \n", "\n", "Using Sympy as a check " ] }, { "cell_type": "code", "execution_count": 2, "metadata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i1phe1u4CzbEyU9kMPhVKIWlN38XHm6ZGcDv5a0R3zZKO/Swp2kmcC5RDX1fCLYHETchI6cSP5SooawA/gscB6xkR1E5L2dYnQSscL5ObJZRI1hAvA5wl0eDMwk3t+90u1+QBG/TxHxwFGEHd5O2GIeYbNu2P2c30XUPiZLysaHlRLEdZl+kuc+G1glaUud8mMTp1rfjuriDdC2r/6ByvY7iQLQcknnlujOJshOkLRXGjrQGEh+tj8PfBeYKGmv8kWePFXrZwNjJOUGyvWizz8+2h6Z/ehl+zXE5wLIqQHk4DtEEW1umeIAYUD42T6U2PjOGoellnwqsKHVwwL987X6i8Am24ttz7e9iIj8TwPuBH5aNkF6L6cB3akcv19hAPm1E9/nrmhELmmcpPF9QaDPnyTbHyYIjydS3R7iKVoGLNhHccYB9BP+BzBVGMIT5qW1AAAAAElFTkSuQmCC\n", "text/latex": [ "$\\displaystyle \\frac{\\log{\\left(\\sin{\\left(a x \\right)} \\right)}}{a}$" ], "text/plain": [ "log(sin(a⋅x))\n", "─────────────\n", " a " ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "x, a = symbols('x, a',positive =True)\n", "integrate(cot(a*x),x)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "(e) $\\displaystyle I=\\int \\frac{x^2}{8+x^3}dx$. In this case the numerator is 1/3 of the derivative of the denominator, therefore, using equation 12, \n", "\n", "$$\\displaystyle I=\\int \\frac{x^2}{8+x^3}dx=\\frac{1}{3}\\ln(8+x^3)$$\n", "\n", "(f) $I=\\int e^{ax}(1-e^{ax})^{-1}dx$. This also has the form of equation 12 with the derivative as numerator therefore, $I=-\\ln(1-e^{ax})/a$.\n", "\n", "## Q16 answer\n", "Using the substitution $x=a\\sin(u)$ and $dx=a\\cos(u)du$ gives \n", "\n", "$$\\displaystyle I=\\int\\frac{1}{\\sqrt{a^2-x^2}}dx=\\int\\frac{\\cos(u)}{\\sin(u)}du = u=\\sin^{-1}\\left( \\frac{x}{a} \\right)$$\n", "\n", "If a computer algebra application was used the answer $\\displaystyle \\arctan\\left( \\frac{a}{\\sqrt{a^2-x^2}} \\right)$ may be produced: $\\arctan() \\equiv \\tan^{-1}()$. The inverse sine and tangents are related easily with a right-angled triangle. For example, let $y = \\sin^{-1}(x/a)$ which is the same as writing $\\sin(y) = x/a$. As sine is opposite / hypotenuse in a right-angled triangle, the adjacent side has length $\\sqrt{a^2 - x^2}$ and therefore $\\tan(y)=x/\\sqrt{a^2-x^2}$ producing $\\displaystyle \\sin^{-1}(x/a)=\\tan^{-1}(x/\\sqrt{a^2-x^2})$\n", "\n", "![Drawing](integration-fig41.png)\n", "\n", "Figure 41. Trig construction.\n", "____\n", "\n", "## Q17 answer\n", "(a) Let $u = x^2$ and thus $du = 2xdx$ the integral can pleasingly be simplified to \n", "\n", "$$\\displaystyle I=\\frac{1}{2}\\int e^{-u}du =-\\frac{1}{2}e^{-u}=-\\frac{1}{2}e^{-x^2} +c$$\n", "\n", "(b) Performing the definite integral \n", "\n", "$$\\displaystyle I=\\int_0^x xe^{-x^2}dx=-\\frac{e^{-x^2}}{2}\\bigg|_0^x= \\frac{1-e^{-x^2}}{2} \\tag{96}$$\n", "\n", "Note that this result is only valid is $x\\ge 0$, why is this?\n", "\n", "![Drawing](integration-fig42.png)\n", "\n", "Figure 42. Plot of the function $xe^{-x^2}$ and its integral $(1-e^{-x^2})/2 $ vs $x$ (red line) showing an error for the integral when $x \\lt 0$, dashed red line. The height of the (red) curve when $x \\ge 0$ is the value of the integral.\n", "____\n", "\n", "Clearly the integration is incorrect when $x \\lt 0$ because the function $xe^{-x^2}$ here is always negative so the integral, as the area under the curve, must also be negative. What has gone wrong? Well, it is because $x$ has been allowed to get smaller than the lower limit in the integral when plotting equation 96. When this happens equation 4 must be used, or the order of integration should be reversed,\n", "\n", "$$\\displaystyle I=\\int_{-x}^0 xe^{-x^2}dx=-\\frac{e^{-x^2}}{2}\\bigg|_{-x}^0= -\\frac{1-e^{-x^2}}{2} $$\n", "\n", "and the only difference is a change of sign. Now this makes everything correct as shown in Figure 43 .\n", "\n", "![Drawing](integration-fig43.png)\n", "\n", "## Q18 answer\n", "Expanding the fraction gives two simpler integrals \n", "\n", "$$\\displaystyle I=\\int\\frac{x-2}{x\\sqrt{x+3}}dx=\\int\\frac{1}{\\sqrt{x+3}}dx=-\\int\\frac{2}{x\\sqrt{x+3}}dx$$\n", "\n", "In expressions of this form always try substituting for the square root, $u=\\sqrt{x+3}$, then $dy=dx/(2\\sqrt{x+3})$ and the first integral is $I_1=\\int2du=2u=2\\sqrt{x+3}$. The second is $I_2=\\displaystyle -\\int\\frac{2}{u^2-3}du$, which is a standard integral, see section 2.13. The result is \n", "\n", "$$\\displaystyle I_2=\\frac{4}{\\sqrt{3}}\\tanh^{-1}\\left(\\frac{\\sqrt{x+3}}{\\sqrt{3}} \\right)+c $$\n", "\n", "Some computer algebra calculations may give the $\\tanh^{-1}()$ fraction upside down compared to this answer. In this case the two are related as $\\tanh^{-1}(w)=\\tanh^{-1}(-1/w)+\\pi/2$.\n", "\n", "## Q19 answer\n", "Guessing at the substitution $u = x^3$ to get a term in $x^2dx$ as $du = 3x^2dx$. Changing the limits when $x = -1,\\, u = -1$, and when $x = 2, \\,u = 8$. The substituted integral can be solved by looking at the table of integrals (Section 2.13),\n", "\n", "$$\\displaystyle I=\\frac{1}{3}\\int_{-1}^8 \\frac{1}{16+u^2}du=\\frac{1}{12}\\tan^{-1}\\left(\\frac{u}{4}\\right)\\bigg|_{-1}^8=\\frac{1}{12}\\left(\\tan^{-1}(2)+\\tan^{-1}\\left(\\frac{1}{4}\\right) \\right)$$\n", "\n", "## Q20 answer\n", "This integration does not look tractable, but try $u = \\sin^{-1}(ax)$, and $dt = dx$ so that $t = x$. Evaluating gives \n", "\n", "$$\\displaystyle I=\\int\\sin^{-1}(ax) dx=x\\sin^{-1}(ax)-\\int x\\frac{d}{dx}\\sin^{-1}(ax) dx$$\n", "\n", "Looking up or working out the deritative of $\\sin-1(ax)$ produces $\\displaystyle I=\\sin^{-1}(ax)-\\int\\frac{ax}{\\sqrt{1-a^2x^2}}dx$\n", "\n", "The integral now has the form of the numerator (top) being related to the derivative of the denominator, equation 12, and the final result is \n", "\n", "$$\\displaystyle I=\\sin^{-1}(ax) +\\frac{\\sqrt{1-a^2x^2}}{a}$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Q21 answer\n", "(a) Changing the limits is described by equation 5, the general integral becomes \n", "\n", "$$\\displaystyle \\int_a^b f(x)dx=g(b)-g(a)=-\\int_b^a f(x)dx$$\n", "\n", "by swapping limits and \n", "\n", "$$\\displaystyle \\int_{-a}^{-b} f(x)dx=g(-b)-g(-a)=\\int_a^b f(-x)dx$$\n", "\n", "by negating limits.\n", "\n", "In this particular example, negating the limit gives $\\displaystyle Ei(-x)=-\\int_x^\\infty \\frac{e^{-t}}{t}dt$\n", "\n", "and swapping limits $\\displaystyle Ei(-x)=-\\int_\\infty^x \\frac{e^{-t}}{t}dt= \\int_{-\\infty}^x\\frac{e^t}{t}dt$.\n", "\n", "and the last step follows from the properties of limits, see Section 1.3.\n", "\n", "(b) Integration by parts gives \n", "\n", "$$\\displaystyle -Ei(x)= \\int_{-x}^\\infty \\frac{e^{-t}}{t}dt=-\\frac{e^{-t}}{t}\\bigg|_{-x}^\\infty - \\int_{-x}^\\infty \\frac{e^{-t}}{t^2}dt = \\frac{e^{x}}{x} - \\int_{-x}^\\infty \\frac{e^{-t}}{t^2}dt $$ \n", "\n", "And repeating the process the next integral is \n", "\n", "$$\\displaystyle -\\int_{-x}^\\infty \\frac{e^{-t}}{t^2}dt=\\frac{e^{-t}}{t^2}\\bigg|_{-x}^\\infty +2 \\int_{-x}^\\infty \\frac{e^{-t}}{t^3}dt = -\\frac{e^{x}}{x^2} +2 \\int_{-x}^\\infty \\frac{e^{-t}}{t^3}dt $$\n", "\n", "Repeating the process $n$ times a pattern becomes clear and is\n", "\n", "$$\\displaystyle \\int_{-x}^\\infty \\frac{e^{-t}}{t}dt=-\\frac{e^{-t}}{t^n}\\bigg|_{-x}^\\infty -n\\int_{-x}^\\infty \\frac{e^{-t}}{t^{n+1}}dt$$\n", "\n", "and adding these integrals gives\n", "\n", "$$\\displaystyle -Ei(x)\\approx \\frac{e^x}{x} - \\frac{e^x}{x^2} + 2\\frac{e^x}{x^3}-6\\frac{e^x}{x^4}+24\\frac{e^x}{x^5} - \\cdots (-1)^n n!\\frac{e^x}{x^{n+1}} - \\cdots n!\\int_{-x}^\\infty \\frac{e^{-t}}{t^{n+1}} $$\n", "\n", "and the summation can be expressed as \n", "\n", "$$\\displaystyle Ei(x)\\approx e^x\\sum_{n=0} (-1)^n\\frac{n!}{x^{n+1}}$$\n", "\n", "Calculating this summation is a frustrating affair, the number produced are typically very large for example $\\approx 10^{20}$ when $x=50$. The results are comparable to the answer Python/Scipy gives for large $x$, say, $\\pm 500$ and for $30$ terms in the summation. However, with $x \\gt \\approx 50$, the results are unpredictable and vary with the number of terms in the summation. Clearly this summation is unstable and not a good way of evaluating this integral. \n", "\n", "The instability for small $x$ arises because $\\pm n!/x^{n+1}$ becomes larger and larger as $n$ increases and the sign alternates. This result shows how an algebraic formula, while correct, can give poor answers in a numerical calculation because of rounding errors; see Chapter 11. This is particularly true of summations with alternating positive and negative terms as in this case. Python/scipy uses the built-in function $\\mathtt{expi(x)}$ to numerically evaluate this integral. (You need to add 'from scipy.special import expi' to import this function into a python worksheet).\n", "\n", "## Q22 answer\n", "(a) Recognize this as an integration by parts and use equation 16. If $u = x$ then $dv = e^{ax}dx$ and the formula gives \n", "\n", "$$\\displaystyle \\int xe^{ax}dx =x\\frac{e^{ax}}{a}-\\frac{1}{a}\\int e^{ax} dx=\\frac{(ax-1)}{a^2}e^{ax}$$\n", "\n", "(b) The result of the previous calculation produces \n", "\n", "$$I_1= xI_0 - I_0/2\\quad\\text{ where }\\quad I_0=\\int e^{ax}dx=e^{ax}/a$$\n", "\n", "Calculate the next integral by letting $u = x$ then $dv = e^{ax}dx$ and the integration by parts formula gives \n", "\n", "$$\\displaystyle \\int x^2 e^{ax}dx=\\frac{x^2}{a}e^{ax}-\\frac{2}{a}\\int xe^{ax}dx$$\n", "\n", "which can be written as \n", "\n", "$$\\displaystyle I_2=x^2I_0-\\frac{2}{a}I_1 \\tag{97}$$\n", "\n", "using $I$ from the question and where, logically, $I_0$ is defined as $\\displaystyle I_0=\\int e^{ax}dx = a^{ax}/a$. Next, define $\\displaystyle I_3=\\int x^3e^{ax}dx$ which is $I_3=x^2I_0-3i_2/a$ and then by induction\n", "\n", "$$\\displaystyle I_n=x^nI_0-\\frac{n}{a}I_{n-1} \\tag{98}$$\n", "\n", "which can also be written as a recursion formula, $aI_n+nI_{n-1}=x^ne^{ax}$. The code below shows the recursion using Sympy. This gives the same answer as direct integration." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAWkAAAAjCAYAAABWz/vwAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy89olMNAAAACXBIWXMAABJ0AAASdAHeZh94AAAJ6klEQVR4nO2df7BVVRXHPw9QxB9jYiOaJSMjVkphaTOmQGChqZVoP7RG06YfkziY42gjT+zr8reNCk/DTJR5hk5j+KPJEdSyMoUQckTFMksNFIFETSV/6+uPtS8eru/dc+4P77v3uT4zd9475+61z97r7L322Wvte3ZHT08P9WBm/wbGSNrQH/LNxMzOBXYDnpR0SrNkWwUzGwwMlfSymW0FrAD2kfRsM+RbBTPbCRghabmZ7QjcB+wu6X/NkA/eXwzJHpjZdsAjwH6SHuufIrUmZjYa+BhwCzCmWbKthKS3gJfT4VCgI32aIt8qSFoDrEn/rzWz9cBwoJCRrVc+6F/MbD6wRNLFNcgeDZwIDANWAUdIes3MFgEnS7rXzK4GVkiaCWVGGugEFlRpoHuAu8zsbWCWpOuqLHe98hUxszMBlZ1eJ2nHKrO6CDgV2K+GYtQj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aB+N3S4SBgFzPbCzfyq1KaettNbv9plj6aVN8s43GbWWIJHoCcZ2Zn4U/Vo9K1pkl6u9a6bfSLpaDFUnwaAL6c5Re4MVuM+1KuAx7sZQXIJpivO7wNuKW0kiFFK+fzTsS3WXwY+BW+VvomfIXHvvKlQAOljlPxSPWd+JS/9Nnou5R0PR5xn4E/5YwDDkl6gAGgi+TnnIIvB1sBnIsPypdn0gx4PST2wWfH9+N+U0v/Z1cW1dtuKuqqyfpoRn2BjbPxw4E5Gbnn8UFqW3yWvhxfJfJUPQYaoCP77g7z9YBdwB41OtODIAgGNObL5w6TdGAzrrdJhFn+q5fZ+NNnEARB8G7ewP3rTaGj3rfgBUEQBO8duWs1gyAIgv4jjHQQBEELE0Y6CIKghRkCYGbhmA6CIGhBInAYDEjM30g2F/9J71v42vjY+SRoO8LdEQxUuoGfSNoD+Bz+I6YgaDviSToYcJjZnkCXpPLXSwZB21G+x2EQDARGAxvM7Bb89Zk3SDqvn8sUBDUR7o5gIDIEfwHOVOCzwGQzm9y/RQqC2ogn6aAtscr76q3GX/7/ZEq7AN9s4Hf9U9ogqJ0w0kG7UmlfvWXADma2Hb7R6AT8bW1B0HZE4DAYEJjZlcBQScem44PxLZw6gDskndyf5QuCWgkjHbQdlfbVk5S3P14QtBUROAzaisy+ejviL2sfj7/w/VWq2IMwCNqF8EkH7UbdexAGQTsRRjpoN+ragzAI2o1wdwTtRs17EAZBOxKBwyAIghYmnqSDIAhamDDSQRAELcz/AWonqUqL0neqAAAAAElFTkSuQmCC\n", "text/latex": [ "$\\displaystyle \\frac{\\left(a^{5} x^{5} - 5 a^{4} x^{4} + 20 a^{3} x^{3} - 60 a^{2} x^{2} + 120 a x - 120\\right) e^{a x}}{a^{6}}$" ], "text/plain": [ "⎛ 5 5 4 4 3 3 2 2 ⎞ a⋅x\n", "⎝a ⋅x - 5⋅a ⋅x + 20⋅a ⋅x - 60⋅a ⋅x + 120⋅a⋅x - 120⎠⋅ℯ \n", "────────────────────────────────────────────────────────────\n", " 6 \n", " a " ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a, x = symbols('a, x',positive = True)\n", "\n", "def Intn(n):\n", " if n == 0: return exp(a*x)/a\n", " if n == 1: return (a*x - 1)*exp(a*x)/a**2 \n", " return (x**n*exp(a*x) - n*Intn(n - 1))/a # recursion formula\n", "#-----------------\n", "\n", "simplify(Intn(5) ) # integral x^5 exp(a*x)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Q23 answer\n", "(a) The integral for $n=1$ can be calculated between $0$ and infinity but the way to do this is a little cunning. The normal 'by parts' integral is $\\displaystyle \\int u dv = uv - \\int vdu$. Now, suppose that $\\displaystyle v=e^{-ax^2}$ therefore $dv=-2axe^{-ax^2}$ and also if $u=1$ then \n", "\n", "$$\\displaystyle I_1=\\frac{1}{2a}\\int_0^\\infty 1(-2axe^{-ax^2})dx$$\n", "\n", "which can now be integrated by parts. The $\\displaystyle -\\int vdu$ integral on the right is zero because $u = 1$. The result is \n", "\n", "$$\\displaystyle I_1=-\\frac{e^{-ax^2}}{2a}\\bigg|_0^\\infty -\\int0dx=\\frac{1}{2a}$$\n", "\n", "(b) Letting $v = x^n$ because $e-x^2$ cannot be integrated easily, gives \n", "\n", "$$\\displaystyle I_n=e^{-ax^2}\\frac{x^{n+1}}{n+1}\\bigg|_0^\\infty + 2a\\int_0^\\infty xe^{-ax^2}\\frac{x^{n+1}}{n+1}dx$$\n", "\n", "which is \n", "\n", "$$\\displaystyle I_n=e^{-ax^2}\\frac{x^{n+1}}{n+1}\\bigg|_0^\\infty + \\frac{2a}{n+1}I_{n+2}$$\n", "\n", "To work out the limits, when $x = 0$, then so is $e^{ax^2}x^{n+1}$. When $x = \\infty$, repeated differentiation using l'Hopital's rule produces\n", "\n", "$$\\displaystyle \\lim_{x\\to\\infty} \\frac{x^{n+1}}{e^{ax^2}(n+1)}\\to \\frac{x^{n-1}}{2ae^{ax^2}}\\to\\to 0$$\n", "\n", "because for any $n$ the numerator will become eventually become 1, while the denominator is still infinity thus making the limit zero. Since both limits are zero then $\\displaystyle I_{n+2}=\\frac{n+1}{2a}I_n$ which is more conveniently re-written as $\\displaystyle I_{n}=\\frac{n-1}{2a}I_{n-2}$ for calculation. \n", "\n", "The values of all other integrals of this type can now be calculated provided that $I_0$ is known and this has the value $I_0 = \\pi/4a$." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgYAAAAhCAYAAACiCWMHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy89olMNAAAACXBIWXMAABJ0AAASdAHeZh94AAAQpUlEQVR4nO2de7yVVZnHv1wm+8h1wk9q46Wg0TLFIzKjJDKin3DQJoEcnTEM7TNOakaYNiNk8/CTnHQsikymhgxUyCRDJgPTlEBILcdEuYwXEiTzMmrogKiMcOaPZ23OPvvsy7v3fvflnL2+nw+fl/3e1nOetd71rvdZz/OsXu3t7WQj6WZgGPBy2DXVzLYSiURaFkmfAc4wszMaLUuk9YjtLz0knQxMDT8PARaa2ezsc/rmue4QYLWZXVFj+SKRSPfhfOAUSe0lz8yDmfVKWZ5IaxHbX0qY2QpgBYCklcB7c8/JNzCIRCKRvUgaATxuZruA2MFGKkLS54DPAu8PuzYAXzWzZSWui+2vzsSBQSQSKcWngZsaLUR3RNIY4HLgWOB9wPlmtqChQjWO54B/Bp4GegNTgKWSjjWzx4tcF9tfHmrZtuLAIBKJFERSX+AYM5uW59gG4IhCl5rZzBqK1l3oD6wHbg7/WhYz+8+cXV+WdBEwCsg7MIjtryg1a1vdfmAg6VTgp8C70rxvveaksuT/BXB6WveNc2qRcpF0HPBFYIOZXRV2jwN+XuCSicCTwGnAo7iZdxPweeDW2krbPTCz5cByAEkLGitN8yCpD/C3+MvtgbAvtr8yqGXb6vYDA9wcdamZzW20IBXS3eWP9Bx+h3c0V0ma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hlH31PpmO89AffeniBpbfh3VKp/SXMxAO9Xc+eQi+myp+toDTBW0ocAJB2Bv8yX55xXTEfgESZrQpt7CLjZzB6m9dpbpc9lWQVEIpEWQtIFuPf+5GLnWdaKpMCz8gyeHwrHfkNHSHAufwl8Ppy3htb6AJmD57rolCCohC57uo6uxQdMGyXtxt87V5vZ3OyTiukoHH8GODrP/VuqvVXxXCYmDgwikRZC0uG4s+FoC0mcCpx3MO4sOxZfIfRdePjTv5Uqw8xGpiNt90LSbDxUcnQIG8vsr1iXPYSz8Wifc3CfgDZgjqTNFpa9j+0tGfVqS3FgEIm0FqOA/YANWYmU+gBjJF2Ix2L3x53p7sedxp7DEzA9TPFU4i2LpG/ieTDGhi/bzP4hRF1eB3zdzH4Ufq+TdCgwHbgx6igZ9dRTHBhEIq3FUromapoPPI1bEnbRkbnt7EyClpChsT+xo+6CpDn4V/FYM3si53DUJexL1/UpdtNh8o86Skbd9BQHBpFICxFinF/L3ifpDeCPmdh7Sa/inc0ESevwTJAz8Ixtm4jsRdINwLl4au5tIQ0vwI6Qtjfq0qMzrpC0GZ9KOAbPKJrJAht1lIy66SnfwGArcKKkpeH3VDPbmmahkUikqVkOfA+PNX8Lj9NfBByfJ8Vrq3Nx2N6Xs194Up+oS3cMnIUvcPRePMHRPDznA0QdJSUVPUk6GZgafg4Euizv3iXBUSQSiUQikdbl/wHJtMBjrl9zdQAAAABJRU5ErkJggg==\n", "text/latex": [ "$\\displaystyle \\left[ 0, \\ \\frac{\\sqrt{\\pi}}{2 \\sqrt{a}}, \\ 1, \\ \\frac{1}{2 a}, \\ 2, \\ \\frac{\\sqrt{\\pi}}{4 a^{\\frac{3}{2}}}, \\ 3, \\ \\frac{1}{2 a^{2}}, \\ 4, \\ \\frac{3 \\sqrt{\\pi}}{8 a^{\\frac{5}{2}}}, \\ 5, \\ \\frac{1}{a^{3}}\\right]$" ], "text/plain": [ "⎡ √π 1 √π 1 3⋅√π 1 ⎤\n", "⎢0, ────, 1, ───, 2, ──────, 3, ────, 4, ──────, 5, ──⎥\n", "⎢ 2⋅√a 2⋅a 3/2 2 5/2 3⎥\n", "⎣ 4⋅a 2⋅a 8⋅a a ⎦" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a, x = symbols('a, x',positive =True)\n", "\n", "def intxn(n):\n", " if n == 0: return sqrt(pi/(4*a) )\n", " if n == 1: return 1/(2*a)\n", " if n == 2: return sqrt(pi/a)/(4*a)\n", " return (n - 1)*intxn(n - 2)/(2*a) # recursion chnage n to n-2 \n", "#-----------------\n", "\n", "ans = []\n", "for n in range( 6): # make list to see results\n", " ans.append(n)\n", " ans.append(intxn(n) )\n", "ans" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Q24 answer\n", "The strategy here is to recognize that $d\\ln(x)=1/x$ or, equivalently, letting $w=\\ln(x)$ (and $dw=dx/x$) the integral becomes\n", "\n", "$$\\displaystyle \\int \\frac{\\cos(\\ln(x))}{x}dx= \\int \\cos(\\ln(x)) d\\ln(x)\\equiv\\int\\cos(w)dw=\\sin(\\ln(x))+c$$\n", "\n", "## Q25 answer\n", "The secant function is the reciprocal of cosine and its integral is a standard one, $\\displaystyle \\int \\sec^2(x)dx = \\tan(x)$. The square root is removed by substitution, therefore try $z=\\sqrt{x}$ and $dz/dx=1/\\sqrt{4x}=1/2z$ making the integral, \n", "\n", "$$\\displaystyle \\int\\sec^2(\\sqrt{x})dx=2\\int z\\sec^2(z)dz$$ \n", "\n", "This integral can now be tackled by the 'parts' method,\n", "\n", "$$\\displaystyle 2\\int z\\sec^2(z)dz=2z\\tan(z)-2\\int \\tan(z)dz=2z\\tan(z)+2\\ln(\\cos(z)) +c$$\n", "\n", "where $c$ is a constant of integration. Substitute back for $z$ to get the result.\n", "\n", "## Q26 answer\n", "(a) This integral can be evaluated by converting to the exponential form but can also be done rather easily by parts; \n", "\n", "$$\\displaystyle \\int \\cosh(x)\\sinh(x)dx=\\sinh^2(x)-\\int \\cosh(x)\\sinh(x)dx$$\n", "\n", "and rearranging gives $\\displaystyle \\int\\cosh(x)\\sinh(x)=\\frac{1}{2}\\sinh^2(x)+c$\n", "\n", "(b) Using the example in section 5 to evaluate the integrals gives $\\displaystyle \\int x\\cos(x)dx=\\frac{e^x}{2}\\left( \\sin(x)+\\cos(x) \\right)$\n", "\n", "## Q27 answer\n", "Converting to an exponential form gives \n", "\n", "$$\\displaystyle I= \\int \\frac{dx}{\\sin(ax)}=2i\\int \\frac{dx}{e^{iax}-e^{-iax}}$$\n", "\n", "which appears to have no easy solution. Try substituting $z=e^{iax},\\; dz=iae^{iax}dx$ giving \n", "\n", "$$\\displaystyle I=\\frac{2}{a}\\int \\frac{dz}{z^2-1} $$\n", "\n", "which has a standard form, (see section 2.13) which is $\\displaystyle I= \\frac{1}{2}\\ln\\left(\\frac{z-1}{z+1} \\right)$ making the integration \n", "\n", "$$\\displaystyle \\int \\frac{dx}{\\sin(ax)}=\\frac{1}{2a}\\ln\\left(\\frac{\\cos(ax)-1}{\\cos(ax)+1} \\right)+c$$\n", "\n", "Some texts may convert the answer into hyperbolic form using $\\displaystyle \\tanh^{-1}(z)=\\frac{1}{2}\\ln\\left( \\frac{1+z}{1-z} \\right)$ where $z$ is defined above. In this case the result has to be real even though $z$ is complex, and even though the result may appear to be complex, the area under the curve, which is the integral, cannot be complex since $1/\\sin(ax)$ is real.\n", "\n", "## Q28 answer\n", "(a) $\\displaystyle \\int_{-\\pi}^\\pi dx=x\\bigg|_{-\\pi}^\\pi =2\\pi$.\n", "\n", "(b) Integrating and then changing the exponential to a sine using $2i\\sin(x)=e^{ix}-e^{-ix}$ gives \n", "\n", "$$\\displaystyle \\int_{-\\pi}^\\pi e^{imx}e^{-inx}dx =-\\frac{e^{-ix(m+n)}}{i(m+n)}\\bigg|_{-\\pi}^\\pi=-\\frac{ e^{-i\\pi(m+n) } }{i(m+n) }+\\frac{e^{i\\pi(m+n)}}{i(m+n)}=2\\frac{\\sin\\left( n\\pi+m\\pi \\right)}{m+n}$$\n", "\n", "Recalling that $m$ and $n$ are integers let $q = n + m$, which can be positive, negative, or zero. Consider the case first when $q \\ne 0$ then the integral is zero because $\\sin(\\pi q) = 0$ for any integer value of $q$. In the case that $q = 0$ then the denominator is zero and using l'Hopital's rule (chapter 3.8) the limit is \n", "\n", "$$\\lim_{q\\to 0} 2\\frac{\\sin(q\\pi}{q}\\to 2\\frac{\\pi\\cos(q\\pi)}{1}\\to 2\\pi$$\n", "\n", "Together these results show that $\\displaystyle \\int_{-\\pi}^\\pi e^{imx}e^{-inx}dx=2\\pi\\delta_{n,m}$.\n", "\n", "## Q29 answer\n", "Differentiating with respect to $\\beta$ only involves the exponential and produces\n", "\n", "$$\\displaystyle \\frac{d}{d\\beta}\\int_0^\\infty \\frac{e^{-\\beta x}\\sin(x)}{x}dx=\\int_0^\\infty e^{-\\beta x}\\sin(x)dx$$\n", "\n", "Integrating the result by parts produces \n", "\n", "$$\\displaystyle \\int_0^\\infty e^{-\\beta x}\\sin(x)dx =-e^{-\\beta x}\\cos(x)\\bigg|_0^\\infty -\\beta\\int_0^\\infty e^{-\\beta x}\\cos(x)dx $$\n", "\n", "Continuing the integration as in Section 5, example (c) and evaluating gives $\\displaystyle \\int_0^\\infty e^{-\\beta x}\\sin(x)dx=\\frac{1}{1+\\beta^2}$. This result has to be integrated again to obtain the final result but now with respect to $\\beta$ which is the standard integral $\\displaystyle \\int\\frac{d\\beta }{1+\\beta^2 }=\\tan^{-1}(\\beta)\\bigg|_0^\\infty =\\frac{\\pi}{2}$. The final result is \n", "\n", "$$\\displaystyle \\int_0^\\infty \\frac{\\sin(x)}{x}dx = \\frac{\\pi}{2}$$\n", "\n", "## Q30 answer\n", "Using the definition of the cosine in a right-angled triangle, and in the limit of small values, \n", "\n", "$$\\displaystyle \\cos(x)=\\frac{dx}{\\sqrt{dx^2+dy^2}}=\\left(1+\\left(\\frac{dy}{dx} \\right)^2 \\right)^{-1/2} $$\n", "\n", "then using the equation in the question $\\displaystyle 2\\pi yT \\left(1+\\left(\\frac{dy}{dx} \\right)^2 \\right)^{-1/2} =c$ and rearranging to give\n", "\n", "$$\\displaystyle \\frac{dy}{dx}=\\sqrt{\\left( \\frac{2\\pi T}{c} \\right)^2y^2-1}= \\sqrt{c_0^2y^2-1}$$\n", "\n", "and, for clarity, the constants are replaced by $c_0$. This equation is now integrated by separating $dy$ and $dx$\n", "\n", "$$\\displaystyle \\int \\frac{dy}{\\sqrt{c_o^2y^2-1}}=\\int dx=x+const$$\n", "\n", "The integral in $y$ evaluates to $\\displaystyle \\int \\frac{dy}{\\sqrt{c_o^2y^2-1}}=\\frac{1}{c_0}\\cosh^{-1}(c_0y)$ which produces \n", "\n", "$$\\displaystyle y=\\frac{\\cosh(c_0x)}{c_0}$$\n", "\n", " The constants can be determined by defining the geometry of the soap film; the equation used is defined with $y = r$ at $x = 0$ therefore, $c_0 = 1/r$ because $\\cosh(0)=1$" ] }, { "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.9.6" } }, "nbformat": 4, "nbformat_minor": 2 }