All problems
ODE Separation Solution Value
Problem
Solve the separable ODE y' = k*y with y(0) = y0 and evaluate the solution at x.
Separating variables gives y(x) = y0 * e^(k*x). Use the given initial value y0.
Hint
Integrate dy / y = k dx and exponentiate both sides.
Test cases
case 1
in: [1,1,0]
expected: 1
case 2
in: [2,0,5]
expected: 2
case 3
in: [1,-1,1]
expected: 0.36787944117144233
case 4
in: [3,2,0.5]
expected: 8.154845485377136
case 5
in: [0,5,3]
expected: 0
Starter codePython
def separation_value(y0, k, x):
# Your code here
pass5 test cases · run your code against them in the editor