Ask Your Question

Revision history [back]

You can use the following

sage: t = SR.var('t')
sage: z = 1-exp(2.0*cos(t) - 2.0*sin(t)-0.4*sqrt(-25*(cos(t) - sin(t))^2 + 100)^2)
sage: numerical_integral(z, 0, 2*pi)
(6.283185293615565, 2.4299802864003794e-10)

The first element of the answer is the value of the integral and the second one an estimation of the error (that you can believe in most situation).

You can use I confirm the followingRuntimeError

sage: t = SR.var('t')
sage: z = 1-exp(2.0*cos(t) - 2.0*sin(t)-0.4*sqrt(-25*(cos(t) - sin(t))^2 + 100)^2)
sage: integral(z, 0, 2*pi)
Traceback (most recent call last):
...
RuntimeError: ECL says: THROW: The catch RAT-ERR is undefined.

Though, you can use the following

sage: numerical_integral(z, 0, 2*pi)
(6.283185293615565, 2.4299802864003794e-10)

The first element of the answer is the value of the integral and the second one an estimation of the error (that you can believe in most situation).

Note that the integral is very close to two times pi

sage: (2*pi).n()
6.28318530717959