aboutsummaryrefslogtreecommitdiffstats
path: root/buch/chapters/020-exponential/uebungsaufgaben/2.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--buch/chapters/020-exponential/uebungsaufgaben/2.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/buch/chapters/020-exponential/uebungsaufgaben/2.c b/buch/chapters/020-exponential/uebungsaufgaben/2.c
new file mode 100644
index 0000000..c5a9644
--- /dev/null
+++ b/buch/chapters/020-exponential/uebungsaufgaben/2.c
@@ -0,0 +1,22 @@
+/*
+ * 2.c -- solution to problem 2
+ *
+ * (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <gsl/gsl_sf_lambert.h>
+
+int main(int argc, char *argv[]) {
+ double s = log(2);
+ printf("s = %f\n", s);
+ double t = gsl_sf_lambert_W0(s);
+ printf("t = %f\n", t);
+ double y = exp(t);
+ printf("y = %f\n", y);
+ double x = atan(y);
+ printf("x = %.18f\n", x);
+ printf("2 = %f\n", pow(tan(x),tan(x)));
+ return EXIT_SUCCESS;
+}