All problems
Laplace Transform of Sine and Cosine
Problem
Return the Laplace transforms of sin(a*t) and cos(a*t) at s as [L_sin, L_cos].
L{sin(a t)} = a / (s^2 + a^2) and L{cos(a t)} = s / (s^2 + a^2). Assume s > 0; a may be zero.
Hint
Both transforms share the denominator s^2 + a^2.
Test cases
case 1
in: [1,1]
expected: [0.5,0.5]
case 2
in: [2,1]
expected: [0.4,0.2]
case 3
in: [0,1]
expected: [0,1]
case 4
in: [3,4]
expected: [0.12,0.16]
case 5
in: [1,2]
expected: [0.2,0.4]
Starter codePython
def laplace_sin_cos(a, s):
# Return [L_sin, L_cos]
# Your code here
pass5 test cases · run your code against them in the editor