X-Git-Url: http://gitweb.michael.orlitzky.com/?p=octave.git;a=blobdiff_plain;f=run-tests.m;h=2ad4c2462b06f1203134c5576aaecde217db9f98;hp=2892ba0e84f916571960177c62bb297068d7b448;hb=99b641383e285ba62808678be74077485a61e024;hpb=d7a73d33b0567c9abd72151b2972d7c0eb66e6a1 diff --git a/run-tests.m b/run-tests.m index 2892ba0..2ad4c24 100755 --- a/run-tests.m +++ b/run-tests.m @@ -43,11 +43,11 @@ unit_test_equals("2 is even", ... true, ... even(2)); -expected_A = [1, 0, 0, 0, 0; ... - 16, -32, 16, 0, 0; ... - 0, 16, -32, 16, 0; ... - 0, 0, 16, -32, 16; ... - 0, 0, 0, 0, 1]; +expected_A = [-1, 0, 0, 0, 0; ... + -16, 32, -16, 0, 0; ... + 0, -16, 32, -16, 0; ... + 0, 0, -16, 32, -16; ... + 0, 0, 0, 0, -1]; unit_test_equals("Homework #1 problem #1 Poisson matrix is correct", ... true, ... expected_A == poisson_matrix(4, 0, 1)); @@ -102,3 +102,16 @@ expected_root = [1.33635; 1.75424]; unit_test_equals("Homework #3 problem #4 root is correct", ... expected_root, ... actual_root); + + + +f = @(x,y) y; +x0 = 0; +y0 = 1; +h = 1; +actual_y = forward_euler1(x0, y0, f, h); +expected_y = 2; + +unit_test_equals("Forward Euler works for one step", ... + expected_y, ... + actual_y);