From c53e9fe25866376d1b3086579c01725444a04702 Mon Sep 17 00:00:00 2001 From: Fabian <@> Date: Tue, 26 Jul 2022 21:27:23 +0200 Subject: 0f1, Code ueberarbeitet --- buch/papers/0f1/listings/potenzreihe.c | 56 ++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'buch/papers/0f1/listings/potenzreihe.c') diff --git a/buch/papers/0f1/listings/potenzreihe.c b/buch/papers/0f1/listings/potenzreihe.c index bfaa0e3..3eb9b86 100644 --- a/buch/papers/0f1/listings/potenzreihe.c +++ b/buch/papers/0f1/listings/potenzreihe.c @@ -1,5 +1,61 @@ #include +/** + * @brief Calculates pochhammer + * @param (a+n-1)! + * @return Result + */ +static double pochhammer(const double x, double n) +{ + double temp = x; + + if (n > 0) + { + while (n > 1) + { + temp *= (x + n - 1); + --n; + } + + return temp; + } + else + { + return 1; + } +} + +/** + * @brief Calculates the Factorial + * @param n! + * @return Result + */ +static double fac(int n) +{ + double temp = n; + + if (n > 0) + { + while (n > 1) + { + --n; + temp *= n; + } + return temp; + } + else + { + return 1; + } +} + +/** + * @brief Calculates the Hypergeometric Function 0F1(;b;z) + * @param b0 in 0F1(;b0;z) + * @param z in 0F1(;b0;z) + * @param n number of itertions (precision) + * @return Result + */ static double powerseries(const double b, const double z, unsigned int n) { double temp = 0.0; -- cgit v1.2.1 From 220b382cf4b7019b199c3023ddab73ba2658e27a Mon Sep 17 00:00:00 2001 From: Fabian <@> Date: Wed, 27 Jul 2022 13:08:39 +0200 Subject: 0f1, bilder --- buch/papers/0f1/listings/potenzreihe.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'buch/papers/0f1/listings/potenzreihe.c') diff --git a/buch/papers/0f1/listings/potenzreihe.c b/buch/papers/0f1/listings/potenzreihe.c index 3eb9b86..23fdfea 100644 --- a/buch/papers/0f1/listings/potenzreihe.c +++ b/buch/papers/0f1/listings/potenzreihe.c @@ -51,18 +51,18 @@ static double fac(int n) /** * @brief Calculates the Hypergeometric Function 0F1(;b;z) - * @param b0 in 0F1(;b0;z) - * @param z in 0F1(;b0;z) + * @param c in 0F1(;c;z) + * @param z in 0F1(;c;z) * @param n number of itertions (precision) * @return Result */ -static double powerseries(const double b, const double z, unsigned int n) +static double powerseries(const double c, const double z, unsigned int n) { double temp = 0.0; for (unsigned int k = 0; k < n; ++k) { - temp += pow(z, k) / (factorial(k) * pochhammer(b, k)); + temp += pow(z, k) / (factorial(k) * pochhammer(c, k)); } return temp; -- cgit v1.2.1