aboutsummaryrefslogtreecommitdiffstats
path: root/buch/chapters/020-exponential/code/xxl.c
diff options
context:
space:
mode:
Diffstat (limited to 'buch/chapters/020-exponential/code/xxl.c')
-rw-r--r--buch/chapters/020-exponential/code/xxl.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/buch/chapters/020-exponential/code/xxl.c b/buch/chapters/020-exponential/code/xxl.c
new file mode 100644
index 0000000..2c38ffe
--- /dev/null
+++ b/buch/chapters/020-exponential/code/xxl.c
@@ -0,0 +1,19 @@
+/*
+ * xxl.c -- find solution of x^x = 27
+ *
+ * (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschue
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <gsl/gsl_sf_lambert.h>
+
+int main(int argc, char *argv[]) {
+ double b = 27;
+ double w = gsl_sf_lambert_W0(log(b));
+ printf("W_0(log(27)) = %f\n", w);
+ double x = exp(w);
+ printf("x = %f\n", x);
+
+ return EXIT_SUCCESS;
+}