diff options
author | tschwall <55748566+tschwall@users.noreply.github.com> | 2022-08-06 16:30:24 +0200 |
---|---|---|
committer | tschwall <55748566+tschwall@users.noreply.github.com> | 2022-08-06 16:30:24 +0200 |
commit | 6db1a91db25b590e4c1aff3d080c30473e4d8f69 (patch) | |
tree | 54fb29d5a4e54d2637341fdcce06631d85bc1951 /buch/papers/0f1/listings/potenzreihe.c | |
parent | M (diff) | |
parent | Merge pull request #39 from NaoPross/master (diff) | |
download | SeminarSpezielleFunktionen-6db1a91db25b590e4c1aff3d080c30473e4d8f69.tar.gz SeminarSpezielleFunktionen-6db1a91db25b590e4c1aff3d080c30473e4d8f69.zip |
Change
Diffstat (limited to 'buch/papers/0f1/listings/potenzreihe.c')
-rw-r--r-- | buch/papers/0f1/listings/potenzreihe.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/buch/papers/0f1/listings/potenzreihe.c b/buch/papers/0f1/listings/potenzreihe.c new file mode 100644 index 0000000..23fdfea --- /dev/null +++ b/buch/papers/0f1/listings/potenzreihe.c @@ -0,0 +1,69 @@ +#include <math.h>
+
+/**
+ * @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 c in 0F1(;c;z)
+ * @param z in 0F1(;c;z)
+ * @param n number of itertions (precision)
+ * @return Result
+ */
+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(c, k));
+ }
+
+ return temp;
+}
\ No newline at end of file |