--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CALUh_%2B2dkMYNVgDvZHuZQW3%3DX9vS9EPqRv9fMVc5zbeUXYrmSw%40mail.gmail.com.
In [1]: x = symbols("x")
...:
...: f = (x**6 + 2)/(8*x**2)
...: g = sqrt(1 + diff(f,x))
...:
...: h = 2*pi*Integral(((x**6 + 2)/(8*x**2))*sqrt(1 + diff(f,x)), (x, 1, 3))
In [2]: h
Out[2]:
3
⌠
⎮ ___________________
⎮ ╱ 3 6
⎮ ⎛ 6 ⎞ ╱ 3⋅x x + 2
⎮ ⎝x + 2⎠⋅ ╱ ──── + 1 - ──────
⎮ ╱ 4 3
⎮ ╲╱ 4⋅x
2⋅π⋅⎮ ────────────────────────────────── dx
⎮ 2
⎮ 8⋅x
⌡
1
In [3]: h.evalf()
On Wed, 25 Jan 2023 at 21:15, emanuel.c...@gmail.com
<emanuel.c...@gmail.com> wrote:
>
> There seems to be some funamental differences between Sympy's integration algorithm an other ones (say Sage, Maxima, Giac, Fricas or Mathematica). Sympy :
>
> ```
> >>> from sympy import *
> >>> x=symbols("x", positive=True)
> >>> f=Lambda((x), (x**6+2)/(8*x**2))
> >>> integrate(sqrt(f(x).diff(x)**2+1)*f(x))
> (Integral(2*Abs(x**4 - x**2 + 1)/x**5, x) + Integral(2*Abs(x**4 - x**2 + 1)/x**3, x) + Integral(x*Abs(x**4 - x**2 + 1), x) + Integral(x**3*Abs(x**4 - x**2 + 1), x))/16
> ```
>
> Sage (either via Maxima's or Giac's integrators) :
>
> ```
> sage: x=var("x", domain="positive")
> sage: f(x)=(x^6+2)/(8*x^2)
> sage: integrate((f(x).diff(x)^2+1).sqrt()*f(x),x)
> 1/128*x^8 + 1/32*x^2 + 1/32*(2*x^6 - 1)/x^4
Maybe it's because SymPy's integrate does not automatically factorise
under the radical (I haven't checked the code to see if factorisation
is attempted):
In [29]: integrand = sqrt(f(x).diff(x)**2+1)*f(x)
In [30]: print(integrand)
(x**6 + 2)*sqrt((3*x**3/4 - (x**6 + 2)/(4*x**3))**2 + 1)/(8*x**2)
In [31]: print(integrand.factor())
(x**2 + 1)*(x**6 + 2)*Abs(x**4 - x**2 + 1)/(16*x**5)
In [32]: print(integrand.factor().integrate(x))
x**8/128 + 3*x**2/32 - 1/(32*x**4)
--
Oscar
--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAHVvXxT5Yj1Wt%2BetUE-ep%3DrZqX%2BvZ5S-VQNyGas7ubL9kvY_uA%40mail.gmail.com.