Problem of Apollonius: Difference between revisions
Content added Content deleted
SqrtNegInf (talk | contribs) m (→{{header|Perl}}: all 8 solutions) |
SqrtNegInf (talk | contribs) m (→{{header|Perl 6}}: all 8 solutions, nicer output) |
||
Line 1,948: | Line 1,948: | ||
has $.y; |
has $.y; |
||
has $.r; |
has $.r; |
||
method gist { " |
method gist { sprintf "%s =%7.3f " xx 3, (:$!x,:$!y,:$!r)».kv } |
||
} |
} |
||
Line 1,992: | Line 1,992: | ||
} |
} |
||
⚫ | |||
sub MAIN { |
|||
for ([X] [-1,1] xx 3) -> @i { |
|||
⚫ | |||
say solve-Apollonius @c, |
say (solve-Apollonius @c, @i).gist; |
||
say solve-Apollonius @c, <-1 -1 -1>; |
|||
}</lang> |
}</lang> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre>x = 2.000 y = 0.833 r = 1.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}}== |
=={{header|PL/I}}== |