Cody

# Problem 1651. Circumcircle Points

Solution 3086941

Submitted on 6 Oct 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
pts=[0 0;5 0;1.8 2.4]; % 3 4 5 triangle r_exp=2.5; r = Circumcircle_radius(pts); assert(abs(r-r_exp)<.001)

s1 = 0 s2 = 2.5000 y = 2.5000 y = 2.5000 5.5902 y = 2.5000 5.5902 1.8028

Output argument "r" (and maybe others) not assigned during call to "Circumcircle_radius". Error in Test1 (line 3) r = Circumcircle_radius(pts);

2   Fail
pts=[0 0;6 0;1.8 2.4]; % 3 x 6 triangle r_exp=3; % Two Point Solver r = Circumcircle_radius(pts); assert(abs(r-r_exp)<.001)

s1 = 0 s2 = 3 y = 3 y = 3.0000 6.7082 y = 3.0000 6.7082 1.8974

Output argument "r" (and maybe others) not assigned during call to "Circumcircle_radius". Error in Test2 (line 3) r = Circumcircle_radius(pts);

3   Fail
pts=[0 0;0 1;1 2;3 0]; % r^2=2.5 r_exp=sqrt(2.5); r = Circumcircle_radius(pts); assert(abs(r-r_exp)<.001)

s1 = 0 s2 = 0.5000 y = 0.5000 y = 0.5000 0.5000 y = 0.5000 0.5000 1.8028 y = 0.5000 0.5000 1.8028 3.0414

Output argument "r" (and maybe others) not assigned during call to "Circumcircle_radius". Error in Test3 (line 3) r = Circumcircle_radius(pts);

4   Fail
pts=[0 1; 0 3; 0 4; 2 6; 3 0; 4 5]; % r2 9.2820069 r_exp=sqrt(9.2820069 ); r = Circumcircle_radius(pts); assert(abs(r-r_exp)<.001)

s1 = 0.5000 s2 = 1.5000 y = 0.7071 y = 0.7071 1.5811 y = 0.7071 1.5811 2.5495 y = 0.7071 1.5811 2.5495 4.7434 y = 0.7071 1.5811 2.5495 4.7434 2.9155 y = 0.7071 1.5811 2.5495 4.7434 2.9155 4.9497

Output argument "r" (and maybe others) not assigned during call to "Circumcircle_radius". Error in Test4 (line 3) r = Circumcircle_radius(pts);

5   Fail
pts=[0,2;0,6;1,1;3,0;3,3;4,10;5,10;7,2;9,7]; % r2 26.6919 r_exp=sqrt(26.6919420552286 ); r = Circumcircle_radius(pts); assert(abs(r-r_exp)<.001)

s1 = 1 s2 = 3 y = 1.4142 y = 1.4142 3.1623 y = 1.4142 3.1623 2.0000 y = 1.4142 3.1623 2.0000 3.6056 y = 1.4142 3.1623 2.0000 3.6056 2.0000 y = 1.4142 3.1623 2.0000 3.6056 2.0000 7.6158 y = 1.4142 3.1623 2.0000 3.6056 2.0000 7.6158 8.0623 y = 1.4142 3.1623 2.0000 3.6056 2.0000 7.6158 8.0623 6.0828 y = 1.4142 3.1623 2.0000 3.6056 2.0000 7.6158 8.0623 6.0828 8.9443

Output argument "r" (and maybe others) not assigned during call to "Circumcircle_radius". Error in Test5 (line 3) r = Circumcircle_radius(pts);

6   Fail
pts=[0,19;1,25;1,30;1,34;3,11;4,30;8,17;9,6;11,44;12,45;15,46;21,0;21,9;21,48;22,42;26,11;31,40;34,27;37,44;39,34;41,8;43,9;43,10;46,16;46,35;48,23]; % r2 exp 608.7807 r_exp=sqrt(608.780718525455); r = Circumcircle_radius(pts); assert(abs(r-r_exp)<.001)

