Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. using System;
  2.  
  3. namespace krtuch
  4. {
  5. class Program
  6. {
  7. const double F1 = -490.0, F2 = 740;
  8. const double r1 = 0.02, r2 = 0.035;
  9. const double d = 0.36;
  10.  
  11. static void Main(string[] args)
  12. {
  13. double r = Math.Cbrt(r1*r1*r1 + r2*r2*r2);
  14. double Q = 0;
  15. for (int i = 0; i < 100; ++i) {
  16. Q += q(i) + _q(i);
  17. }
  18. Console.WriteLine(Q / r);
  19. }
  20.  
  21. static double q(int i) {
  22. if (i == 0) {
  23. return F1 * r1;
  24. }
  25.  
  26. return -r1 * _q(i - 1) / (d - _s(i-1));
  27. }
  28.  
  29. static double _q(int i) {
  30. if (i == 0) {
  31. return F2 * r2;
  32. }
  33.  
  34. return -r2 * q(i - 1) / (d - s(i-1));
  35. }
  36.  
  37.  
  38. static double s(int i) {
  39. if (i == 0) {
  40. return 0;
  41. }
  42.  
  43. return r1 * r1 / (d - _s(i-1));
  44. }
  45.  
  46. static double _s(int i) {
  47. if (i == 0) {
  48. return 0;
  49. }
  50.  
  51. return r2 * r2 / (d - s(i-1));
  52. }
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement