Cody

# Problem 231. Differential equations I

Solution 2745538

Submitted on 27 Jul 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
f = @(x) -x; tf =1; y0 =1; assert(abs(deqnsolve(f,y0,tf)-exp(-1)) < 1e-5)

y0 = 1 tf = 5 h = 1.0000e-06 y1 = 1 a = 0 b = 1 c = 1000000 y1 = -4 res = -4

Assertion failed.

2   Fail
f = @sin; tf =1; y0 =1/2; assert(abs(deqnsolve(f,y0,tf)-2*acot(exp(-1)*cot(1/4))) < 1e-5)

y0 = 1 tf = 5 h = 1.0000e-06 y1 = 1 a = 0 b = 1 c = 1000000 y1 = 1.0000 res = 1.0000

Assertion failed.

3   Fail
f = @(x) 1/(x+1); tf =6; y0 =1; assert(abs(deqnsolve(f,y0,tf)-3) < 1e-5)

y0 = 1 tf = 5 h = 1.0000e-06 y1 = 1 a = 0 b = 1 c = 1000000 y1 = 1.0000 res = 1.0000

Assertion failed.

4   Fail
a = rand*0.9; f = @(x) x-a*x^2; tf = rand+1.5; y0=1; assert(abs(deqnsolve(f,y0,tf)-exp(tf)/(1-a+a*exp(tf))) < 1e-5)

y0 = 1 tf = 5 h = 1.0000e-06 y1 = 1 a = 0 b = 1 c = 1000000 y1 = -1.3864e+07 res = -1.3864e+07

Assertion failed.