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));
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);