もしかしたら、中学3年生の問題になりますか?(中心角は中3)
問題文は2次元ですが、3次元FreeCADのマクロで作図しました。
オリジナル
問題2
解答2
上と同じです。大学入試数学問題集成>テキスト
sympyで計算だけ(オリジナルの方法で)
正弦定理をこのページ下の参考で、勉強中
sympyで計算だけ(【大学入試ガチ解説】様の方法で)
youtube
https://www.youtube.com/watch?v=mpYyM2uv3xY
一目で?面積は、15/16です。
1:4 (【大学入試ガチ解説】様より)(このページ下の参考。wikiの図形の相似より)
4✕4-1✕1=15
1✕√15✕15/16
相似の勉強中。
わからなくなったので、以下の三平方の定理にしました。
sympyで計算だけ(【大学入試ガチ解説】様の方法を勉強後に)
三平方の定理だけで。
相似を使っていません。のつもりです。計算式を無理やりsolveにしています。
もしかしたら、中学3年生の問題になりますか?
from sympy import *
ML,MH,HL,r,R=symbols('ML MH HL r R',real=True,positive=True)
OM=1
OL=4
ML=solve(Eq(OM**2+ML**2,OL**2),ML)[0]
MH=solve(Eq(OM*ML ,OL*MH),MH)[0]
HL=solve(Eq(MH**2+HL**2,ML**2),HL)[0]
print("#(1)",HL*MH)
print("#(2)",solve(Eq(HL*MH,Rational(1,2)*(MH*2+ML*2)*r),r)[0])
print("#(2)",solve(Eq(OL , 2*R),R)[0])
#(1) 15*sqrt(15)/16
#(2) 3/4
#(2) 2
sympyで計算だけ(安易な方法で)
円と円の交点計算でしました。
from sympy import *
O=Point(0,0)
r=1
OL=4
L=Point(OL,0)
C=Circle(O,r)
LM=sqrt(OL**2-r**2)
M=C.intersection(Circle(L,LM))[1]
N=C.intersection(Circle(L,LM))[0]
print("#(1)",Rational(1,2)*(M.y-N.y)*(L.x-M.x).simplify())
print("#(2)",Triangle(L,M,N).inradius)
print("#(2)",Triangle(L,M,N).circumradius)
#(1) 15*sqrt(15)/16
#(2) 3/4
#(2) 2
sympyとFreeCADのマクロで(作図)
円の作図に、アドバイスをお願いします。短くなりますか?
import FreeCAD
import Part
import DraftTools
import Draft
import Mesh
############################################################################
# 計算
from sympy import *
O=Point(0,0)
r=1
OL=4
L=Point(OL,0)
C=Circle(O,r)
LM=sqrt(OL**2-r**2)
M=C.intersection(Circle(L,LM))[1]
N=C.intersection(Circle(L,LM))[0]
print("#(1)",Rational(1,2)*(M.y-N.y)*(L.x-M.x).simplify())
print("#(2)",Triangle(L,M,N).inradius)
print("#(2)",Triangle(L,M,N).circumradius)
############################################################################
# 円の作図 FrecCADのdocより
# https://wiki.freecad.org/Macro_Circle
def circle(x=0.0,y=0.0,z=0.0,radius=0.0,diameter=0.0,circumference=0.0,area=0.0,startangle=0.0,endangle=0.0,arc=0.0,anglecenter=0.0,cord=0.0,arrow=0.0,center=0,placemObject=""):
from math import sqrt, pi
if placemObject == "":
pl = FreeCAD.Placement()
pl.Rotation = FreeCADGui.ActiveDocument.ActiveView.getCameraOrientation()
pl.Base = FreeCAD.Vector(x,y,z)
else:
pl = FreeCAD.Placement()
pl = placemObject # placement imposted
if diameter != 0: # with diameter
radius = diameter / 2.0
elif circumference != 0: # with circumference
radius = (circumference / pi) / 2.0
elif area != 0: # with area
radius = sqrt((area / pi))
elif (cord != 0) and (arrow != 0): # with cord and arrow
radius = ((arrow**2) + (cord**2) / 4.0) / (arrow*2)
elif (arc != 0) and (anglecenter != 0): # with arc and anglecenter central in degrees
radius = ((360/anglecenter)*arc) / pi/2.0
if endangle != 0:
startangle = endangle - anglecenter
endangle = anglecenter + startangle
startangle = endangle - anglecenter
if radius != 0:
try:
Draft.makeCircle(radius,placement=pl,face=False,startangle=startangle,endangle=endangle,support=None)
if center != 0:
x=pl.Base.x
y=pl.Base.y
z=pl.Base.z
Draft.makePoint(x,y,z)
except Exception:
App.Console.PrintError("Unexpected keyword argument" + "\n")
App.ActiveDocument.recompute()
else:
App.Console.PrintMessage("Unexpected keyword argument" + "\n")
App.Console.PrintMessage("circle(x,y,z,radius,diameter,circumference,area,startangle,endangle,[arc,anglecenter],[cord,arrow],center,placemObject)" + "\n")
App.Console.PrintMessage("circle(radius=10.0,placemObject=App.Placement(App.Vector(11,20,30), App.Rotation(30,40,0), App.Vector(0,0,0)))" + "\n")
return
def myCircle_2D(x,y,r):
circle(x=float(x),y=float(y),z=0.0,
radius=float(r),
center=1,
placemObject=App.Placement(App.Vector(float(x),float(y),0),
App.Rotation(0,0,0),App.Vector(0,0,0)))
return
######################################################################
# 3D作図 z=0 XY平面に作図しました。
def myXYZ2Txt_2D(A):
return '(' + str(A.x) + ',' + str(A.y) + ')'
def myTxtXYZ_2D(A,myWedgei):
P5x=float(A.x)
P5y=float(A.y)
P5z=0.0
p5 = FreeCAD.Vector(P5x, P5y, P5z)
myText = Draft.makeText(myWedgei, p5)
myText.Label = myWedgei
FreeCADGui.ActiveDocument.ActiveObject.FontSize = '0.2 mm'
return
def myTxtXYZ_S_2D(*xy_tx):
for i in range(1,int(len(xy_tx)/2)+1):
myTxtXYZ_2D(xy_tx[2*i-2],xy_tx[2*i-1]+myXYZ2Txt_2D(xy_tx[2*i-2]) )
return
def myLine_2D(A,B):
Ax,Ay,Az=float(A.x),float(A.y),0.0
Bx,By,Bz=float(B.x),float(B.y),0.0
pl = FreeCAD.Placement()
pl.Rotation.Q = (0.4247081540122249, 0.17592004639554645, 0.33985110062924484, 0.8204732460821097)
pl.Base = FreeCAD.Vector(-3.9166066876399563, -2.1670824762243774, 1.7495260956243028)
points = [FreeCAD.Vector(Ax,Ay,Az), FreeCAD.Vector(Bx,By,Bz)]
line = Draft.make_wire(points, placement=pl, closed=False, face=True, support=None)
Draft.autogroup(line)
return
def myLine_S_2D(*args):
for i in range(1,len(args)):
myLine_2D(args[i-1],args[i])
return
def myLine_C_2D(*args):
for i in range(1,len(args)):
myLine_2D(args[i-1],args[i])
myLine_2D(args[i],args[0])
return
myLine_C_2D (L,M,N)
myLine_2D (O,L)
myLine_2D (O,M)
myLine_2D (O,N)
myTxtXYZ_S_2D(O,"O",L,"L",M,"M",N,"N")
myCircle_2D(0,0,r)
myCircle_2D( Triangle(L,M,N).incenter.x, Triangle(L,M,N).incenter.y, Triangle(L,M,N).inradius )
myCircle_2D( Triangle(L,M,N).circumcenter.x, Triangle(L,M,N).circumcenter.y, Triangle(L,M,N).circumradius )
#
doc = App.activeDocument()
App.ActiveDocument.addObject("App::Origin", "Origin")
App.ActiveDocument.getObject('Origin').Visibility = True
App.ActiveDocument.recompute()
Gui.activeDocument().activeView().viewAxonometric()
Gui.SendMsgToActiveView("ViewFit")
#(1) 15*sqrt(15)/16
#(2) 3/4
#(2) 2
真上から見た。外心、内心の座標表示が。抜けていました。
参考
Triangleは、polygonでも特別classみたいです。ありがたい事です。
class sympy.geometry.polygon.Triangle(*args, **kwargs)
勉強中
>相似な図形の面積比は相似比の2乗....