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/kettenbruchRekursion.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/kettenbruchRekursion.c')
-rw-r--r-- | buch/papers/0f1/listings/kettenbruchRekursion.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/buch/papers/0f1/listings/kettenbruchRekursion.c b/buch/papers/0f1/listings/kettenbruchRekursion.c new file mode 100644 index 0000000..3caaf43 --- /dev/null +++ b/buch/papers/0f1/listings/kettenbruchRekursion.c @@ -0,0 +1,27 @@ +/**
+ * @brief Calculates the Hypergeometric Function 0F1(;c;z)
+ * @param c in 0F1(;c;z)
+ * @param z in 0F1(;c;z)
+ * @param k number of itertions (precision)
+ * @return Result
+ */
+static double fractionIter0f1(const double c, const double z, unsigned int k)
+{
+ //declaration
+ double a = 0.0;
+ double b = 0.0;
+ double abk = 0.0;
+ double temp = 0.0;
+
+ for (; k > 0; --k)
+ {
+ abk = z / (k * ((k - 1) + c)); //abk = ak, bk
+
+ a = k > 1 ? (1 + abk) : 1; //a0, a1
+ b = k > 1 ? -abk : abk; //b1
+
+ temp = b / (a + temp); //bk / (ak + last result)
+ }
+
+ return a + temp; //a0 + temp
+}
\ No newline at end of file |