R.<m,n> = QQ[] Ax=0 Ay=0 Bx=2 By=0 #m=tan half A #n=tan half B p=(1-m*n)/(m+n) #I= incenter #O=circumcenter #H=orthocenter Iy=2/(1/m+1/n) Ix=Iy/m #R= circumradius #r=inradius r=Iy tanA=2*m/(1-m^2) sinA=2*m/(1+m^2) tanB=2*n/(1-n^2) sinB=2*n/(1+n^2) tanC=2*p/(1-p^2) sinC=2*p/(1+p^2) R=1/sinC c=2 a=2*R*sinA b=2*R*sinB Cy=2/((1-m^2)/2/m+(1-n^2)/2/n) Cx=Cy/2/m*(1-m^2) Hx=Cx Hy=Cx*(2-Cx)/Cy Ox=1 Oy=(Cy-Hy)/2 print (a^2-(Bx-Cx)^2-(By-Cy)^2) print (b^2-(Ax-Cx)^2-(Ay-Cy)^2) print (R^2-(Ax-Ox)^2-(Ay-Oy)^2, R^2-(Bx-Ox)^2-(By-Oy)^2, R^2-(Cx-Ox)^2-(Cy-Oy)^2) print (((Ix-Cx)*(Cy-Ay)+(Iy-Cy)*(Ax-Cx))/b/r, ((Ix-Cx)*(By-Cy)+(Iy-Cy)*(Cx-Bx))/a/r) print ((Ax-Bx)*(Cx-Hx)+(Ay-By)*(Cy-Hy), (Bx-Cx)*(Ax-Hx)+(By-Cy)*(Ay-Hy), (Cx-Ax)*(Bx-Hx)+(Cy-Ay)*(By-Hy)) print (Cy^2-(a+b+c)*(a+b-c)*(b+c-a)*(c+a-b)/16) print (c^2-a^2-b^2+2*a*b*sinC/tanC) #This program uses the law of sines and sin(theta-phi) formula. An altitude of a triangle splits it into two right triangles each of which can be used to calculate the altitude. Equating the results yields the law of sines. The program uses the 2R part to define R. Later a point is found distance R from each vertex, verifying R and proving the 2R part of the law. Adding pi to theta or phi negates the sin(theta-phi) formula so they may be taken in the right half plane. Negating both negates so we can take at least theta in the first quadrant. Transposing them negates so we can take theta>phi and thus in the first quadrant. Take phi in the fourth quadrant, the other case similar. Draw rays for theta and phi. The line x=cos theta cos phi and the rays define a triangle where the upper sine is cos theta. Try cos theta for the bottom side. Then in the ratio of the top leg of the bottom right triangle to the hypotenuse cos theta cancels leaving cos phi which is right. Thus the law of sines ratio is one and the left sin(theta-phi) equals the right side split by the x axis. Try sin theta cos phi for the upper segment. Then in the ratio of legs of the top right triangle cos phi cancels leaving sin theta/cos theta=tan theta which is right. Reflecting through the x axis moves the sought lower segment to a known upper segment and transposes theta and -phi. Note cos(theta+phi)=sin((90-theta)-phi).
0
0
0 0 0
1 1
0 0 0
0
0
9