Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. from cmath import *
  2. D = []
  3. V = []
  4. i = complex(0.0, 1.0)
  5.  
  6. for ball_data in eval(input()):
  7. diameter, mass = ball_data
  8. D.append(complex(diameter))
  9. V.append(complex(mass / 1000))
  10.  
  11. for ind in range(len(D)):
  12. #v_ball = pi * D[ind] ** 3 / 6
  13. D = D[ind]
  14. V = V[ind]
  15. h = (D / 2) - ((1.0 - i * sqrt(3.0)) * pow(D, 2.0) * pow(pi, 1.0 / 3.0)) / (4.0 * pow(
  16. pow(D, 3.0) * pi - 12.0 * V + 2.0 * sqrt(6.0) * sqrt(-(pow(D, 3.0) * pi * V) + 6.0 * pow(V, 2.0)),
  17. 1.0 / 3.0)) - ((1.0 + i * sqrt(3.0)) * pow(
  18. pow(D, 3.0) * pi - 12.0 * V + 2.0 * sqrt(6.0) * sqrt(-(pow(D, 3.0) * pi * V) + 6.0 * pow(V, 2.0)),
  19. 1.0 / 3.0)) / (4.0 * pow(pi, 1.0 / 3.0))
  20.  
  21.  
  22. print((h.real * 1000) / 1000)
  23. print((h.imag * 1000) / 1000)
  24. print(i)
  25. print(pi)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement