From e813668878dead2166880f5397b0e63cad758676 Mon Sep 17 00:00:00 2001 From: Kat Richey Date: Thu, 27 Oct 2022 23:27:03 -0500 Subject: [PATCH 1/3] Comment tweak, we still have exp --- math/exp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/math/exp.c b/math/exp.c index e893a76..dbe5080 100644 --- a/math/exp.c +++ b/math/exp.c @@ -9,8 +9,9 @@ I was stuck on how to actually implement the Taylor series without it getting far too big for even a long double, and I'm not sure I ever would have thought to just break it out recursively like this. Instead of each - term being x^n/n!, this says that it's (x/n+1)*(nth term), with a base case - of x/1! = x. Pretty clever, really. + term being x^n/n!, where we have to figure out both x^n and n!, both of which + could be massive, we instead say that it's (x/n+1)*(nth term), with a base + case (1st term) of x/1! = x. Pretty clever, really. Also, really glad I know how to at least read a basic FORTRAN program. This probably would have been a little more annoying if I didn't. From 4bca9fd69d37e5816c45fca8b611e8d650c32316 Mon Sep 17 00:00:00 2001 From: Kat Richey Date: Thu, 27 Oct 2022 23:51:48 -0500 Subject: [PATCH 2/3] easy peasy --- math/sin.c | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 math/sin.c diff --git a/math/sin.c b/math/sin.c new file mode 100644 index 0000000..867604b --- /dev/null +++ b/math/sin.c @@ -0,0 +1,5 @@ +#include + +double sin(double x) { + return cos(x - M_PI_2); +} \ No newline at end of file From 59563610888d79fb3b7b0a27217890036b703453 Mon Sep 17 00:00:00 2001 From: Kat Richey Date: Thu, 27 Oct 2022 23:53:21 -0500 Subject: [PATCH 3/3] And tangent --- math/tan.c | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 math/tan.c diff --git a/math/tan.c b/math/tan.c new file mode 100644 index 0000000..3f1b86f --- /dev/null +++ b/math/tan.c @@ -0,0 +1,5 @@ +#include + +double tan(double x) { + return (cos(x - M_PI_2) / cos(x)) +} \ No newline at end of file