Skip to content
DeepForgeby svx
All problems
EasyCalculusca-144

Spherical Radial Laplacian

Problem

For a radially symmetric function f(r) = r^n, the Laplacian in spherical coordinates reduces to f'' + (2/r) * f'.

This equals n * (n + 1) * r^(n - 2). Given n and r > 0, return that value.

Hint

Only the radial part of the spherical Laplacian is nonzero for a radial function.

Test cases

case 1
in: [2,3]
expected: 6
case 2
in: [1,2]
expected: 1
case 3
in: [0,5]
expected: 0
case 4
in: [-1,2]
expected: 0
case 5
in: [3,1]
expected: 12
Starter codePython
def spherical_radial_laplacian(n, r):
    # Your code here
    pass

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