'''
Created on 13-Sep-2021

@author: Rishi Priyansh
'''
import random
import inspect
import traceback

from xv.km.managers import BaseManager
from xv.km.kelements import KProblemTemplate

# _review_manager
# ReviewManager

        
        
class ReviewManager(BaseManager):
    '''
    ReviewManager
    Example:
        ke = ReviewManager()
        ke.getRandomProblem()
        ke.getRandomProblem(problem_type = 0)
        ...
        
        ke.printProblem()
        ke.printAnswer()
        ke.printSolution()
        
        ke.printProblemTypes()
        
    '''    
    _OPR_TYPE_COUNT = 10
    
    def __new__(cls, *args, **kwargs):
        instance = super(ReviewManager, cls).__new__(cls, *args, **kwargs)
        for base_class in ReviewManager.__bases__:
            base_class.__init__(instance, *args, **kwargs)
        return instance
    
    def __init__(self, *args, **kwargs):
        pass
    
    def _init_problem_types(self, *args, **kwargs):
        self._append_problem_types([
            '_problem_SI_Units',
            '_problem_kinematics',
            '_problem_dynamics',
            '_problem_conservation_laws',
            '_problem_gravitation_law',
            '_problem_dynamics_solid_body',
            '_problem_elastic_deformation',
            '_problem_hydrodynamics',
            '_problem_relativistic_mechanics',
            '_problem_gas_law',
            '_problem_first_law_of_thermodynamics',
            '_problem_kinetic_theory_of_gases',
            '_problem_second_law_of_thermodynamics',
            '_problem_capillary_effects',
            '_problem_phase_transformations',
            '_problem_transport_phenomena',
            '_problem_electrodynamics',
            '_problem_conductors_and_dielectrics',
            '_problem_electric_capacitance',
            '_problem_electric_current',
            '_problem_magnetic_field',
            '_problem_electromagnetic_induction',
            '_problem_motion_of_charged_particles',
            '_problem_mechanical_oscillations',
            '_problem_electric_oscillations',
            '_problem_elastic_waves_acoustics',
            '_problem_electromagnetic_waves',
            '_problem_geometrical_optics',
            '_problem_interference_of_light',
            '_problem_diffraction_of_light',
            '_problem_polarization_of_light',
            '_problem_dispersion_and_absorption_of_light',
            '_problem_optics_of_moving_sources',
            '_problem_thermal_radiation',
            '_problem_scattering_of_particles',
            '_problem_wave_properties_of_particles',
            '_problem_atoms_spectra',
            '_problem_molecules_and_crystals',
            '_problem_radioactivity',
            '_problem_nuclear_reactions',
            '_problem_elementary_particles',
            
            
            ])
        pass
        
    def _problem_SI_Units(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        SI_Units
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

        
        $
        \\begin{{array}}{{|l|c|l|}}
        \\hline \\text {{ Unit }} & \\text {{ Symbol }} & \\text {{ Base unit }} \\\\
        \\hline \\text {{ metre }} & \\mathrm{{m}} & \\text {{ length }} \\\\
        \\hline \\text {{ kilogram }} & \\mathrm{{kg}} & \\text {{ mass }} \\\\
        \\hline \\text {{ second }} & \\mathrm{{s}} & \\text {{ time }} \\\\
        \\hline \\text {{ ampere }} & \\mathrm{{A}} & \\text {{ electric current }} \\\\
        \\hline \\text {{ kelvin }} & \\mathrm{{K}} & \\text {{ temperature }} \\\\
        \\hline \\text {{ mole }}^{{\\star}} & \\mathrm{{mol}} & \\text {{ amount of a substance }} \\\\
        \\hline \\text {{ candela }}^{{\\star \\star}} & \\mathrm{{cd}} & \\text {{ light intensity }} \\\\
        \\hline
        \\end{{array}}
        $
        
        $
        \\begin{{array}}{{|l|c|l|l|}}
        \\hline \\text {{ Quantity }} & \\text {{ Symbol }} & \\text {{ Unit }} & \\text {{ SI base units }} \\\\
        \\hline \\text {{ force }} & F & \\text {{ newton }}(\\mathrm{{N}}) & \\mathrm{{kgms}}^{{-2}} \\\\
        \\hline \\text {{ pressure }} & p & \\text {{ pascal }}(\\mathrm{{Pa}}) & \\mathrm{{kgm}}^{{-1}} \\mathrm{{~s}}^{{-2}} \\\\
        \\hline \\text {{ energy }} & E & \\text {{ joule }}(\\mathrm{{J}}) & \\mathrm{{kgm}}^2 \\mathrm{{~s}}^{{-3}} \\\\
        \\hline \\text {{ power }} & P & \\text {{ watt }}(\\mathrm{{W}}) & \\mathrm{{kgm}}^2 \\mathrm{{~s}}^{{-1}} \\\\
        \\hline \\text {{ frequency }} & f & \\text {{ hertz }}(\\mathrm{{Hz}}) & \\mathrm{{s}}^{{-1}} \\\\
        \\hline \\text {{ charge }} & Q & \\text {{ coulomb }}(\\mathrm{{C}}) & \\mathrm{{As}} \\\\
        \\hline \\text {{ potential difference (p.d.) }} & V & \\text {{ volt }}(\\mathrm{{V}}) & \\mathrm{{kgm}}^2 \\mathrm{{~s}}^{{-3}} \\mathrm{{~A}}^{{-1}} \\\\
        \\hline \\text {{ electrical resistance }} & R & \\text {{ ohm }}(\\Omega) & \\mathrm{{kgm}}^2 \\mathrm{{~s}}^{{-3}} \\mathrm{{~A}}^{{-2}} \\\\
        \\hline \\text {{ capacitance }} & C & \\text {{ farad }}(\\mathrm{{F}}) & \\mathrm{{A}}^2 \\mathrm{{~kg}}^{{-1}} \\mathrm{{~m}}^{{-2}} \\mathrm{{~s}}^4 \\\\
        \\hline \\text {{ magnetic flux density }}{{ }}^{{\\star}} & B & \\text {{ tesla }}(\\mathrm{{T}}) & \\mathrm{{kg}} \\mathrm{{s}}^{{-2}} \\mathrm{{~A}}^{{-1}} \\\\
        \\hline \\text {{ magnetic flux }}{{ }}^{{\\star}} & \\Phi & \\text {{ weber }}(\\mathrm{{Wb}}) & \\mathrm{{kgm}}^2 \\mathrm{{~s}}^{{-2}} \\mathrm{{~A}}^{{-1}} \\\\
        \\hline
        \\end{{array}}
        $
        
        $
        \\begin{{array}}{{|l|c|l|l|}}
        \\hline \\text {{ Prefix }} & \\text {{ Symbol }} & \\text {{ Multiple }} & \\text {{ Example }} \\\\
        \\hline \\text {{ pico }} & \\mathrm{{p}} & 10^{{-12}} & \\mathrm{{pF}} \\text {{ (picofarad) }} \\\\
        \\hline \\text {{ nano }} & \\mathrm{{n}} & 10^{{-9}} & \\mathrm{{nC}} \\text {{ (nanocoulomb) }} \\\\
        \\hline \\text {{ micro }} & \\mu & 10^{{-6}} & \\mu \\mathrm{{A}} \\text {{ (microamp) }} \\\\
        \\hline \\text {{ milli }} & \\mathrm{{m}} & 10^{{-3}} & \\mathrm{{mV}} \\text {{ (millivolt) }} \\\\
        \\hline \\text {{ centi }} & \\mathrm{{c}} & 10^{{-2}} & \\mathrm{{~cm}} \\text {{ (centimetre) }} \\\\
        \\hline \\text {{ deci }} & \\mathrm{{d}} & 10^{{-1}} & \\mathrm{{~dB}} \\text {{ (decibel) }} \\\\
        \\hline \\text {{ kilo }} & \\mathrm{{k}} & 10^3 & \\mathrm{{~kg}} \\text {{ (kilogram) }} \\\\
        \\hline \\text {{ mega }} & \\mathrm{{M}} & 10^6 & \\mathrm{{M}} \\Omega \\text {{ (megohm) }} \\\\
        \\hline \\text {{ giga }} & \\mathrm{{G}} & 10^9 & \\mathrm{{GJ}} \\text {{ (gigajoule) }} \\\\
        \\hline \\text {{ tera }} & \\mathrm{{T}} & 10^{{12}} & \\text {{ TW (terawatt) }} \\\\
        \\hline
        \\end{{array}}
        $
        
        
        
        

        
        
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    
    def _problem_physical_constants(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        physical constants
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

        $
        \\begin{{array}}{{l|l}}
        \\hline \\text {{ Diameter of a nucleus }} & 10^{{-14}} \\mathrm{{~m}} \\\\
        \\hline \\text {{ Diameter of an atom }} & 10^{{-10}} \\mathrm{{~m}} \\\\
        \\hline \\text {{ Wavelength of visible light }} & 400-700 \\mathrm{{~nm}} \\\\
        \\hline \\text {{ Radius of the Earth }} & 6.4 \\times 10^6 \\mathrm{{~m}} \\\\
        \\hline \\text {{ Mass of an electron }} & 9.1 \\times 10^{{-31}} \\mathrm{{~kg}} \\\\
        \\hline \\text {{ Mass of a proton }} & 1.7 \\times 10^{{-27}} \\mathrm{{~kg}} \\\\
        \\hline \\text {{ Mass of a postage stamp }} & 5 \\times 10^{{-5}} \\mathrm{{~kg}} \\\\
        \\hline \\text {{ Mass of an apple }} & 0.1 \\mathrm{{~kg}} \\\\
        \\hline \\text {{ Mass of an adult }} & 70 \\mathrm{{~kg}} \\\\
        \\hline \\text {{ Density of air }} & 1.3 \\mathrm{{kgm}}^{{-3}} \\\\
        \\hline \\text {{ Density of water }} & 10^3 \\mathrm{{kgm}}^{{-3}} \\\\
        \\hline \\text {{ Gravitational field strength, }} g & 9.81 \\mathrm{{Nkg}}^{{-1}}\\left(9.81 \\mathrm{{~m}} \\mathrm{{~s}}^{{-2}}\\right)
        \\end{{array}}
        $
        $
        \\begin{{array}}{{l|l}}
        \\text {{ Atmospheric pressure }} & 1.0 \\times 10^5 \\mathrm{{~Pa}} \\\\
        \\hline \\text {{ One day }} & 8.64 \\times 10^4 \\mathrm{{~s}} \\\\
        \\hline \\text {{ One year }} & 3.1 \\times 10^7 \\mathrm{{~s}} \\\\
        \\hline \\text {{ Speed of a car }} & 20-30 \\mathrm{{~m}} \\mathrm{{~s}}^{{-1}} \\\\
        \\hline \\text {{ Speed of sound in air }} & 330 \\mathrm{{~m}} \\mathrm{{~s}}^{{-1}} \\\\
        \\hline \\text {{ Speed of light in a vacuum }} & 3 \\times 10^8 \\mathrm{{~ms}}^{{-1}} \\\\
        \\hline \\text {{ Energy of an alpha particle }} & 5 \\mathrm{{MeV}} \\\\
        \\hline \\text {{ Freezing point of water }} & 0^{{\\circ}} \\mathrm{{C}} \\\\
        \\hline \\text {{ Boiling point of water }} & 100^{{\\circ}} \\mathrm{{C}} \\\\
        \\hline \\text {{ Specific heat capacity of water }} & 4200 \\mathrm{{Jkg}}^{{-1}}{{ }}^{{\\circ}} \\mathrm{{C}}^{{-1}} \\\\
        \\hline \\text {{ Charge on an electron }} e & 1.6 \\times 10^{{-19}} \\mathrm{{C}} \\\\
        \\hline \\text {{ Charge transferred by a lightning flash }} & 1 \\mathrm{{C}}
        \\end{{array}}
        $
        
        
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_kinematics(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        kinematics review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""



        - Average vectors of velocity and acceleration of a point:
        $
        \\langle\\mathbf{{v}}\\rangle=\\frac{{\\Delta \\mathbf{{r}}}}{{\\Delta t}}, \\quad\\langle\\mathbf{{w}}\\rangle=\\frac{{\\Delta \\mathbf{{v}}}}{{\\Delta t}},
        $
        where $\\Delta \\mathbf{{r}}$ is the displacement vector (an increment of a radius vector).
        
        - Velocity and acceleration of a point:
        $
        \\mathbf{{v}}=\\frac{{d \\mathbf{{r}}}}{{d t}}, \\quad \\mathbf{{w}}=\\frac{{d \\mathbf{{v}}}}{{d t}} .
        $
        
        - Acceleration of a point expressed in projections on the tangent and the normal to a trajectory:
        $
        w_\\tau=\\frac{{d v_\\tau}}{{d t}}, \\quad w_n=\\frac{{v^2}}{{R}},
        $
        where $R$ is the radius of curvature of the trajectory at the given point.
        
        - Distance covered by a point:
        $
        s=\\int v d t,
        $
        where $v$ is the modulus of the velocity vector of a point.
        
        - Distance covered by a point:
        $
        s=\\int v d t
        $
        where $v$ is the modulus of the velocity vector of a point.
        
        - Angular velocity and angular acceleration of a solid body:
        $
        \\omega=\\frac{{d \\varphi}}{{d t}}, \\quad \\boldsymbol{{\\beta}}=\\frac{{d \\omega}}{{d t}} .
        $
        body:
        $
        \\mathbf{{v}}=[\\omega \\mathrm{{r}}], \\quad w_n=\\omega^2 R, \\quad\\left|w_\\tau\\right|=\\beta R,
        $
        where $\\mathbf{{r}}$ is the radius vector of the considered point relative to an arbitrary point on the rotation axis, and $R$ is the distance from the rotation axis.
        

        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_dynamics(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        dynamics review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""


        The fundamental equation of dynamics of a mass point (Newton's sec. ond law):
        $
        m \\frac{{d \\mathbf{{v}}}}{{d t}}=\\mathbf{{F}} .
        $
        
        - The same equation expressed in projections on the tangent and the normal of the point's trajectory:
        $
        m \\frac{{d v_\\tau}}{{d t}}=F_\\tau, \\quad m \\frac{{v^2}}{{R}}=F_n .
        $
        
        - The equation of dynamics of a point in the non-inertial reference frame $K^{{\\prime}}$ which rotates with a constant angular velocity $\\omega$ about an axis translating with an acceleration $w_0$ :
        $
        m \\mathbf{{w}}^{{\\prime}}=\\mathbf{{F}}-m \\mathbf{{w}}_0+m \\omega^2 \\mathbf{{R}}+2 m\\left[\\mathbf{{v}}^{{\\prime}} \\omega\\right],
        $
        where $\\mathbf{{R}}$ is the radius vector of the point relative to the axis of rotation of the $K^{{\\prime}}$ frame.
        
        
        
        
        


        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_conservation_laws(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        conservation laws review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""


        - Work and power of the force F:
        $
        A=\\int \\mathbf{{F}} d \\mathbf{{r}}=\\int F_s d s, \\quad P=\\mathbf{{F}} \\mathbf{{v}}
        $
        
        - Increment of the kinetic energy of a particle:
        $
        T_2-T_1=A \\text {{, }}
        $
        where $A$ is the work performed by the resultant of all the forces acting on the particle.
        
        - Work performed by the forces of a field is equal to the decrease of the potential energy of a particle in the given field:
        $
        A=U_1-U_2 \\text {{. }}
        $
        
        - Relationship between the force of a feld and the potential energy of a particle in the field:
        $
        \\mathbf{{F}}=-\\nabla U,
        $
        i.e. the force is equal to the antigradient of the potential energy.
        
        
        $\\bullet$ Increment of the total mechanical energy of a particle in a given poten- tial field:
        $
        E_2-E_1=A_{{e x t r}}
        $
        where $A_{{\\text {{extr }}}}$ is the algebraic sum of works performed by all extraneous forces, that is, by the forces not belonging to those of the given field.
        
        
        - Increment of the total mechanical energy of a system:
        $
        E_2-E_1=A_{{e x t}}+A_{{i n t}}^{{\\text {{noncons }}}},
        $
        where $E=T+U$, and $U$ is the inherent potential energy of the system.
        
        - Law of momentum variation of a system:
        $
        d \\mathrm{{p}} / d t=\\mathbf{{F}},
        $
        where $\\mathbf{{F}}$ is the resultant of all external forces.
        
        - Equation of motion of the system's centre of inertia:
        $
        m \\frac{{d \\mathbf{{v}}_C}}{{d t}}=\\mathbf{{F}},
        $
        where $\\mathbf{{F}}$ is the resultant of all external forces.
        
        - Kinetic energy of a system
        $
        T=\\widetilde{{T}}+\\frac{{m v_C^2}}{{2}},
        $
        where $\\widetilde{{T}}$ is its kinetic energy in the system of centre of inertia.
        
        - Equation of dynamics of a body with variable mass:
        $
        m \\frac{{d \\mathbf{{v}}}}{{d t}}=\\mathbf{{F}}+\\frac{{d m}}{{d t}} \\mathbf{{u}}
        $
        where $\\mathbf{{u}}$ is the velocity of the separated (gained) substance relative to the body considered.
        
        
        - Law of angular momentum variation of a system:
        $
        \\frac{{d \\mathbf{{M}}}}{{d t}}=\\mathbf{{N}},
        $
        where $M$ is the angular momentum of the system, and $\\mathbf{{N}}$ is the total moment of all external forces.
        
        - Angular momentum of a system:
        $
        \\mathbf{{M}}=\\widetilde{{\\mathbf{{M}}}}+\\left[\\mathbf{{r}}_C \\mathbf{{p}}\\right],
        $
        where $\\widetilde{{\\mathbf{{M}}}}$ is its angular momentum in the system of the centre of inertia, $\\mathbf{{r}}_C$ is the radius vector of the centre of inertia, and $\\mathbf{{p}}$ is the momentum of the system.
        
        


        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_gravitation_law(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        gravitation law review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

        
        
        - Universal gravitation law
        $
        F=\\gamma \\frac{{m_1 m_2}}{{r^2}}
        $
        
        - The squares of the periods of revolution of any two planets around the Sun are proportional to the cubes of the major semiaxes of their orbits (Kepler):
        $
        T^2 \\propto a^3 \\text {{. }}
        $
        
        - Strength $G$ and potential $\\varphi$ of the gravitational field of a mass point:
        $
        \\mathbf{{G}}=-\\gamma \\frac{{m}}{{r^3}} \\mathbf{{r}}, \\quad \\varphi=-\\gamma \\frac{{m}}{{r}} .
        $
        
        - Orbital and escape velocities:
        $
        v_1=\\sqrt{{g R}}, \\quad v_2=\\sqrt{{2}} v_1 .
        $
        
        
        

        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_dynamics_solid_body(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        dynamics solid body review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

    
        - Equation of dynamics of a solid body rotating about a stationary axis $z$ :
        $
        I \\beta_z=N_z,
        $
        where $N_z$ is the algebraic sum of the moments of external forces relative to the $z$ axis.
        
        - According to Steiner's theorem:
        $
        I=I_C+m a^2 .
        $
        
        - Kinetic energy of a solid body rotating about a stationary axis:
        $
        T=\\frac{{1}}{{2}} I \\omega^2 \\text {{. }}
        $
        
        - Work performed by external forces during the rotation of a solid body about a stationary axis:
        $
        A=\\int N_z d \\varphi
        $
        
        
        - Kinetic energy of a solid body in plane motion:
        $
        T=\\frac{{I_C \\omega^2}}{{2}}+\\frac{{m v_C^2}}{{2}} \\text {{. }}
        $
        
        - Relationship between the angular velocity $\\omega^{{\\prime}}$ of gyroscope precession, its angular momentum $M$ equal to $I \\omega$, and the moment $N$ of the external forces:
        $
        \\left[\\omega^{{\\prime}} \\mathbf{{M}}\\right]=\\mathbf{{N}} \\text {{. }}
        $
         


        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_elastic_deformation(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        elastic_deformation review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

    
        
        - Relation between tensile (compressive) strain $\\varepsilon$ and stress $\\sigma$ :
        $
        \\varepsilon=\\sigma / E,
        $
        where $E$ is Young's modulus.
        
        - Relation between lateral compressive (tensile) strain $\\varepsilon^{{\\prime}}$ and longitudinal tensile (compressive) strain $\\varepsilon$ :
        $
        \\varepsilon^{{\\prime}}=-\\mu \\varepsilon
        $
        where $\\mu$ is Poisson's ratio.
        
        - Relation between shear strain $\\gamma$ and tangential stress $\\tau$ :
        $
        \\gamma=\\tau / G,
        $
        where $G$ is shear modulus.
        
        - Compressibility:
        $
        \\beta=-\\frac{{1}}{{V}} \\frac{{d V}}{{d p}} .
        $
        
        - Volume density of elastic strain energy:
        $
        u=E \\varepsilon^2 / 2, \\quad u=G \\gamma^2 / 2 .
        $
        
        


        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_hydrodynamics(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        hydrodynamics review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""


    
        - The fundamental equation of hydrodynamics of ideal fluid (Eulerian equation):
        $
        \\rho \\frac{{d \\mathbf{{v}}}}{{d t}}=\\mathbf{{f}}-\\nabla p
        $
        where $\\rho$ is the fluid density, $f$ is the volume density of mass forces ( $f=\\rho g$ in the case of gravity), $\\nabla p$ is the pressure gradient.
        
        - Bernoulli's equation. In the steady flow of an ideal fluid
        $
        \\frac{{\\rho v^2}}{{2}}+\\rho g h+p=\\text {{ const }}
        $
        along any streamline.
        
        - Reynolds number defining the flow pattern of a viscous fluid:
        $
        \\mathrm{{Re}}=\\rho v l / \\eta \\text {{, }}
        $
        where $l$ is a characteristic length, $\\eta$ is the fluid viscosity.
        
        - Poiseuille's law. The volume of liquid flowing through a circular tube (in $\\mathrm{{m}}^{{3 / \\mathrm{{s}}}}$ ):
        $
        Q=\\frac{{\\pi R^4}}{{8 \\eta}} \\frac{{p_1-p_2}}{{l}}
        $
        
        Poiseuille's law. The volume of liquid flowing through a circular tube (in $\\mathrm{{m}}^3 / \\mathrm{{s}}$ ):
        $
        Q=\\frac{{\\pi R^4}}{{8 \\eta}} \\frac{{p_1-p_2}}{{l}},
        $
        where $R$ and $l$ are the tube's radius and length, $p_1-p_2$ is the pressure difference between the ends of the tube.
        - Stokes' law. The friction force on the sphere of radius $r$ moving through a viscous fluid:
        $
        F=6 \\pi \\eta r v .
        $
        
        


        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_relativistic_mechanics(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        relativistic_mechanics review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

        - Lorentz contraction of length and slowing of a moving clock:
        $
        l=l_0 \\sqrt{{1-(v / c)^2}}, \\quad \\Delta t=\\frac{{\\Delta t_0}}{{\\sqrt{{1-(v / c)^2}}}},
        $
        where $l_0$ is the proper length and $\\Delta t_n$ is the proper time of the moving clock.
        
        - Lorentz transformation*:
        $
        x^{{\\prime}}=\\frac{{x-V t}}{{\\sqrt{{1-(V / c)^2}}}}, \\quad y^{{\\prime}}=y, \\quad t^{{\\prime}}=\\frac{{t-x V / c^2}}{{1-(V / c)^2}} \\text {{. }}
        $
        
        - Interval $s_{{12}}$ is an invariant:
        $
        s_{{12}}^2=c^2 t_{{12}}^2-l_{{12}}^2=\\mathrm{{inv}},
        $
        where $t_{{12}}$ is the time interval between events 1 and $2, l_{{12}}$ is the distance between the points at which these events occurred.
        
        - Transformation of velocity*:
        $
        v_x^{{\\prime}}=\\frac{{v_x-V}}{{1-v_x V / c^2}}, \\quad v_y^{{\\prime}}=\\frac{{v_y \\sqrt{{1-(V / c)^2}}}}{{1-v_x V / c^2}} .
        $
        
        - Relativistic mass and relativistic momentum:
        $
        m=\\frac{{m_0}}{{\\sqrt{{1-(v / c)^2}}}}, \\quad \\mathbf{{p}}=m \\mathbf{{v}}=\\frac{{m_0 \\mathbf{{v}}}}{{\\sqrt{{1-(v / c)^2}}}},
        $
        where $m_0$ is the rest mass, or, simply, the mass.
        
        - Relativistic equation of dynamics for a particle:
        $
        \\frac{{d \\mathbf{{p}}}}{{d t}}=\\mathbf{{F}},
        $
        where $\\mathbf{{p}}$ is the relativistic momentum of the particle.
        
        - Total and kinetic energies of a relativistic particle:
        $
        E=m c^2=m_0 c^2+T, \\quad T=\\left(m-m_0\\right) c^2 .
        $
        
        ticle Relationship between the energy and momentum of a relativistic par-
        $
        E^2-p^2 c^2=m_0^2 c^4, \\quad p c=\\sqrt{{T\\left(T+2 m_0 c^2\\right)}} .
        $
        
        - When considering the collisions of particles it helps to use the following invariant quantity:
        $
        E^2-p^2 c^2=m_3^2 c^4
        $
        where $E$ and $p$ are the total energy and momentum of the system prior to the collision, and $m_0$ is the rest mass of the particle (or the system) formed.
        
    
        


        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_gas_law(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        gas law review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""


    
        - Ideal gas law:
        $
        p V=\\frac{{m}}{{M}} R T
        $
        where $M$ is the molar mass.
        
        - Barometric formula:
        $
        p=p_0 \\mathrm{{e}}^{{-M g h / R T}},
        $
        where $p_0$ is the pressure at the height $h=0$.
        
        - Van der Waals equation of gas state (for a mole):
        $
        \\left(p+\\frac{{a}}{{V_M^2}}\\right)\\left(V_M-b\\right)=R T,
        $
        where $V_M$ is the molar volume under given $p$ and $T$.
        
        


        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        
    def _problem_first_law_of_thermodynamics(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        first_law_of_thermodynamics review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

    
        - The first law of thermodynamics:
        $
        Q=\\Delta U+A,
        $
        where $\\Delta U$ is the increment of the internal energy of the system.
        
        - Work performed by gas:
        $
        A=\\int p d V
        $
        
        - Internal energy of an ideal gas:
        $
        U=\\frac{{m}}{{M}} C_V T=\\frac{{m}}{{M}} \\frac{{R T}}{{\\gamma-1}}=\\frac{{p V}}{{\\gamma-1}} .
        $
        
        - Molar heat cápacity in a polytropic process ( $p V^n=$ const):
        $
        C=\\frac{{R}}{{\\gamma-1}}-\\frac{{R}}{{n-1}}=\\frac{{(n-\\gamma) R}}{{(n-1)(\\gamma-1)}} .
        $
        
        - Internal energy of one mole of a Van der Waals gas:
        $
        U=C_V T-\\frac{{a}}{{V_M}} .
        $
        

        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_kinetic_theory_of_gases(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        kinetic_theory_of_gases review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

    
    
        - Number of collisions exercised by gas molecules on a unit area of the wall surface per unit time:
        $
        v=\\frac{{1}}{{4}} n\\langle v\\rangle,
        $
        where $n$ is the concentration of molecules, and $\\langle v\\rangle$ is their mean velocity.
        
        - Equation of an ideal gas state:
        $
        p=n k T \\text {{. }}
        $
        
        - Mean energy of molecules:
        $
        \\langle\\varepsilon\\rangle=\\frac{{i}}{{2}} k T,
        $
        where $i$ is the sum of translational, rotational, and the double number of vibrational degrees of freedom.
        
        - Maxwellian distribution:
        $
        \\begin{{aligned}}
        d N\\left(v_x\\right) & =N\\left(\\frac{{m}}{{2 \\pi k T}}\\right)^{{1 / 2}} e^{{-m v_x^2 / 2 k T}} d v_x \\\\
        d N(v) & =N\\left(\\frac{{m}}{{2 \\pi k T}}\\right)^{{3 / 2}} e^{{-m v^2 / 2 k T}} 4 \\pi v^2 d v
        \\end{{aligned}}
        $
        
        - Maxwellian distribution in a reduced form:
        $
        d N(u)=N \\frac{{4}}{{\\sqrt{{\\pi}}}} e^{{-u^2}} u^2 d u,
        $
        where $u=v / v_p, v_p$ is the most probable velocity.
        
        - The most probable, the mean, and the root mean square velocities of molecules:
        $
        v_p=\\sqrt{{2 \\frac{{k T}}{{m}}}} \\quad\\langle v\\rangle=\\sqrt{{\\frac{{8}}{{\\pi}} \\frac{{k T}}{{m}}}}, \\quad v_{{s q}}=\\sqrt{{3 \\frac{{k T}}{{m}}}} .
        $
        
        - Boltzmann's formula:
        $
        n=n_0 \\mathrm{{e}}^{{-\\left(U-U_0\\right) / k T}} \\text {{, }}
        $
        where $U$ is the potential energy of a molecule.
        

        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_second_law_of_thermodynamics(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        second_law_of_thermodynamics review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

    
    
        - Heat engine efficiency:
        $
        \\eta=\\frac{{A}}{{Q_1}}=1-\\frac{{Q_2^{{\\prime}}}}{{Q_1}},
        $
        where $Q_1$ is the heat obtained by the working substance, $Q_2^{{\\prime}}$ is the heat released by the working substance.
        
        - Efficiency of a Carnot cycle:
        $
        \\eta=\\frac{{T_1-T_2}}{{T_1}},
        $
        where $T_1$ and $T_2$ are the temperatures of the hot and cold bodies respectively.
        
        - Clausius inequality:
        $
        \\oint \\frac{{\\delta Q}}{{T}} \\leqslant 0,
        $
        where $\\delta Q$ is the elementary amount of heat transferred to the system ( $\\delta Q$ is an algebraic quantity).
        
        - Entropy increment of a system:
        $
        \\Delta S \\geqslant \\int \\frac{{\\delta Q}}{{T}}
        $
        
        - Fundamental relation of thermodynamics:
        $
        T d S \\geqslant d U+p d V .
        $
        
        - Relation between the entropy and the statistical weight $\\Omega$ (the thermodynamic probability):
        $
        S=k \\ln \\Omega .
        $
        
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_capillary_effects(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        capillary_effects review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

    
        Additional (capillary) pressure in a liquid under an arbitrary surface (Laplace's formula):
        $
        \\Delta p=\\alpha\\left(\\frac{{1}}{{R_1}}+\\frac{{1}}{{R_2}}\\right)
        $
        where $\\alpha$ is the surface tension of a given liquid.
        
        - Free energy increment of the surface layer of a liquid:
        $
        d F=\\alpha d S,
        $
        where $d S$ is the area increment of the surface layer.
        
        - Amount of heat required to form a unit area of the liquid surface layer during the isothermal increase of its surface:
        $
        q=-T \\frac{{d \\alpha}}{{d T}}
        $         
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_phase_transformations(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        phase_transformations review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

        - Relations between Van der Waals constants and the parameters of the critical state of a substance:
        $
        V_{{M c r}}=3 b, p_{{c r}}=\\frac{{a}}{{27 b^2}}, \\quad T_{{c r}}=\\frac{{8 a}}{{27 R b}} .
        $
        
        - Relation between the critical parameters for a mole of substance:
        $
        p_{{c r}} V_{{M c r}}=(3 / 8) R T_{{c r}} .
        $
        
        - Clausius-Clapeyron equation:
        $
        \\frac{{d p}}{{d T}}=\\frac{{q_{{12}}}}{{T\\left(V_2^{{\\prime}}-V_1^{{\\prime}}\\right)}}
        $
        where $q_{{12}}$ is the specific heat absorbed in the transformation $1 \\rightarrow 2, V_1^{{\\prime}}$ and $V_2^{{\\prime}}$ are the specific volumes of phases 1 and 2 .
        
        
            
      
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_transport_phenomena(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        transport_phenomena review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

        
        
        - Relative number of gas molecules traversing the distance $s$ without collisions:
        $
        N / N_0=\\mathrm{{e}}^{{-s / \\lambda}}
        $
        where $\\lambda$ is the mean free path.
        
        - Mean free path of a gas molecule:
        $
        \\lambda=\\frac{{1}}{{\\sqrt{{2}} \\pi d^2 n}},
        $
        where $d$ is the effective diameter of a molecule, and $n$ is the number of molecules per unit volume.
        
        - Coefficients of diffusion $D$, viscosity $\\eta$, and heat conductivity $x$ of gases:
        $
        D=\\frac{{1}}{{3}}\\langle v\\rangle \\lambda, \\quad \\eta=\\frac{{1}}{{3}}\\langle v\\rangle \\lambda \\rho, \\quad x=\\frac{{1}}{{3}}\\langle v\\rangle \\lambda \\rho c_V,
        $
        where $\\rho$ is the gas density, and $c_V$ is its specific heat capacity at constant volume.
        
        - Friction force acting on a unit area of plates during their motion parallel to each other in a highly rarefied gas:
        $
        F=\\frac{{1}}{{6}}\\langle v\\rangle \\rho\\left|u_1-u_2\\right|,
        $
        where $u_1$ and $u_2$ are the velocities of the plates.
        
        - Density of a thermal flux transferred between two walls by highly rarefied gas:
        $
        q=\\frac{{1}}{{6}}\\langle v\\rangle \\rho c_V\\left|T_1-T_2\\right|
        $
        where $T_1$ and $T_2$ are the temperatures of the walls.
        
        
       
            
      
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_electrodynamics(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        electrodynamics review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""


        
        - Strength and potential of the field of a point charge $q$ :
        $
        \\mathbf{{E}}=\\frac{{1}}{{4 \\pi \\varepsilon_0}} \\frac{{q}}{{r^3}} \\mathbf{{r}}, \\quad \\varphi=\\frac{{1}}{{4 \\pi \\varepsilon_0}} \\frac{{q}}{{r}} .
        $
        
        - Relation between field strength and potential:
        $
        \\mathbf{{E}}=-\\boldsymbol{{\\nabla}} \\varphi,
        $
        i.e. field strength is equal to the antigradient of the potential.
        
        - Gauss's theorem and circulation of the vector E:
        $
        \\oint \\mathbf{{E}} d \\mathbf{{S}}=q / \\varepsilon_0, \\quad \\oint \\mathbf{{E}} d \\mathbf{{r}}=0 .
        $
        
        - Potential and strength of the field of a point dipole with electric moment p:
        $
        \\varphi=\\frac{{1}}{{4 \\pi \\varepsilon_0}} \\frac{{\\mathbf{{p r}}}}{{r^3}}, \\quad E=\\frac{{1}}{{4 \\pi \\varepsilon_0}} \\frac{{p}}{{r^3}} \\sqrt{{1+3 \\cos ^2 \\theta}},
        $
        where $\\theta$ is the angle between the vectors $\\mathbf{{r}}$ and $\\mathbf{{p}}$.
        
        - Energy $W$ of the dipole $p$ in an external electric field, and the moment $\\mathrm{{N}}$ of forces acting on the dipole:
        $
        W=-\\mathbf{{p E}}, \\quad \\mathbf{{N}}=[\\mathbf{{p}} \\mathbf{{E}}] \\text {{. }}
        $
        
        - Force $F$ acting on a dipole, and its projection $F_x$ :
        $
        \\mathbf{{F}}=p \\frac{{\\partial \\mathbf{{E}}}}{{\\partial l}}, \\quad F_x=\\mathbf{{p}} \\cdot \\nabla E_x,
        $
        where $\\partial \\mathbf{{E}} / \\partial l$ is the derivative of the vector $\\mathbf{{E}}$ with respect to the dipole direction, $\\nabla E_x$ is the gradient of the function $E_{{\\boldsymbol{{x}}}}$.
        
        
        
        


        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_conductors_and_dielectrics(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        conductors_and_dielectrics review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

        
        - Electric field strength near the surface of a conductor in vacuum:
        $
        E_n=\\sigma / \\varepsilon_0 .
        $
        
        - Flux of polarization P across a closed surface:
        $
        \\oint \\mathbf{{P}} d \\mathbf{{S}}=-q^{{\\prime}},
        $
        where $q^{{\\prime}}$ is the algebraic sum of bound charges enclosed by this surface.
        
        - Vector D and Gauss's theorem for it:
        $
        \\mathbf{{D}}=\\varepsilon_0 \\mathbf{{E}}+\\mathbf{{P}}, \\quad \\oint \\mathbf{{D}} d \\mathbf{{S}}=q,
        $
        where $q$ is the algebraic sum of extraneous charges inside a closed surface.
        
        - Relations at the boundary between two dielectrics:
        $
        P_{{2 n}}-P_{{1 n}}=-\\sigma^{{\\prime}}, \\quad D_{{2 n}}-D_{{1 n}}=\\sigma, \\quad E_{{2 \\tau}}=E_{{1 \\tau}},
        $
        where $\\sigma^{{\\prime}}$ and $\\sigma$ are the surface densities of bound and extraneous charges, and the unit vector $\\mathbf{{n}}$ of the normal is directed from medium 1 to medium 2.
        
        - In isotropic dielectrics:
        $
        \\mathbf{{P}}=x \\varepsilon_0 \\mathbf{{E}}, \\quad \\mathbf{{D}}=\\varepsilon \\varepsilon_0 \\mathbf{{E}}, \\quad \\varepsilon=1+x .
        $
        
        - In the case of an isotropic uniform dielectric filling up all the space between the equipotential surfaces:
        $
        \\mathbf{{E}}=\\mathbf{{E}}_0 / \\varepsilon
        $
          


        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate

    def _problem_electric_capacitance(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        electric_capacitance review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

        
        - Capacitance of a parallel-plate capacitor:
        $
        C=\\varepsilon \\varepsilon_0 S / d .
        $
        
        - Interaction energy of a system of point charges:
        $
        W=\\frac{{1}}{{2}} \\sum q_i \\varphi_{{i \\bullet}}
        $
        
        - Total electric energy of a system with continuous charge distribution:
        $
        W=\\frac{{1}}{{2}} \\int \\varphi \\rho d V .
        $
        
        - Total electric energy of two charged bodies 1 and 2:
        $
        W=W_1+W_2+W_{{12}} \\text {{, }}
        $
        where $W_1$ and $W_2$ are the self-energies of the bodies, and $W_{{12}}$ is the interaction energy.
        
        - Energy of a charged capacitor:
        $
        W=\\frac{{q V}}{{2}}=\\frac{{q^2}}{{2 C}}=\\frac{{C V^2}}{{2}}
        $
        
        - Volume density of electric field energy:
        $
        w=\\frac{{\\mathbf{{E D}}}}{{2}}=\\frac{{\\varepsilon \\varepsilon_0 E^{{\\mathbf{{2}}}}}}{{2}}
        $
        


        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_electric_current(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        electric_current review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

        
        
        - Ohm's law for an inhomogeneous segment of a circuit:
        $
        I=\\frac{{V_{{12}}}}{{R}}=\\frac{{\\varphi_1-\\varphi_2+\\mathscr{{E}}_{{12}}}}{{R}},
        $
        where $V_{{12}}$ is the voltage drop across the segment.
        
        - Differential form of Ohm's law:
        $
        \\mathbf{{j}}=\\sigma\\left(\\mathbf{{E}}+\\mathbf{{E}}^*\\right) \\text {{, }}
        $
        where $\\mathbf{{E}}^*$ is the strength of a field produced by extraneous forces.
        
        - Kirchhoff's laws (for an electric circuit):
        $
        \\sum I_k=0, \\quad \\sum I_k R_k=\\sum \\mathscr{{E}}_k .
        $
        
        - Power $P$ of current and thermal power $Q$ :
        $
        P=V I=\\left(\\varphi_1-\\varphi_2+\\mathscr{{C}}_{{12}}\\right) I, \\quad Q=R I^2 .
        $
        
        - Specific power $P_{{s p}}$ of current and specific thermal power $Q_{{s p}}$ :
        $
        P_{{s p}}=\\mathbf{{j}}\\left(\\mathbf{{E}}+\\mathbf{{E}}^*\\right), \\quad Q_{{s p}}=\\rho \\mathbf{{j}}^2
        $
        
        - Current density in a metal:
        $
        \\boldsymbol{{j}}=\\boldsymbol{{e n}} \\mathbf{{u}},
        $
        where $\\mathbf{{u}}$ is the average velocity of carriers.
        
        - Number of ions recombining per unit volume of gas per unit time:
        $
        \\dot{{n_r}}=r n^2 \\text {{, }}
        $
        where $r$ is the recombination coefficient.
        
        

        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_magnetic_field(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        magnetic_field review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

    
        - Magnetic field of a point charge $q$ moving with non-relativistic velocity $\\mathrm{{v}}$ :
        $
        \\mathbf{{B}}=\\frac{{\\mu_0}}{{4 \\pi}} \\frac{{q[\\mathbf{{v r}}]}}{{r^3}}
        $
        
        - Biot-Savart law:
        $
        d \\mathbf{{B}}=\\frac{{\\mu_0}}{{4 \\pi}} \\frac{{[\\mathbf{{j}} \\mathbf{{r}}]}}{{r^3}} d V, \\quad d \\mathbf{{B}}=\\frac{{\\mu_0}}{{4 \\pi}} \\frac{{I[d \\mathbf{{l}}, \\mathbf{{r}}]}}{{r^3}} .
        $
        
        - Circulation of a vector $\\mathbf{{B}}$ and Gauss's theorem for it:
        $
        \\oint \\mathbf{{B}} d \\mathbf{{r}}=\\mu_0 I, \\quad \\oint \\mathbf{{B}} d \\mathbf{{S}}=0
        $
        
        - Lorentz force:
        $
        \\mathbf{{F}}=q \\mathbf{{E}}+q[\\mathbf{{v B}}] .
        $
        
        - Ampere force:
        $
        \\mathbf{{F}}=q \\mathbf{{E}}+q[\\mathbf{{v B}}] .
        $
        
        - Force and moment of forces acting on a magnetic dipole $\\mathbf{{p}}_m=I S \\mathbf{{n}}$ :
        $
        \\mathbf{{F}}=p_m \\frac{{\\partial \\mathbf{{B}}}}{{\\partial n}}, \\quad \\mathbf{{N}}=\\left[\\mathbf{{p}}_m \\mathbf{{B}}\\right]
        $
        where $\\partial \\mathbf{{B}} / \\partial n$ is the derivative of a vector $\\mathbf{{B}}$ with respect to the dipole direction.
        
        - Vector $\\mathbf{{H}}$ and its circulation:
        $
        \\mathbf{{H}}=\\frac{{\\mathbf{{B}}}}{{\\mu_0}}-\\mathbf{{J}}, \\oint \\mathbf{{H}} d \\mathbf{{r}}=I,
        $
        where $I$ is the algebraic sum of macroscopic currents.
        
        - Relations at the boundary between two magnetics:
        $
        B_{{1 n}}=B_{{2 n}}, \\quad H_{{1 \\tau}}=H_{{2 \\tau}} .
        $
        
        - For the case of magnetics in which $\\mathbf{{J}}=\\chi \\mathbf{{H}}$ :
        $
        \\mathbf{{B}}=\\mu \\mu_0 \\mathbf{{H}}, \\quad \\mu=1+\\chi .
        $
        

        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_electromagnetic_induction(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        electromagnetic_induction review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""


        - Faraday's law of electromagnetic induction:
        $
        \\mathscr{{G}}_i=-\\frac{{d \\Phi}}{{d t}}
        $
        
        
        - In the case of a solenoid and doughnut coil:
        $
        \\Phi=N \\Phi_1,
        $
        where $N$ is the number of turns, $\\Phi_1$ is the magnetic flux through each turn.
        
        
        - Inductance of a solenoid:
        $
        L=\\mu \\mu_0 n^2 V .
        $
        
        
        - Intrinsic energy of a current and interaction energy of two currents:
        $
        W=\\frac{{L I^2}}{{2}}, \\quad W_{{12}}=L_{{12}} I_1 I_2
        $
        
        
        - Volume density of magnetic field energy:
        $
        w=\\frac{{B^2}}{{2 \\mu \\mu_0}}=\\frac{{\\mathrm{{BH}}}}{{2}} .
        $
        
        
        - Displacement current density:
        $
        \\mathbf{{j}}_{{\\text {{dis }}}}=\\frac{{\\partial \\mathrm{{B}}}}{{\\partial t}} .
        $
        
        
        - Maxwell's equations in differential form:
        $
        \\begin{{array}}{{ll}}
        \\boldsymbol{{\\nabla}} \\times \\mathbf{{E}}=-\\frac{{\\partial \\mathbf{{B}}}}{{\\partial t}}, & \\boldsymbol{{\\nabla}} \\cdot \\mathbf{{B}}=0, \\\\
        \\boldsymbol{{\\nabla}} \\times \\mathbf{{H}}=\\mathbf{{j}}+\\frac{{\\partial \\mathbf{{D}}}}{{\\partial t}}, & \\boldsymbol{{\\nabla}} \\cdot \\mathbf{{D}}=\\rho,
        \\end{{array}}
        $
        where $\\nabla \\times \\equiv$ rot (the rotor) and $\\nabla \\cdot \\equiv \\operatorname{{div}}$ (the divergence).
        
        
        - Field transformation formulas for transition from a reference frame $K$ to a reference frame $K^{{\\prime}}$ moving with the velocity $v_0$ relative to it.
        In the case $v_0 \\ll \\mathbf{{E}}^{{\\prime}}=\\mathbf{{E}}+\\left[\\mathbf{{v}}_0 \\mathbf{{B}}\\right], \\quad \\mathbf{{B}}^{{\\prime}}=\\mathbf{{B}}-\\left[\\mathbf{{v}}_0 \\mathbf{{E}}\\right] / c^2$
        In the general case
        $
        \\begin{{array}}{{ll}}
        \\mathbf{{E}}_{{\\|}}^{{\\prime}}=\\mathbf{{E}}_{{\\|,}} & \\mathbf{{B}}_{{\\|}}^{{\\prime}}=\\mathbf{{B}}_{{\\|}}, \\\\
        \\mathbf{{E}}_{{\\perp}}^{{\\prime}}=\\frac{{\\mathbf{{E}}_{{\\perp}}+\\left[\\mathbf{{v}}_0 \\mathbf{{B}}\\right]}}{{\\sqrt{{1-\\left(v_0 / c\\right)^2}}}}, & B_{{\\perp}}^{{\\prime}}=\\frac{{\\mathbf{{B}}_{{\\perp}}-\\left[\\mathbf{{v}}_0 \\mathbf{{E}}\\right] / c^2}}{{\\sqrt{{1-\\left(v_0 / c\\right)^2}}}},
        \\end{{array}}
        $
        where the symbols \\|| and $\\perp$ denote the field components, respectively parallel and perpendicular to the vector $v_0$.
        

        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_motion_of_charged_particles(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        motion_of_charged_particles review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

    
        - Lorentz force:
        $
        \\mathbf{{F}}=q \\mathbf{{E}}+q[\\mathbf{{v B}}] .
        $
        
        
        - Motion equation of a relativistic particle:
        $
        \\frac{{d}}{{d t}} \\frac{{m_0 \\mathbf{{v}}}}{{\\sqrt{{1-(v / c)^9}}}}=\\mathbf{{F}}
        $
        
        
        - Period of revolution of a charged particle in a uniform magnetic field:
        $
        T=\\frac{{2 \\pi m}}{{q B}},
        $
        where $m$ is the relativistic mass of the particle, $m=m_0 / \\sqrt{{1-(v / c)^2}}$.
        
        
        - Betatron condition, that is the condition for an electron to move along a circular orbit in a betatron:
        $
        B_0=\\frac{{1}}{{2}}\\langle B\\rangle
        $
        where $B_0$ is the magnetic induction at an orbit's point, $\\langle B\\rangle$ is the mean value of the induction inside the orbit.
        
        

        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_mechanical_oscillations(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        mechanical_oscillations review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

    
        - Harmonic motion equation and its solution:
        $
        \\ddot{{x}}+\\omega_0^2 x=0, \\quad x=a \\cos \\left(\\omega_0 t+\\alpha\\right),
        $
        where $\\omega_0$ is the natural oscillation frequency.
        
        
        - Damped oscillation equation and its solution:
        $
        \\ddot{{x}}+2 \\beta \\dot{{x}}+\\omega_0^2 x=0, \\quad x=a_0 e^{{-\\beta t}} \\cos (\\omega t+\\alpha),
        $
        where $\\beta$ is the damping coefficient, $\\omega$ is the frequency of damped oscillations:
        $
        \\omega=\\sqrt{{\\omega^2-\\beta^2}} .
        $
        
        
        - Logarithmic damping decrement $\\lambda$ and quality factor $Q$ :
        $
        \\lambda=\\beta T, \\quad Q=\\pi / \\lambda,
        $
        where $T=2 \\pi / \\omega$.
        
        
        - Forced oscillation equation and its steady-state solution:
        $
        \\ddot{{x}}+2 \\beta \\dot{{x}}+\\omega_0^2 x=f_0 \\cos \\omega t, \\quad x=a \\cos (\\omega t-\\varphi),
        $
        where
        $
        a=\\frac{{f_0}}{{\\sqrt{{\\left(\\omega_0^2-\\omega^2\\right)^2+4 \\beta^2 \\omega^2}}}} \\quad \\tan \\varphi=\\frac{{2 \\beta \\omega}}{{\\omega_0^3-\\omega^2}} .
        $
        
        
        - Maximum shift amplitude occurs at
        $
        \\omega_{{r e s}}=\\sqrt{{\\omega_0^2-2 \\beta^2}} .
        $
        

        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_electric_oscillations(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        electric_oscillations review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

        
        
        - Damped oscillation in a circuit
        where
        $
        q=q_m \\mathrm{{e}}^{{-\\beta t}} \\cos (\\omega t+\\alpha),
        $
        $
        \\omega=\\sqrt{{\\omega_0^2-\\beta^2}}, \\quad \\omega_0=\\frac{{1}}{{\\sqrt{{L C}}}}, \\quad \\beta=\\frac{{R}}{{2 L}} .
        $
        
        
        - Logarithmic damping decrement $\\lambda$ and quality factor $Q$ of a circuit are defined by Eqs. (4.1d). When damping is low:
        $
        \\lambda=\\pi R \\sqrt{{\\frac{{C}}{{L}}}}, \\quad Q=\\frac{{1}}{{R}} \\sqrt{{\\frac{{L}}{{C}}}} .
        $
        
        - Steady-state forced oscillation in a circuit with a voltage $V=V_m \\cos \\omega t$ connected in series:
        where
        $
        I=I_m \\cos (\\omega t-\\varphi)
        $
        $
        \\tan \\varphi=\\frac{{\\omega L-\\frac{{1}}{{\\omega C}}}}{{R}}
        $
        
        - Power generated in an ac circuit:
        $
        P=V I \\cos \\varphi,
        $
        where $V$ and $I$ are the effective values of voltage and current:
        $
        V=V_m / \\sqrt{{2}}, \\quad I=I_m / \\sqrt{{2}}
        $
        
        


        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_elastic_waves_acoustics(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        elastic_waves_acoustics review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

    
        - Equations of plane and spherical waves:
        $
        \\xi=a \\cos (\\omega t-k x), \\quad \\xi=\\frac{{a_0}}{{r}} \\cos (\\omega t-k r) .
        $
        In the case of a homogeneous absorbing medium the factors $\\mathrm{{e}}^{{-\\gamma x}}$ and $\\mathrm{{e}}^{{-\\gamma r}}$ respectively appear in the formulas, where $\\gamma$ is the wave damping coefficient.
        
        
        - Wave equation:
        $
        \\frac{{\\partial^2 \\xi}}{{\\partial x^2}}+\\frac{{\\partial^2 \\xi}}{{\\partial y^2}}+\\frac{{\\partial^2 \\xi}}{{\\partial z^2}}=\\frac{{1}}{{v^2}} \\frac{{\\partial^2 \\xi}}{{\\partial t^2}} .
        $
        
        
        - Phase velocity of longitudinal waves in an elastic medium $\\left(v_{{\\|}}\\right)$and transverse waves in a string $\\left(v_1\\right)$ :
        $
        v_{{\\|}}=\\sqrt{{E / \\rho}}, \\quad v_{{\\perp}}=\\sqrt{{T / \\rho_1}},
        $
        where $E$ is Young's modulus, $\\rho$ is the density of the medium, $T$ is the tension of the string, $\\rho_1$ is its linear density.
        
        
        - Volume density of energy of an elastic wave:
        $
        w=\\rho a^2 \\omega^2 \\sin ^2(\\omega t-k x), \\quad\\langle w\\rangle=1 / 2 \\rho a^2 \\omega^2 \\text {{. }}
        $
        
        - Energy flow density, or the Umov vector for a travelling wave:
        $
        \\mathbf{{j}}=w \\mathbf{{v}}, \\quad\\langle\\mathbf{{j}}\\rangle=1 / 2 \\rho a^2 \\omega^2 \\mathbf{{v}} \\text {{. }}
        $
        
        
        - Standing wave equation:
        $
        \\xi=a \\cos k x \\cdot \\cos \\omega t
        $
        
        
        - Acoustical Doppler effect:
        $
        v=v_0 \\frac{{v+v_{{o b}}}}{{v-v_s}} .
        $
        
        
        - Loudness level (in bels):
        $
        L=\\log \\left(I / I_0\\right) .
        $
        
        
        - Relation between the intensity $I$ of a sound wave and the pressure oscillation amplitude $(\\Delta p)_m$ :
        $
        I=(\\Delta p)_m^2 / 2 \\rho v
        $
        
        

        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_electromagnetic_waves(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        electromagnetic_waves review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

    
        - Phase velocity of an electromagnetic wave:
        $
        v=c / \\sqrt{{\\varepsilon \\mu}}, \\quad \\text {{ where }} c=1 / \\sqrt{{\\varepsilon_0 \\mu_0}} .
        $
        
        - In a travelling electromagnetic wave:
        $
        E \\sqrt{{\\varepsilon \\varepsilon_0}}=H \\sqrt{{\\mu \\mu_0}}
        $
        
        - Space density of the energy of an electromagnetic field:
        $
        w=\\frac{{\\mathbf{{E D}}}}{{2}}+\\frac{{\\mathbf{{B H}}}}{{2}} \\text {{. }}
        $
        
        - Flow density of electromagnetic energy, the Poynting vector:
        $
        \\mathbf{{S}}=[\\mathbf{{E H}}] \\text {{. }}
        $
        
        - Energy flow density of electric dipole radiation in a far field zone:
        $
        S \\sim \\frac{{1}}{{r^2}} \\sin ^2 \\theta
        $
        where $r$ is the distance from the dipole, $\\theta$ is the angle between the radius vector $\\mathbf{{r}}$ and the axis of the dipole.
        - Radiation power of an electric dipole with moment $\\mathbf{{p}}(t)$ and of a charge $q$, moving with acceleration w:
        $
        P=\\frac{{1}}{{4 \\pi \\varepsilon_0}} \\frac{{2 \\ddot{{\\mathbf{{p}}}}^2}}{{3 c^3}}, \\quad P=\\frac{{1}}{{4 \\pi \\varepsilon_0}} \\frac{{2 q^2 \\mathbf{{w}}^2}}{{3 c^3}} .
        $
        
        

        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_geometrical_optics(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        geometrical_optics review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

    
        - Luminous intensity $I$ and illuminance $E$ :
        $
        I=\\frac{{d \\Phi}}{{d \\Omega}}, \\quad E=\\frac{{d \\Phi_{{i n c}}}}{{d S}}
        $
        
        
        - Illuminance produced by a point isotropic source:
        $
        E=\\frac{{I \\cos \\alpha}}{{r^2}},
        $
        where $\\alpha$ is the angle between the normal to the surface and the direction to the source.
        
        
        - Luminosity $M$ and luminance $L$ :
        $
        M=\\frac{{d \\Phi_{{e m i t}}}}{{d S}}, \\quad L=\\frac{{d \\Phi}}{{d \\Omega \\Delta S \\cos \\theta}} .
        $
        
        - For a Lambert source $L=$ const and luminosity
        $
        M=\\pi L .
        $
        
        - Relation between refractive angle $\\theta$ of a prism and least deviation angle $\\alpha$ :
        $
        \\sin \\frac{{\\alpha+\\theta}}{{2}}=n \\sin \\frac{{\\theta}}{{2}},
        $
        where $n$ is the refractive index of the prism.
        
        
        - Equation of spherical mirror:
        $
        \\frac{{1}}{{s^{{\\prime}}}}+\\frac{{1}}{{s}}=\\frac{{2}}{{R}},
        $
        where $R$ is the curvature radius of the mirror.
        
        
        - Equations for aligned optical system (Fig. 5.2):
        $
        \\frac{{n^{{\\prime}}}}{{s^{{\\prime}}}}-\\frac{{n}}{{s}}=\\Phi, \\frac{{f^{{\\prime}}}}{{s^{{\\prime}}}}+\\frac{{f}}{{s}}=1, \\quad x x^{{\\prime}}=f f^{{\\prime}} .
        $
        
        
        
        - Relations between focal lengths and optical power:
        $
        f^{{\\prime}}=\\frac{{n^{{\\prime}}}}{{\\Phi}}, \\quad f=-\\frac{{n}}{{\\Phi}}, \\quad \\frac{{f^{{\\prime}}}}{{f}}=-\\frac{{n^{{\\prime}}}}{{n}} .
        $
        
        
        - Optical power of a spherical refractive surface:
        $
        \\Phi=\\frac{{n^{{\\prime}}-n}}{{R}} .
        $
        
        
        - Optical power of a thin lens in a medium with refractive index $n_0$ :
        $
        \\Phi=\\left(n-n_0\\right)\\left(\\frac{{1}}{{R_1}}-\\frac{{1}}{{R_2}}\\right),
        $
        where $n$ is the refractive index of the lens.
        
        
        - Optical power of a thick lens:
        $
        \\Phi=\\Phi_1+\\Phi_2-\\frac{{d}}{{n}} \\Phi_1 \\Phi_2,
        $
        where $d$ is the thickness of the lens. This equation is also valid for a system of two thin lenses separated by a medium with refractive index $n$.
        
        
        - Principal planes $H$ and $H^{{\\prime}}$ are removed from the crest points $O$ and $O^{{\\prime}}$ of surfaces of a thick lens (Fig. 5.3) by the following distances:
        $
        X=\\frac{{d}}{{n}} \\frac{{\\Phi_2}}{{\\Phi}}, \\quad X^{{\\prime}}=-\\frac{{d}}{{n}} \\frac{{\\Phi_1}}{{\\Phi}} .
        $
        
        - Lagrange-Helmholtz invariant:
        $
        n y u=\\text {{ const. }}
        $
        
        
        - Magnifying power of an optical device:
        $
        \\Gamma=\\frac{{\\tan \\psi^{{\\prime}}}}{{\\tan \\psi}},
        $
        where $\\psi^{{\\prime}}$ and $\\psi$ are the angles subtended at the eye by an image formed by the optical device and by the corresponding object at a distance for convenient viewing (in the case of a microscope or magnifying glass that distance is equal to $\\left.l_0=25 \\mathrm{{~cm}}\\right)$.
        

        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_interference_of_light(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        interference_of_light review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

    
        - Width of a fringe:
        $
        \\Delta x=\\frac{{l}}{{d}} \\lambda,
        $
        where $l$ is the distance from the sources to the screen, $d$ is the distance between the sources.
        
        
        - Temporal and spatial coherences. Coherence length and coherence radius:
        $
        l_{{\\mathrm{{coh}}}} \\simeq \\frac{{\\lambda^2}}{{\\Delta \\lambda}}, \\quad \\rho_{{\\mathrm{{coh}}}} \\simeq \\frac{{\\lambda}}{{\\psi}},
        $
        where $\\psi$ is the angular dimension of the source.
        
        
        - Condition for interference maxima in the case of light reflected from a thin plate of thickness $b$ :
        $
        2 b \\sqrt{{n^2-\\sin ^2 \\theta_1}}=(k+1 / 2) \\lambda,
        $
        where $k$ is an integer.
        
        - Newton's rings produced on reflection of light from the surfaces of an air interlayer formed between a lens of radius $R$ and a glass plate with which the convex surface of the lens is in contact. Tbe radii of the rings:
        $
        r=\\sqrt{{\\lambda R k / 2}},
        $
        with the rings being bright if $k=1,3,5, \\ldots$, and dark if $k=2,4,6, \\ldots$ The value $k=0$ corresponds to the middle of the central dark spot.
        
        

        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_diffraction_of_light(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        diffraction_of_light review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""


        
        - Radius of the periphery of the $k$ th Fresnel zone:
        $
        r_k=\\sqrt{{k \\lambda \\frac{{a b}}{{a+b}}}}, k=1,2,3, \\ldots
        $
        
        
        - Cornu's spiral (Fig. 5.19). The numbers along that spiral correspond to the values of parameter $v$. In the case of a plane wave $v=x \\sqrt{{2 / b \\lambda}}$, where $x$
        and $b$ are the distances defining the position of the element $d S$ of a wavefront relative to the observation point $P$ as shown in the upper left corner of the figure.
        
        
        - Fraunhofer diffraction produced by light falling normally from a slit. Condition of intensity minima:
        $
        b \\sin \\theta=\\pm k \\lambda, \\quad k=1,2,3, \\ldots,
        $
        where $b$ is the width of the slit, $\\theta$ is the diffraction angle.
        
        
        - Diffraction grating, with light falling normally. The main Fraunhofer maxima appear under the condition
        $
        d \\sin \\theta=\\pm k \\lambda, \\quad k=0,1,2, \\ldots
        $
        the condition of additional minima:
        $
        d \\sin \\theta=\\pm \\frac{{k^{{\\prime}}}}{{N}} \\lambda
        $
        where $k^{{\\prime}}=1,2, \\ldots$, except for $0, N, 2 N, \\ldots$.
        
        
        - Angular dispersion of a diffraction grating:
        $
        D=\\frac{{\\delta \\theta}}{{\\delta \\lambda}}=\\frac{{k}}{{d \\cos \\theta}} \\text {{. }}
        $
        
        
        
        - Resolving power of a diffraction grating:
        $
        R=\\frac{{\\lambda}}{{\\delta \\lambda}}=k N,
        $
        where $N$ is the number of lines of the grating.
        
        
        - Resolving power of an objective
        $
        R=\\frac{{1}}{{\\delta \\psi}}=\\frac{{D}}{{1.22 \\lambda}},
        $
        where $\\delta \\psi$ is the least angular separation resolved by the objective, $D$ is the diameter of the objective.
        
        
        - Bragg's equation. The condition of diffraction maxima:
        $
        2 d \\sin \\alpha=\\pm k \\lambda,
        $
        where $d$ is the interplanar distance, $\\alpha$ is the glancing angle, $k=1,2,3, \\ldots$.
        
        
        

        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_polarization_of_light(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        polarization_of_light review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

    
        - Degree of polarization of light:
        $I=I_0 \\cos ^2 \\varphi$
        
        
        - Malus's law:
        - Brewster's law:
        $
        \\tan \\theta_B=n_2 / n_1 .
        $
        
        
        - Fresnel equations for intensity of light reflected at the boundary between two dielectrics:
        $
        I_{{\\perp}}^{{\\prime}}=I_{{\\perp}} \\frac{{\\sin ^2\\left(\\theta_1-\\theta_2\\right)}}{{\\sin ^2\\left(\\theta_1+\\theta_2\\right)}}, \\quad I_{{\\|}}^{{\\prime}}=I_{{\\|}} \\frac{{\\tan ^2\\left(\\theta_1-\\theta_2\\right)}}{{\\tan ^2\\left(\\theta_1+\\theta_2\\right)}}
        $
        where $I_{{\\perp}}$ and $I_{{\\|}}$are the intensities of incident light whose electric vector oscillations are respectively perpendicular and parallel to the plane of incidence.
        
        A crystalline plate between two polarizers $P$ and $P^{{\\prime}}$. If the angle between the plane of polarizer $P$ and the optical axis $O O^{{\\prime}}$ of the plate is equal to $45^{{\\circ}}$, the intensity $I^{{\\prime}}$ of light which passes through the polarizer $P^{{\\prime}}$ turns out to be either maximum or minimum under the following conditions:
        
        
        Here $\\delta=2 \\pi\\left(n_0-n_e\\right) d / \\lambda$ is the phase difference between the ordinary and extraordinary rays, $k=0,1,2, \\ldots$
        
        
        - Natural and magnetic rotation of the plane of polarization:
        $
        \\varphi_{{n a t}}=\\alpha l, \\varphi_{{m a g n}}=V l H,
        $
        where $\\alpha$ is the rotation constant, $V$ is Verdet's constant.
        
        
        

        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_dispersion_and_absorption_of_light(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        dispersion_and_absorption_of_light review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

    
        
        - Permittivity of substance according to elementary theory of dispersion:
        $
        \\varepsilon=1+\\sum_k \\frac{{n_k e^2 / m \\varepsilon_0}}{{\\omega_{{0 k}}^2-\\omega^2}},
        $
        where $n_k$ is the concentration of electrons of natural frequency $\\omega_{{0 k}}$.
        
        
        - Relation between refractive index and permittivity of substance:
        $
        n=\\sqrt{{\\varepsilon_{{.}}}}
        $
        
        
        - Phase velocity $v$ and group velocity $u$ :
        $
        v=\\omega / k, \\quad u=d \\omega / d k .
        $
        
        
        - Rayleigh's formula:
        $
        u=v-\\lambda \\frac{{d v}}{{d \\lambda}} .
        $
        
        
        - Attenuation of a narrow beam of electromagnetic radiation:
        $
        I=I_0 \\mathrm{{e}}^{{-\\mu d}},
        $
        where $\\mu=x+x^{{\\prime}}, \\mu, x, x^{{\\prime}}$ are the coefficients of linear attenuation, absorption, and scattering.
        
        
        

        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_optics_of_moving_sources(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        optics_of_moving_sources review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""


        - Doppler effect for $\\ll c:$
        $
        \\frac{{\\Delta \\omega}}{{\\omega}}=\\frac{{v}}{{c}} \\cos \\theta
        $
        where $v$ is the velocity of a source, $\\theta$ is the angle between the source's motion direction and the observation line.
        
        
        - Doppler effect in the general case:
        $
        \\omega=\\omega_0 \\frac{{\\sqrt{{1-\\beta^2}}}}{{1-\\beta \\cos \\theta}} .
        $
        where $\\beta=v / c$
        
        
        - If $\\theta=0$, the Doppler effect is called radial, and if $\\theta=\\pi / 2$, transverse.
        
        
        - Vavilov-Cherenkov effect:
        $
        \\cos \\theta=\\frac{{c}}{{n v}}
        $
        where $\\theta$ is the angle between the radiation propagation direction and the velo* city vector $v$ of a particle.
        
        
        
        

        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_thermal_radiation(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        thermal_radiation review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

        
        
        - Radiosity
        $
        M_e=\\frac{{c}}{{4}} u,
        $
        where $u$ is the space density of thermal radiation energy.
        
        
        - Wien's formula and Wien's displacement law:
        $
        u_\\omega=\\omega^3 F(\\omega / T), \\quad T \\lambda_m=b,
        $
        where $\\lambda_m$ is the wavelength corresponding to the maximum of the function $u_\\lambda$.
        
        
        - Stefan-Boltzmann law:
        $
        M_e=\\sigma T^4,
        $
        where $\\sigma$ is the Stefan-Boltzmann constant.
        
        
        - Planck's formula:
        $
        u_\\omega=\\frac{{\\hbar \\omega^3}}{{\\pi^2 c^3}} \\frac{{1}}{{e^{{\\hbar \\omega / k T}}-1}} .
        $
        
        
        - Einstein's photoelectric equation:
        $
        \\hbar \\omega=A+\\frac{{m v_{{\\max }}^2}}{{2}}
        $
        
        
        - Compton effect:
        $
        \\Delta \\lambda=2 \\pi \\pi_C(1-\\cos \\theta),
        $
        where $\\star_C=\\hbar / m c$ is Compton's wavelength.
        
        
        


        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_scattering_of_particles(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        scattering_of_particles review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

        
        
        - Angle $\\theta$ at which a charged particle is deflected by the Coulomb feld of a stationary atomic nucleus is defined by the formula:
        $
        \\tan \\frac{{\\theta}}{{2}}=\\frac{{q_1 q_2}}{{2 b T}},
        $
        where $q_1$ and $q_2$ are the charges of the particle and the nucleus, $b$ is the aiming parameter, $T$ is the kinetic energy of a strik-
        ing particle.
        
        
        - Rutherford formula. The relative number of particles scattered into an elementary solid angle $d \\Omega$ at an angle $\\theta$ to their initial propagation direction:
        $
        \\frac{{d N}}{{N}}=n\\left(\\frac{{q_1 q_2}}{{4 T}}\\right)^2 \\frac{{d \\Omega}}{{\\sin ^4(\\theta / 2)}},
        $
        where $n$ is the number of nuclei of the foil per unit area of its surface, $d \\Omega=\\sin \\theta d \\theta d \\varphi$.
        
        
        - Generalized Balmer formula (Fig. 6.1):
        $
        \\omega=R Z^2\\left(\\frac{{1}}{{n_1^2}}-\\frac{{1}}{{n_2^2}}\\right), \\quad R=\\frac{{m e^4}}{{2 \\hbar^3}}
        $
        where $\\omega$ is the transition frequency (in $s^{{-1}}$ ) between energy levels with quantum numbers $n_1$ and $n_2, R$ is the Rydberg constant, $Z$ is the serial number of a hydrogen-like ion.
        
        
        


        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_wave_properties_of_particles(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        wave_properties_of_particles review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

    
        
        - The de Broglie wavelength of a particle with momentum $p$ :
        $
        \\lambda=\\frac{{2 \\pi \\hbar}}{{p}} .
        $
        
        
        - Uncertainty principle:
        $
        \\Delta x \\cdot \\Delta p_x \\geqslant \\hbar .
        $
        
        
        - Schrödinger time-dependent and time-independent equations:
        $
        \\begin{{gathered}}
        i \\hbar \\frac{{\\partial \\Psi}}{{\\partial t}}=-\\frac{{\\hbar^2}}{{2 m}} \\nabla^2 \\Psi+U \\Psi, \\\\
        \\nabla^2 \\Psi+\\frac{{2 m}}{{\\hbar^2}}(E-U) \\psi=0,
        \\end{{gathered}}
        $
        where $\\Psi$ is the total wave function, $\\psi$ is its coordinate part, $\\nabla^2$ is the Laplace operator, $E$ and $U$ are the total and potential energies of the particle. In spherical coordinates:
        $
        \\nabla^2=\\frac{{\\partial^2}}{{\\partial r^2}}+\\frac{{2}}{{r}} \\frac{{\\partial}}{{\\partial r}}+\\frac{{1}}{{r^2 \\sin \\theta}} \\frac{{\\partial}}{{\\partial \\theta}}\\left(\\sin \\theta \\frac{{\\partial}}{{\\partial \\theta}}\\right)+\\frac{{1}}{{r^2 \\sin ^2 \\theta}} \\frac{{\\partial^2}}{{\\partial \\varphi^2}} .
        $
        
        
        - Coefficient of transparency of a potential barrier $V(x)$ :
        $
        D \\approx \\exp \\left[-\\frac{{2}}{{n}} \\int_{{x_1}}^{{x_2}} \\sqrt{{2 m(V-E)}} d x\\right],
        $
        where $x_1$ and $x_2$ are the coordinates of the points between which $V>E$.
        
        

        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_atoms_spectra(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        atoms_spectra review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""


        
        - Spectral labelling of terms: ${{ }}^x(L)_J$, where $x=2 S+1$ is the multiplicity, $L, S, J$ are quantum numbers,
        $
        \\begin{{aligned}}
        & L=0,1,2,3,4,5,6, \\ldots \\\\
        & (L): S, P, D, F, G, H, I, \\ldots
        \\end{{aligned}}
        $
        
        - Terms of alkali metal atoms:
        $
        T=\\frac{{R}}{{(n+\\alpha)^2}} \\text {{, }}
        $
        where $R$ is the Rydberg constant, $\\alpha$ is the Rydberg correction.
        Fig. 6.7 illustrates the diagram of a lithium atom terms.
        
        
        - Angular momenta of an atom:
        $
        M_L=\\hbar \\sqrt{{L(L+1)}} \\text {{, }}
        $
        with similar expressions for $M_S$ and $M_J$ :
        
        
        - Hund rules:
        (1) For a certain electronic configuration, the terms of the largest $S$ value are the lowest in energy, and among the terms of $S_{{\\max }}$ that of the largest $L$ usually lies lowest;
        
        
        (2) for the basic (normal) term $J=|L-S|$ if the subshell is less than halffilled, and $J=L+S$ in the remaining cases.
        
        
        - Boltzmann's formula:
        $
        \\frac{{N_2}}{{N_1}}=\\frac{{g_2}}{{g_1}} \\mathrm{{e}}^{{-\\left(E_2-E_1\\right) / k T}},
        $
        where $g_1$ and $g_2$ are the statistical weights (degeneracies) of the corresponding levels.
        
        
        - Probabilities of atomic transitions per unit time between level 1 and a higher level 2 for the cases of spontaneous radiation, induced radiation, and absorption:
        $
        P_{{21}}^{{s p}}=A_{{21}}, P_{{21}}^{{i n d}}=B_{{21}} u_\\omega, P_{{12}}^{{a b s}}=B_{{12}} u_\\omega,
        $
        where $A_{{21}}, B_{{21}}, B_{{12}}$ are Einstein coefficients, $u_\\omega$ is the spectral density of radiation corresponding to frequency $\\omega$ of transition between the given levels.
        
        
        - Relation between Einstein coefficients:
        $
        g_1 B_{{12}}=g_2 B_{{21}}, \\quad B_{{21}}=\\frac{{\\pi^2 c^3}}{{\\hbar \\omega^3}} A_{{21}} .
        $
        
        
        - Diagram showing formation of X-ray spectra (Fig. 6.8).
        
        
        - Moseley's law for $K_\\alpha$ lines:
        $
        \\omega_{{K_\\alpha}}=\\frac{{3}}{{4}} R(Z-\\sigma)^2 \\text {{, }}
        $
        
        where $\\sigma$ is the correction constant which is equal to unity for light elements.
        
        
        - Magnetic moment of an atom and Landé $g$ factor:
        $\\mu=g \\sqrt{{J(J+1)}} \\mu_B, \\quad g=1+\\frac{{J(J+1)+S(S+1)-L(L+1)}}{{2 J(J+1)}} .(6.3 g)$
        
        
        - Zeeman splitting of spectral lines in a weak magnetic feld:
        $
        \\Delta \\omega=\\left(m_1 g_1-m_2 g_2\\right) \\mu_B B / \\hbar \\text {{. }}
        $
        
        
        - With radiation directed along the magnetic field, the Zeeman components caused by the transition $m_1=m_2$ are absent.
        
        
        

        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_molecules_and_crystals(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        molecules_and_crystals review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

        
        
        - Rotational energy of a diatomic molecule:
        $
        E_J=\\frac{{\\hbar^2}}{{2 I}} J(J+1),
        $
        where $I$ is the molecule's moment of inertia.
        
        
        - Vibrational energy of a diatomic molecule:
        $
        E_v=\\hbar \\omega\\left(v+\\frac{{1}}{{2}}\\right),
        $
        where $\\omega$ is the natural frequency of oscillations of the molecule.
        
        
        - Mean energy of a quantum harmonic oscillator at a temperature $T$ :
        $
        \\langle E\\rangle=\\frac{{\\hbar \\omega}}{{2}}+\\frac{{\\hbar \\omega}}{{e^{{\\hbar \\omega / k T}}-1}} .
        $
        
        
        - Debye formula for molar vibrational energy of a crystal:
        $
        U=9 R \\theta\\left[\\frac{{1}}{{8}}+\\left(\\frac{{T}}{{\\Theta}}\\right)^4 \\int_0^{{\\Theta / T}} \\frac{{x^3 d x}}{{\\mathrm{{e}}^x-1}}\\right],
        $
        where $\\theta$ is the Debye temperature,
        $
        \\Theta=\\hbar \\omega_{{\\max }} / k \\text {{. }}
        $
        
        
        - Molar vibrational heat capacity of a crystal for $T \\ll \\Theta$ :
        $
        C=\\frac{{12}}{{5}} \\pi^4 R\\left(\\frac{{T}}{{\\Theta}}\\right)^3 \\text {{. }}
        $
        
        
        - Distribution of free electrons in metal in the vicinity of the absolute zero:
        $
        d n=\\frac{{\\sqrt{{2}} m^{{3 / 2}}}}{{\\pi^2 \\hbar^3}} \\sqrt{{E}} d E,
        $
        where $d n$ is the concentration of electrons whose energy falls within the interval $E, E+d E$. The energy $E$ is counted off the bottom of the conduction band.
        
        
        - Fermi level at $T=0$ :
        $
        E_F=\\frac{{\\hbar^2}}{{2 m}}\\left(3 \\pi^2 n\\right)^{{2 / 3}},
        $
        where $n$ is the concentration of free electrons in metal.
        
        
        


        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_radioactivity(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        radioactivity review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

    
        - Fundamental law of radioactive decay:
        $
        N=N_0 e^{{-\\lambda t}} \\text {{. }}
        $
        
        
        - Relation between the decay constant $\\lambda$, the mean lifetime $\\tau$, and the half-life $T:$
        $
        \\lambda=\\frac{{1}}{{\\tau}}=\\frac{{\\ln 2}}{{T}} .
        $
        
        
        
        - Specific activity is the activity of a unit mass of a radioisotope.
        
        

        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_nuclear_reactions(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        nuclear_reactions review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

        
        - Binding energy of a nucleus:
        $
        E_b=Z m_{{\\mathrm{{H}}}}+(A-Z) m_n-M,
        $
        where $Z$ is the charge of the nucleus (in units of $e$ ), $A$ is the mass number, $m_H$, $m_n$, and $M$ are the masses of a hydrogen atom, a neutron, and an atom corres ponding to the given nucleus.
        In calculations the following formula is more convenient to use:
        $
        E_b=Z \\Delta_{{\\mathbf{{H}}}}+(A-Z) \\Delta_n-\\Delta,
        $
        where $\\Delta_H, \\Delta_n$, and $\\Delta$ are the mass surpluses of a hydrogen atom, a neutron, and an atom corresponding to the given nucleus.
        
        
        
        - Energy diagram of a nuclear reaction
        $
        m+M \\rightarrow M^* \\rightarrow m^{{\\prime}}+M^{{\\prime}}+Q
        $
        is illustrated in Fig. $6.12$, where $m+M$ and $m^{{\\prime}}+M^{{\\prime}}$ are the sums of rest masses of particles before and after the reaction, $\\tilde{{T}}$ and $\\tilde{{T}}^{{\\prime}}$ are the total kinetic ener-
        gies of particles before and after the reaction (in the frame of the centre of inertia), $E^*$ is the excitation energy of the transitional nucleus, $Q$ is the energy of the reaction, $E$ and $E^{{\\prime}}$ are the binding energies of the particles $m$ and $m^{{\\prime}}$ in the transitional nucleus, $1,2,3$ are the energy levels of the transitional nucleus.
        - Threshold (minimum) kinetic energy incoming particle at which an endoergic nuclear reaction
        $
        T_{{t h}}=\\frac{{m+M}}{{M}}|Q|
        $
        becomes possible; here $m$ and $M$ are the masses of the incoming particle and the target nucleus.
        
        
        
        

        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_elementary_particles(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = fr"""
        elementary_particles review
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""

        
        
        - Total energy and momentum of a relativistic particle:
        $
        E=m_0 c^2+T, \\quad p c=\\sqrt{{T\\left(\\bar{{T}}+2 m_0 c^2\\right)}},
        $
        where $T$ is the kinetic energy of the particle.
        
        
        - When examining collisions of particles it pays to use the invariant:
        $
        E^2-p^2 c^2=m_0^2 c^4,
        $
        where $E$ and $p$ are the total energy and the total momentum of the system prior to collision, $m_0$ is the rest mass of the formed particle.
        
        
        - Threshold (minimal) kinetic energy of a particle $m$ striking a stationary particle $M$ and activating the endoergic reaction $m+M \\rightarrow m_1+m_2+\\ldots$ :
        $
        T_{{t h}}=\\frac{{\\left(m_1+m_2+\\ldots\\right)^2-(m+M)^2}}{{2 M}} c^2,
        $
        where $m, M, m_1, m_2, \\ldots$ are the rest masses of the respective particles.
        
        
        - Quantum numbers classifying elementary particles:
        $Q$, electric charge,
        $L$, lepton charge,
        $B$, baryon charge,
        $T$, isotopic spin, $T_z$, its projection,
        $S$, strangeness, $S=2\\langle Q\\rangle-B$,
        $Y$, hypercharge, $Y=B+S$.
        
        
        - Relation between quantum numbers of strongly interacting particles:
        $
        Q=T_z+\\frac{{Y}}{{2}}=T_z+\\frac{{B+S}}{{2}}
        $
        
        
        - Interactions of particles obey the laws of conservation of the $Q, L$ and $B$ charges. In strong interactions the laws of conservation of $S$ (or $Y$ ), $T$, and its projection $T_z$ are also valid.
        
        
        
        
        


        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        {soln_s}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate

