The worst way to calculate definite integrals
On mobile devices, read the page in horizontal/"landscape" mode. Otherwise math may not fit the screen.RIES is a program that finds closed-form expressions for a given numerical value. In other words, it is a kind of inverse symbolic calculator. For example, running RIES with "ries 0.242213" results in
\[\begin{aligned} 1-\frac{x}{2}=\sqrt{\sqrt{\pi}-1}\end{aligned}\]where you could solve for $x$ to get your approximation. It can give expressions in terms of various constants and trigonometric functions. Of course, these closed forms have nothing to do with the number being approximated – there’s no reason why 0.242213 should involve pi – the program simply tries to find a closed form expression that is close enough.
I know what you’re thinking: this is a great program for finding closed form expressions for definite integrals containing a parameter, of the form
\[\begin{aligned} I=\int_a^b f(\alpha ,x)dx .\end{aligned}\]For example, take the simple integral
\[\begin{aligned} I=\int _{-\infty}^\infty e^{-mx^2}dx. \end{aligned}\]We can tabulate the numerical values of this integral for a bunch of $m$, then run ries for those values of the integral, and ask it to use the parameter $m$ for the closed form expression. This can be done using a modified version of ries. This version allows you to define your own constants; you just have to change the value of the constant m for each value of the integral. Without further ado, the results:
Parameter $m$ | Value of integral | RIES guess |
---|---|---|
1.0 | 1.7724.. | $\sqrt{\frac{\pi }{m}}$ |
1.1 | 1.6899.. | $\sqrt{\frac{\pi }{m}}$ |
1.2 | 1.6180.. | $\sqrt{\frac{\pi }{m}}$ |
1.3 | 1.5545.. | $\sqrt{\frac{\pi }{m}}$ |
1.4 | 1.4979.. | $\sqrt{\frac{\pi }{m}}$ |
Success! That’s the correct answer. This is way too easy, though. What about this:
\[\begin{aligned} \int_0^1 \frac{\ln(mx)}{(x^2+1)} dx &= -\text{Catalan}+\frac{1}{4}\pi \ln (m)\end{aligned}\]It has the unusual Catalan constant. Still, by using the appropriate settings 1, we get
Parameter $m$ | Value of integral | RIES guess |
---|---|---|
1.0 | -0.9519.. | $\ln (\text{Catalan})=\ln (-m)$ |
1.1 | -0.8411 | $(e^{x+\text{Catalan}})^2 = \sqrt{m}^\pi$ |
1.2 | -0.7726.. | $(e^{x+\text{Catalan}})^2 = \sqrt{m}^\pi$ |
1.3 | -0.7099.. | $(e^{x+\text{Catalan}})^2 = \sqrt{m}^\pi$ |
1.4 | -0.6517.. | $(e^{x+\text{Catalan}})^2 = \sqrt{m}^\pi$ |
The last four answers are correct when you solve for "x", which is what RIES calls the target value. Success again! What about the following:
\[\begin{aligned} \int _0^{\pi}\sin (mx) \cos ^2(mx)dx &= -\frac{\cos ^3(\pi m)-1}{3 m}\end{aligned}\]This time we run in to trouble; we can’t find the correct answer just by running RIES with default settings. It wants to use the $\sin$ as a component of the solution; if we forbid the use of $\sin$ by using the flag $-NS$, we get the correct result.
I am sure you’re itching to apply this horrifying innovative technique.
Here are some spells scientific tips for finding the right answer:
-
Use the –max-match-distance option to control which solutions RIES shows you. The smaller the number, the closer it has to get for the solution to be shown.
-
Use –min-match-distance to specify a cutoff at which the calculation terminates; once RIES gets to this distance from the value, it stops.
-
Remember to only look for solutions as accurate as your parameter value; if you cut off your numerical integral value at 5 digits, don’t look for solutions at the accuracy of $10^{-16}$.
-
You can turn off some functions by command line flags, like -NS to turn off sine functions.
-
If you can’t find a satisfactory result, increase search depth by using the l flag; anything beyond $-l7$ is going to take a pretty long time, but should find more solutions.
-
I wrote a script available here that changes the value of the parameter m automatically. It’s used by putting values of the parameter and integral in to a json file, like so:
{"parameters": [1.0, 1.1, 1.2, 1.3, 1.4], "values": [-0.915965594177219, -0.841109154005822, -0.7727705783234835, -0.7099051827233291, -0.6517009175006867] }
Then you just place the script in to the same directory as the ries executable and run it. Inspect output manually.
Happy integrating!
-
The usual method for choosing the correct RIES settings is by the use of witchcraft. ↩