解题,详细步骤
बनाया गया: 21 जून 2025
बनाया गया: 21 जून 2025
pythonfrom PIL import Image import matplotlib.pyplot as plt img = Image.open('/mnt/data/image.png') plt.imshow(img) plt.axis('off') (-0.5, 654.5, 290.5, -0.5)
pythonplt.figure(figsize=(8,3)) plt.imshow(img.crop((0,0,1589,300))) plt.axis('off') (-0.5, 1588.5, 299.5, -0.5)
pythonplt.figure(figsize=(8,4)) plt.imshow(img.crop((0,60,800,180))) plt.axis('off') (-0.5, 799.5, 119.5, -0.5)
pythonplt.figure(figsize=(8,4)) plt.imshow(img.crop((0,0,800,100))) plt.axis('off') (-0.5, 799.5, 99.5, -0.5)
pythonimport sympy as sp h = 120*sp.sqrt(2) p, t = sp.symbols('p t', real=True) # coordinates xO = (p + 120 - 60*t)/2 yO = (h*t)/2 # AO AO = sp.sqrt((120 - xO)**2 + (yO)**2) ratio_eq = sp.Eq(AO, 3*p/2) # dot product for angle OB = sp.Matrix([-xO, -yO]) OC = sp.Matrix([60 - xO, h - yO]) cos_theta = (OB.dot(OC)) / (sp.sqrt(OB.dot(OB)) * sp.sqrt(OC.dot(OC))) # Have to minimize cos_theta -> maximize angle # We can eliminate p using ratio equation perhaps because p variable appear maybe unknown. # Solve for p in ratio equation p_expr = sp.solve(ratio_eq, p)[0] p_expr_simplified = sp.simplify(p_expr) p_expr_simplified -15*t/2 - 15*sqrt(73*t**2 + 36*t + 36)/2 - 15
pythonimport numpy as np, math def p_value(t): return -15*t/2 - 15*math.sqrt(73*t*t + 36*t + 36)/2 - 15 for tt in np.linspace(0,1,6): print(tt, p_value(tt))
pythonp_solutions = sp.solve(ratio_eq, p) p_solutions [-15*t/2 - 15*sqrt(73*t**2 + 36*t + 36)/2 - 15, -15*t/2 + 15*sqrt(73*t**2 + 36*t + 36)/2 - 15]
pythonp2 = -15*t/2 + 15*sp.sqrt(73*t**2 + 36*t + 36)/2 - 15 # evaluate some t for tt in np.linspace(0,1,6): print(tt, p2.subs(t,tt).evalf())
pythoncos_theta_t = sp.simplify(cos_theta.subs(p, p2)) cos_theta_t (512*t*(t - 2) - (-9*t + sqrt(73*t**2 + 36*t + 36) + 14)*(9*t - sqrt(73*t**2 + 36*t + 36) + 2))/(sqrt(512*t**2 + (-9*t + sqrt(73*t**2 + 36*t + 36) + 14)**2)*sqrt(512*(t - 2)**2 + (9*t - sqrt(73*t**2 + 36*t + 36) + 2)**2))
pythonimport numpy as np, math def cos_theta_num(tt): pval = p2.subs(t, tt).evalf() xO = (pval + 120 - 60*tt)/2 yO = (h*tt)/2 OBx = -xO OBy = -yO OCx = 60 - xO OCy = h - yO return (OBx*OCx + OBy*OCy)/ (math.hypot(OBx,OBy)* math.hypot(OCx,OCy)) # sample grid ts = np.linspace(0,1,101) cos_vals = [cos_theta_num(tt) for tt in ts] min_index = np.argmin(cos_vals) best_t = ts[min_index] best_cos = cos_vals[min_index] best_t, best_cos (1.0, -0.770285810410892)
pythondef angle_deg(cosv): return math.degrees(math.acos(cosv)) angles = [angle_deg(cv) for cv in cos_vals] best_angle = angles[min_index] angles[0], angles[-1] (84.94884747198208, 140.37956131830805)
python# symbolic derivative sign cos_expr = sp.simplify(cos_theta_t) dcos_dt = sp.diff(cos_expr, t) # See if sign is negative in (0,1) for tt in [0.2,0.5,0.8]: print(tt, dcos_dt.subs(t,tt).evalf())
pythonAP_expr = 120 - p2 AP_at1 = sp.simplify(AP_expr.subs(t,1)) AP_at1 285/2 - 15*sqrt(145)/2
设坐标与基本量
(取正根;另一根为负,舍去。)
其中
把上式及第 3 步中的 代入,整理得
其分子、分母均 ,显然 对 的一阶导数 ,
故 随 单调递减, 单调递增。
当 取得最大值时(即 ),
(答案若保留根式即 )