Please Help thanks in advance Given the coordinates of three points (x_1, y_1),
ID: 3572919 • Letter: P
Question
Please Help thanks in advance
Given the coordinates of three points (x_1, y_1), (x_2, y_2), and (x_3, y_3) it is possible to find the coordinates of the center of the circle (C_x, C_y) that passes through the three points by solving the following simultaneous equations: 2[(x_1 - x_2) (y_1 - y_2) (x_2 - x_3) (y_2 - y_3)] [C_x C_y] = [(x_1^2 + y_1^2) - (x_2^2 + y_2^2) (x_2^2 + y_2^2) - (x_3^2 + y_3^2)] Write a program in a script file that calculates the coordinates of the center and the radius of a circle that passes through three given points. When executed the program asks the user to enter the coordinates of the three points. The program then calculates the center and radius and displays the results in the following format: "The coordinates of the center are (xx.x, xx.x) and the radius is xx.x.", where xx.x stands for the calculated quantities rounded to the nearest tenth. Execute the program entering the following three points: (10.5, 4), (2, 8.6), and (-4, -7).Explanation / Answer
(x1,y1),(x2,y2),(x3,y3).
Use input function to get the coordinate values from the user.
Code:
x1 =input(‘Enter the coordinates of point 1: ');
x2=input(‘Enter the coordinates of point 2: ');
x3=input(‘Enter the coordinates of point 3: ');
A=2"[x1 (1 )-x2(1) x1(2)-x2(2); x2(1)-x3(1) x2(2)-x3(2)];
B={x1(1)"2+x1(2)“2-x2(1 )‘2-x2(2)“2; x2(1)"2+x2(2)‘2-x3(1 )‘2-x3(2)“2];
C=AB;
r = Sqrt((X1(1)-C(1))"2 + (X1(2}C(2))"2);
fprintf(‘ The coordinates of the center are (%.1f, %.1f)',C)
fprintf(‘and the radius is %.1f. ',r)
Sample Output:
Enter the coordinates of point 1: [10.5, 4]
Enter the coordinates of point 2: [2, 8.61
Enter the coordinates of point 3: [-4, -7]
The coordinates of the center are (2.5, -0.6) and the radius is 9.2.
The centre or the circie and radius of the circle are displayed.
Therefore, the required center of the circle and radius of the circle are (2.5, -0.6), 9.2