CoCalc -- Collaborative Calculation in the Cloud
Sharedsupport / 2015-02-12-121421-integral.sagewsOpen in CoCalc

Examples for support purposes...

# 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)
x  2cos(5x+4)+2+2+2x\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
x  325sin(58x+12)\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)
x  2cos(58x+12)x2cos(5x+4)+2+2+2x\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)