s1 = 9.5000 s2 = 13 y = 11.2361 y = 11.2361 14.7054 y = 11.2361 14.7054 19.0066 y = 11.2361 14.7054 19.0066 22.6550 y = 11.2361 14.7054 19.0066 22.6550 6.8007 y = 11.2361 14.7054 19.0066 22.6550 6.8007 17.8676 y = 11.2361 14.7054 19.0066 22.6550 6.8007 17.8676 4.2720 y = 11.2361 14.7054 19.0066 22.6550 6.8007 17.8676 4.2720 7.0178 y = 11.2361 14.7054 19.0066 22.6550 6.8007 17.8676 4.2720 7.0178 31.0363 y = 11.2361 14.7054 19.0066 22.6550 6.8007 17.8676 4.2720 7.0178 31.0363 32.0975 y = 11.2361 14.7054 19.0066 22.6550 6.8007 17.8676 4.2720 7.0178 31.0363 32.0975 33.4552 y = 11.2361 14.7054 19.0066 22.6550 6.8007 17.8676 4.2720 7.0178 31.0363 32.0975 33.4552 17.3566 y = 11.2361 14.7054 19.0066 22.6550 6.8007 17.8676 4.2720 7.0178 31.0363 32.0975 33.4552 17.3566 12.1758 y = 11.2361 14.7054 19.0066 22.6550 6.8007 17.8676 4.2720 7.0178 31.0363 32.0975 33.4552 17.3566 12.1758 36.8409 y = 11.2361 14.7054 19.0066 22.6550 6.8007 17.8676 4.2720 7.0178 31.0363 32.0975 33.4552 17.3566 12.1758 36.8409 31.5793 y = 11.2361 14.7054 19.0066 22.6550 6.8007 17.8676 4.2720 7.0178 31.0363 32.0975 33.4552 17.3566 12.1758 36.8409 31.5793 16.6208 y = 11.2361 14.7054 19.0066 22.6550 6.8007 17.8676 4.2720 7.0178 31.0363 32.0975 33.4552 17.3566 12.1758 36.8409 31.5793 16.6208 34.5145 y = Columns 1 through 17 11.2361 14.7054 19.0066 22.6550 6.8007 17.8676 4.2720 7.0178 31.0363 32.0975 33.4552 17.3566 12.1758 36.8409 31.5793 16.6208 34.5145 Column 18 28.2179 y = Columns 1 through 17 11.2361 14.7054 19.0066 22.6550 6.8007 17.8676 4.2720 7.0178 31.0363 32.0975 33.4552 17.3566 12.1758 36.8409 31.5793 16.6208 34.5145 Columns 18 through 19 28.2179 41.4397 y = Columns 1 through 17 11.2361 14.7054 19.0066 22.6550 6.8007 17.8676 4.2720 7.0178 31.0363 32.0975 33.4552 17.3566 12.1758 36.8409 31.5793 16.6208 34.5145 Columns 18 through 20 28.2179 41.4397 36.2112 y = Columns 1 through 17 11.2361 14.7054 19.0066 22.6550 6.8007 17.8676 4.2720 7.0178 31.0363 32.0975 33.4552 17.3566 12.1758 36.8409 31.5793 16.6208 34.5145 Columns 18 through 21 28.2179 41.4397 36.2112 31.8944 y = Columns 1 through 17 11.2361 14.7054 19.0066 22.6550 6.8007 17.8676 4.2720 7.0178 31.0363 32.0975 33.4552 17.3566 12.1758 36.8409 31.5793 16.6208 34.5145 Columns 18 through 22 28.2179 41.4397 36.2112 31.8944 33.7380 y = Columns 1 through 17 11.2361 14.7054 19.0066 22.6550 6.8007 17.8676 4.2720 7.0178 31.0363 32.0975 33.4552 17.3566 12.1758 36.8409 31.5793 16.6208 34.5145 Columns 18 through 23 28.2179 41.4397 36.2112 31.8944 33.7380 33.6341 y = Columns 1 through 17 11.2361 14.7054 19.0066 22.6550 6.8007 17.8676 4.2720 7.0178 31.0363 32.0975 33.4552 17.3566 12.1758 36.8409 31.5793 16.6208 34.5145 Columns 18 through 24 28.2179 41.4397 36.2112 31.8944 33.7380 33.6341 36.6231 y = Columns 1 through 17 11.2361 14.7054 19.0066 22.6550 6.8007 17.8676 4.2720 7.0178 31.0363 32.0975 33.4552 17.3566 12.1758 36.8409 31.5793 16.6208 34.5145 Columns 18 through 25 28.2179 41.4397 36.2112 31.8944 33.7380 33.6341 36.6231 42.6175 y = Columns 1 through 17 11.2361 14.7054 19.0066 22.6550 6.8007 17.8676 4.2720 7.0178 31.0363 32.0975 33.4552 17.3566 12.1758 36.8409 31.5793 16.6208 34.5145 Columns 18 through 26 28.2179 41.4397 36.2112 31.8944 33.7380 33.6341 36.6231 42.6175 39.7775

Output argument "r" (and maybe others) not assigned during call to "Circumcircle_radius". Error in Test6 (line 3) r = Circumcircle_radius(pts);

