fork download
  1. using System;
  2.  
  3. class Program
  4. {
  5. static void Main()
  6. {
  7. double K = 3, L = 12.48;
  8. double[] xs = { 2.005, -0.437, -2.47 };
  9.  
  10. foreach (double x in xs)
  11. {
  12. if (x == 0) continue;
  13.  
  14. double a = Math.Tan(Math.Pow(Math.Sqrt(K), Math.Pow(K, 1.0 / 3.0))) - 1.0 / (2.0 * x);
  15. double denomB = Math.Pow(0.842, 4) * Math.Sqrt(8 * K) * Math.Cos(4 * x);
  16.  
  17. if (Math.Abs(denomB) < 1e-12) continue;
  18. double b = (Math.Sin(2 * x) * L * Math.Pow(5.75, 1.0 / 3.0)) / denomB;
  19.  
  20. double ab = a * b;
  21. double y = (ab < 0) ? ((a - 2 * b) / (2 * a + 5 * b)) : Math.Sqrt(ab);
  22.  
  23. Console.WriteLine($"x: {x:F3} | y: {y:F6}");
  24. }
  25. }
  26. }
Success #stdin #stdout 0.07s 31500KB
stdin
Standard input is empty
stdout
x: 2.005 | y: -0.413942
x: -0.437 | y: -0.401880
x: -2.470 | y: 3.361922