โจทย์: กำหนดรัศมีความโค้ง (Radius of Curvature) ของกระจกทรงกลม หาระยะโฟกัส (Focal Length)
ระยะโฟกัส = ระยะห่างจากศูนย์กลางความโค้งไปยังโฟกัสหลัก
สูตร: - กระจกโค้งใน (Concave): F = R/2 - กระจกโค้งนอก (Convex): F = -R/2
โค้ดตัวอย่าง
def focal_length_concave(R):
return R / 2
def focal_length_convex(R):
return - (R / 2)
R = 30
print("Focal length of spherical concave mirror is:", focal_length_concave(R), "units")
print("Focal length of spherical convex mirror is:", focal_length_convex(R), "units")
ผลลัพธ์
Focal length of spherical concave mirror is: 15.0 units
Focal length of spherical convex mirror is: -15.0 units

สรุป
เรียนรู้สูตรและโปรแกรม Python หาระยะโฟกัสของกระจกทรงกลม (Concave/Convex) จากรัศมีความโค้ง