Skip to content
DeepForgeby svx
All problems
MediumCalculusca-127

Wronskian Value

Problem

The Wronskian of f = e^(r1*x) and g = e^(r2*x) is W = f*g' - f'*g = (r2 - r1) * e^((r1 + r2)*x).

Given the two rates and x, return W(x). Two equal rates make the functions linearly dependent and give 0.

Hint

A nonzero Wronskian witnesses linear independence of the two solutions.

Test cases

case 1
in: [1,2,0]
expected: 1
case 2
in: [1,2,1]
expected: 20.085536923187668
case 3
in: [-1,-2,2]
expected: -0.0024787521766663585
case 4
in: [1,1,5]
expected: 0
case 5
in: [0,3,1]
expected: 60.256610769563004
Starter codePython
def wronskian_exp(r1, r2, x):
    # Your code here
    pass

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