7   Fail
% Random case to avoid hard coders xc=rand; yc=rand; r=.5+rand; pts=[]; % Equilateral points pts(1,:)=[xc+r,yc]; pts(2,:)=[xc+r*cos(2*pi/3),yc+r*sin(2*pi/3)]; pts(3,:)=[xc+r*cos(-2*pi/3),yc+r*sin(-2*pi/3)]; for i=4:10 rnew=rand*r; theta=randi(360)*pi/180; pts(i,:)=[xc+rnew*cos(theta),yc+rnew*sin(theta)]; end pts=pts(randperm(size(pts,1)),:); r_exp=r; r = Circumcircle_radius(pts); assert(abs(r-r_exp)<.001)

s1 = 0.2270 s2 = 0.2855 y = 0.7508 y = 0.7508 0.3696 y = 0.7508 0.3696 0.2913 y = 0.7508 0.3696 0.2913 0.8913 y = 0.7508 0.3696 0.2913 0.8913 1.2781 y = 0.7508 0.3696 0.2913 0.8913 1.2781 0.8373 y = 0.7508 0.3696 0.2913 0.8913 1.2781 0.8373 0.4613 y = 0.7508 0.3696 0.2913 0.8913 1.2781 0.8373 0.4613 1.2605 y = 0.7508 0.3696 0.2913 0.8913 1.2781 0.8373 0.4613 1.2605 0.4984 y = 0.7508 0.3696 0.2913 0.8913 1.2781 0.8373 0.4613 1.2605 0.4984 0.9525

Output argument "r" (and maybe others) not assigned during call to "Circumcircle_radius". Error in Test7 (line 17) r = Circumcircle_radius(pts);

8   Fail
% Random case to avoid hard coders xc=rand; yc=rand; r=.5+rand; pts=[]; % Equilateral points pts(1,:)=[xc+r,yc]; pts(2,:)=[xc+r*cos(2*pi/3),yc+r*sin(2*pi/3)]; pts(3,:)=[xc+r*cos(-2*pi/3),yc+r*sin(-2*pi/3)]; for i=4:30 rnew=rand*r; theta=randi(360)*pi/180; pts(i,:)=[xc+rnew*cos(theta),yc+rnew*sin(theta)]; end pts=pts(randperm(size(pts,1)),:); r_exp=r; r = Circumcircle_radius(pts); assert(abs(r-r_exp)<.001)

