公用事业#
Contains
refraction_angle
fresnel_coefficients
偏离
brewster_angle
critical_angle
lens_makers_formula
mirror_formula
lens_formula
hyperfocal_distance
transverse_magnification
- sympy.physics.optics.utils.brewster_angle(medium1, medium2)[源代码]#
此函数计算从介质1到介质2的布儒斯特入射角(弧度)。
- 参数:
中等1 :中等或可合成
介质折射率1
中等2 :中等或可合成
介质折射率1
实例
>>> from sympy.physics.optics import brewster_angle >>> brewster_angle(1, 1.33) 0.926093295503462
- sympy.physics.optics.utils.critical_angle(medium1, medium2)[源代码]#
此函数以弧度计算从介质1到介质2的临界入射角(标记全部内部的开始)。
- 参数:
中等1 :中等或可合成
Refractive index of Medium 1.
中等2 :中等或可合成
Refractive index of Medium 1.
实例
>>> from sympy.physics.optics import critical_angle >>> critical_angle(1.33, 1) 0.850908514477849
- sympy.physics.optics.utils.deviation(incident, medium1, medium2, normal=None, plane=None)[源代码]#
此函数用于计算由于在平面上的折射而引起的光线偏移角度。
- 参数:
事件 :矩阵、Ray3D、序列或浮点
入射矢量或入射角
中1 : 物理与光学.中等。中等或者值得同情
介质1或其折射率
中等2 : 物理与光学.中等。中等或者值得同情
介质2或其折射率
正常的 :矩阵、光线3D或序列
法向量
飞机 :平面
两种介质的分离平面。
返回入射光线和折射光线之间的角度偏差
实例
>>> from sympy.physics.optics import deviation >>> from sympy.geometry import Point3D, Ray3D, Plane >>> from sympy.matrices import Matrix >>> from sympy import symbols >>> n1, n2 = symbols('n1, n2') >>> n = Matrix([0, 0, 1]) >>> P = Plane(Point3D(0, 0, 0), normal_vector=[0, 0, 1]) >>> r1 = Ray3D(Point3D(-1, -1, 1), Point3D(0, 0, 0)) >>> deviation(r1, 1, 1, n) 0 >>> deviation(r1, n1, n2, plane=P) -acos(-sqrt(-2*n1**2/(3*n2**2) + 1)) + acos(-sqrt(3)/3) >>> round(deviation(0.1, 1.2, 1.5), 5) -0.02005
- sympy.physics.optics.utils.fresnel_coefficients(angle_of_incidence, medium1, medium2)[源代码]#
该函数使用菲涅耳方程计算反射和透射系数。当电场矢量在入射面(标记为“p”)和电场矢量垂直于入射面(标记为“s”)时,可获得两种极化。有四个实系数,除非入射光线在全内部反射,在这种情况下有两个复系数。入射角是入射光线与曲面法线之间的角度。
medium1
和medium2
可以是Medium
或任何可比较对象。- 参数:
angle_of_incidence :可解释
中1 :中等或可合成
介质1或其折射率
中等2 :中等或可合成
介质2或其折射率
- 返回:
Returns a list with four real Fresnel coefficients:
[reflection p (TM), reflection s (TE),
transmission p (TM), transmission s (TE)]
If the ray is undergoes total internal reflection then returns a
list of two complex Fresnel coefficients:
[reflection p (TM), reflection s (TE)]
实例
>>> from sympy.physics.optics import fresnel_coefficients >>> fresnel_coefficients(0.3, 1, 2) [0.317843553417859, -0.348645229818821, 0.658921776708929, 0.651354770181179] >>> fresnel_coefficients(0.6, 2, 1) [-0.235625382192159 - 0.971843958291041*I, 0.816477005968898 - 0.577377951366403*I]
工具书类
- sympy.physics.optics.utils.hyperfocal_distance(f, N, c)[源代码]#
- 参数:
f: 可交代的
Focal length of a given lens.
N: 可交代的
F-number of a given lens.
c: 可交代的
Circle of Confusion (CoC) of a given image format.
例子
>>> from sympy.physics.optics import hyperfocal_distance >>> round(hyperfocal_distance(f = 0.5, N = 8, c = 0.0033), 2) 9.47
- sympy.physics.optics.utils.lens_formula(focal_length=None, u=None, v=None)[源代码]#
当提供其中两个参数时,此函数提供其中一个参数。这仅对近轴射线有效。
- 参数:
focal_length :可解释
镜子的焦距。
u :可解释
物体离主轴光学中心的距离。
v :可解释
图像到主轴光学中心的距离。
实例
>>> from sympy.physics.optics import lens_formula >>> from sympy.abc import f, u, v >>> lens_formula(focal_length=f, u=u) f*u/(f + u) >>> lens_formula(focal_length=f, v=v) f*v/(f - v) >>> lens_formula(u=u, v=v) u*v/(u - v)
- sympy.physics.optics.utils.lens_makers_formula(n_lens, n_surr, r1, r2, d=0)[源代码]#
This function calculates focal length of a lens. It follows cartesian sign convention.
- 参数:
n_lens :中等或可合成
透镜的折射率。
n_surr :中等或可合成
周围环境反射指数。
r1 :可解释
第一个曲面的曲率半径。
r2 :可解释
第二曲面的曲率半径。
d : sympifiable, optional
Thickness of lens, default value is 0.
实例
>>> from sympy.physics.optics import lens_makers_formula >>> from sympy import S >>> lens_makers_formula(1.33, 1, 10, -10) 15.1515151515151 >>> lens_makers_formula(1.2, 1, 10, S.Infinity) 50.0000000000000 >>> lens_makers_formula(1.33, 1, 10, -10, d=1) 15.3418463277618
- sympy.physics.optics.utils.mirror_formula(focal_length=None, u=None, v=None)[源代码]#
当提供其中两个参数时,此函数提供其中一个参数。这仅对近轴射线有效。
- 参数:
focal_length :可解释
镜子的焦距。
u :可解释
物体在主轴上离磁极的距离。
v :可解释
图像到主轴上的极点的距离。
实例
>>> from sympy.physics.optics import mirror_formula >>> from sympy.abc import f, u, v >>> mirror_formula(focal_length=f, u=u) f*u/(-f + u) >>> mirror_formula(focal_length=f, v=v) f*v/(-f + v) >>> mirror_formula(u=u, v=v) u*v/(u + v)
- sympy.physics.optics.utils.refraction_angle(incident, medium1, medium2, normal=None, plane=None)[源代码]#
This function calculates transmitted vector after refraction at planar surface.
medium1
andmedium2
can beMedium
or any sympifiable object. Ifincident
is a number then treated as angle of incidence (in radians) in which case refraction angle is returned.If
incident
is an object of \(Ray3D\), \(normal\) also has to be an instance of \(Ray3D\) in order to get the output as a \(Ray3D\). Please note that if plane of separation is not provided and normal is an instance of \(Ray3D\),normal
will be assumed to be intersecting incident ray at the plane of separation. This will not be the case when \(normal\) is a \(Matrix\) or any other sequence. Ifincident
is an instance of \(Ray3D\) and \(plane\) has not been provided andnormal
is not \(Ray3D\), output will be a \(Matrix\).- 参数:
事件 :矩阵、Ray3D、序列或数字
入射矢量或入射角
中1 : 物理与光学.中等。中等或者值得同情
介质1或其折射率
中等2 : 物理与光学.中等。中等或者值得同情
介质2或其折射率
正常的 :矩阵、光线3D或序列
法向量
飞机 :平面
两种介质的分离平面。
- 返回:
Returns an angle of refraction or a refracted ray depending on inputs.
实例
>>> from sympy.physics.optics import refraction_angle >>> from sympy.geometry import Point3D, Ray3D, Plane >>> from sympy.matrices import Matrix >>> from sympy import symbols, pi >>> n = Matrix([0, 0, 1]) >>> P = Plane(Point3D(0, 0, 0), normal_vector=[0, 0, 1]) >>> r1 = Ray3D(Point3D(-1, -1, 1), Point3D(0, 0, 0)) >>> refraction_angle(r1, 1, 1, n) Matrix([ [ 1], [ 1], [-1]]) >>> refraction_angle(r1, 1, 1, plane=P) Ray3D(Point3D(0, 0, 0), Point3D(1, 1, -1))
两种介质的折射率不同
>>> n1, n2 = symbols('n1, n2') >>> refraction_angle(r1, n1, n2, n) Matrix([ [ n1/n2], [ n1/n2], [-sqrt(3)*sqrt(-2*n1**2/(3*n2**2) + 1)]]) >>> refraction_angle(r1, n1, n2, plane=P) Ray3D(Point3D(0, 0, 0), Point3D(n1/n2, n1/n2, -sqrt(3)*sqrt(-2*n1**2/(3*n2**2) + 1))) >>> round(refraction_angle(pi/6, 1.2, 1.5), 5) 0.41152
- sympy.physics.optics.utils.transverse_magnification(si, so)[源代码]#
Calculates the transverse magnification upon reflection in a mirror, which is the ratio of the image size to the object size.
- 参数:
所以:值得同情
Lens-object distance.
si:可解释
Lens-image distance.
例子
>>> from sympy.physics.optics import transverse_magnification >>> transverse_magnification(30, 15) -2