Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class jimmy{
- public static double r(double k){
- return(0.02+0.01*k);
- }
- public static double psi(double n,double k){
- if(n == 0)
- return 1;
- else{
- if (k == 0)
- return 0.1*10*psi(n-1,0)/2/(1+r(k));
- else if (k == n)
- return 0.1*10*psi(n-1,k-1)/2/(1+r(k));
- else
- return 0.1*10*1/2*(psi(n-1,k-1)/(1+r(k-1))+psi(n-1,k)/(1+r(k)));
- }
- }
- public static void main(String[] args){
- System.out.println(psi(4,3));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement