Lesson 14 of 18
Polar Area
Polar Area
In polar coordinates, a curve is defined by radius as a function of angle: .
The area enclosed by a polar curve from to :
A = rac{1}{2} int_a^b [r( heta)]^2 , d heta
Why the Formula Works
Each infinitesimal slice at angle is a sector with radius and angle . A sector's area is rac{1}{2}r^2 d heta (fraction of circle area ).
Classic Examples
Full circle on :
A = rac{1}{2} int_0^{2pi} R^2 , d heta = rac{1}{2} cdot R^2 cdot 2pi = pi R^2
Semicircle on :
A = rac{1}{2} int_0^{pi} 1 , d heta = rac{pi}{2} approx 1.5708
Rose curves and limaçons: more complex integrands requiring numerical integration.
Numerical Approach
Apply the midpoint rule:
#define PI 3.14159265358979
double h = (b - a) / n;
for each midpoint θ:
double r = r_fn(θ);
sum += r * r;
return 0.5 * sum * h;
Your Task
Implement double polar_area(double (*r_fn)(double), double a, double b, int n).
TCC compiler loading...
Loading...
Click "Run" to execute your code.