Skip to content
DeepForgeby svx
All problems
MediumCalculusca-120

Gibbs Overshoot Value

Problem

The Gibbs overshoot of the Fourier partial sums of a unit square wave is G = (2/pi) * Si(pi), where Si is the sine integral.

Evaluate Si(pi) with the series sum over k = 0 to n-1 of (-1)^k * pi^(2k+1) / ((2k+1)! * (2k+1)), then multiply by 2/pi. Use 3.141592653589793 for pi.

Hint

The limit is the Wilbraham-Gibbs constant, about 1.1789797.

Test cases

case 1
in: [1]
expected: 2
case 2
in: [2]
expected: 0.9033772887678492
case 3
in: [3]
expected: 1.2280742588811906
case 4
in: [20]
expected: 1.1789797444721675
Starter codePython
def gibbs_overshoot(n):
    # Your code here
    pass

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