Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <cstdio>
- #include <vector>
- #include <string>
- #include <algorithm>
- #include <cmath>
- using namespace std;
- const double EPS = 1E-6;
- int n = 2;
- vector<double> x(n);
- int main()
- {
- //variant 3
- // x - cos y = 3
- // cos ( x - 1) + y = 0.5
- x[0] = 3;
- x[1] = 3.5;
- double last1 = 100000;
- double last2 = 100000;
- while ((fabs(last1 - fabs(x[0])) > EPS) || (fabs(last2 - fabs(x[1])) > EPS))
- {
- last1 = fabs(x[0]);
- last2 = fabs(x[1]);
- double xx = x[0];
- double yy = x[1];
- x[0] -= xx - cos (yy) - 3.0;
- x[1] -= cos(xx - 1.0) + yy - 0.5;
- }
- cout << fixed << setprecision(8) << x[0] << endl << x[1];
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement