球面镜焦距的Java程序
焦距是镜子中心到主焦点之间的距离。为了确定球面镜的焦距,我们应该知道该镜面的曲率半径。从顶点到曲率中心的距离称为曲率半径。
焦距是曲率半径的一半。
公式 :
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
// Java program to determine
// the focal length of a
// of a spherical mirror
import java.util.*;
import java.lang.*;
public class GfG{
// Determines focal length
// of a spherical concave
// mirror
public static float focal_length_concave(float R)
{
return R / 2 ;
}
// Determines focal length of a
// spherical convex mirror
public static float focal_length_convex(float R)
{
return - ( R / 2 ) ;
}
// Driver function
public static void main(String argc[])
{
float R = 30 ;
System.out.print("Focal length of" +
"spherical concave"+
"mirror is : "+
focal_length_concave(R) +
" units\n");
System.out.println("Focal length of"+
"spherical convex"+
"mirror is : "+
focal_length_convex(R) +
" units");
}
}
/* This code is contributed by Sagar Shukla */
输出:
Focal length ofspherical concavemirror is : 15.0 units
Focal length ofspherical convexmirror is : -15.0 units
请参阅完整的文章来确定球面镜的焦距以获取更多详细信息!