Cody

Problem 231. Differential equations I

Solution 2745559

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 = 0.0100 y1 = 1 a = 0 b = 1 c = 100 k = 0 y2 = 1 y1 = 1 k = 1 y2 = 0.9900 y1 = 0.9900 k = 2 y2 = 0.9700 y1 = 0.9700 k = 3 y2 = 0.9400 y1 = 0.9400 k = 4 y2 = 0.9000 y1 = 0.9000 k = 5 y2 = 0.8500 y1 = 0.8500 k = 6 y2 = 0.7900 y1 = 0.7900 k = 7 y2 = 0.7200 y1 = 0.7200 k = 8 y2 = 0.6400 y1 = 0.6400 k = 9 y2 = 0.5500 y1 = 0.5500 k = 10 y2 = 0.4500 y1 = 0.4500 k = 11 y2 = 0.3400 y1 = 0.3400 k = 12 y2 = 0.2200 y1 = 0.2200 k = 13 y2 = 0.0900 y1 = 0.0900 k = 14 y2 = -0.0500 y1 = -0.0500 k = 15 y2 = -0.2000 y1 = -0.2000 k = 16 y2 = -0.3600 y1 = -0.3600 k = 17 y2 = -0.5300 y1 = -0.5300 k = 18 y2 = -0.7100 y1 = -0.7100 k = 19 y2 = -0.9000 y1 = -0.9000 k = 20 y2 = -1.1000 y1 = -1.1000 k = 21 y2 = -1.3100 y1 = -1.3100 k = 22 y2 = -1.5300 y1 = -1.5300 k = 23 y2 = -1.7600 y1 = -1.7600 k = 24 y2 = -2 y1 = -2 k = 25 y2 = -2.2500 y1 = -2.2500 k = 26 y2 = -2.5100 y1 = -2.5100 k = 27 y2 = -2.7800 y1 = -2.7800 k = 28 y2 = -3.0600 y1 = -3.0600 k = 29 y2 = -3.3500 y1 = -3.3500 k = 30 y2 = -3.6500 y1 = -3.6500 k = 31 y2 = -3.9600 y1 = -3.9600 k = 32 y2 = -4.2800 y1 = -4.2800 k = 33 y2 = -4.6100 y1 = -4.6100 k = 34 y2 = -4.9500 y1 = -4.9500 k = 35 y2 = -5.3000 y1 = -5.3000 k = 36 y2 = -5.6600 y1 = -5.6600 k = 37 y2 = -6.0300 y1 = -6.0300 k = 38 y2 = -6.4100 y1 = -6.4100 k = 39 y2 = -6.8000 y1 = -6.8000 k = 40 y2 = -7.2000 y1 = -7.2000 k = 41 y2 = -7.6100 y1 = -7.6100 k = 42 y2 = -8.0300 y1 = -8.0300 k = 43 y2 = -8.4600 y1 = -8.4600 k = 44 y2 = -8.9000 y1 = -8.9000 k = 45 y2 = -9.3500 y1 = -9.3500 k = 46 y2 = -9.8100 y1 = -9.8100 k = 47 y2 = -10.2800 y1 = -10.2800 k = 48 y2 = -10.7600 y1 = -10.7600 k = 49 y2 = -11.2500 y1 = -11.2500 k = 50 y2 = -11.7500 y1 = -11.7500 k = 51 y2 = -12.2600 y1 = -12.2600 k = 52 y2 = -12.7800 y1 = -12.7800 k = 53 y2 = -13.3100 y1 = -13.3100 k = 54 y2 = -13.8500 y1 = -13.8500 k = 55 y2 = -14.4000 y1 = -14.4000 k = 56 y2 = -14.9600 y1 = -14.9600 k = 57 y2 = -15.5300 y1 = -15.5300 k = 58 y2 = -16.1100 y1 = -16.1100 k = 59 y2 = -16.7000 y1 = -16.7000 k = 60 y2 = -17.3000 y1 = -17.3000 k = 61 y2 = -17.9100 y1 = -17.9100 k = 62 y2 = -18.5300 y1 = -18.5300 k = 63 y2 = -19.1600 y1 = -19.1600 k = 64 y2 = -19.8000 y1 = -19.8000 k = 65 y2 = -20.4500 y1 = -20.4500 k = 66 y2 = -21.1100 y1 = -21.1100 k = 67 y2 = -21.7800 y1 = -21.7800 k = 68 y2 = -22.4600 y1 = -22.4600 k = 69 y2 = -23.1500 y1 = -23.1500 k = 70 y2 = -23.8500 y1 = -23.8500 k = 71 y2 = -24.5600 y1 = -24.5600 k = 72 y2 = -25.2800 y1 = -25.2800 k = 73 y2 = -26.0100 y1 = -26.0100 k = 74 y2 = -26.7500 y1 = -26.7500 k = 75 y2 = -27.5000 y1 = -27.5000 k = 76 y2 = -28.2600 y1 = -28.2600 k = 77 y2 = -29.0300 y1 = -29.0300 k = 78 y2 = -29.8100 y1 = -29.8100 k = 79 y2 = -30.6000 y1 = -30.6000 k = 80 y2 = -31.4000 y1 = -31.4000 k = 81 y2 = -32.2100 y1 = -32.2100 k = 82 y2 = -33.0300 y1 = -33.0300 k = 83 y2 = -33.8600 y1 = -33.8600 k = 84 y2 = -34.7000 y1 = -34.7000 k = 85 y2 = -35.5500 y1 = -35.5500 k = 86 y2 = -36.4100 y1 = -36.4100 k = 87 y2 = -37.2800 y1 = -37.2800 k = 88 y2 = -38.1600 y1 = -38.1600 k = 89 y2 = -39.0500 y1 = -39.0500 k = 90 y2 = -39.9500 y1 = -39.9500 k = 91 y2 = -40.8600 y1 = -40.8600 k = 92 y2 = -41.7800 y1 = -41.7800 k = 93 y2 = -42.7100 y1 = -42.7100 k = 94 y2 = -43.6500 y1 = -43.6500 k = 95 y2 = -44.6000 y1 = -44.6000 k = 96 y2 = -45.5600 y1 = -45.5600 k = 97 y2 = -46.5300 y1 = -46.5300 k = 98 y2 = -47.5100 y1 = -47.5100 k = 99 y2 = -48.5000 y1 = -48.5000 k = 100 y2 = -49.5000 y1 = -49.5000 k = 101 y2 = -50.5100 y1 = -50.5100 k = 102 y2 = -51.5300 y1 = -51.5300 k = 103 y2 = -52.5600 y1 = -52.5600 k = 104 y2 = -53.6000 y1 = -53.6000 k = 105 y2 = -54.6500 y1 = -54.6500 k = 106 y2 = -55.7100 y1 = -55.7100 k = 107 y2 = -56.7800 y1 = -56.7800 k = 108 y2 = -57.8600 y1 = -57.8600 k = 109 y2 = -58.9500 y1 = -58.9500 k = 110 y2 = -60.0500 y1 = -60.0500 k = 111 y2 = -61.1600 y1 = -61.1600 k = 112 y2 = -62.2800 y1 = -62.2800 k = 113 y2 = -63.4100 y1 = -63.4100 k = 114 y2 = -64.5500 y1 = -64.5500 k = 115 y2 = -65.7000 y1 = -65.7000 k = 116 y2 = -66.8600 y1 = -66.8600 k = 117 y2 = -68.0300 y1 = -68.0300 k = 118 y2 = -69.2100 y1 = -69.2100 k = 119 y2 = -70.4000 y1 = -70.4000 k = 120 y2 = -71.6000 y1 = -71.6000 k = 121 y2 = -72.8100 y1 = -72.8100 k = 122 y2 = -74.0300 y1 = -74.0300 k = 123 y2 = -75.2600 y1 = -75.2600 k = 124 y2 = -76.5000 y1 = -76.5000 k = 125 y2 = -77.7500 y1 = -77.7500 k = 126 y2 = -79.0100 y1 = -79.0100 k = 127 y2 = -80.2800 y1 = -80.2800 k = 128 y2 = -81.5600 y1 = -81.5600 k = 129 y2 = -82.8500 y1 = -82.8500 k = 130 y2 = -84.1500 y1 = -84.1500 k = 131 y2 = -85.4600 y1 = -85.4600 k = 132 y2 = -86.7800 y1 = -86.7800 k = 133 y2 = -88.1100 y1 = -88.1100 k = 134 y2 = -89.4500 y1 = -89.4500 k = 135 y2 = -90.8000 y1 = -90.8000 k = 136 y2 = -92.1600 y1 = -92.1600 k = 137 y2 = -93.5300 y1 = -93.5300 k = 138 y2 = -94.9100 y1 = -94.9100 k = 139 y2 = -96.3000 y1 = -96.3000 k = 140 y2 = -97.7000 y1 = -97.7000 k = 141 y2 = -99.1100 y1 = -99.1100 k = 142 y2 = -100.5300 y1 = -100.5300 k = 143 y2 = -101.9600 y1 = -101.9600 k = 144 y2 = -103.4000 y1 = -103.4000 k = 145 y2 = -104.8500 y1 = -104.8500 k = 146 y2 = -106.3100 y1 = -106.3100 k = 147 y2 = -107.7800 y1 = -107.7800 k = 148 y2 = -109.2600 y1 = -109.2600 k = 149 y2 = -110.7500 y1 = -110.7500 k = 150 y2 = -112.2500 y1 = -112.2500 k = 151 y2 = -113.7600 y1 = -113.7600 k = 152 y2 = -115.2800 y1 = -115.2800 k = 153 y2 = -116.8100 y1 = -116.8100 k = 154 y2 = -118.3500 y1 = -118.3500 k = 155 y2 = -119.9000 y1 = -119.9000 k = 156 y2 = -121.4600 y1 = -121.4600 k = 157 y2 = -123.0300 y1 = -123.0300 k = 158 y2 = -124.6100 y1 = -124.6100 k = 159 y2 = -126.2000 y1 = -126.2000 k = 160 y2 = -127.8000 y1 = -127.8000 k = 161 y2 = -129.4100 y1 = -129.4100 k = 162 y2 = -131.0300 y1 = -131.0300 k = 163 y2 = -132.6600 y1 = -132.6600 k = 164 y2 = -134.3000 y1 = -134.3000 k = 165 y2 = -135.9500 y1 = -135.9500 k = 166 y2 = -137.6100 y1 = -137.6100 k = 167 y2 = -139.2800 y1 = -139.2800 k = 168 y2 = -140.9600 y1 = -140.9600 k = 169 y2 = -142.6500 y1 = -142.6500 k = 170 y2 = -144.3500 y1 = -144.3500 k = 171 y2 = -146.0600 y1 = -146.0600 k = 172 y2 = -147.7800 y1 = -147.7800 k = 173 y2 = -149.5100 y1 = -149.5100 k = 174 y2 = -151.2500 y1 = -151.2500 k = 175 y2 = -153.0000 y1 = -153.0000 k = 176 y2 = -154.7600 y1 = -154.7600 k = 177 y2 = -156.5300 y1 = -156.5300 k = 178 y2 = -158.3100 y1 = -158.3100 k = 179 y2 = -160.1000 y1 = -160.1000 k = 180 y2 = -161.9000 y1 = -161.9000 k = 181 y2 = -163.7100 y1 = -163.7100 k = 182 y2 = -165.5300 y1 = -165.5300 k = 183 y2 = -167.3600 y1 = -167.3600 k = 184 y2 = -169.2000 y1 = -169.2000 k = 185 y2 = -171.0500 y1 = -171.0500 k = 186 y2 = -172.9100 y1 = -172.9100 k = 187 y2 = -174.7800 y1 = -174.7800 k = 188 y2 = -176.6600 y1 = -176.6600 k = 189 y2 = -178.5500 y1 = -178.5500 k = 190 y2 = -180.4500 ...

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 = 0.0100 y1 = 1 a = 0 b = 1 c = 100 k = 0 y2 = 1 y1 = 1 k = 1 y2 = 1.0084 y1 = 1.0084 k = 2 y2 = 1.0175 y1 = 1.0175 k = 3 y2 = 1.0189 y1 = 1.0189 k = 4 y2 = 1.0114 y1 = 1.0114 k = 5 y2 = 1.0018 y1 = 1.0018 k = 6 y2 = 0.9990 y1 = 0.9990 k = 7 y2 = 1.0055 y1 = 1.0055 k = 8 y2 = 1.0154 y1 = 1.0154 k = 9 y2 = 1.0196 y1 = 1.0196 k = 10 y2 = 1.0141 y1 = 1.0141 k = 11 y2 = 1.0041 y1 = 1.0041 k = 12 y2 = 0.9987 y1 = 0.9987 k = 13 y2 = 1.0029 y1 = 1.0029 k = 14 y2 = 1.0129 y1 = 1.0129 k = 15 y2 = 1.0194 y1 = 1.0194 k = 16 y2 = 1.0165 y1 = 1.0165 k = 17 y2 = 1.0069 y1 = 1.0069 k = 18 y2 = 0.9994 y1 = 0.9994 k = 19 y2 = 1.0009 y1 = 1.0009 k = 20 y2 = 1.0100 y1 = 1.0100 k = 21 y2 = 1.0183 y1 = 1.0183 k = 22 y2 = 1.0183 y1 = 1.0183 k = 23 y2 = 1.0098 y1 = 1.0098 k = 24 y2 = 1.0007 y1 = 1.0007 k = 25 y2 = 0.9994 y1 = 0.9994 k = 26 y2 = 1.0070 y1 = 1.0070 k = 27 y2 = 1.0166 y1 = 1.0166 k = 28 y2 = 1.0193 y1 = 1.0193 k = 29 y2 = 1.0127 y1 = 1.0127 k = 30 y2 = 1.0028 y1 = 1.0028 k = 31 y2 = 0.9988 y1 = 0.9988 k = 32 y2 = 1.0043 y1 = 1.0043 k = 33 y2 = 1.0143 y1 = 1.0143 k = 34 y2 = 1.0196 y1 = 1.0196 k = 35 y2 = 1.0153 y1 = 1.0153 k = 36 y2 = 1.0054 y1 = 1.0054 k = 37 y2 = 0.9989 y1 = 0.9989 k = 38 y2 = 1.0019 y1 = 1.0019 k = 39 y2 = 1.0115 y1 = 1.0115 k = 40 y2 = 1.0190 y1 = 1.0190 k = 41 y2 = 1.0174 y1 = 1.0174 k = 42 y2 = 1.0082 y1 = 1.0082 k = 43 y2 = 0.9999 y1 = 0.9999 k = 44 y2 = 1.0001 y1 = 1.0001 k = 45 y2 = 1.0086 y1 = 1.0086 k = 46 y2 = 1.0176 y1 = 1.0176 k = 47 y2 = 1.0189 y1 = 1.0189 k = 48 y2 = 1.0112 y1 = 1.0112 k = 49 y2 = 1.0016 y1 = 1.0016 k = 50 y2 = 0.9990 y1 = 0.9990 k = 51 y2 = 1.0057 y1 = 1.0057 k = 52 y2 = 1.0156 y1 = 1.0156 k = 53 y2 = 1.0195 y1 = 1.0195 k = 54 y2 = 1.0139 y1 = 1.0139 k = 55 y2 = 1.0040 y1 = 1.0040 k = 56 y2 = 0.9987 y1 = 0.9987 k = 57 y2 = 1.0031 y1 = 1.0031 k = 58 y2 = 1.0130 y1 = 1.0130 k = 59 y2 = 1.0194 y1 = 1.0194 k = 60 y2 = 1.0163 y1 = 1.0163 k = 61 y2 = 1.0067 y1 = 1.0067 k = 62 y2 = 0.9993 y1 = 0.9993 k = 63 y2 = 1.0010 y1 = 1.0010 k = 64 y2 = 1.0102 y1 = 1.0102 k = 65 y2 = 1.0184 y1 = 1.0184 k = 66 y2 = 1.0182 y1 = 1.0182 k = 67 y2 = 1.0096 y1 = 1.0096 k = 68 y2 = 1.0006 y1 = 1.0006 k = 69 y2 = 0.9995 y1 = 0.9995 k = 70 y2 = 1.0072 y1 = 1.0072 k = 71 y2 = 1.0167 y1 = 1.0167 k = 72 y2 = 1.0193 y1 = 1.0193 k = 73 y2 = 1.0125 y1 = 1.0125 k = 74 y2 = 1.0027 y1 = 1.0027 k = 75 y2 = 0.9988 y1 = 0.9988 k = 76 y2 = 1.0044 y1 = 1.0044 k = 77 y2 = 1.0144 y1 = 1.0144 k = 78 y2 = 1.0196 y1 = 1.0196 k = 79 y2 = 1.0151 y1 = 1.0151 k = 80 y2 = 1.0052 y1 = 1.0052 k = 81 y2 = 0.9989 y1 = 0.9989 k = 82 y2 = 1.0020 y1 = 1.0020 k = 83 y2 = 1.0117 y1 = 1.0117 k = 84 y2 = 1.0190 y1 = 1.0190 k = 85 y2 = 1.0173 y1 = 1.0173 k = 86 y2 = 1.0080 y1 = 1.0080 k = 87 y2 = 0.9998 y1 = 0.9998 k = 88 y2 = 1.0002 y1 = 1.0002 k = 89 y2 = 1.0088 y1 = 1.0088 k = 90 y2 = 1.0177 y1 = 1.0177 k = 91 y2 = 1.0188 y1 = 1.0188 k = 92 y2 = 1.0110 y1 = 1.0110 k = 93 y2 = 1.0015 y1 = 1.0015 k = 94 y2 = 0.9991 y1 = 0.9991 k = 95 y2 = 1.0059 y1 = 1.0059 k = 96 y2 = 1.0157 y1 = 1.0157 k = 97 y2 = 1.0195 y1 = 1.0195 k = 98 y2 = 1.0138 y1 = 1.0138 k = 99 y2 = 1.0038 y1 = 1.0038 k = 100 y2 = 0.9987 y1 = 0.9987 k = 101 y2 = 1.0032 y1 = 1.0032 k = 102 y2 = 1.0132 y1 = 1.0132 k = 103 y2 = 1.0194 y1 = 1.0194 k = 104 y2 = 1.0162 y1 = 1.0162 k = 105 y2 = 1.0065 y1 = 1.0065 k = 106 y2 = 0.9992 y1 = 0.9992 k = 107 y2 = 1.0011 y1 = 1.0011 k = 108 y2 = 1.0103 y1 = 1.0103 k = 109 y2 = 1.0185 y1 = 1.0185 k = 110 y2 = 1.0181 y1 = 1.0181 k = 111 y2 = 1.0094 y1 = 1.0094 k = 112 y2 = 1.0005 y1 = 1.0005 k = 113 y2 = 0.9996 y1 = 0.9996 k = 114 y2 = 1.0074 y1 = 1.0074 k = 115 y2 = 1.0169 y1 = 1.0169 k = 116 y2 = 1.0192 y1 = 1.0192 k = 117 y2 = 1.0123 y1 = 1.0123 k = 118 y2 = 1.0025 y1 = 1.0025 k = 119 y2 = 0.9988 y1 = 0.9988 k = 120 y2 = 1.0046 y1 = 1.0046 k = 121 y2 = 1.0146 y1 = 1.0146 k = 122 y2 = 1.0196 y1 = 1.0196 k = 123 y2 = 1.0150 y1 = 1.0150 k = 124 y2 = 1.0050 y1 = 1.0050 k = 125 y2 = 0.9989 y1 = 0.9989 k = 126 y2 = 1.0022 y1 = 1.0022 k = 127 y2 = 1.0119 y1 = 1.0119 k = 128 y2 = 1.0191 y1 = 1.0191 k = 129 y2 = 1.0172 y1 = 1.0172 k = 130 y2 = 1.0079 y1 = 1.0079 k = 131 y2 = 0.9997 y1 = 0.9997 k = 132 y2 = 1.0003 y1 = 1.0003 k = 133 y2 = 1.0090 y1 = 1.0090 k = 134 y2 = 1.0178 y1 = 1.0178 k = 135 y2 = 1.0187 y1 = 1.0187 k = 136 y2 = 1.0108 y1 = 1.0108 k = 137 y2 = 1.0014 y1 = 1.0014 k = 138 y2 = 0.9991 y1 = 0.9991 k = 139 y2 = 1.0061 y1 = 1.0061 k = 140 y2 = 1.0159 y1 = 1.0159 k = 141 y2 = 1.0195 y1 = 1.0195 k = 142 y2 = 1.0136 y1 = 1.0136 k = 143 y2 = 1.0036 y1 = 1.0036 k = 144 y2 = 0.9987 y1 = 0.9987 k = 145 y2 = 1.0034 y1 = 1.0034 k = 146 y2 = 1.0134 y1 = 1.0134 k = 147 y2 = 1.0195 y1 = 1.0195 k = 148 y2 = 1.0161 y1 = 1.0161 k = 149 y2 = 1.0063 y1 = 1.0063 k = 150 y2 = 0.9992 y1 = 0.9992 k = 151 y2 = 1.0012 y1 = 1.0012 k = 152 y2 = 1.0105 y1 = 1.0105 k = 153 y2 = 1.0186 y1 = 1.0186 k = 154 y2 = 1.0180 y1 = 1.0180 k = 155 y2 = 1.0092 y1 = 1.0092 k = 156 y2 = 1.0004 y1 = 1.0004 k = 157 y2 = 0.9996 y1 = 0.9996 k = 158 y2 = 1.0076 y1 = 1.0076 k = 159 y2 = 1.0170 y1 = 1.0170 k = 160 y2 = 1.0192 y1 = 1.0192 k = 161 y2 = 1.0122 y1 = 1.0122 k = 162 y2 = 1.0024 y1 = 1.0024 k = 163 y2 = 0.9988 y1 = 0.9988 k = 164 y2 = 1.0048 y1 = 1.0048 k = 165 y2 = 1.0147 y1 = 1.0147 k = 166 y2 = 1.0196 y1 = 1.0196 k = 167 y2 = 1.0148 y1 = 1.0148 k = 168 y2 = 1.0049 y1 = 1.0049 k = 169 y2 = 0.9988 y1 = 0.9988 k = 170 y2 = 1.0023 y1 = 1.0023 k = 171 y2 = 1.0121 y1 = 1.0121 k = 172 y2 = 1.0192 y1 = 1.0192 k = 173 y2 = 1.0170 y1 = 1.0170 k = 174 y2 = 1.0077 y1 = 1.0077 k = 175 y2 = 0.9997 y1 = 0.9997 k = 176 y2 = 1.0004 y1 = 1.0004 k = 177 y2 = 1.0092 y1 = 1.0092 k = 178 y2 = 1.0179 y1 = 1.0179 k = 179 y2 = 1.0186 y1 = 1.0186 k = 180 y2 = 1.0106 y1 = 1.0106 k = 181 y2 = 1.0013 y1 = 1.0013 k = 182 y2 = 0.9992 y1 = 0.9992 k = 183 y2 = 1.0062 y1 = 1.0062 k = 184 y2 = 1.0160 y1 = 1.0160 k = 185 y2 = 1.0195 y1 = 1.0195 k = 186 y2 = 1.0135 y1 = 1.0135 k = 187 y2 = 1.0035 y1 = 1.0035 k = 188 y2 = 0.9987 y1 = 0.9987 k = 189 y2 = 1.0036 y1 = 1.0036 k = 190 y2 = ...

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 = 0.0100 y1 = 1 a = 0 b = 1 c = 100 k = 0 y2 = 1.0100 y1 = 1.0100 k = 1 y2 = 1.0150 y1 = 1.0150 k = 2 y2 = 1.0183 y1 = 1.0183 k = 3 y2 = 1.0208 y1 = 1.0208 k = 4 y2 = 1.0228 y1 = 1.0228 k = 5 y2 = 1.0245 y1 = 1.0245 k = 6 y2 = 1.0259 y1 = 1.0259 k = 7 y2 = 1.0272 y1 = 1.0272 k = 8 y2 = 1.0283 y1 = 1.0283 k = 9 y2 = 1.0293 y1 = 1.0293 k = 10 y2 = 1.0302 y1 = 1.0302 k = 11 y2 = 1.0310 y1 = 1.0310 k = 12 y2 = 1.0318 y1 = 1.0318 k = 13 y2 = 1.0325 y1 = 1.0325 k = 14 y2 = 1.0332 y1 = 1.0332 k = 15 y2 = 1.0338 y1 = 1.0338 k = 16 y2 = 1.0344 y1 = 1.0344 k = 17 y2 = 1.0350 y1 = 1.0350 k = 18 y2 = 1.0355 y1 = 1.0355 k = 19 y2 = 1.0360 y1 = 1.0360 k = 20 y2 = 1.0365 y1 = 1.0365 k = 21 y2 = 1.0369 y1 = 1.0369 k = 22 y2 = 1.0373 y1 = 1.0373 k = 23 y2 = 1.0378 y1 = 1.0378 k = 24 y2 = 1.0382 y1 = 1.0382 k = 25 y2 = 1.0385 y1 = 1.0385 k = 26 y2 = 1.0389 y1 = 1.0389 k = 27 y2 = 1.0393 y1 = 1.0393 k = 28 y2 = 1.0396 y1 = 1.0396 k = 29 y2 = 1.0399 y1 = 1.0399 k = 30 y2 = 1.0403 y1 = 1.0403 k = 31 y2 = 1.0406 y1 = 1.0406 k = 32 y2 = 1.0409 y1 = 1.0409 k = 33 y2 = 1.0412 y1 = 1.0412 k = 34 y2 = 1.0415 y1 = 1.0415 k = 35 y2 = 1.0417 y1 = 1.0417 k = 36 y2 = 1.0420 y1 = 1.0420 k = 37 y2 = 1.0423 y1 = 1.0423 k = 38 y2 = 1.0425 y1 = 1.0425 k = 39 y2 = 1.0428 y1 = 1.0428 k = 40 y2 = 1.0430 y1 = 1.0430 k = 41 y2 = 1.0433 y1 = 1.0433 k = 42 y2 = 1.0435 y1 = 1.0435 k = 43 y2 = 1.0437 y1 = 1.0437 k = 44 y2 = 1.0439 y1 = 1.0439 k = 45 y2 = 1.0442 y1 = 1.0442 k = 46 y2 = 1.0444 y1 = 1.0444 k = 47 y2 = 1.0446 y1 = 1.0446 k = 48 y2 = 1.0448 y1 = 1.0448 k = 49 y2 = 1.0450 y1 = 1.0450 k = 50 y2 = 1.0452 y1 = 1.0452 k = 51 y2 = 1.0454 y1 = 1.0454 k = 52 y2 = 1.0456 y1 = 1.0456 k = 53 y2 = 1.0458 y1 = 1.0458 k = 54 y2 = 1.0459 y1 = 1.0459 k = 55 y2 = 1.0461 y1 = 1.0461 k = 56 y2 = 1.0463 y1 = 1.0463 k = 57 y2 = 1.0465 y1 = 1.0465 k = 58 y2 = 1.0466 y1 = 1.0466 k = 59 y2 = 1.0468 y1 = 1.0468 k = 60 y2 = 1.0470 y1 = 1.0470 k = 61 y2 = 1.0471 y1 = 1.0471 k = 62 y2 = 1.0473 y1 = 1.0473 k = 63 y2 = 1.0474 y1 = 1.0474 k = 64 y2 = 1.0476 y1 = 1.0476 k = 65 y2 = 1.0477 y1 = 1.0477 k = 66 y2 = 1.0479 y1 = 1.0479 k = 67 y2 = 1.0480 y1 = 1.0480 k = 68 y2 = 1.0482 y1 = 1.0482 k = 69 y2 = 1.0483 y1 = 1.0483 k = 70 y2 = 1.0485 y1 = 1.0485 k = 71 y2 = 1.0486 y1 = 1.0486 k = 72 y2 = 1.0487 y1 = 1.0487 k = 73 y2 = 1.0489 y1 = 1.0489 k = 74 y2 = 1.0490 y1 = 1.0490 k = 75 y2 = 1.0491 y1 = 1.0491 k = 76 y2 = 1.0493 y1 = 1.0493 k = 77 y2 = 1.0494 y1 = 1.0494 k = 78 y2 = 1.0495 y1 = 1.0495 k = 79 y2 = 1.0497 y1 = 1.0497 k = 80 y2 = 1.0498 y1 = 1.0498 k = 81 y2 = 1.0499 y1 = 1.0499 k = 82 y2 = 1.0500 y1 = 1.0500 k = 83 y2 = 1.0501 y1 = 1.0501 k = 84 y2 = 1.0503 y1 = 1.0503 k = 85 y2 = 1.0504 y1 = 1.0504 k = 86 y2 = 1.0505 y1 = 1.0505 k = 87 y2 = 1.0506 y1 = 1.0506 k = 88 y2 = 1.0507 y1 = 1.0507 k = 89 y2 = 1.0508 y1 = 1.0508 k = 90 y2 = 1.0509 y1 = 1.0509 k = 91 y2 = 1.0510 y1 = 1.0510 k = 92 y2 = 1.0512 y1 = 1.0512 k = 93 y2 = 1.0513 y1 = 1.0513 k = 94 y2 = 1.0514 y1 = 1.0514 k = 95 y2 = 1.0515 y1 = 1.0515 k = 96 y2 = 1.0516 y1 = 1.0516 k = 97 y2 = 1.0517 y1 = 1.0517 k = 98 y2 = 1.0518 y1 = 1.0518 k = 99 y2 = 1.0519 y1 = 1.0519 k = 100 y2 = 1.0520 y1 = 1.0520 k = 101 y2 = 1.0521 y1 = 1.0521 k = 102 y2 = 1.0522 y1 = 1.0522 k = 103 y2 = 1.0523 y1 = 1.0523 k = 104 y2 = 1.0524 y1 = 1.0524 k = 105 y2 = 1.0525 y1 = 1.0525 k = 106 y2 = 1.0525 y1 = 1.0525 k = 107 y2 = 1.0526 y1 = 1.0526 k = 108 y2 = 1.0527 y1 = 1.0527 k = 109 y2 = 1.0528 y1 = 1.0528 k = 110 y2 = 1.0529 y1 = 1.0529 k = 111 y2 = 1.0530 y1 = 1.0530 k = 112 y2 = 1.0531 y1 = 1.0531 k = 113 y2 = 1.0532 y1 = 1.0532 k = 114 y2 = 1.0533 y1 = 1.0533 k = 115 y2 = 1.0534 y1 = 1.0534 k = 116 y2 = 1.0534 y1 = 1.0534 k = 117 y2 = 1.0535 y1 = 1.0535 k = 118 y2 = 1.0536 y1 = 1.0536 k = 119 y2 = 1.0537 y1 = 1.0537 k = 120 y2 = 1.0538 y1 = 1.0538 k = 121 y2 = 1.0539 y1 = 1.0539 k = 122 y2 = 1.0539 y1 = 1.0539 k = 123 y2 = 1.0540 y1 = 1.0540 k = 124 y2 = 1.0541 y1 = 1.0541 k = 125 y2 = 1.0542 y1 = 1.0542 k = 126 y2 = 1.0543 y1 = 1.0543 k = 127 y2 = 1.0543 y1 = 1.0543 k = 128 y2 = 1.0544 y1 = 1.0544 k = 129 y2 = 1.0545 y1 = 1.0545 k = 130 y2 = 1.0546 y1 = 1.0546 k = 131 y2 = 1.0546 y1 = 1.0546 k = 132 y2 = 1.0547 y1 = 1.0547 k = 133 y2 = 1.0548 y1 = 1.0548 k = 134 y2 = 1.0549 y1 = 1.0549 k = 135 y2 = 1.0549 y1 = 1.0549 k = 136 y2 = 1.0550 y1 = 1.0550 k = 137 y2 = 1.0551 y1 = 1.0551 k = 138 y2 = 1.0552 y1 = 1.0552 k = 139 y2 = 1.0552 y1 = 1.0552 k = 140 y2 = 1.0553 y1 = 1.0553 k = 141 y2 = 1.0554 y1 = 1.0554 k = 142 y2 = 1.0554 y1 = 1.0554 k = 143 y2 = 1.0555 y1 = 1.0555 k = 144 y2 = 1.0556 y1 = 1.0556 k = 145 y2 = 1.0556 y1 = 1.0556 k = 146 y2 = 1.0557 y1 = 1.0557 k = 147 y2 = 1.0558 y1 = 1.0558 k = 148 y2 = 1.0558 y1 = 1.0558 k = 149 y2 = 1.0559 y1 = 1.0559 k = 150 y2 = 1.0560 y1 = 1.0560 k = 151 y2 = 1.0560 y1 = 1.0560 k = 152 y2 = 1.0561 y1 = 1.0561 k = 153 y2 = 1.0562 y1 = 1.0562 k = 154 y2 = 1.0562 y1 = 1.0562 k = 155 y2 = 1.0563 y1 = 1.0563 k = 156 y2 = 1.0564 y1 = 1.0564 k = 157 y2 = 1.0564 y1 = 1.0564 k = 158 y2 = 1.0565 y1 = 1.0565 k = 159 y2 = 1.0566 y1 = 1.0566 k = 160 y2 = 1.0566 y1 = 1.0566 k = 161 y2 = 1.0567 y1 = 1.0567 k = 162 y2 = 1.0567 y1 = 1.0567 k = 163 y2 = 1.0568 y1 = 1.0568 k = 164 y2 = 1.0569 y1 = 1.0569 k = 165 y2 = 1.0569 y1 = 1.0569 k = 166 y2 = 1.0570 y1 = 1.0570 k = 167 y2 = 1.0570 y1 = 1.0570 k = 168 y2 = 1.0571 y1 = 1.0571 k = 169 y2 = 1.0572 y1 = 1.0572 k = 170 y2 = 1.0572 y1 = 1.0572 k = 171 y2 = 1.0573 y1 = 1.0573 k = 172 y2 = 1.0573 y1 = 1.0573 k = 173 y2 = 1.0574 y1 = 1.0574 k = 174 y2 = 1.0574 y1 = 1.0574 k = 175 y2 = 1.0575 y1 = 1.0575 k = 176 y2 = 1.0576 y1 = 1.0576 k = 177 y2 = 1.0576 y1 = 1.0576 k = 178 y2 = 1.0577 y1 = 1.0577 k = 179 y2 = 1.0577 y1 = 1.0577 k = 180 y2 = 1.0578 y1 = 1.0578 k = 181 y2 = 1.0578 y1 = 1.0578 k = 182 y2 = 1.0579 y1 = 1.0579 k = 183 y2 = 1.0579 y1 = 1.0579 k = 184 y2 = 1.0580 y1 = 1.0580 k = 185 y2 = 1.0581 y1 = 1.0581 k = 186 y2 = 1.0581 y1 = 1.0581 k = 187 y2 = 1.0582 y1 = 1.0582 k = 188 y2 = 1.0582 y1 = 1.0582 k = 189 y2 = 1.0583 y1 = 1.0583 k = 190 y...

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 = 0.0100 y1 = 1 a = 0 b = 1 c = 100 k = 0 y2 = 1 y1 = 1 k = 1 y2 = 1.0089 y1 = 1.0089 k = 2 y2 = 1.0245 y1 = 1.0245 k = 3 y2 = 1.0445 y1 = 1.0445 k = 4 y2 = 1.0667 y1 = 1.0667 k = 5 y2 = 1.0890 y1 = 1.0890 k = 6 y2 = 1.1091 y1 = 1.1091 k = 7 y2 = 1.1247 y1 = 1.1247 k = 8 y2 = 1.1338 y1 = 1.1338 k = 9 y2 = 1.1339 y1 = 1.1339 k = 10 y2 = 1.1230 y1 = 1.1230 k = 11 y2 = 1.0988 y1 = 1.0988 k = 12 y2 = 1.0591 y1 = 1.0591 k = 13 y2 = 1.0017 y1 = 1.0017 k = 14 y2 = 0.9243 y1 = 0.9243 k = 15 y2 = 0.8248 y1 = 0.8248 k = 16 y2 = 0.7009 y1 = 0.7009 k = 17 y2 = 0.5504 y1 = 0.5504 k = 18 y2 = 0.3711 y1 = 0.3711 k = 19 y2 = 0.1607 y1 = 0.1607 k = 20 y2 = -0.0829 y1 = -0.0829 k = 21 y2 = -0.3620 y1 = -0.3620 k = 22 y2 = -0.6788 y1 = -0.6788 k = 23 y2 = -1.0354 y1 = -1.0354 k = 24 y2 = -1.4342 y1 = -1.4342 k = 25 y2 = -1.8774 y1 = -1.8774 k = 26 y2 = -2.3671 y1 = -2.3671 k = 27 y2 = -2.9056 y1 = -2.9056 k = 28 y2 = -3.4951 y1 = -3.4951 k = 29 y2 = -4.1378 y1 = -4.1378 k = 30 y2 = -4.8359 y1 = -4.8359 k = 31 y2 = -5.5917 y1 = -5.5917 k = 32 y2 = -6.4073 y1 = -6.4073 k = 33 y2 = -7.2850 y1 = -7.2850 k = 34 y2 = -8.2271 y1 = -8.2271 k = 35 y2 = -9.2356 y1 = -9.2356 k = 36 y2 = -10.3129 y1 = -10.3129 k = 37 y2 = -11.4612 y1 = -11.4612 k = 38 y2 = -12.6826 y1 = -12.6826 k = 39 y2 = -13.9795 y1 = -13.9795 k = 40 y2 = -15.3539 y1 = -15.3539 k = 41 y2 = -16.8082 y1 = -16.8082 k = 42 y2 = -18.3445 y1 = -18.3445 k = 43 y2 = -19.9651 y1 = -19.9651 k = 44 y2 = -21.6722 y1 = -21.6722 k = 45 y2 = -23.4680 y1 = -23.4680 k = 46 y2 = -25.3547 y1 = -25.3547 k = 47 y2 = -27.3346 y1 = -27.3346 k = 48 y2 = -29.4098 y1 = -29.4098 k = 49 y2 = -31.5826 y1 = -31.5826 k = 50 y2 = -33.8551 y1 = -33.8551 k = 51 y2 = -36.2297 y1 = -36.2297 k = 52 y2 = -38.7085 y1 = -38.7085 k = 53 y2 = -41.2938 y1 = -41.2938 k = 54 y2 = -43.9877 y1 = -43.9877 k = 55 y2 = -46.7926 y1 = -46.7926 k = 56 y2 = -49.7105 y1 = -49.7105 k = 57 y2 = -52.7437 y1 = -52.7437 k = 58 y2 = -55.8945 y1 = -55.8945 k = 59 y2 = -59.1650 y1 = -59.1650 k = 60 y2 = -62.5575 y1 = -62.5575 k = 61 y2 = -66.0742 y1 = -66.0742 k = 62 y2 = -69.7173 y1 = -69.7173 k = 63 y2 = -73.4891 y1 = -73.4891 k = 64 y2 = -77.3917 y1 = -77.3917 k = 65 y2 = -81.4273 y1 = -81.4273 k = 66 y2 = -85.5983 y1 = -85.5983 k = 67 y2 = -89.9067 y1 = -89.9067 k = 68 y2 = -94.3549 y1 = -94.3549 k = 69 y2 = -98.9450 y1 = -98.9450 k = 70 y2 = -103.6792 y1 = -103.6792 k = 71 y2 = -108.5598 y1 = -108.5598 k = 72 y2 = -113.5890 y1 = -113.5890 k = 73 y2 = -118.7691 y1 = -118.7691 k = 74 y2 = -124.1021 y1 = -124.1021 k = 75 y2 = -129.5904 y1 = -129.5904 k = 76 y2 = -135.2362 y1 = -135.2362 k = 77 y2 = -141.0416 y1 = -141.0416 k = 78 y2 = -147.0090 y1 = -147.0090 k = 79 y2 = -153.1404 y1 = -153.1404 k = 80 y2 = -159.4382 y1 = -159.4382 k = 81 y2 = -165.9046 y1 = -165.9046 k = 82 y2 = -172.5417 y1 = -172.5417 k = 83 y2 = -179.3518 y1 = -179.3518 k = 84 y2 = -186.3371 y1 = -186.3371 k = 85 y2 = -193.4998 y1 = -193.4998 k = 86 y2 = -200.8422 y1 = -200.8422 k = 87 y2 = -208.3665 y1 = -208.3665 k = 88 y2 = -216.0748 y1 = -216.0748 k = 89 y2 = -223.9695 y1 = -223.9695 k = 90 y2 = -232.0526 y1 = -232.0526 k = 91 y2 = -240.3265 y1 = -240.3265 k = 92 y2 = -248.7933 y1 = -248.7933 k = 93 y2 = -257.4553 y1 = -257.4553 k = 94 y2 = -266.3147 y1 = -266.3147 k = 95 y2 = -275.3737 y1 = -275.3737 k = 96 y2 = -284.6345 y1 = -284.6345 k = 97 y2 = -294.0994 y1 = -294.0994 k = 98 y2 = -303.7705 y1 = -303.7705 k = 99 y2 = -313.6501 y1 = -313.6501 k = 100 y2 = -323.7404 y1 = -323.7404 k = 101 y2 = -334.0437 y1 = -334.0437 k = 102 y2 = -344.5620 y1 = -344.5620 k = 103 y2 = -355.2977 y1 = -355.2977 k = 104 y2 = -366.2530 y1 = -366.2530 k = 105 y2 = -377.4300 y1 = -377.4300 k = 106 y2 = -388.8311 y1 = -388.8311 k = 107 y2 = -400.4584 y1 = -400.4584 k = 108 y2 = -412.3141 y1 = -412.3141 k = 109 y2 = -424.4005 y1 = -424.4005 k = 110 y2 = -436.7198 y1 = -436.7198 k = 111 y2 = -449.2742 y1 = -449.2742 k = 112 y2 = -462.0658 y1 = -462.0658 k = 113 y2 = -475.0970 y1 = -475.0970 k = 114 y2 = -488.3700 y1 = -488.3700 k = 115 y2 = -501.8869 y1 = -501.8869 k = 116 y2 = -515.6500 y1 = -515.6500 k = 117 y2 = -529.6616 y1 = -529.6616 k = 118 y2 = -543.9237 y1 = -543.9237 k = 119 y2 = -558.4387 y1 = -558.4387 k = 120 y2 = -573.2087 y1 = -573.2087 k = 121 y2 = -588.2360 y1 = -588.2360 k = 122 y2 = -603.5228 y1 = -603.5228 k = 123 y2 = -619.0714 y1 = -619.0714 k = 124 y2 = -634.8838 y1 = -634.8838 k = 125 y2 = -650.9624 y1 = -650.9624 k = 126 y2 = -667.3094 y1 = -667.3094 k = 127 y2 = -683.9269 y1 = -683.9269 k = 128 y2 = -700.8173 y1 = -700.8173 k = 129 y2 = -717.9827 y1 = -717.9827 k = 130 y2 = -735.4253 y1 = -735.4253 k = 131 y2 = -753.1473 y1 = -753.1473 k = 132 y2 = -771.1511 y1 = -771.1511 k = 133 y2 = -789.4387 y1 = -789.4387 k = 134 y2 = -808.0125 y1 = -808.0125 k = 135 y2 = -826.8746 y1 = -826.8746 k = 136 y2 = -846.0272 y1 = -846.0272 k = 137 y2 = -865.4726 y1 = -865.4726 k = 138 y2 = -885.2129 y1 = -885.2129 k = 139 y2 = -905.2505 y1 = -905.2505 k = 140 y2 = -925.5875 y1 = -925.5875 k = 141 y2 = -946.2262 y1 = -946.2262 k = 142 y2 = -967.1686 y1 = -967.1686 k = 143 y2 = -988.4172 y1 = -988.4172 k = 144 y2 = -1.0100e+03 y1 = -1.0100e+03 k = 145 y2 = -1.0318e+03 y1 = -1.0318e+03 k = 146 y2 = -1.0540e+03 y1 = -1.0540e+03 k = 147 y2 = -1.0765e+03 y1 = -1.0765e+03 k = 148 y2 = -1.0993e+03 y1 = -1.0993e+03 k = 149 y2 = -1.1225e+03 y1 = -1.1225e+03 k = 150 y2 = -1.1459e+03 y1 = -1.1459e+03 k = 151 y2 = -1.1697e+03 y1 = -1.1697e+03 k = 152 y2 = -1.1938e+03 y1 = -1.1938e+03 k = 153 y2 = -1.2182e+03 y1 = -1.2182e+03 k = 154 y2 = -1.2430e+03 y1 = -1.2430e+03 k = 155 y2 = -1.2681e+03 y1 = -1.2681e+03 k = 156 y2 = -1.2935e+03 y1 = -1.2935e+03 k = 157 y2 = -1.3193e+03 y1 = -1.3193e+03 k = 158 y2 = -1.3454e+03 y1 = -1.3454e+03 k = 159 y2 = -1.3718e+03 y1 = -1.3718e+03 k = 160 y2 = -1.3986e+03 y1 = -1.3986e+03 k = 161 y2 = -1.4258e+03 y1 = -1.4258e+03 k = 162 y2 = -1.4532e+03 y1 = -1.4532e+03 k = 163 y2 = -1.4811e+03 y1 = -1.4811e+03 k = 164 y2 = -1.5093e+03 y1 = -1.5093e+03 k = 165 y2 = -1.5378e+03 y1 = -1.5378e+03 k = 166 y2 = -1.5667e+03 y1 = -1.5667e+03 k = 167 y2 = -1.5960e+03 y1 = -1.5960e+03 k = 168 y2 = -1.6256e+03 y1 = -1.6256e+03 k = 169 y2 = -1.6556e+03 y1 = -1.6556e+03 k = 170 y2 = -1.6859e+03 y1 = -1.6859e+03 k = 171 y2 = -1.7166e+03 y1 = -1.7166e+03 k = 172 y2 = -1.7477e+03 y1 = -1.7477e+03 k = 173 y2 = -1.7792e+03 y1 = -1.7792e+03 k = 174 y2 = -1.8110e+03 y1 = -1.8110e+03 k = 175 y2 = -1.8433e+03 y1 = -1.8433e+03 k = 176 y2 = -1.8758e+03 y1 = -1.8758e+03 k = 177 y2 = -1.9088e+03 y1 = -1.9088e+03 k = 178 y2 = -1.9422e+03 y1 = -1.9422e+03 k = 179 y2 = -1.9759e+03 y1 = -1.9759e+03 k = 180 y2 = -2.0101e+03 y1 = -2.0101e+03 k = 181 y2 = -2.0446e+03 y1 = -2.0446e+03 k = 182 y2 = -2.0795e+03 y1 = -2.0795e+03 k = 183 y2 = -2.1148e+03 y1 = -2.1148e+03 k = 184 y2 = -2.1505e+03 y1 = -2.1505e+03 k = 185 y2 = -2.1866e+03 y...

Assertion failed.