aboutsummaryrefslogtreecommitdiffstats
path: root/buch/papers/0f1/listings/kettenbruchRekursion.c
diff options
context:
space:
mode:
Diffstat (limited to 'buch/papers/0f1/listings/kettenbruchRekursion.c')
-rw-r--r--buch/papers/0f1/listings/kettenbruchRekursion.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/buch/papers/0f1/listings/kettenbruchRekursion.c b/buch/papers/0f1/listings/kettenbruchRekursion.c
index 958d4e1..3caaf43 100644
--- a/buch/papers/0f1/listings/kettenbruchRekursion.c
+++ b/buch/papers/0f1/listings/kettenbruchRekursion.c
@@ -1,19 +1,27 @@
-static double fractionIter0f1(const double b0, const double z, unsigned int n)
+/**
+ * @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 abn = 0.0;
+ double abk = 0.0;
double temp = 0.0;
- for (; n > 0; --n)
+ for (; k > 0; --k)
{
- abn = z / (n * ((n - 1) + b0)); //abn = ak, bk
+ abk = z / (k * ((k - 1) + c)); //abk = ak, bk
- a = n > 1 ? (1 + abn) : 1; //a0, a1
- b = n > 1 ? -abn : abn; //b1
+ a = k > 1 ? (1 + abk) : 1; //a0, a1
+ b = k > 1 ? -abk : abk; //b1
- temp = b / (a + temp);
+ temp = b / (a + temp); //bk / (ak + last result)
}
- return a + temp; //a0 + temp
+ return a + temp; //a0 + temp
} \ No newline at end of file