Exemplo n.º 1
0
 static double Middle(int g, int r, double tau, double t)
 {
     double k = (tau < r) ? g : (tau < r+g) ? r+g-tau : 0;
     Rk4 solver = new Rk4(
       (double eta, double[] V, double[] res) =>
       { res[0] = -gp(tau) * h(eta, tau) * Inner(eta, k, t); },
       1);
     double[] reserves = solver.SolveFinal(120, 1, /* steps = */ 2, new double[] { 0.0 });
     // Integral in state 0:
     return reserves[0];
 }
Exemplo n.º 2
0
 // GF820 computations.  Notation as in Jeppe Woetmann Nielsen's note
 // on 820 dated 2013-01-25.  Female 35 year old insured life (method
 // Outer), unknown male spouse (method Inner).
 static double Inner(double eta, double k, double t)
 {
     Rk4 solver = new Rk4(
       (double s, double[] V, double[] res) =>
       { res[0] = rate(t+s) * V[0] - indicator(s >= k) - GmMale(eta+s) * (0 - V[0]); },
       1);
     double[] reserves = solver.SolveFinal(120-eta, 0, steps, new double[] { 0.0 });
     // Reserve in state 0:
     return reserves[0];
 }