I am trying to compute the sum of the absolute values of these two expressions, and I am somehow confused, since the sum should be the same, right?
Consider the integrals:
It's easy to see, that the area underneath them is the same, and indeed both integrals return 4.
I wrote a simple script to evenly sample those functions and add all the sampled values together. Scaling aside, both expressions should yield the same result, but they dont. Here is the code:
import numpy as np
angles = np.linspace(0, 2*np.pi, 1000)
line1, line2= [], []
for n in angles:
line1.append(np.abs(np.cos(n)))
line2.append(np.abs(np.sin(n)))
print(sum(line1), sum(line2))
The result is the following:
636.983414656738 635.9826284722284
The sums are off by almost exactly 1. I know that they are not 4, because there is some constant factor missing, but the point is, that the values should be the same. Am I completly missing something here or is this a bug?