Advertisement
Guest User

Untitled

a guest
Oct 19th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. #include "math.h"
  4.  
  5. using namespace std;
  6.  
  7. double psi(double x)
  8. {
  9. double s;
  10. s = (1 - x - +pow(x, 2)) / sqrt(1 + (2 * pow(x, 2)));
  11. return s;
  12. }
  13. double fi(double x)
  14. {
  15. double s;
  16. s = (5 * pow(x, 2) - x + 7.9);
  17. return s;
  18. }
  19. double lam(double x)
  20. {
  21. const double e = 2.71;
  22. double s;
  23. s = 3.1*pow(e, -pow(x, 2));
  24. return s;
  25. }
  26. double lamh(double x)
  27. {
  28. const double e = 2.71;
  29. double s;
  30. s = -6.2*pow(e, -pow(x, 2))*x;
  31. return s;
  32. }
  33.  
  34. const double eps = 0.0000000001;
  35. int main()
  36. {
  37. int n, i, j;
  38. double x, y, y1;
  39. cout << "Enter n = ";
  40. cin >> n;
  41. for (i = 0; i < n; i++)
  42. {
  43. y1 = 0;
  44. y = 0;
  45. cout << "Enter x = ";
  46. cin >> x;
  47. y1 = -(psi(x)/fi(x));
  48. for (j = 0; true; j++)
  49. {
  50. y = y1 - ((y1*fi(x) + psi(x) + lam(y1)) / (fi(x) + lamh(y1)));
  51. if (abs(y - y1) <= eps)
  52. {
  53. break;
  54. }
  55. else
  56. {
  57. y1 = y;
  58. y = 0;
  59. }
  60. }
  61. cout << '(' << x << ',' << y << ')' << endl;
  62. cout << "F(" << x << ',' << y << ")= " << y * fi(x) + psi(x) + lam(y) << endl;
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement