FunctionsMath.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace testing
  7. {
  8. internal class FunctionsMath
  9. {
  10. public double pow(double a, double pow)
  11. {
  12. for (int i = 1; i < pow; i++)
  13. {
  14. a *= a;
  15. }
  16. return a;
  17. }
  18. public struct Trigonometry
  19. {
  20. public static double tg(double a) => Math.Sin(a) / cos(a);
  21. public static double cos(double a)
  22. {
  23. if (Math.Sin(a) > 0)
  24. return Math.Sqrt(1 - (Math.Sin(a) * Math.Sin(a)));
  25. else
  26. return -Math.Sqrt(1 - (Math.Sin(a) * Math.Sin(a)));
  27. }
  28. public static double sec(double a) => 1 / cos(a);
  29. public static double cot(double a) => cos(a) / Math.Sin(a);
  30. }
  31. public struct Logarifms
  32. {
  33. public static double log(double a, double b)
  34. {
  35. double res = 0;
  36. if (a > 0 && a != 1 && b > 0)
  37. {
  38. res = Math.Log(b) / Math.Log(a);
  39. }
  40. return res;
  41. }
  42. }
  43. }
  44. }