{'fraction_non_alphanumeric': 0.02449669153878643, 'fraction_numerical': 0.0030972828382373643, 'mean_word_length': 4.669193934557063, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Developing specialized software for investigating interference in complex optical systems

The paper describes a physical model and primary calculation algorithms we developed and implemented in a software package for simulating interference in complex optical systems. A model of a highly monochromatic laser beam interacting with various optical elements is proposed. We verified and validated our model by creating an interference pattern on a screen. Model verification involved an experiment with a Mach-Zehnder interferometer. Model validation consisted of simulating our own optical experiment.


Introduction
At present, a number of problems arise when performing optical experiments involving passing a light beam through a range of optical elements, such as a polariser, a translucent mirror, a beam splitter, and more. The first problem is that the accuracy required from the equipment entails high costs. The second problem is that such optical systems are difficult to assemble and adjust. This is often the case for universities and small laboratories. The arguments presented encourage developing software designed to replace a real optical experiment with a similar virtual one. There exist professional software solutions, for example, VirtualLab Fusion. However, using those solutions to simulate real optical systems requires spending much time studying the interface and settings in detail. This is the reason why we formulated an important software development requirement: the interface should be simple and only feature the minimum adequate number of settings describing the main physical patterns used in simulations. The following sections of our paper will include: a description of the laser beam model implemented in the program and the model of its interaction with optical elements; verification of the model proposed using an experiment with the Mach-Zehnder interferometer, and model validation using our own optical experiment.
2. Description of the model of highly monochromatic laser radiation Laser radiation is described by an electromagnetic wave propagating along the wave vector k. The vectors of electrical intensity E and magnetic induction B oscillate in a plane perpendicular to the direction of wave propagation. We will further use only the electric component of the electromagnetic wave, that is, the intensity vector E [1]. Since laser radiation is highly monochromatic, it is possible to consider the laser radiation intensity distribution to be a delta function of frequency. Intensity vector variation for a matching electromagnetic wave propagating along the z axis may be written as follows [2]: where E( r, t) is the electromagnetic field vector at r = {x, y, z} at the moment t, a is the unit polarisation vector lying in the xy plane, E 0 is the wave amplitude, ω is the angular frequency, ϕ is the initial phase.
As the beam passes through the optical elements, the nature of the oscillatory process described by e i(kz−ωt) [3] remains steady. Only the a, E 0 , ϕ factors vary. To simplify further calculations, we will introduce a new quantity called "complex polarisation" along the x and y axes -A x and A y respectively: where a x and a y are projections of the unit polarisation vector on the x and y axes. We use two complex numbers to describe laser radiation, that is, the A x and A y complex polarisations. All optical elements execute certain operations on these values. Thus, a linear operator can represent each element of the optical system.

Model of laser radiation interaction with optical elements
An optical element (operator matrix) acts on the incoming laser radiation (column vector), which produces outgoing laser radiation (column vector). Describing elements with more than one input requires considering the superposition of incoming waves and refraining from summing their complex polarisation values. This is necessary so that at the stage of on-screen intensity calculation we may take imperfect ray focusing into account and generate an interference pattern as a result. This imperfect focus may simulate alignment errors in real optical elements, for example. In such elements, there will be more outgoing waves than incoming. The operator matrix form can be derived from the physical principles governing the interaction between real optical elements and an electromagnetic wave. We present several optical elements and their operators below.

Polariser
A polariser is an optical element that has one input {1} and one output {2}. A polariser turns an incoming wave of arbitrary polarisation into an outgoing plane-polarised wave, the direction of which is determined by the polariser angle θ [4]. The effect of this optical element on a set of incoming waves may be written as follows: where the superscript denotes the direction in which the wave comes or goes, and the subscript denotes projections on the x and y axes, respectively. With more than one input wave, sequentially applying the operator to each incoming wave generates the list of outgoing waves.   [5]. The effect of this optical element on a set of incoming waves may be written as follows:

Polarising beam splitter
where the first superscript denotes the direction in which the wave comes or goes; the second superscript denotes the number of the wave in the sequence of waves arriving or leaving in this direction; the subscript denotes projections on the x and y axes, respectively. If more than one wave arrives at both inputs, then the waves incoming in two directions are grouped into pairs that undergo the matrix transformation. For differing numbers of incoming waves, we suppose that the missing waves exist, but their complex polarisations equal zero.

Screen
A screen is an optical element on the surface of which incoming waves are summed and intensity gets calculated. The intensity is a function of the x and y coordinates of the screen points. To observe interference, the waves arriving at the screen must be not parallel, but positioned at a small angle to each other. Describing such errors is a laborious task, since this parameter is determined for a specific spatial configuration of optical elements in a real installation [6]. In the physical model presented, for each wave arriving at the screen, a different discrepancy parameter is set. Each wave arriving at the screen has a planar front, however, this front is at an angle relative to the screen plane. We assume that the screen is parallel to the xy plane and located at the z 0 point. The plane parallel to the wave front and passing through the origin {0, 0, 0} is called the zero plane. We presume that in this plane the incoming wave may be written as follows: where i and j are unit vectors in the x and y directions, respectively; l is the distance along the direction of wave propagation, measured from the zero plane. The zero plane inclination angle is determined by the normal vector emerging from the {0, 0, 0} point and intersecting the screen plane. The coordinates of this intersection point for the wave j are written as follows: {x j , y j , z 0 }. By definition, these coordinates completely determine the the zero plane equation for the j-th wave: x j x + y j y + z 0 z = 0, where coordinates {x, y, z} define a point lying on a plane. The rule locating a set of points {x j , y j , z 0 } for each incoming wave determines the model computing the on-screen intensity. The implementation presented features the following point location laws: along the x (I) or y (II) axes of the screen at a distance d from each other; along a circle of the radius d at the vertices of a regular polygon (III); random uniform distribution within a circle of the radius d (IV ). The main purpose of such a description is to ensure simplicity of calculating the shortest distance from an arbitrary screen point to the zero plane, in other words, the simplicity of calculating the phase of the j-th wave at any point on the screen. The shortest distance l from an arbitrary screen point {x i , y i , z 0 } to the zero plane of the j-th wave may be computed as follows: The intensity at the screen point i : {x i , y i , z 0 } can be calculated using the total electrical intensity magnitude at this point. The intensities of the x and y electromagnetic wave components are computed independently [7]: where ε 0 is the dielectric constant, c is the speed of light in a vacuum, N is the total number of incoming waves, A j x and A j y are the complex polarisations of the j-th wave along the x and y axes, respectively, l j i is the distance from the point i to the zero plane of the incoming wave j.

Verification of the physical model
The main requirement for experiment selection is the presence of analytical or experimental results that can confirm data obtained during the simulation. We verified the physical model presented using an experiment with a Mach-Zehnder interferometer. In the software developed the experimental setup consists of a laser, two translucent mirrors, a phase delay line and a screen. In the case when two waves with the same phase arrive at the screen, a bright band, that is, a peak of intensity, should be observed in the centre of the screen. A dark band, that is, minimum intensity, should be observed in the centre of the screen in the case of waves arriving in antiphase [8,9]. Figures 1 and 2 show the optical system schematic and simulation results in accordance with the (III) model for computing intensity on the screen. A set of optical elements is located in the left part of the program window. In the centre there is an area for assembling optical circuits. On the right we can see the interference pattern obtained on the screen. The x axis is horizontal, the y axis is vertical. Green bars indicate peak intensity, blue -minimum intensity. In the simulation of this experiment, in the absence of a phase delay in one of the interferometer arms, a bright band is observed in the centre of the screen (figure 1). Then, when the phase is delayed by π, a dark band is observed in the centre of the screen (figure 2). This example is one of many that verify the software developed.
It is important to note that all methods produce the same interference patterns for two incoming waves when any of these models are used to compute on-screen intensity. The only difference is the difference in scale in the x and y directions of the screen and the angle of rotation about the axis z. We obtained simulation results for intensity described by models (I) or (II) up to the π/2 angle of the interference pattern rotation. The (III) model makes it possible to obtain an interference pattern consisting of more than a set of straight lines when the number of incoming waves is over two. The model (IV ) allows for the most realistic simulation since it uses a random value of the inclination angle between the wave front and the screen.

Validation of the physical model
We validated the physical model presented using our own optical experiment. The optical system includes: a laser, a translucent mirror, a Michelson interferometer, a polarising beam splitter, a polariser and a screen. A translucent mirror splits diagonally polarised laser radiation in two directions. An optical element (in a real system, a set of optical elements) representing a Michelson interferometer is installed at the top of the circuit. This "Michelson interferometer" element outputs the sum of the incoming wave and the incoming wave with its phase shifted by π according to its specified internal parameters. The beam splitter output is a set of waves described by the following terms: A x from the left incoming wave, A y from the two topmost incoming waves. Thus, there is no interference pattern on the screen, if the output polariser has an angle θ = 0 (polarisation along the axis x). If the polariser angle is θ = π/2, then an interference pattern from the two y -A y components is observed on the screen. The intensity curve is similar in shape to the intensity curve for the Mach-Zehnder interferometer. If the polariser angle is θ = π/4, then all three polarising waves contribute to interference.
The interference pattern type depends on the on-screen intensity calculation model given. We chose the model (IV ) for this simulation. Figures 3 and 4 present simulation results. In the interference pattern the x axis is horizontal, the y axis is vertical. Green bars indicate peak intensity, blue -minimum intensity. The polariser inclination angle is θ = π/2 for the figure 3. In this figure, we may observe interference from the two A y components. There is an interference pattern from all three incoming waves in figure 4 . The plots show that the interference pattern in figure 4 becomes more rarefied. It is easy to detect such an effect in a real optical experiment with the naked eye. The simplified physical model implemented makes it possible to observe the nature of the resulting interference pattern, but there are problems that require a more accurate solution.
To increase the accuracy of the model, it is necessary to take into account a number of the following effects: laser radiation distribution as a normal distribution function of frequency with a given half-width parameter; absorption and scattering of laser radiation in the propagation medium; external effects on the optical setup (mechanical oscillations); intensity distribution of laser radiation in the beam. Accounting for these effects will allow a static intensity pattern to transform into a dynamic one. However, this transition involves computationally complex operations, which will significantly increase computation time.

Conclusion
The paper presents a physical model of a highly monochromatic laser beam interacting with various optical elements. It also describes software algorithms used to implement the physical model proposed. Our simulation results concerning an experiment with a Mach-Zehnder interferometer are in agreement with real-world experimental data. We also demonstrate the results of simulating our own optical experiment in order to showcase the capabilities of our software. The software developed is available at the website [10].