0
$\begingroup$

I have read about how to define a recursive function using RecurrenceTable but for $u(100)$ you need all 99 previous terms. The posts doesn't help me. I want to define in mathematica this function:

$$ u(n) = u_0 + \frac{\mu}{\Gamma(\nu)} \sum_{i=1}^n \frac{\Gamma(n-i+\nu)}{\Gamma(n-i+1)} u(i-1)(1-u(i-1)), $$ where $\Gamma(x)$ is the Euler gamma function and $\mu$ and $\nu$ are positive numbers.

Can anybody help me?

$\endgroup$
2

2 Answers 2

0
$\begingroup$

Unless the values for {u[0], μ, ν} are small, an overflow tends to occur.

SeedRandom[1];

ν = RandomReal[{1/10, 2}, WorkingPrecision -> 50];
μ = RandomReal[{1/10, 2}, WorkingPrecision -> 50];

Clear[u]

u[0] = RandomReal[{1/100, 1}, WorkingPrecision -> 50];

u[n_Integer?Positive] := u[n] =
  u[0] + μ/Gamma[ν] Sum[
     u[i - 1] (1 - u[i - 1]) Gamma[n - i + ν]/Gamma[n - i + 1], {i, n}]

u[100]

(*  1.000082  *)
$\endgroup$
3
  • $\begingroup$ Your code works perfect. But now,I want to draw a bifurcation diagram of u in terms of $mu$. I know I should define a function of $n$ and $mu$. It would be u[n_Integer?Positive,mu]?? Lot of thanks $\endgroup$
    – Dog_69
    Commented May 29, 2017 at 20:36
  • $\begingroup$ No, it would be u[n_Integer?Positive, m_] := u[n, m] = ... $\endgroup$
    – Bob Hanlon
    Commented May 29, 2017 at 21:19
  • $\begingroup$ Yes I forget the "-" but I had this idea. Thanks. $\endgroup$
    – Dog_69
    Commented May 29, 2017 at 21:35
0
$\begingroup$

The possible implementation would be something like:

u[n_, nu_, mu_] := 
 u[n, nu, mu] = 
  u0 + mu/Gamma[nu]*
    Sum[Gamma[n - i + nu]/
      Gamma[n - i + 1] u[i - 1, nu, mu] (1 - u[i - 1, nu, mu]), {i, 1,
       n}]
$\endgroup$
1
  • $\begingroup$ I have tried this implementation, but for n=20 the time is longer. $\endgroup$
    – Dog_69
    Commented May 29, 2017 at 18:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.