 CoCalc Public Filessupport / 2015-02-12-121421-integral.sagews
Authors: Harald Schilly, ℏal Snyder, William A. Stein
Description: Jupyter notebook support/2015-06-04-141749-bokeh.ipynb
# function to integrate
f(x) = sqrt(2+sqrt(2+sqrt(2+2*cos(5*sqrt(x)+4))))*x^(-1/2)
show(f)
plot(f, 1, 10, plot_points=200)

$\displaystyle x \ {\mapsto}\ \frac{\sqrt{\sqrt{\sqrt{2 \, \cos\left(5 \, \sqrt{x} + 4\right) + 2} + 2} + 2}}{\sqrt{x}}$ # compute the integral
%time result = integral(f, x)
show(result)

CPU time: 10.69 s, Wall time: 10.70 s
$\displaystyle x \ {\mapsto}\ \frac{32}{5} \, \sin\left(\frac{5}{8} \, \sqrt{x} + \frac{1}{2}\right)$
# derivative minus original function must be 0 -- this doesn't look like 0...
g = result.derivative(x) - f
show(g)

$\displaystyle x \ {\mapsto}\ \frac{2 \, \cos\left(\frac{5}{8} \, \sqrt{x} + \frac{1}{2}\right)}{\sqrt{x}} - \frac{\sqrt{\sqrt{\sqrt{2 \, \cos\left(5 \, \sqrt{x} + 4\right) + 2} + 2} + 2}}{\sqrt{x}}$
# Definitely not 0.
plot(g, 1, 10) #wait forever?
%time result2 = integral(f, x, algorithm='sympy')

show(result2)