For some reason I was pondering the integration of the function:$$ \frac{x}{\sqrt{1-x^2}}$$the other day and decided to give it a try. I spend so much time on number theory that I know my integration skills are atrophying so this was an opportunity to get in a little practice both with integration and with honing my LaTeX skills. Given that the function is undefined at \(x=1\), I decided that I would integrate between 0 and 1 and thus I was confronted with the integral:$$ \int_0^1 \! \frac{x}{\sqrt{1-x^2}} \, dx$$This of course is a very easy integral once we make the substitution \(x=\sin \theta\) where \(dx=\cos \theta \, d\theta\). The integration limits will change and become 0 to \(\pi/2\). The integral thus becomes:$$ \begin{align} \int_0^{\pi/2} \! \frac{\sin \theta \cdot \cos \theta}{\sqrt{1-\sin^2 \theta}} \, d\theta &= \int_0^{\pi/2} \! \frac{\sin \theta \cdot \cos \theta}{\cos \theta} \, d\theta \\&= \int_0^{\pi/2} \! \sin \theta \, d\theta \\ &= - \biggl [ \cos \theta \biggr ]_0^{\pi/2} \\ &=1 \end{align}$$It's interesting to note that whatever power \(x\) is raised to, the denominator will always disappear after the substitution. That is to say that for an integer \(n>0\) we have:$$\int_0^1 \! \frac{x^n}{\sqrt{1-x^2}} \, dx=\int_0^{\pi/2} \! \sin^n \theta \, d\theta$$Referring to a very useful site - https://www.integral-calculator.com/ - I was reminded of the famous reduction formula for this type of integral, namely: $$ \int \! \sin^n \theta \, d\theta = \frac{n-1}{n} \int \! \sin^{n-2} \, d\theta - \frac{ \cos \theta \cdot \sin^{n-1} \theta}{n}$$Let's apply this formula progressively for \(n\)=2, 3 and 4.
The case of \(n=2\):$$ \begin{align} \int_0^{\pi/2} \! \sin^2 \theta \, d\theta &=\frac{1}{2}\int_0^{\pi/2} \! 1\, d\theta - \biggl [ \frac{ \cos \theta \cdot \sin \theta }{2} \biggr ]_0^{\pi/2}\\&=\frac{\pi}{4} \end{align} $$What we notice is that there will always be a \( \sin \theta \cdot \cos \theta \) term on the far right as the reduction proceeds but this can be ignored because of our limits: the result will always be zero. This simplification means that we now have:$$ \int_0^{\pi/2} \! \sin^n \theta \, d\theta = \frac{n-1}{n} \int_0^{\pi/2} \! \sin^{n-2} \theta \, d\theta$$Let's test this out for the case of \(n=3\) and \(n=4\):
The case of \(n=3\):$$ \begin{align} \int_0^{\pi/2} \! \sin^3 \theta \, d\theta &= \frac{2}{3} \int_0^{\pi/2} \! \sin \theta \, d\theta \\ &= \frac{2}{3} \end{align}$$The case of \(n=4\):$$ \begin{align} \int_0^{\pi/2} \! \sin^4 \theta \, d\theta &= \frac{3}{4} \int_0^{\pi/2} \! \sin^2 \theta \, d\theta \\ &= \frac{3 \pi}{16} \end{align}$$The integral calculator site not only provides the steps but also a graph. Figure 1 shows the area under the curve for:$$ \int_0^1 \! \frac{x^4}{\sqrt{1-x^2}} \, dx$$
Figure 1 |
For those with a technical background, the following section explains how the Integral Calculator works.First, a parser analyzes the mathematical function. It transforms it into a form that is better understandable by a computer, namely a tree (see figure below). In doing this, the Integral Calculator has to respect the order of operations. A specialty in mathematical expressions is that the multiplication sign can be left out sometimes, for example we write "5x" instead of "5*x". The Integral Calculator has to detect these cases and insert the multiplication sign.The parser is implemented in JavaScript, based on the Shunting-yard algorithm, and can run directly in the browser. This allows for quick feedback while typing by transforming the tree into LaTeX code. MathJax takes care of displaying it in the browser.When the "Go!" button is clicked, the Integral Calculator sends the mathematical function and the settings (variable of integration and integration bounds) to the server, where it is analyzed again. This time, the function gets transformed into a form that can be understood by the computer algebra system Maxima.
Maxima takes care of actually computing the integral of the mathematical function. Maxima's output is transformed to LaTeX again and is then presented to the user. The antiderivative is computed using the Risch algorithm, which is hard to understand for humans. That's why showing the steps of calculation is very challenging for integrals.In order to show the steps, the calculator applies the same integration techniques that a human would apply. The program that does this has been developed over several years and is written in Maxima's own programming language. It consists of more than 17000 lines of code. When the integrand matches a known form, it applies fixed rules to solve the integral (e. g. partial fraction decomposition for rational functions, trigonometric substitution for integrands involving the square roots of a quadratic polynomial or integration by parts for products of certain functions). Otherwise, it tries different substitutions and transformations until either the integral is solved, time runs out or there is nothing left to try. The calculator lacks the mathematical intuition that is very useful for finding an antiderivative, but on the other hand it can try a large number of possibilities within a short amount of time. The step by step antiderivatives are often much shorter and more elegant than those found by Maxima.The "Check answer" feature has to solve the difficult task of determining whether two mathematical expressions are equivalent. Their difference is computed and simplified as far as possible using Maxima. For example, this involves writing trigonometric/hyperbolic functions in their exponential forms. If it can be shown that the difference simplifies to zero, the task is solved. Otherwise, a probabilistic algorithm is applied that evaluates and compares both functions at randomly chosen places. In the case of antiderivatives, the entire procedure is repeated with each function's derivative, since antiderivatives are allowed to differ by a constant.The interactive function graphs are computed in the browser and displayed within a canvas element (HTML5). For each function to be graphed, the calculator creates a JavaScript function, which is then evaluated in small steps in order to draw the graph. While graphing, singularities (e. g. poles) are detected and treated specially. The gesture control is implemented using Hammer.js.If you have any questions or ideas for improvements to the Integral Calculator, don't hesitate to write me an e-mail.
No comments:
Post a Comment