about summary refs log tree commit diff
path: root/usth/MATH2.2/hw
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/hw
parent29d1001e2e21eff289bff23412e284c8b2e44595 (diff)
downloadcp-82e6cf7d1046d6cee16f7e8b044ec33e7ec6c4b7.tar.gz
[usth] Numerical Method is MATH2.4
Diffstat (limited to 'usth/MATH2.2/hw')
-rw-r--r--usth/MATH2.2/hw/README.md22
-rwxr-xr-xusth/MATH2.2/hw/cubic25
-rw-r--r--usth/MATH2.2/hw/fibonacci.m7
-rw-r--r--usth/MATH2.2/hw/homework.pdfbin122465 -> 0 bytes
-rwxr-xr-xusth/MATH2.2/hw/linear11
-rwxr-xr-xusth/MATH2.2/hw/quadratic14
6 files changed, 0 insertions, 79 deletions
diff --git a/usth/MATH2.2/hw/README.md b/usth/MATH2.2/hw/README.md
deleted file mode 100644
index fbb5730..0000000
--- a/usth/MATH2.2/hw/README.md
+++ /dev/null
@@ -1,22 +0,0 @@
-# Numerical Methods: Homework 1
-
-My name is Nguyễn Gia Phong, my student ID is BI9-184.
-
-The homework were written in Octave and saved as
-
-* `linear`: interactive script to solve linear equation
-* `quadratic`: interactive script to solve quadratic equation
-* `cubic`: interactive script to solve cubic equation
-* `fibonacci.m`: function `fibonacci (n)` returning a vector containing
-  Fibonacci numbers from F<sub>1</sub> to F<sub>n</sub>
-
-The scripts are named without any file extension following the \*nix traditions.
-The homework can be downloaded as a whole in a ZIP package using the button
-near the top-left corner, or alternatively cloned using `git`:
-
-    git clone https://gist.github.com/McSinyx/1d9ff91d1ecfd60254c188bddb7926d5
-
-If this causes any inconvenience, please let me know.
-
-[![Creative Commons License](https://i.creativecommons.org/l/by-sa/4.0/80x15.png)](http://creativecommons.org/licenses/by-sa/4.0/)
-This work is licensed under a [Creative Commons Attribution-ShareAlike 4.0 International License](http://creativecommons.org/licenses/by-sa/4.0/).
diff --git a/usth/MATH2.2/hw/cubic b/usth/MATH2.2/hw/cubic
deleted file mode 100755
index ca24739..0000000
--- a/usth/MATH2.2/hw/cubic
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env octave
-disp ("Solve quadratic equation a*x^3 + b*x^2 + c*x + d = 0");
-a = input ("a = ");
-while (a == 0)
-  disp ("a must be nonzero");
-  a = input ("a = ");
-end
-b = input ("b = ");
-c = input ("c = ");
-d = input ("d = ");
-
-% Using the trigonometric and hyperbolic solutions on Wikipedia:
-% https://en.wikipedia.org/wiki/Cubic_function
-p = (3*a*c - b^2) / (3*a^2);
-q = (2*b^3 - 9*a*b*c + 27*a^2*d) / (27*a^3);
-if (p == 0)
-  disp ("The given cubic equation has only one distinct solution:");
-  x = cbrt(-q) - b/a/3
-else
-  r = 2 * sqrt(-p/3);
-  disp ("The three solutions of the given quadratic equation are:");
-  for k = 0 : 2
-    x = r * cos((acos(3*q/p/r) - 2*pi*k) / 3) - b/a/3
-  end
-end
diff --git a/usth/MATH2.2/hw/fibonacci.m b/usth/MATH2.2/hw/fibonacci.m
deleted file mode 100644
index 340c108..0000000
--- a/usth/MATH2.2/hw/fibonacci.m
+++ /dev/null
@@ -1,7 +0,0 @@
-function fib = fibonacci (n)
-  fib = 0 : n;
-  for i = 2 : n
-    fib(i + 1) = fib(i) + fib(i - 1);
-  end
-  fib = fib(2:end);
-end
diff --git a/usth/MATH2.2/hw/homework.pdf b/usth/MATH2.2/hw/homework.pdf
deleted file mode 100644
index 9d3f2e9..0000000
--- a/usth/MATH2.2/hw/homework.pdf
+++ /dev/null
Binary files differdiff --git a/usth/MATH2.2/hw/linear b/usth/MATH2.2/hw/linear
deleted file mode 100755
index fad7e67..0000000
--- a/usth/MATH2.2/hw/linear
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/env octave
-disp ("Solve quadratic equation ax + b = 0");
-a = input ("a = ");
-while (a == 0)
-  disp ("a must be nonzero");
-  a = input ("a = ");
-end
-b = input ("b = ");
-
-disp ("The two solutions of the given linear equation is:");
-x = -b / a
diff --git a/usth/MATH2.2/hw/quadratic b/usth/MATH2.2/hw/quadratic
deleted file mode 100755
index b6ea91a..0000000
--- a/usth/MATH2.2/hw/quadratic
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/env octave
-disp ("Solve quadratic equation a*x^2 + b*x + c = 0");
-a = input ("a = ");
-while (a == 0)
-  disp ("a must be nonzero");
-  a = input ("a = ");
-end
-b = input ("b = ");
-c = input ("c = ");
-
-sd = sqrt(b*b - a*c*4);
-disp ("The two solutions of the given quadratic equation are:");
-x0 = (-b - sd) / a / 2
-x1 = (-b + sd) / a / 2