Error when doing integration with QuadGK

I used the following code

using QuadGK
v = quadgk(x->cos(x)^2/((x+1)*(x^2-x+1)),-pi,0)[1]

and got the error below

ERROR: DomainError with -1.0000000000000009:
integrand produced Inf in the interval (-1.0000000000000022, -0.9999999999999996)

Please help me to resolve this situation.

Thank you.

Ooops, I see. It is clear from the error message. Sorry for posting the above question.

1 Like