circle

128 days ago by bennettmeredith

"Find k(a,b,c)=center of circle through complex points a, b and c." 
       
'Find k(a,b,c)=center of circle through complex points a, b and c.'
'Find k(a,b,c)=center of circle through complex points a, b and c.'
a=var("a");b=var("b");c=var("c") 
       
f(a,b)=abs(b)^2-abs(a)^2 
       
g(a,b)=b-a 
       
h(a,b)=conjugate(g(a,b)) 
       
k(a,b,c)=(f(a,b)*g(b,c)-f(b,c)*g(a,b))/(h(a,b)*g(b,c)-h(b,c)*g(a,b)) 
       
def kk(a,b,c): r = k(a,b,c) return r,[g(r,a)*h(r,a),g(r,b)*h(r,b),g(r,c)*h(r,c)] 
       
kk(0,1+I,2) 
       
(1, [1, 1, 1])
(1, [1, 1, 1])
kk(1+I,1+3*I,2+2*I) 
       
(2*I + 1, [1, 1, 1])
(2*I + 1, [1, 1, 1])
kk(0,1,I) 
       
(1/2*I + 1/2, [1/2, 1/2, 1/2])
(1/2*I + 1/2, [1/2, 1/2, 1/2])
kk(1,2,3) 
       
Traceback (click to the left of this block for traceback)
...
RuntimeError: power::eval(): division by zero
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_54.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("a2soMSwyLDMp"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmpJi9eg0/___code___.py", line 3, in <module>
    exec compile(u'kk(_sage_const_1 ,_sage_const_2 ,_sage_const_3 )
  File "", line 1, in <module>
    
  File "/tmp/tmpDUXnyz/___code___.py", line 3, in kk
    r = k(a,b,c)
  File "expression.pyx", line 3653, in sage.symbolic.expression.Expression.__call__ (sage/symbolic/expression.cpp:16197)
  File "/sagenb/sage_install/sage-4.7.2/local/lib/python2.6/site-packages/sage/symbolic/callable.py", line 478, in _call_element_
    return SR(_the_element.substitute(**d))
  File "expression.pyx", line 3504, in sage.symbolic.expression.Expression.substitute (sage/symbolic/expression.cpp:15561)
RuntimeError: power::eval(): division by zero
kk(1,2,3+I) 
       
(3/2*I + 3/2, [5/2, 5/2, 5/2])
(3/2*I + 3/2, [5/2, 5/2, 5/2])
kk(1+2*i,4-I,3+5*I) 
       
(21/10*I + 41/10, [481/50, 481/50, 481/50])
(21/10*I + 41/10, [481/50, 481/50, 481/50])