Linear Algebra and the C Language/a07a
The coefficients of a circle with Gauss-Jordan Total Pivoting
I use gj_TP_mR(); to calculate the coefficients of a circle.
Presentation :
Find the coefficients a, b, c, d of the circle,
ax**2 + ay**2 + bx + cy + d = 0
which crosses these three points
(x[1],y[1]) (x[2],y[2]) (x[3],y[3])
Using the three points we obtain the matrix.
(a)x**2 (a)y**2 (b)x (c)y (d) = 0
x[1]**2 y[1]**2 x[1] y[1] 1 0
x[2]**2 y[2]**2 x[2] y[2] 1 0
x[3]**2 y[3]**2 x[3] y[3] 1 0
This system has three lines and four unknowns (a, b, c, d).
It is a homogeneous system, so it has an infinite number of solutions.
To find a solution, I chose to set a = 1.
We therefore have five rows and five unknowns.
(a)x**2 (a)y**2 x y
1 0 0 0 0 1
0 1 0 0 0 1
x[1]**2 y[1]**2 x[1] y[1] 1 0
x[2]**2 y[2]**2 x[2] y[2] 1 0
x[3]**2 y[3]**2 x[3] y[3] 1 0
All that remains is to solve the system.
Delete this h file at the end of the session.
Examples with : gj_TP_mR(); ... and ... invgj_mR();
- c00a.c ... ... ... invgj_mR(); ... ... ... .. ax**2 + ay**2 + cx + dy + e = 0
- c00b.c ... ... ... invgj_mR();
- c00c.c ... ... ... invgj_mR();
- c00d.c ... ... ... invgj_mR();