-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgauss_sedial.cpp
More file actions
65 lines (45 loc) · 932 Bytes
/
Copy pathgauss_sedial.cpp
File metadata and controls
65 lines (45 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include<iostream>
#include<math.h>
#define EPS 1.0e-6
using namespace std;
double F1(double x, double y, double z)
{
return 15*x + 3*y - 2*z - 85;
}
double F2(double x, double y, double z)
{
return 2*x + 10*y + z - 51;
}
double F3(double x, double y, double z)
{
return x - 2*y + 8*z - 5;
}
double X(double y, double z)
{
return (85 - 3*y + 2*z)/15;
}
double Y(double x, double z)
{
return (51 - 2*x - z)/10;
}
double Z(double x, double y)
{
return (5 - x + 2*y)/8;
}
int main()
{
double x1, y1, z1;
x1 = y1 = z1 = 0.0;
while(1)
{
if( fabs(F1(x1, y1, z1) && F2(x1, y1, z1) && F3(x1, y1, z1)) <= EPS )
{
cout << x1 << ", " << y1 << ", " << z1 << endl;
break;
}
x1 = X(y1, z1);
y1 = Y(x1, z1);
z1 = Z(x1, y1);
}
return 0;
}