Jump to content

Problem of Apollonius: Difference between revisions

m
→‎{{header|Perl 6}}: all 8 solutions, nicer output
m (→‎{{header|Perl}}: all 8 solutions)
m (→‎{{header|Perl 6}}: all 8 solutions, nicer output)
Line 1,948:
has $.y;
has $.r;
method gist { sprintf "circle%s =%7.3f " xx 3, (:$!x, :$!y, :$!r)"».kv }
}
 
Line 1,992:
}
my @c = circle(0, 0, 1), circle(4, 0, 1), circle(2, 4, 2);
sub MAIN {
for ([X] [-1,1] xx 3) -> @i {
my @c = circle(0, 0, 1), circle(4, 0, 1), circle(2, 4, 2);
say (solve-Apollonius @c, <1 1 1>@i).gist;
say solve-Apollonius @c, <-1 -1 -1>;
}</lang>
{{out}}
<pre>circle(2,x = 2.1,000 3 y = 0.833 r = 1.9)167
x = 2.000 y = 3.214 r = 2.786
circle(2, 0.833333333333333, 1.16666666666667)</pre>
x = 3.002 y = 0.123 r = 2.005
x = 4.127 y = 3.252 r = 4.255
x = 0.998 y = 0.123 r = 2.005
x = -0.127 y = 3.252 r = 4.255
x = 2.000 y = -1.500 r = 3.500
x = 2.000 y = 2.100 r = 3.900</pre>
 
=={{header|PL/I}}==
2,392

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.