From a726ce696feff527dd920d2bebb67a5c157790a5 Mon Sep 17 00:00:00 2001 From: Vitor Shen <17490173+shenvitor@users.noreply.github.com> Date: Tue, 6 Feb 2024 18:41:25 +0100 Subject: [PATCH] add compare sp.Integral and UnevaluatableIntegral --- docs/usage/sympy.ipynb | 144 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) diff --git a/docs/usage/sympy.ipynb b/docs/usage/sympy.ipynb index 8c9d07907..1f07d6d04 100644 --- a/docs/usage/sympy.ipynb +++ b/docs/usage/sympy.ipynb @@ -339,6 +339,150 @@ "plt.show()" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "There are numerous functions whose integrals cannot be expressed in terms of known special functions and for which no closed-form solutions have been identified yet. Here are a few examples:\n", + "\n", + "1. **Integral Involving Complex Exponential and Polynomials:**\n", + " $$ \\int e^{x + e^{-x}} dx $$\n", + " This integral combines an exponential function with a nested exponential term, leading to a complexity that resists simplification in terms of known functions.\n", + "\n", + "2. **Integral of a Rational Function Times an Exponential:**\n", + " $$ \\int \\frac{e^x}{x^2 + 1} dx $$\n", + " This integral involves the exponential function and a non-trivial rational function, which together do not yield to standard integration techniques.\n", + "\n", + "3. **Integral of an Exponential of a Trigonometric Function:**\n", + " $$ \\int e^{\\sin x} dx $$\n", + " The combination of an exponential function and a sinusoidal function is another case where known methods of integration in terms of elementary or special functions fail.\n", + "\n", + "4. **Product of a Polynomial and a Trigonometric Function:**\n", + " $$ \\int x^4 \\sin(x^2) dx $$\n", + " This integral combines a polynomial with a trigonometric function in a non-standard way, making it resistant to analytical methods.\n", + "\n", + "5. **Integral of a Logarithmic Function Inside an Exponential:**\n", + " $$ \\int e^{\\ln(x)/x} dx $$\n", + " The combination of a logarithmic function inside an exponential function, as seen here, creates a complex relationship not easily resolved by known functions.\n", + "\n", + "In the context of hadron physics and high-energy physics, encountering such challenging integrals is not uncommon. They can arise in theoretical models, complex scattering problems, or in the analysis of experimental data. In such cases, physicists often resort to numerical integration, computational approximations, or the development of new special functions or methods tailored to the problem at hand. These integrals, while not solvable in a traditional sense, can still provide significant insights into the behaviors and properties of the systems being studied." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Some example test to compare ``sp.Integral`` and ``UnevaluatableIntegral``" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "UnevaluatableIntegral(sp.exp(-(x**4)), (x, a, b)).doit()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "sp.Integral(sp.exp(-(x**4)), (x, a, b)).doit()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "UnevaluatableIntegral(sp.sin(x) / x, (x, a, b)).doit()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "sp.Integral(sp.sin(x) / x, (x, a, b)).doit()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "UnevaluatableIntegral(sp.exp(x + sp.exp(-x)), (x, a, b)).doit()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "sp.Integral(sp.exp(x + sp.exp(-x)), (x, a, b)).doit()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "UnevaluatableIntegral(sp.exp(sp.log(x) / x), (x, a, b)).doit()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "sp.Integral(sp.exp(sp.log(x) / x), (x, a, b)).doit()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "UnevaluatableIntegral(sp.exp(sp.sin(x)), (x, a, b)).doit()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "sp.Integral(sp.exp(sp.sin(x)), (x, a, b)).doit()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "UnevaluatableIntegral(sp.exp(x) / (x**2 + 1), (x, a, b)).doit()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "sp.Integral(sp.exp(x) / (x**2 + 1), (x, a, b)).doit()" + ] + }, { "cell_type": "markdown", "metadata": {},