s1 = 0.5662 s2 = 0.2441 y = 0.5581 y = 0.5581 0.5404 y = 0.5581 0.5404 1.2728 y = 0.5581 0.5404 1.2728 0.6695 y = 0.5581 0.5404 1.2728 0.6695 1.2155 y = 0.5581 0.5404 1.2728 0.6695 1.2155 0.2672 y = 0.5581 0.5404 1.2728 0.6695 1.2155 0.2672 0.7551 y = 0.5581 0.5404 1.2728 0.6695 1.2155 0.2672 0.7551 0.1432 y = 0.5581 0.5404 1.2728 0.6695 1.2155 0.2672 0.7551 0.1432 0.8579 y = 0.5581 0.5404 1.2728 0.6695 1.2155 0.2672 0.7551 0.1432 0.8579 1.2595 y = 0.5581 0.5404 1.2728 0.6695 1.2155 0.2672 0.7551 0.1432 0.8579 1.2595 1.0365 y = 0.5581 0.5404 1.2728 0.6695 1.2155 0.2672 0.7551 0.1432 0.8579 1.2595 1.0365 0.5628 y = 0.5581 0.5404 1.2728 0.6695 1.2155 0.2672 0.7551 0.1432 0.8579 1.2595 1.0365 0.5628 0.2843 y = 0.5581 0.5404 1.2728 0.6695 1.2155 0.2672 0.7551 0.1432 0.8579 1.2595 1.0365 0.5628 0.2843 0.3686 y = 0.5581 0.5404 1.2728 0.6695 1.2155 0.2672 0.7551 0.1432 0.8579 1.2595 1.0365 0.5628 0.2843 0.3686 0.2808 y = 0.5581 0.5404 1.2728 0.6695 1.2155 0.2672 0.7551 0.1432 0.8579 1.2595 1.0365 0.5628 0.2843 0.3686 0.2808 1.0562 y = 0.5581 0.5404 1.2728 0.6695 1.2155 0.2672 0.7551 0.1432 0.8579 1.2595 1.0365 0.5628 0.2843 0.3686 0.2808 1.0562 0.5239 y = Columns 1 through 17 0.5581 0.5404 1.2728 0.6695 1.2155 0.2672 0.7551 0.1432 0.8579 1.2595 1.0365 0.5628 0.2843 0.3686 0.2808 1.0562 0.5239 Column 18 0.5398 y = Columns 1 through 17 0.5581 0.5404 1.2728 0.6695 1.2155 0.2672 0.7551 0.1432 0.8579 1.2595 1.0365 0.5628 0.2843 0.3686 0.2808 1.0562 0.5239 Columns 18 through 19 0.5398 0.3973 y = Columns 1 through 17 0.5581 0.5404 1.2728 0.6695 1.2155 0.2672 0.7551 0.1432 0.8579 1.2595 1.0365 0.5628 0.2843 0.3686 0.2808 1.0562 0.5239 Columns 18 through 20 0.5398 0.3973 0.4470 y = Columns 1 through 17 0.5581 0.5404 1.2728 0.6695 1.2155 0.2672 0.7551 0.1432 0.8579 1.2595 1.0365 0.5628 0.2843 0.3686 0.2808 1.0562 0.5239 Columns 18 through 21 0.5398 0.3973 0.4470 0.9608 y = Columns 1 through 17 0.5581 0.5404 1.2728 0.6695 1.2155 0.2672 0.7551 0.1432 0.8579 1.2595 1.0365 0.5628 0.2843 0.3686 0.2808 1.0562 0.5239 Columns 18 through 22 0.5398 0.3973 0.4470 0.9608 0.5625 y = Columns 1 through 17 0.5581 0.5404 1.2728 0.6695 1.2155 0.2672 0.7551 0.1432 0.8579 1.2595 1.0365 0.5628 0.2843 0.3686 0.2808 1.0562 0.5239 Columns 18 through 23 0.5398 0.3973 0.4470 0.9608 0.5625 0.8758 y = Columns 1 through 17 0.5581 0.5404 1.2728 0.6695 1.2155 0.2672 0.7551 0.1432 0.8579 1.2595 1.0365 0.5628 0.2843 0.3686 0.2808 1.0562 0.5239 Columns 18 through 24 0.5398 0.3973 0.4470 0.9608 0.5625 0.8758 0.4226 y = Columns 1 through 17 0.5581 0.5404 1.2728 0.6695 1.2155 0.2672 0.7551 0.1432 0.8579 1.2595 1.0365 0.5628 0.2843 0.3686 0.2808 1.0562 0.5239 Columns 18 through 25 0.5398 0.3973 0.4470 0.9608 0.5625 0.8758 0.4226 0.9583 y = Columns 1 through 17 0.5581 0.5404 1.2728 0.6695 1.2155 0.2672 0.7551 0.1432 0.8579 1.2595 1.0365 0.5628 0.2843 0.3686 0.2808 1.0562 0.5239 Columns 18 through 26 0.5398 0.3973 0.4470 0.9608 0.5625 0.8758 0.4226 0.9583 0.6535 y = Columns 1 through 17 0.5581 0.5404 1.2728 0.6695 1.2155 0.2672 0.7551 0.1432 0.8579 1.2595 1.0365 0.5628 0.2843 0.3686 0.2808 1.0562 0.5239 Columns 18 through 27 0.5398 0.3973 0.4470 0.9608 0.5625 0.8758 0.4226 0.9583 0.6535 1.2152 y = Columns 1 through 17 0.5581 0.5404 1.2728 0.6695 1.2155 0.2672 0.7551 0.1432 0.8579 1.2595 1.0365 0.5628 0.2843 0.3686 0.2808 1.0562 0.5239 Columns 18 through 28 0.5398 0.3973 0.4470 0.9608 0.5625 0.8758 0.4226 0.9583 0.6535 1.2152 0.2079 y = Columns 1 through 17 0.5581 0.5404 1.2728 0.6695 1.2155 0.2672 0.7551 0.1432 0.8579 1.2595 1.0365 0.5628 0.2843 0.3686 0.2808 1.0562 0.5239 Columns 18 through 29 0.5398 0.3973 0.4470 0.9608 0.5625 0.8758 0.4226 0.9583 0.6535 1.2152 0.2079 0.8442 y = Columns 1 through 17 0.5581 0.5404 1.2728 0.6695 1.2155 0.2672 0.7551 0.1432 0.8579 1.2595 1.0365 0.5628 0.2843 0.3686 0.2808 1.0562 0.5239 Columns 18 through 30 0.5398 0.3973 0.4470 0.9608 0.5625 0.8758 0.4226 0.9583 0.6535 1.2152 0.2079 0.8442 0.4724

Output argument "r" (and maybe others) not assigned during call to "Circumcircle_radius". Error in Test8 (line 17) r = Circumcircle_radius(pts);

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!