📜  球面镜焦距的Python程序

📅  最后修改于: 2022-05-13 01:56:56.681000             🧑  作者: Mango

球面镜焦距的Python程序

焦距是镜子中心到主焦点之间的距离。为了确定球面镜的焦距,我们应该知道该镜面的曲率半径。从顶点到曲率中心的距离称为曲率半径。焦距是曲率半径的一半。公式 :

F =   ( R / 2 )      for concave mirror
F = - ( R / 2 )      for convex mirror

例子 :

For a convex mirror
Input : R = 30 
Output : F = 15


For a convex mirror
Input : R = 25
Output : F = - 12.5
Python


Python3
# Python3 program to determine
# the focal length of a
# of a spherical mirror
 
# Determines focal length of
# a spherical concave mirror
def focal_length_concave(R):
    return R / 2
 
# Determines focal length of
# a spherical convex mirror
def focal_length_convex(R):
    return - ( R/ 2 )
 
# Driver function
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 units
Focal length of spherical convex mirror is -15 units

请参阅完整的文章来确定球面镜的焦距以获取更多详细信息!