about summary refs log tree commit diff
path: root/usth/MATH2.2/final
diff options
context:
space:
mode:
authorNguyễn Gia Phong <vn.mcsinyx@gmail.com>2020-02-16 14:26:55 +0700
committerNguyễn Gia Phong <vn.mcsinyx@gmail.com>2020-02-16 14:26:55 +0700
commit82e6cf7d1046d6cee16f7e8b044ec33e7ec6c4b7 (patch)
treef7b7ae0bce69070c47a1b31a85bd2bc69dfecf09 /usth/MATH2.2/final
parent29d1001e2e21eff289bff23412e284c8b2e44595 (diff)
downloadcp-82e6cf7d1046d6cee16f7e8b044ec33e7ec6c4b7.tar.gz
[usth] Numerical Method is MATH2.4
Diffstat (limited to 'usth/MATH2.2/final')
-rw-r--r--usth/MATH2.2/final/EX1.m36
-rw-r--r--usth/MATH2.2/final/EX2.m38
-rw-r--r--usth/MATH2.2/final/EX3.m16
3 files changed, 0 insertions, 90 deletions
diff --git a/usth/MATH2.2/final/EX1.m b/usth/MATH2.2/final/EX1.m
deleted file mode 100644
index 354aa2f..0000000
--- a/usth/MATH2.2/final/EX1.m
+++ /dev/null
@@ -1,36 +0,0 @@
-disp ("Question 1:");
-disp ("(a)");
-printf ("11^3 + 12^3 - 7^3 = %d\n", 11^3 + 12^3 - 7^3);
-printf ("15! = %d\n", factorial (15));
-
-disp ("(b)");
-A = [1 2 3
-     4 5 6
-     7 8 9];
-B = eye (3);
-
-disp ("(b.i)");
-disp ("A + B = ");
-disp (A + B);
-
-disp ("(b.ii)");
-disp ("A' = ");
-disp (A');
-
-disp ("(b.iii)");
-disp ("A^-1 = ");
-disp (inv (A));
-
-disp ("(c.i)");
-printf ("x^2 = 19  ->  x = %g\n", sqrt (19));
-disp ("(c.ii)");
-printf ("x^4 = 55  ->  x = %g\n", sqrt (sqrt (19)));
-
-disp ("(d)");
-X = 0 : 30;
-Y = X * 2 + 3;
-plot (X, Y);
-xlabel ("x");
-ylabel ("y = 2x + 3");
-disp ("Press any key to continue...");
-kbhit;
diff --git a/usth/MATH2.2/final/EX2.m b/usth/MATH2.2/final/EX2.m
deleted file mode 100644
index 9b8c95e..0000000
--- a/usth/MATH2.2/final/EX2.m
+++ /dev/null
@@ -1,38 +0,0 @@
-disp ("Question 2:");
-disp ("(a)");
-pkg load symbolic;
-syms x real;
-solve (sqrt (x) - x + 1 == 0)
-% ans = (sym)
-%   √5   3
-%   ── + ─
-%   2    2
-pkg unload symbolic;
-disp ("To get numerical solutions we can use fzero");
-disp ("With the initial guess of 0, fzero (@(x) sqrt (x) - x + 1, 0) returns");
-fzero (@(x) sqrt (x) - x + 1, 0)
-
-disp ("(b)");
-hold on;
-ezplot (@(x) exp (-x));
-ezplot (@(x) sin (x));
-hold off;
-disp ("Press any key to continue...");
-kbhit;
-
-disp ("(c)");
-s = 0;
-for k = 1 : 1000
-  s += k^3;
-endfor
-printf ("The cubic sum of integers from 1 to 1000 is %d\n", s);
-
-disp ("(d)");
-A = [2 1 4
-     1 2 -5
-     3 -2 4];
-b = [10 1 8]';
-disp ("Using mldivide, [x y z] = ");
-disp (mldivide (A, b)');
-disp ("Using inv, [x y z] = ");
-disp ((inv (A) * b)');
diff --git a/usth/MATH2.2/final/EX3.m b/usth/MATH2.2/final/EX3.m
deleted file mode 100644
index 99240f8..0000000
--- a/usth/MATH2.2/final/EX3.m
+++ /dev/null
@@ -1,16 +0,0 @@
-disp ("Question 3:");
-disp ("(a)");
-function y = f (x)
-  y = 2 + x.^2 + exp(x.*2 + 1);
-endfunction
-h = 0.005;
-printf ("By forward difference with h = 0.05, f'(1.35) = %g\n",
-        (f (1.35 + h) - f (1.35)) / h);
-
-disp ("(b)");
-disp ("I am unsure if diff is different on Matlab, but on octave,");
-disp ("it's simply taking differences between consecutive elements.");
-x = [1.35, 1.35+h];
-printf ("Using diff with h = 0.05, we get same result, f'(1.35) = %g\n",
-        (diff (f (x)) / h));
-disp ("Using symbolical methods, f'(1.35) = 83.5946 which is quite close.");