1 | initial version |
This may not be the most efficient solution but works.
pta=[1,2]
ptb=[2,3]
ptc=[-1,3]
a=var('a')
b=var('b')
r=var('r')
func_cir=(x-a)**2+(y-b)**2==r**2
eq1 = func_cir.subs(x==pta[0]).subs(y==pta[1])
eq2 = func_cir.subs(x==ptb[0]).subs(y==ptb[1])
eq3 = func_cir.subs(x==ptc[0]).subs(y==ptc[1])
sol = solve([eq1,eq2,eq3],a,b,r)
p1=list_plot([pta,ptb,ptc])
p2=circle((sol[0][0].rhs(),sol[0][1].rhs()),sol[1][2].rhs())
(p1+p2).show()
2 | No.2 Revision |
This may not be the most efficient solution but works.
pta=[1,2]
ptb=[2,3]
ptc=[-1,3]
a=var('a')
b=var('b')
r=var('r')
func_cir=(x-a)**2+(y-b)**2==r**2
eq1 = func_cir.subs(x==pta[0]).subs(y==pta[1])
eq2 = func_cir.subs(x==ptb[0]).subs(y==ptb[1])
eq3 = func_cir.subs(x==ptc[0]).subs(y==ptc[1])
sol = solve([eq1,eq2,eq3],a,b,r)
p1=list_plot([pta,ptb,ptc])
p2=circle((sol[0][0].rhs(),sol[0][1].rhs()),sol[1][2].rhs())
p2=circle((sol[1][0].rhs(),sol[1][1].rhs()),sol[1][2].rhs())
(p1+p2).show()