My friend gave me the challenge of calculating pi, but I keep getting stuck. I keep getting pi defined in terms of itself. What am I doing wrong?
Code:
x^2 + y^2 = 1 - Equation for a circle when r = 1
y = sqrt(1 - x^2) - Move y to other side of equation
A/4 = ∫(0 to 1) (sqrt(1 - x^2)) - solving area under the curve for the positive x and y
A/4 = (sqrt(1 − 1^2) * 1 + asin(1))/2 - (sqrt(1 − 0^2) * 0 + asin(0))/2 - definite integral
A/4 = (1 + asin(1))/2 - FUCK asin(1) = pi/4
I know I've done this before. Grrr.
Bookmarks