from sage.symbolic.integration.integral import definite_integral
P = polygon([0,0])
n = 40
L = []
SL = []
C = []
for i in range(n+1):
sol = circlecurve([i/n,0], [1/2,(i*sqrt(3)/2)/n], [1/2+cos(2*pi*i/n).n()*sqrt(3)/6,sqrt(3)/6+sin(2*pi*i/n).n()*sqrt(3)/6])
L.append( piecewise( [ [ ( -0.5, sol[1][a]-sol[1][r] ), lambda x: 1 ] , [ [ sol[1][a]-sol[1][r], sol[1][a]+sol[1][r] ], lambda x: -sqrt(sol[1][r]**2-(x-sol[1][a])**2)+sol[1][b] ], [ ( sol[1][a]+sol[1][r], 7 ) , lambda x: 1] ] ) )
if i == 0 or i == n:
P += circle((sol[1][a],sol[1][b]),sol[1][r], color='black')
C += sol
c1 = ((x-C[1][a])^2+(y-C[1][b])^2==C[1][r]^2)
c2 = ((x-C[3][a])^2+(y-C[3][b])^2==C[3][r]^2)
uc1 = sqrt(C[1][r]^2-(x-C[1][a])^2)+C[1][b]
lc1 = -sqrt(C[1][r]^2-(x-C[1][a])^2)+C[1][b]
lc2 = -sqrt(C[3][r]^2-(x-C[3][a])^2)+C[3][b]
s12 = solve([c1, c2],x,y, solution_dict=True)
for j in range((ZZ)(0.75*n)):
SL.append((0.46+j/n, lowest(L, 1, n-1, 0.46+j/n)))
S = spline(SL)
print("Grote cirkel: ", (pi*C[3][r]^2).n())
print("Kleine cirkel: ", (definite_integral(uc1,x,C[1][a]-C[1][r],s12[0][x]) - definite_integral(lc1,x,C[1][a]-C[1][r],0) - definite_integral(lc1,x,0,0.46)).n())
print("\"Driehoekje\": ", definite_integral(lc2,x,s12[0][x],1).n())
print("Curve onder de as: ", (definite_integral(lc2,x,1,1.2) - S.definite_integral(0.46, 1.2)).n())
print("Totaal: ", ((pi*C[3][r]^2)+(definite_integral(uc1,x,C[1][a]-C[1][r],s12[0][x])-definite_integral(lc1,x,C[1][a]-C[1][r],0)-definite_integral(lc1,x,0,0.46))+definite_integral(lc2,x,s12[0][x],1)+(definite_integral(lc2,x,1,1.2)-S.definite_integral(0.46, 1.2))).n())
P += point([0, 0])
P += point([0.46, SL[0][1]])
P += point([s12[1][x], s12[1][y]])
P += list_plot(SL, plotjoined=True, color='black')
P+=plot(1.23, (x,0.39,1.21), color='black', fillcolor = 'black', fill=lc2)
P.show(xmin = -0.4, xmax = 1.2, ymin = -0.25, ymax = 1.2)
P+=plot(0, (x,C[1][a]-C[1][r],s12[0][x]), color='black', fillcolor = 'black', fill=uc1)
P.show(xmin = -0.4, xmax = 1.2, ymin = -0.25, ymax = 1.2)
P+=plot(0, (x,C[1][a]-C[1][r],0), color='black', fillcolor = 'white', fill=lc1)
P.show(xmin = -0.4, xmax = 1.2, ymin = -0.25, ymax = 1.2)
P+=plot(0, (x,0,0.46), color='black', fillcolor = 'black', fill=lc1)
P.show(xmin = -0.4, xmax = 1.2, ymin = -0.25, ymax = 1.2)
P+=plot(0, (x,s12[0][x],1), color='black', fillcolor = 'black', fill=lc2)
P.show(xmin = -0.4, xmax = 1.2, ymin = -0.25, ymax = 1.2)
P+=plot(0, (x,0.46, 1.21), color='black', fillcolor = 'black', fill=S)
P.show(xmin = -0.4, xmax = 1.2, ymin = -0.25, ymax = 1.2)
P+=plot(0, (x,1, 1.21), color='black', fillcolor = 'white', fill=lc2)
P.show(xmin = -0.4, xmax = 1.2, ymin = -0.25, ymax = 1.2)
|
('Grote cirkel: ', 28.0024615607099)
('Grote cirkel: ', 28.0024615607099)
|