Skip to content
DeepForgeby svx
All problems
MediumCalculusca-168

Polar Area Integral

Problem

Evaluate the polar integral of x^2 + y^2 over the disk of radius R.

The change to polar coordinates with Jacobian r gives the integral of r^3 dr dtheta, which equals pi * R^4 / 2. Given R >= 0, return this value using 3.141592653589793 for pi.

Hint

The integrand becomes r^2 and the area element becomes r dr dtheta.

Test cases

case 1
in: [1]
expected: 1.5707963267948966
case 2
in: [2]
expected: 25.132741228718345
case 3
in: [0]
expected: 0
case 4
in: [0.5]
expected: 0.09817477042468103
Starter codePython
def polar_moment(radius):
    # Your code here
    pass

4 test cases · run your code against them in the editor