Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. class jimmy{
  2.  
  3. public static double r(double k){
  4. return(0.02+0.01*k);
  5. }
  6.  
  7. public static double psi(double n,double k){
  8. if(n == 0)
  9. return 1;
  10. else{
  11. if (k == 0)
  12. return 0.1*10*psi(n-1,0)/2/(1+r(k));
  13. else if (k == n)
  14. return 0.1*10*psi(n-1,k-1)/2/(1+r(k));
  15. else
  16. return 0.1*10*1/2*(psi(n-1,k-1)/(1+r(k-1))+psi(n-1,k)/(1+r(k)));
  17. }
  18. }
  19.  
  20. public static void main(String[] args){
  21. System.out.println(psi(4,3));
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement