'''
Created on 01-Apr-2021
@author: rishi_priyansh
'''
import random
import inspect
import traceback
from sympy import (symbols, Symbol)

from xv.km.util import latex_fraction, latex_atom
from .....helper import BaseHelper

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

class GravitationManager(BaseManager):
    '''
    GravitationManager
    Example:
        ke = GravitationManager()
        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(GravitationManager, cls).__new__(cls, *args, **kwargs)
        for base_class in GravitationManager.__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_1_201',
			'_problem_1_202',
			'_problem_1_203',
			'_problem_1_204',
			'_problem_1_205',
			'_problem_1_206',
			'_problem_1_207',
			'_problem_1_208',
			'_problem_1_209',
			'_problem_1_210',
			'_problem_1_211',
			'_problem_1_212',
			'_problem_1_213',
			'_problem_1_214',
			'_problem_1_215',
			'_problem_1_216',
			'_problem_1_217',
			'_problem_1_218',
			'_problem_1_219',
			'_problem_1_220',
			'_problem_1_221',
			'_problem_1_222',
			'_problem_1_223',
			'_problem_1_224',
			'_problem_1_225',
			'_problem_1_226',
			'_problem_1_227',
			'_problem_1_228',
			'_problem_1_229',
			'_problem_1_230',
			'_problem_1_231',
			'_problem_1_232',
			'_problem_1_233',
            
            ])
        pass
                
    def _problem_1_200(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        A planet of mass $M$ moves along a circle around the Sun with velocity $v=34.9 \\mathrm{{~km}} / \\mathrm{{s}}$ (relative to the heliocentric reference frame). Find the period of revolution of this planet around the Sun.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        $\\displaystyle \\begin{{aligned}}
        &\\text{{We have }}\\qquad& \\frac{{M v^2}}{{r}}&=\\frac{{\\gamma M m_s}}{{r^2}} \\text {{ or }} r=\\frac{{\\gamma m_s}}{{v^2}} \\\\
        &\\text{{Thus }}\\qquad& \\omega&=\\frac{{v}}{{r}}=\\frac{{v}}{{\\gamma m_s / v^2}}=\\frac{{v^3}}{{\\gamma m_s}}
        \\end{{aligned}}$
        (Here $m_s$ is the mass of the Sun.)
        So $\\displaystyle \\quad T=\\frac{{2 \\pi \\gamma m_s}}{{v^3}}=\\frac{{2 \\pi \\times 6.67 \\times 10^{{-11}} \\times 1.97 \\times 10^{{30}}}}{{\\left(34.9 \\times 10^3\\right)^3}}=1.94 \\times 10^7 \\mathrm{{sec}}=225$ days.
        (The answer is incorrectly written in terms of the planetary mass $M$ )
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate

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

        problem_s = f"""
        The Jupiter's period of revolution around the Sun is 12 times that of the Earth. Assuming the planetary orbits to be circular, find:
        (a) how many times the distance between the Jupiter and the Sun exceeds that between the Earth and the Sun;
        (b) the velocity and the acceleration of Jupiter in the heliocentric reference frame.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        For any planet
        $M R \\omega^2=\\frac{{\\gamma M m_s}}{{R^2}} \\text {{ or }} \\omega=\\sqrt{{\\frac{{\\gamma m_s}}{{R^3}}}}$
        $\\begin{{aligned}}
        &\\text{{So, }} \\qquad & T & =\\frac{{2 \\pi}}{{\\omega}}=2 \\pi R^{{3 / 2}} / \\sqrt{{\\gamma m_s}} \\\\
        &\\text{{(a) Thus }} \\qquad & \\frac{{T_J}}{{T_E}} & =\\left(\\frac{{R_J}}{{R_E}}\\right)^{{3 / 2}} \\\\
        &\\text{{So }} \\qquad & \\frac{{R_J}}{{R_E}} & =\\left(T_J / T_E\\right)^{{2 / 3}}=(12)^{{2 / 3}}=5 \\cdot 24 \\\\
        &\\text{{(b) }} \\qquad & V_J^2 & =\\frac{{\\gamma m_s}}{{R_J}} \\text {{, and }} R_J=\\left(T \\frac{{\\sqrt{{\\gamma m_s}}}}{{2 \\pi}}\\right)^{{2 / 3}} \\\\
        &\\text{{So }} \\qquad & V_J^2 & =\\frac{{\\left(\\gamma m_s\\right)^{{2 / 3}}(2 \\pi)^{{2 / 3}}}}{{T^{{2 / 3}}}} \\text {{ or, }} V_J=\\left(\\frac{{2 \\pi \\gamma m_s}}{{T}}\\right)^{{2 / 3}}
        \\end{{aligned}}$
        So where $T=12$ years. $m_s=$ mass of ths Sun.
        Putting the values we get $V_J=12.97 \\mathrm{{~km}} / \\mathrm{{s}}$
        $\\begin{{aligned}}
        \\text {{ Acceleration }} & =\\frac{{v_J^2}}{{R_J}}=\\left(\\frac{{2 \\pi \\gamma m_s}}{{T}}\\right)^{{2 / 3}} \\times\\left(\\frac{{2 \\pi}}{{T \\sqrt{{\\gamma m_s}}}}\\right)^{{2 / 3}} \\\\
        & =\\left(\\frac{{2 \\pi}}{{T}}\\right)^{{4 / 3}}\\left(\\gamma m_s\\right)^{{1 / 3}} \\\\
        & =2.15 \\times 10^{{-4}} \\mathrm{{~km}} / \\mathrm{{s}}^2
        \\end{{aligned}}$

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

        problem_s = f"""
        A planet of mass $M$ moves around the Sun along an ellipse so that its minimum distance from the Sun is equal to $r$ and the maximum distance to $R$. Making use of Kepler's laws, find its period of revolution around the Sun.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Semi-major axis $=(r+R) / 2$
        It is sufficient to consider the motion be along a circle of semi-major axis $\\displaystyle \\frac{{r+R}}{{2}}$ for $T$ does not depend on eccentricity.
        Hence $\\displaystyle \\qquad T=\\frac{{2 \\pi\\left(\\frac{{r+R}}{{2}}\\right)^{{3 / 2}}}}{{\\sqrt{{\\gamma m_s}}}}=\\pi \\sqrt{{(r+R)^3 / 2 \\gamma m_s}}$
        (again $m_s$ is the mass of the Sun)
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_1_203(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        A small body starts falling onto the Sun from a distance equal to the radius of the Earth's orbit. The initial velocity of the body is equal to zero in the heliocentric reference frame. Making use of Kepler's laws, find how long the body will be falling.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        We can think of the body as moving in a very elongated orbit of maximum distance $R$ and minimum distance 0 so semi major axis $=R / 2$. Hence if $\\tau$ is the time of fall then 
        $\\begin{{aligned}} 
        & \\left(\\frac{{2 \\tau}}{{T}}\\right)^2=\\left(\\frac{{R / 2}}{{R}}\\right)^3 \\text {{ or }} \\tau^2=T^2 / 32 \\\\
        \\text {{ or }} & \\tau=T / 4 \\sqrt{{2}}=365 / 4 \\sqrt{{2}}=64.5 \\text {{ days. }}
        \\end{{aligned}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_1_204(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Suppose we have made a model of the Solar system scaled down in the ratio $\\eta$ but of materials of the same mean density as the actual materials of the planets and the Sun. How will the orbital periods of revolution of planetary models change in this case?
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        $T=2 \\pi R^{{3 / 2}} / \\sqrt{{\\gamma m_s}}$
        If the distances are scaled down, $R^{{3 / 2}}$ decreases by a factor $\\eta^{{3 / 2}}$ and so does $m_s$. Hence $T$ does not change.
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_1_205(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        A double star is a system of two stars moving around the centre of inertia of the system due to gravitation. Find the distance between the components of the double star, if its total mass equals $M$ and the period of revolution $T$.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        The double star can be replaced by a single star of mass $\\frac{{m_1 m_2}}{{m_1+m_2}}$ moving about the centre of mass subjected to the force $\\gamma m_1 m_2 / r^2$. Then
        $\\displaystyle T=\\frac{{2 \\pi r^{{3 / 2}}}}{{\\sqrt{{\\gamma m_1 m_2 / \\frac{{m_1 m_2}}{{m_1+m_2}}}}}}=\\frac{{2 \\pi r^{{3 / 2}}}}{{\\sqrt{{\\gamma M}}}}$
        So $\\displaystyle \\qquad r^{{3 / 2}}=\\frac{{T}}{{2 \\pi}} \\sqrt{{\\gamma M}}$
        or, $\\displaystyle \\qquad r=\\left(\\frac{{T}}{{2 \\pi}}\\right)^{{2 / 3}}(\\gamma M)^{{1 / 3}}=\\sqrt[3]{{\\gamma M(T / 2 \\pi)^2}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_1_206(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Find the potential energy of the gravitational interaction
        (a) of two mass points of masses $m_1$ and $m_2$ located at a distance $r$ from each other;
        (b) of a mass point of mass $m$ and a thin uniform rod of mass $M$ and length $l$, if they are located along a straight line at a distance $a$ from each other; also find the force of their interaction.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        (a) The gravitational potential due to $m_1$ at the point of location of $m_2$ :
        $\\displaystyle V_2=\\int_r^{{\\infty}} \\vec{{G}} \\cdot d \\vec{{r}}=\\int_r^{{\\infty}}-\\frac{{\\gamma m_1}}{{x^2}} d x=-\\frac{{\\gamma m_1}}{{r}}$
        So, $\\displaystyle \\qquad U_{{21}}=m_2 V_2=-\\frac{{\\gamma m_1 m_2}}{{r}}$
        Similarly $\\displaystyle \\qquad U_{{12}}=-\\frac{{\\gamma m_1 m_2}}{{r}}$
        Hence $\\displaystyle \\qquad U_{{12}}=U_{{21}}=U=-\\frac{{\\gamma m_1 m_2}}{{r}}$
        (b) Choose the location of the point mass as the origin. Then the potential eriergy $d U$ of an element of mass $d M=\\frac{{M}}{{l}} d x$ of the rod in the field of the point mass is
        $\\displaystyle d U=-\\gamma m \\frac{{M}}{{l}} d x \\frac{{1}}{{x}}$
        where $x$ is the distance between the element and the point. (Note that the rod and the point mass are on a straight line.) If then $a$ is the distance of the nearer end of the rod from the point mass.
        The force of interaction is
        $\\displaystyle \\begin{{aligned}}
        F & =-\\frac{{\\partial U}}{{\\partial a}} \\\\
        & =\\gamma \\frac{{m M}}{{l}} \\times \\frac{{1}}{{1+\\frac{{l}}{{a}}}}\\left(-\\frac{{l}}{{a^2}}\\right)=-\\frac{{\\gamma m M}}{{a(a+l)}}
        \\end{{aligned}}$
        Minus sign means attraction.
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_1_207(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        A planet of mass $m$ moves along an ellipse around the Sun so that its maximum and minimum distances from the Sun are equal to $r_1$ and $r_2$ respectively. Find the angular momentum $M$ of this planet relative to the centre of the Sun.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        As the planet is under central force (gravitational interaction), its angular momentum is conserved about the Sun (which is situated at one of the focii of the ellipse)
        So, $\\displaystyle \\qquad m v_1 r_1=m v_2 r_2$ or, $\\displaystyle v_1^2=\\frac{{v_2^2 r_2^2}}{{r_1^2}} \\qquad (1)$
        From the conservation of mechanical energy of the system (Sun + planet),
        $\\displaystyle \\qquad -\\frac{{\\gamma m_s m}}{{r_1}}+\\frac{{1}}{{2}} m v_1^2=-\\frac{{\\gamma m_s m}}{{r_2}}+\\frac{{1}}{{2}} m v_2^2$
        or, $\\displaystyle \\qquad -\\frac{{\\gamma m_s}}{{r_1}}+\\frac{{1}}{{2}} v_2^2 \\frac{{r_2^2}}{{r_1^2}}=-\\left(\\frac{{\\gamma m_s}}{{r_2}}\\right)+\\frac{{1}}{{2}} v_2^2[\\text {{ Using (1)] }}$
        Thus, $\\displaystyle \\qquad v_2=\\sqrt{{2 \\gamma m_s r_1 / r_2\\left(r_1+r_2\\right)}} \\qquad (2)$
        Hence $\\displaystyle \\qquad M=m v_2 r_2=m \\sqrt{{2 \\gamma m_s r_1 r_2 /\\left(r_1+r_2\\right)}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_1_208(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Using the conservation laws, demonstrate that the total mechanical energy of a planet of mass $m$ moving around the Sun along an ellipse depends only on its semi-major axis $a$. Find this energy as a function of $a$.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        From the previous problem, if $r_1, r_2$ are the maximum and minimum distances from the sun to the planet and $v_1, v_2$ are the corresponding velocities, then, say,
        $\\begin{{gathered}}
        E=\\frac{{1}}{{2}} m v_2^2-\\frac{{\\gamma m m_s}}{{r_2}} \\\\
        =\\frac{{\\gamma m m_s}}{{r_1+r_2}} \\cdot \\frac{{r_1}}{{r_2}}-\\frac{{\\gamma m m_s}}{{r_2}}=-\\frac{{\\gamma m m_s}}{{r_1+r_2}}=-\\frac{{\\gamma m m_s}}{{2 a}} \\text {{ [Using Eq. (2) of 1.207] }}
        \\end{{gathered}}$
        where $2 a=$ major axis $=r_1+r_2$. The same result can also be obtained directly by writing an equation analogous to Eq (1) of problem 1.191.
        $\\displaystyle E=\\frac{{1}}{{2}} m \\dot{{r}}^2+\\frac{{M^2}}{{2 m r^2}}-\\frac{{\\gamma m m_s}}{{r}}$
        (Here $M$ is angular momentum of the planet and $\\boldsymbol{{m}}$ is its mass). For extreme position $\\dot{{r}}=0$ and we get the quadratic
        $\\displaystyle E r^2+\\gamma m m_s r-\\frac{{M^2}}{{2 m}}=0$
        The sum of the two roots of this equation are
        $\\displaystyle r_1+r_2=-\\frac{{\\gamma m m_s}}{{E}}=2 a$
        Thus $\\displaystyle \\qquad E=-\\frac{{\\gamma m m_s}}{{2 a}}=\\text {{ constant }}$
        """ 
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_1_209(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        A planet $A$ moves along an elliptical arbit around the Sun. At the moment when it was at the distance $r_0$ from the Sun its velocity was equal to $v_0$ and the angle between the radius vector $r_0$ and the velocity vector $v_0$ was equal to $\\alpha$. Find the maximum and minimum distances that will separate this planet from the Sun during its orbital motion.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        From the conservtion of angular momentum about the Sun.
        $m v_0 r_0 \\sin \\alpha=m v_1 r_1=m v_2 r_2 \\text {{ or, }} v_1 r_1=v_2 r_2=v_0 r_2 \\sin \\alpha$
        From conservation of mechanical energy,
        $\\displaystyle \\qquad \\frac{{1}}{{2}} m v_0^2-\\frac{{\\gamma m_s m}}{{r_0}}=\\frac{{1}}{{2}} m v_1^2-\\frac{{\\gamma m_s m}}{{r_1}}$
        or,$\\displaystyle \\qquad \\frac{{v_0^2}}{{2}}-\\frac{{\\gamma m_s}}{{r_0}}=\\frac{{v_0^2 r_0^2 \\sin ^2 \\alpha}}{{2 r_1^2}}-\\frac{{\\gamma m_s}}{{r_1}} \\text {{ (Using 1) }}$
        or,$\\displaystyle \\qquad \\left(v_0^2-\\frac{{2 \\gamma m_s}}{{r_0}}\\right) r_1^2+2 \\gamma m_s r_1-v_0^2 r_0^2 \\sin \\alpha=0$
        So,$\\displaystyle \\qquad r_1=\\frac{{-2 \\gamma m_s \\pm \\sqrt{{4 \\gamma^2 m_s^2+4\\left(v_0^2 r_0^2 \\sin ^2 \\alpha\\right)\\left(v_0^2-\\frac{{2 \\gamma m_s}}{{r_0}}\\right)}}}}{{2\\left(v_0^2-\\frac{{2 \\gamma m_s}}{{r_0}}\\right)}}$
        $\\displaystyle \\qquad =\\frac{{1 \\pm \\sqrt{{1-\\frac{{v_0^2 r_0^2 \\sin ^2 \\alpha}}{{\\gamma m_s}}\\left(\\frac{{2}}{{r_0}}-\\frac{{v_0^2}}{{r m_s}}\\right)}}}}{{\\left(\\frac{{2}}{{r_0}}-\\frac{{v_0}}{{\\gamma m_s}}\\right)}}=\\frac{{r_0\\left[1 \\pm \\sqrt{{1-(2-\\eta) \\eta \\sin ^2 \\alpha}}\\right]}}{{(2-\\eta)}}$
        where $\\eta=v_0^2 r_0 / \\gamma m_s$, ( $m_s$ is the mass of the Sun).
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_1_210(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        A cosmic body $A$ moves to the Sun with velocity $v_0$ (when far from the Sun) and aiming parameter $l$ the arm of the vector $v_0$ relative to the centre of the Sun (Fig. 1.51). Find the minimum distance by which this body will get to the Sun.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        file_name = 'problems-in-general-physics-fig-1-51.png'
        file_path = self._init_file_path(file_name)        
        problemTemplate.add_problem(file_path, 'image/jpg')
        
        soln_s = f"""
        At the minimum separation with the Sun, the cosmic body's velocity is perpendicular to its position vector relative to the Sun. If $r_{{\\min }}$ be the sought minimum distance, from conservation of angular momentum about the Sun $(C)$.
        $\\displaystyle m v_0 l=m v r_{{\\min }} \\text {{ or, }} v=\\frac{{v_0 l}}{{r_{{\\min }}}}$
        From conservation of mechanical energy of the system (sun + cosmic body),
        $\\displaystyle \\qquad \\frac{{1}}{{2}} m v_0^2=-\\frac{{\\gamma m_s m}}{{r_{{\\min }}}}+\\frac{{1}}{{2}} m v^2$
        So, $\\displaystyle \\qquad \\frac{{v_0^2}}{{2}}=-\\frac{{\\gamma m_s}}{{r_{{\\min }}}}+\\frac{{v_0^2}}{{2 r_{{\\min }}^2}} \\quad \\text {{ (using 1) }}$
        or, $\\displaystyle \\qquad v_0^2 r_{{\\min }}^2+2 \\gamma m_s r_{{\\min }}-v_0^2 l^2=0$
        So, $\\displaystyle \\qquad r_{{\\min }}=\\frac{{-2 \\gamma m_s \\pm \\sqrt{{4 \\gamma^2 m^2+4 v_0^2 v_0^2 l^2}}}}{{2 v_0^2}}=\\frac{{-\\gamma m_s \\pm \\sqrt{{\\gamma^2 m_s^2+v_0^4 l^2}}}}{{v_0^2}}$
        Hence, taking positive root
        $\\displaystyle r_{{\\min }}=\\left(\\gamma m_s / v_0^2\\right)\\left[\\sqrt{{1+\\left(l v_0^2 / \\gamma m_s\\right)^2}}-1\\right]$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate

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

        problem_s = f"""
        A particle of mass $m$ is located outside a uniform sphere of mass $M$ at a distance $r$ from its centre. Find:
        (a) the potential energy of gravitational interaction of the particle and the sphere;
        (b) the gravitational force which the sphere exerts on the particle.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Suppose that the sphere has a radius equal to $a$. We may imagine that the sphere is made up of concentric thin spherical shells (layers) with radii ranging from 0 to $a$, and each spherical layer is made up of elementry bands (rings). Let us first calculate potential due to an elementry band of a spherical layer at the point of location of the point mass $m$ (say point $P$ ) (Fig.). As all the points of the band are located at the distance $l$ from the point $P$, so,
        $\\displaystyle \\partial \\varphi=-\\frac{{\\gamma \\partial M}}{{l}}$ (where mass of the band) $\\qquad (1)$
        $\\displaystyle \\partial M=\\left(\\frac{{d M}}{{4 \\pi a^2}}\\right)(2 \\pi a \\sin \\theta)(a d \\theta)$
        $\\displaystyle =\\left(\\frac{{d M}}{{2}}\\right) \\sin \\theta d \\theta\\qquad (2)$
        And $\\qquad l^2=a^2+r^2-2 a r \\cos \\theta\\qquad (3)$
        Differentiating Eq. (3), we get
        $\\displaystyle l d l=a r \\sin \\theta d \\theta\\qquad (4)$
        Hence using above equations
        $\\displaystyle \\partial \\varphi=-\\left(\\frac{{\\gamma d M}}{{2 a r}}\\right) d l\\qquad (5)$
        Now integrating this Eq. over the whole spherical layer
        $\\displaystyle d \\varphi=\\int \\partial \\varphi=-\\frac{{\\gamma d M}}{{2 a r}} \\int_{{r=a}}^{{r+a}} dl$
        So $\\displaystyle d \\varphi=-\\frac{{\\gamma d M}}{{r}} \\qquad (6)$
        Equation (6) demonstrates that the potential produced by a thin uniform spherical layer outside the layer is such as if the whole mass of the layer were concentrated at it's centre; Hence the potential due to the sphere at point $P$;
        $\\displaystyle \\varphi=\\int d \\varphi=-\\frac{{\\gamma}}{{r}} \\int d M=-\\frac{{\\gamma M}}{{r}} \\qquad (7)$
        This expression is similar to that of Eq. (6)
        Hence thte sought potential energy of gravitational interaction of the particle $\\boldsymbol{{m}}$ and the sphere,
        $U=m \\varphi=-\\frac{{\\gamma M m}}{{r}}$
        (b) Using the Eq.,
        $\\displaystyle G_r=-\\frac{{\\partial \\varphi}}{{\\partial r}}$
        $\\displaystyle G_r=-\\frac{{\\gamma M}}{{r^2}} \\quad \\text {{ (using Eq. 7) }}$
        So $\\displaystyle \\vec{{G}}=-\\frac{{\\gamma M}}{{r^3}} \\vec{{r}} \\text {{ and }} \\vec{{F}}=m \\vec{{G}}=-\\frac{{\\gamma m M}}{{r^3}} \\vec{{r}} \\qquad (8)$

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

        problem_s = f"""
        Demonstrate that the gravitational force acting on a particle $A$ inside a uniform spherical layer of matter is equal to zero.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        (The problem has already a clear hint in the answer sheet of the problem book). Here we adopt a different method.
        Let $\\boldsymbol{{m}}$ be the mass of the spherical layer, wich is imagined to be made up of rings. At a point inside the spherical layer at distance $r$ from the centre, the gravitational potential due to a ring element of radius $a$ equals,
        $\\displaystyle d \\varphi=-\\frac{{\\gamma m}}{{2 a r}} d l$ (see Eq. (5) of solution of 1.211)
        So, $\\displaystyle \\qquad\\varphi=\\int d \\varphi=-\\frac{{\\gamma m}}{{2 a r}} \\int_{{a-r}}^{{a+r}} d l=-\\frac{{\\gamma m}}{{a}} \\qquad (1)$
        Hence $\\displaystyle \\qquad G_r=-\\frac{{\\partial \\varphi}}{{\\partial r}}=0$
        Hence gravitational field strength as well as field force becomes zero, inside a thin sphereical layer.
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_1_213(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        A particle of mass $m$ was transferred from the centre of the base of a uniform hemisphere of mass $M$ and radius $R$ into infinity. What work was performed in the process by the gravitational force exerted on the particle by the hemisphere?
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        One can imagine that the uniform hemisphere is made up of thin hemispherical layers of radii ranging from 0 to $R$. Let us consider such a layer (Fig.). Potential at point $\\mathrm{{O}}$, due to this layer is,
        $\\displaystyle d \\varphi=-\\frac{{\\gamma d m}}{{r}}=-\\frac{{3 \\gamma M}}{{R^3}} r d r$, where $d m=\\frac{{M}}{{(2 / 3) \\pi R^3}}\\left(\\frac{{4 \\pi r^2}}{{2}}\\right) d r$
        (This is because all points of each hemispherical shell are equidistant from $O$.)
        Hence, $\\displaystyle \\qquad \\varphi=\\int d \\varphi=-\\frac{{3 \\gamma M}}{{R^3}} \\int_0^R r d r=-\\frac{{3 \\gamma M}}{{2 R}}$
        Hence, the work done by the gravitational field force on the particle of mass $m$, to remove it to infinity is given by the formula
        $A=m \\varphi$, since $\\varphi=0$ at infinity.
        Hence the sought work,
        $\\displaystyle A_{{0 \\rightarrow \\infty}}=-\\frac{{3 \\gamma m M}}{{2 R}}$
        (The work done by the external agent is $-A$.)
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_1_214(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        There is a uniform sphere of mass $M$ and radius $R$. Find the strength $G$ and the potential $\\varphi$ of the gravitational field of this sphere as a function of the distance $r$ from its centre (with $r<R$ and $r>R)$. Draw the approximate plots of the functions $G(r)$ and $\\varphi(r)$
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        In the solution of problem 1.211 , we have obtained $\\varphi$ and $G$ due to a uniform shpere, at a distance $r$ from it's centre outside it. We have from Eqs. (7) and (8) of 1.211,
        $\\displaystyle \\varphi=-\\frac{{\\gamma M}}{{r}} \\text {{ and }} \\vec{{G}}=-\\frac{{\\gamma M}}{{r^3}} \\vec{{r}} \\qquad (A)$
        Accordance with the Eq. (1) of the solution of 1.212 , potential due to a spherical shell of radius $a$, at any point, inside it becomes
        $\\displaystyle \\varphi=\\frac{{\\gamma M}}{{a}}=\\text {{ Const. and }} G_r=-\\frac{{\\partial \\varphi}}{{\\partial r}}=0 \\qquad (B)$
        For a point (say $P$ ) which lies inside the uniform solid sphere, the potential $\\varphi$ at that point may be represented as a sum.
        $\\varphi_{{\\text {{inside }}}}=\\varphi_1+\\varphi_2$
        where $\\varphi_1$ is the potential of a solid sphere having radius $r$ and $\\varphi_2$ is the potential of the layer of radii $r$ and $R$. In accordance with equation (A)
        $\\displaystyle \\varphi_1=-\\frac{{\\gamma}}{{r}}\\left(\\frac{{M}}{{(4 / 3) \\pi R^3}} \\frac{{4}}{{3}} \\pi r^3\\right)=-\\frac{{\\gamma M}}{{R^3}} r^2$
        The potential $\\varphi_2$ produced by the layer (thick shell) is the same at all points inside it. The potential $\\varphi_2$ is easiest to calculate, for the point positioned at the layer's centre. Using Eq. (B)
        $\\displaystyle \\varphi_2=-\\gamma \\int_r^R \\frac{{d M}}{{r}}=-\\frac{{3}}{{2}} \\frac{{\\gamma M}}{{R^3}}\\left(R_1^2-r^2\\right)$
        where $\\displaystyle \\qquad d M=\\frac{{M}}{{(4 / 3) \\pi R^3}} 4 \\pi r^2 d r=\\left(\\frac{{3 M}}{{R^3}}\\right) r^2 d r$
        is the mass of a thin layer between the radii $r$ and $r+d r$.
        Thus $\\displaystyle \\qquad \\varphi_{{\\text {{inside }}}}=\\varphi_1+\\varphi_2=\\left(\\frac{{\\gamma M}}{{2 R}}\\right)\\left(3-\\frac{{r^2}}{{R^2}}\\right) \\qquad (C)$
        $\\displaystyle \\begin{{aligned}}
        &\\text{{From the Eq.}}& \\qquad G_r & =\\frac{{-\\partial \\varphi}}{{\\partial r}} \\\\
        && G_r & =\\frac{{\\gamma M r}}{{R^3}} \\\\
        &\\text{{or}}& \\qquad \\vec{{G}}=-\\frac{{\\gamma M}}{{R^3}} \\vec{{r}} & =-\\gamma \\frac{{4}}{{3}} \\pi \\rho \\vec{{r}}
        \\end{{aligned}}$
        (where $\\displaystyle \\rho=\\frac{{M}}{{\\frac{{4}}{{3}} \\pi R^3}}$, is the density of the sphere)
        The plots $\\varphi(r)$ and $G(r)$ for a uniform sphere of radius $R$ are shown in figure of answersheet. Alternate : Like Gauss's theorem of electrostatics, one can derive Gauss's theorem for gravitation in the form $\\oint \\vec{{G}} \\cdot d \\vec{{S}}=-4 \\pi \\gamma m_{{i n c l o s e d}}$. For calculation of $\\vec{{G}}$ at a point inside the sphere at a distance $r$ from its centre, let us consider a Gaussian surface of radius $r$, Then,
        $\\displaystyle G_r 4 \\pi r^2=-4 \\pi \\gamma\\left(\\frac{{M}}{{R^3}}\\right) r^3 \\text {{ or, }} G_r=-\\frac{{\\gamma M}}{{R^3}} r$
        Hence, $\\displaystyle \\qquad \\vec{{G}}=-\\frac{{\\gamma^* M}}{{R^3}} \\vec{{r}}=-\\gamma \\frac{{4}}{{3}} \\pi \\rho \\vec{{r}}$ as $\\left.\\rho=\\frac{{M}}{{(4 / 3) \\pi R^3}}\\right)$
        So, $\\displaystyle \\qquad \\varphi=\\int_r^{{\\infty}} G_r d r=\\int_r^R-\\frac{{\\gamma M}}{{R^3}} r d r+\\int_R^{{\\infty}}-\\frac{{\\gamma M}}{{r^2}} d r$
        Integrating and summing up, we get,
        $\\displaystyle \\varphi=-\\frac{{\\gamma M}}{{2 R}}\\left(3-\\frac{{r^2}}{{R^2}}\\right)$
        And from Gauss's theorem for outside it :
        $\\displaystyle G_r 4 \\pi r^2=-4 \\pi \\gamma M \\text {{ or }} G_r=-\\frac{{\\gamma M}}{{r^2}}$
        Thus $\\displaystyle \\qquad \\varphi(r)=\\int_r^{{\\infty}} G_r d r=-\\frac{{\\gamma M}}{{r}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_1_215(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Inside a uniform sphere of density $\\rho$ there is a spherical cavity whose centre is at a distance $l$ from the centre of the sphere. Find the strength $G$ of the gravitational field inside the cavity.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Treating the cavity as negative mass of density $-\\rho$ in a uniform sphere density $+\\rho$ and using the superposition principle, the sought field strength is :
        $\\vec{{G}} = \\vec{{G_1}} + \\vec{{G_2}}$
        or $\\displaystyle \\qquad \\vec{{G}}=-\\frac{{4}}{{3}} \\pi \\gamma \\rho \\overrightarrow{{r_{{+}}}}+-\\frac{{4}}{{3}} \\gamma \\pi(-\\rho) \\overrightarrow{{r_{{-}}}}$
        (where $\\overrightarrow{{r_{{+}}}}$and $\\overrightarrow{{r_{{-}}}}$are the position vectors of an orbitrary point $\\boldsymbol{{P}}$ inside the cavity with respect to centre of sphere and cavity respectively.)
        Thus $\\displaystyle \\qquad \\vec{{G}}=-\\frac{{4}}{{3}} \\pi \\gamma \\rho\\left(\\overrightarrow{{r_{{+}}}}-\\overrightarrow{{r_{{-}}}}\\right)=-\\frac{{4}}{{3}} \\pi \\gamma \\rho \\vec{{l}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_1_216(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        A uniform sphere has a mass $M$ and radius $R$. Find the pressure p inside the sphere, caused by gravitational compression, as a function of the distance $r$ from its centre. Evaluate $p$ at the centre of the Earth, assuming it to be a uniform sphere.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        We partition the solid sphere into thin spherical layers and consider a layer of thickness $d r$ lying at a distance $r$ from the centre of the ball. Each spherical layer presses on the layers within it. The considered layer is attracted to the part of the sphere lying within it (the outer part does not act on the layer). Hence for the considered layer
        $\\displaystyle d p 4 \\pi r^2=d F$
        or, $\\displaystyle \\qquad d P 4 \\pi r^2=\\frac{{\\gamma\\left(\\frac{{4}}{{3}} \\pi r^3 \\rho\\right)\\left(4 \\pi r^2 d r \\rho\\right)}}{{r^2}}$
        (where $\\rho$ is the mean density of sphere)
        or, $\\displaystyle \\qquad d p=\\frac{{4}}{{3}} \\pi \\gamma \\rho^2 r d r$
        Thus $\\displaystyle \\qquad p=\\int_r^R d p=\\frac{{2 \\pi}}{{3}} \\gamma \\rho^2\\left(R^2-r^2\\right)$
        (The pressure.must vanish at $r=R$.)
        or, $\\displaystyle \\qquad p=\\frac{{3}}{{8}}\\left(1-\\left(\\dot{{r}}^2 / R^2\\right)\\right) \\gamma M^2 / \\pi R^4$, Putting $\\rho=M /(4 / 3) \\pi R^3$
        Putting $r=0$, we have the pressure at sphere's centre, and treating it as the Earth where mean density is equal to $\\rho=5.5 \\times 10^3 \\mathrm{{~kg}} / \\mathrm{{m}}^3$ and $R=64 \\times 10^2 \\mathrm{{~km}}$ we have,
        $p=1.73 \\times 10^{{11}} \\mathrm{{~Pa}}$ or $1.72 \\times 10^6$ atms.
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_1_217(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Find the proper potential energy of gravitational interaction of matter forming
        (a) a thin uniform spherical layer of mass $m$ and radius $R$;
        (b) a uniform sphere of mass $m$ and radius $R$ (make use of the answer to Problem 1.214).
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        (a) Since the potential at each point of a spherical surface (shell) is constant and is equal to $\\displaystyle \\varphi=-\\frac{{\\gamma m}}{{R}}$, [as we have in Eq. (1) of solution of problem 1.212]
        We obtain in accordance with the equation
        $\\displaystyle \\begin{{aligned}}
        U & =\\frac{{1}}{{2}} \\int d m \\varphi=\\frac{{1}}{{2}} \\varphi \\int d m \\\\
        & =\\frac{{1}}{{2}}\\left(-\\frac{{\\gamma m}}{{R}}\\right) m=-\\frac{{\\gamma m^2}}{{2 R}}
        \\end{{aligned}}$
        (The factor $\\frac{{1}}{{2}}$ is needed otherwise contribution of different mass elements is counted twice.)
        (b) In this case the potential inside the sphere depends only on $r$ (see Eq. (C) of the solution of problem 1.214 )
        $\\displaystyle \\varphi=-\\frac{{3 \\gamma m}}{{2 R}}\\left(1-\\frac{{r^2}}{{3 R^2}}\\right)$
        Here $d m$ is the mass of an elementry spherical layer confined between the radii $r$ and $r+d r$ :
        $\\displaystyle d m=\\left(4 \\pi r^2 d r \\rho\\right)=\\left(\\frac{{3 m}}{{R^3}}\\right) r^2 d r$
        $\\displaystyle \\begin{{gathered}}
        U=\\frac{{1}}{{2}} \\int d m \\varphi \\\\
        =\\frac{{1}}{{2}} \\int_0^{{R}}\\left(\\frac{{3 m}}{{R^3}}\\right) r^2 d r\\left\\{{-\\frac{{3 \\gamma m}}{{2 R}}\\left(1-\\frac{{r^2}}{{3 R^2}}\\right)\\right\\}}
        \\end{{gathered}}$
        After integrating, we get
        $\\displaystyle U=-\\frac{{3}}{{5}} \\frac{{\\gamma m^2}}{{R}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_1_218(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Two Earth's satellites move in a common plane along circular orbits. The orbital radius of one satellite $r=7000 \\mathrm{{~km}}$ while that of the other satellite is $\\Delta r=70 \\mathrm{{~km}}$ less. What time interval separates the periodic approaches of the satellites to each other over the minimum distance?
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Let $\\displaystyle \\omega=\\sqrt{{\\frac{{\\gamma M_E}}{{r^3}}}}=$ circular frequency of the satellite in the outer orbit,
        $\\displaystyle \\omega_0=\\sqrt{{\\frac{{\\gamma M_E}}{{(r-\\Delta r)^3}}}}=$ circular frequency of the satellite in the inner orbit.
        So, relative angular velocity $=\\omega_0 \\pm \\omega$ where - sign is to be taken when the satellites are moving in the same sense and + sign if they are moving in opposite sense. Hence, time between closest approaches
        $\\displaystyle =\\frac{{2 \\pi}}{{\\omega_0 \\pm \\omega}}=\\frac{{2 \\pi}}{{\\sqrt{{\\gamma M_E}} / r^{{3 / 2}} \\frac{{1}}{{2 \\Delta r}}+\\delta}}=\\left\\{{\\begin{{array}}{{c}}
        4.5 \\text {{ days }}(\\delta=0) \\\\
        0.80 \\text {{ hour }}(\\delta=2)
        \\end{{array}}\\right.$
        where $\\delta$ is 0 in the first case and 2 in the second case.
        """ 
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_1_219(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Calculate the ratios of the following accelerations: the acceleration $w_1$ due to the gravitational force on the Earth's surface, the acceleration $w_2$ due to the centrifugal force of inertia on the Earth's equator, and the acceleration $w_3$ caused by the Sun to the bodies on the Earth.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        $\\begin{{aligned}} 
        & \\omega_1=\\frac{{\\gamma M}}{{R^2}}=\\frac{{6.67 \\times 10^{{-11}} \\times 5.96 \\times 10^{{24}}}}{{\\left(6.37 \\times 10^6\\right)^2}}=9.8 \\mathrm{{~m}} / \\mathrm{{s}}^2 \\\\
        & \\omega_2=\\omega^2 R=\\left(\\frac{{2 \\pi}}{{T}}\\right)^2 R=\\left(\\frac{{2 \\times 22}}{{24 \\times 3600 \\times 7}}\\right)^2 6.37 \\times 10^6=0.034 \\mathrm{{~m}} / \\mathrm{{s}}^2 \\\\
        & \\text {{ and }} \\quad \\omega_3=\\frac{{\\gamma M_S}}{{R_{{\\text {{mean }}}}^2}}=\\frac{{6.67 \\times 10^{{-11}} \\times 1.97 \\times 10^{{30}}}}{{\\left(149.50 \\times 10^6 \\times 10^3\\right)^2}}=5.9 \\times 10^{{-3}} \\mathrm{{~m}} / \\mathrm{{s}}^2 \\\\
        & \\text {{ Then }} \\quad \\omega_1: \\omega_2: \\omega_3=1: 0.0034: 0.0006
        \\end{{aligned}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_1_220(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        At what height over the Earth's pole the free-fall acceleration decreases by one per cent; by half?
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Let $h$ be the sought height in the first case. so
        $\\displaystyle \\begin{{gathered}}
        \\frac{{99}}{{100}} g=\\frac{{\\gamma M}}{{(R+h)^2}} \\\\
        =\\frac{{\\gamma M}}{{R^2\\left(1+\\frac{{h}}{{R}}\\right)^2}}=\\frac{{g}}{{\\left(1+\\frac{{h}}{{R}}\\right)^2}}
        \\end{{gathered}}$
        or $\\displaystyle \\qquad \\frac{{99}}{{100}}=\\left(1+\\frac{{h}}{{R}}\\right)^{{-2}}$
        From the statement of the problem, it is obvious that in this case $h \\ll R$
        Thus $\\displaystyle \\qquad \\frac{{99}}{{100}}=\\left(1-\\frac{{2 h}}{{R}}\\right) \\text {{ or }} h=\\frac{{R}}{{200}}=\\left(\\frac{{6400}}{{200}}\\right) \\mathrm{{km}}=32 \\mathrm{{~km}}$
        In the other case if $h^{{\\prime}}$ be the sought height, than
        $\\displaystyle \\qquad \\frac{{g}}{{2}}=g\\left(1+\\frac{{h^{{\\prime}}}}{{R}}\\right)^{{-2}} \\text {{ or }} \\frac{{1}}{{2}}=\\left(1+\\frac{{h^{{\\prime}}}}{{R}}\\right)^{{-2}}$
        From the language of the problem, in this case $h^{{\\prime}}$ is not very small in comparision with $R$. Therefore in this case we cannot use the approximation adopted in the previous case.
        Here, $\\displaystyle \\left(1+\\frac{{h^{{\\prime}}}}{{R}}\\right)^2=2 \\qquad$ So, $\\displaystyle \\frac{{h^{{\\prime}}}}{{R}}= \\pm \\sqrt{{2}}-1$
        As - ve sign is not acceptable
        $\\displaystyle h^{{\\prime}}=(\\sqrt{{2}}-1) R=(\\sqrt{{2}}-1) 6400 \\mathrm{{~km}}=2650 \\mathrm{{~km}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate

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

        problem_s = f"""
        On the pole of the Earth a body is imparted velocity $v_0$ directed vertically up. Knowing the radius of the Earth and the freefall acceleration on its surface, find the height to which the body will ascend. The air drag is to be neglected.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Let the mass of the body be $m$ and let it go upto a height $h$.
        From conservation of mechanical energy of the system
        $\\displaystyle -\\frac{{\\gamma M m}}{{R}}+\\frac{{1}}{{2}} m v_0^2=\\frac{{-\\gamma M m}}{{(R+h)}}+0$
        Using $\\displaystyle \\frac{{\\gamma M}}{{R^2}}=g$, in above equation and on solving we get,
        $\\displaystyle h=\\frac{{R v_0^2}}{{2 g R-v_0^2}}$

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

        problem_s = f"""
        An artificial satellite is launched into a circular orbit around the Earth with velocity $v$ relative to the reference frame moving translationally and fixed to the Earth's rotation axis. Find the distance from the satellite to the Earth's surface. The radius of the Earth and the free-fall acceleration on its surface are supposed to be known.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Gravitational pull provides the required centripetal acceleration to the satelite. Thus if $h$ be the sought distance, we have
        $\\begin{{aligned}}
        &\\text{{so, }} \\qquad \\frac{{m v^2}}{{(R+h)}}=\\frac{{\\gamma m M}}{{(R+h)^2}} \\text {{ or, }}(R+h) v^2=\\gamma M \\\\
        &\\text{{or, }} \\qquad R v^2+h v^2=g R^2, \\text {{ as }} g=\\frac{{\\gamma M}}{{R^2}} \\\\
        &\\text{{Hence}} \\qquad h=\\frac{{g R^2-R v^2}}{{v^2}}=R\\left[\\frac{{g R}}{{v^2}}-1\\right]
        \\end{{aligned}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_1_223(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Calculate the radius of the circular orbit of a stationary Earth's satellite, which remains motionless with respect to its surface. What are its velocity and acceleration in the inertial reference frame fixed at a given moment to the centre of the Earth?
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        A satellite that hovers above the earth's equator and corotates with it moving from the west to east with the diurnal angular velocity of the earth appears stationary to an observer on the earth. It is called geostationary. For this calculation we may neglect the annual motion of the earth as well as all other influences. Then, by Newton's law,
        $\\displaystyle \\frac{{\\gamma M m}}{{r^2}}=m\\left(\\frac{{2 \\pi}}{{T}}\\right)^2 r$
        where $M=$ mass of the earth, $T=86400$ seconds = period of daily rotation of the earth and $r=$ distance of the satellite from the centre of the earth. Then
        $\\displaystyle r=\\sqrt[3]{{\\gamma M\\left(\\frac{{T}}{{2 \\pi}}\\right)^2}}$
        Substitution of $M=5.96 \\times 10^{{24}} \\mathrm{{~kg}}$ gives
        $\\displaystyle r=4.220 \\times 10^4 \\mathrm{{~km}}$
        The instantaneous velocity with respect to an inertial frame fixed to the centre of the earth at that moment will be
        $\\displaystyle \\left(\\frac{{2 \\pi}}{{T}}\\right) r=3.07 \\mathrm{{~km}} / \\mathrm{{s}}$
        and the acceleration will be the centripetal acceleration.
        $\\displaystyle \\left(\\frac{{2 \\pi}}{{T}}\\right)^2 r=0.223 \\mathrm{{~m}} / \\mathrm{{s}}^2$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_1_224(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        A satellite revolving in a circular equatorial orbit of ra$\\operatorname{{dius}} R=2.00 \\cdot 10^4 \\mathrm{{~km}}$ from west to east appears over a certain point at the equator every $\\tau=11.6$ hours. Using these data, calculate the mass of the Earth. The gravitational constant is supposed to be known.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        We know from the previous problem that a satellite moving west to east at a distance $R=2 \\cdot 00 \\times 10^4 \\mathrm{{~km}}$ from the centre of the earth will be revolving round the earth with an angular velocity faster than the earth's diurnal angualr velocity. Let
        $\\omega=$ angular velocity of the satellite
        $\\displaystyle \\omega_0=\\frac{{2 \\pi}}{{T}}=$ anuglar velocity of the earth. Then
        $\\displaystyle \\omega-\\omega_0=\\frac{{2 \\pi}}{{\\tau}}$
        as the relative angular velocity with respect to earth. Now by Newton's law
        $\\displaystyle \\begin{{aligned}}
        &\\frac{{\\gamma M}}{{R^2}}=\\omega^2 R \\\\
        \\text{{so, }} \\qquad M & =\\frac{{R^3}}{{\\gamma}}\\left(\\frac{{2 \\pi}}{{\\tau}}+\\frac{{2 \\pi}}{{T}}\\right)^2 \\\\
        & =\\frac{{4 \\pi^2 R^3}}{{\\gamma T^2}}\\left(1+\\frac{{T}}{{\\tau}}\\right)^2
        \\end{{aligned}}$
        Substitution gives $M=6.27 \\times 10^{{24}} \\mathrm{{~kg}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_1_225(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        A satellite revolves from east to west in a circular equatorial orbit of radius $R=1.00 \\cdot 10^4 \\mathrm{{~km}}$ around the Earth. Find the velocity and the acceleration of the satellite in the reference frame fixed to the Earth.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        The velocity of the satellite in the inertial space fixed frame is $\\sqrt{{\\frac{{\\gamma M}}{{R}}}}$ east to west. With respect to the Earth fixed frame, from the $\\vec{{v}}_1^{{\\prime}}=\\vec{{v}}-(\\vec{{w}} \\times \\vec{{r}})$ the velocity is
        $\\displaystyle v^{{\\prime}}=\\frac{{2 \\pi R}}{{T}}+\\sqrt{{\\frac{{\\gamma M}}{{R}}}}=7.03 \\mathrm{{~km}} / \\mathrm{{s}}$
        Here $M$ is the mass of the earth and $T$ is its period of rotation about its own axis.
        It would be $\\displaystyle -\\frac{{2 \\pi R}}{{T}}+\\sqrt{{\\frac{{\\gamma M}}{{R}}}}$, if the satellite were moving from west to east.
        To find the acceleration we note the formula
        $\\displaystyle m \\vec{{w}}^{{\\prime}}=\\vec{{F}}+2 m(\\vec{{v}}^{{\\prime}} \\times \\vec{{\\omega}})+m \\omega^2 \\vec{{R}}$
        Here $\\displaystyle \\vec{{F}}=-\\frac{{\\gamma M m}}{{R^3}} \\vec{{R}}$ and $\\vec{{v}}^{{\\prime}} \\perp \\vec{{\\omega}}$ and $\\vec{{v}}^{{\\prime}} \\times \\vec{{\\omega}}$ is directed towards the centre of the Earth.
        Thus $\\displaystyle \\qquad w^{{\\prime}}=\\frac{{\\gamma M}}{{R^2}}+2\\left(\\frac{{2 \\pi R}}{{T}}+\\sqrt{{\\frac{{\\gamma M}}{{R}}}}\\right) \\frac{{2 \\pi}}{{T}}-\\left(\\frac{{2 \\pi}}{{T}}\\right)^2 R$
        toward the earth's rotation axis
        $\\displaystyle =\\frac{{\\gamma M}}{{R^2}}+\\frac{{2 \\hat{{}}}}{{T}}\\left[\\frac{{2 \\pi R}}{{T}}+2 \\sqrt{{\\frac{{\\gamma M}}{{R}}}}\\right]=4.94 \\mathrm{{~m}} / \\mathrm{{s}}^2 \\text {{ on substitution. }}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_1_226(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        A satellite must move in the equatorial plane of the Earth close to its surface either in the Earth's rotation direction or against it. Find how many times the kinetic energy of the satellite in the latter case exceeds that in the former case (in the reference frame fixed to the Earth).
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        From the well known relationship between the velocities of a particle w.r.t a space fixed frame $(K)$ rotating frame $\\left(K^{{\\prime}}\\right) \\vec{{v}}=\\overrightarrow{{v}}^{{\\prime}}+(\\vec{{w}} \\times \\vec{{r}})$
        $\\displaystyle v_1^{{\\prime}}=v-\\left(\\frac{{2 \\pi}}{{T}}\\right) R$
        Thus kinetic energy of the satellite in the earth's frame
        $\\displaystyle T_1^{{\\prime}}=\\frac{{1}}{{2}} m v_1^{{\\prime 2}}=\\frac{{1}}{{2}} m\\left(v-\\frac{{2 \\pi R}}{{T}}\\right)^2\\qquad (1)$
        Obviously when the satellite moves in opposite sense comared to the rotation of the Earth its velocity relative to the same frame would be
        $\\displaystyle v_2^{{\\prime}}=v+\\left(\\frac{{2 \\pi}}{{T}}\\right) R$
        And kinetic energy
        $\\displaystyle T_2^{{\\prime}}=\\frac{{1}}{{2}} m v_2^{{\\prime 2}}=\\frac{{1}}{{2}} m\\left(v+\\frac{{2 \\pi R}}{{T}}\\right)^2 \\qquad (2)$
        From (1) and (2)
        $\\displaystyle T^{{\\prime}}=\\frac{{\\left(v+\\frac{{2 \\pi R}}{{T}}\\right)^2}}{{\\left(v-\\frac{{2 \\pi R}}{{T}}\\right)^2}} \\qquad (3)$
        Now from Newton's second law
        $\\displaystyle \\frac{{\\gamma M m}}{{R^2}}=\\frac{{m v^2}}{{R}} \\text {{ or }} v=\\sqrt{{\\frac{{\\gamma M}}{{R}}}}=\\sqrt{{g R}} \\qquad (4)$
        Using (4) and (3) .
        $\\displaystyle \\frac{{T_2^{{\\prime}}}}{{T_1^{{\\prime}}}}=\\frac{{\\left(\\sqrt{{g R}}+\\frac{{2 \\pi R}}{{T}}\\right)^2}}{{\\left(\\sqrt{{g R}}-\\frac{{2 \\pi R}}{{T}}\\right)^2}}=1.27 \\text {{ nearly (Using Appendices) }}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_1_227(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        An artificial satellite of the Moon revolves in a circular orbit whose radius exceeds the radius of the Moon $\\eta$ times. In the process of motion the satellite experiences a slight resistance due to cosmic dust. Assuming the resistance force to depend on the velocity of the satellite as $F=\\alpha v^2$, where $\\alpha$ is a constant, find how long the satellite will stay in orbit until it falls onto the Moon's surface.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        For a satellite in a circular orbit about any massive body, the following relation holds between kinetic, potential \\& total energy :
        $T=-E, U=2 E \\qquad (1)$
        Thus since total mechanical energy must decrease due to resistance of the cosmic dust, the kintetic energy will increase and the satellite will 'fall', We see then, by work energy theorm
        $d T=-d E=-d A_{{f r}}$
        So, $\\displaystyle \\qquad m v d v=\\alpha v^2 v d t \\quad \\text {{ or, }} \\quad \\frac{{\\alpha d t}}{{m}}=\\frac{{d v}}{{v^2}}$
        Now from Netow's law at an arbitray radius $r$ from the moon's centre.
        $\\displaystyle \\frac{{v^2}}{{r}}=\\frac{{\\gamma M}}{{r^2}} \\text {{ or }} v=\\sqrt{{\\frac{{\\gamma M}}{{r}}}}$
        ( $M$ is the mass of the moon.) Then
        $\\displaystyle v_i=\\sqrt{{\\frac{{\\gamma M}}{{\\eta R}}}}, v_f=\\sqrt{{\\frac{{\\gamma M}}{{R}}}}$
        where $R=$ moon's radius. So
        $\\displaystyle\\int_{{v_1}}^{{v_f}} \\frac{{d v}}{{v^2}}=\\frac{{\\alpha}}{{m}} \\int_0^\\tau d t=\\frac{{\\alpha \\tau}}{{m}}$
        or, $\\displaystyle \\quad \\tau=\\frac{{m}}{{\\alpha}}\\left(\\frac{{1}}{{v_i}}-\\frac{{1}}{{v_f}}\\right)=\\frac{{m}}{{\\alpha \\sqrt{{\\frac{{M}}{{\\gamma}}}}}}(\\sqrt{{\\eta}}-1)=\\frac{{m}}{{\\alpha \\sqrt{{g R}}}}(\\sqrt{{\\eta}}-1)$
        where $g$ is moon's gravity. The averaging implied by Eq. (1) (for noncircular orbits) makes the result approximate.
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_1_228(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Calculate the orbital and escape velocities for the Moon. Compare the results obtained with the corresponding velocities for the Earth.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        From Newton's second law
        $\\displaystyle \\frac{{\\gamma M m}}{{R^2}}=\\frac{{m v_0^2}}{{R}} \\text {{ or }} v_0=\\sqrt{{\\frac{{\\gamma M}}{{R}}}}=1.67 \\mathrm{{~km}} / \\mathrm{{s}} \\qquad (1)$
        From conservation of mechanical energy
        $\\displaystyle \\frac{{1}}{{2}} m v_e^2-\\frac{{\\gamma M m}}{{R}}=0 \\text {{ or, }} v_e=\\sqrt{{\\frac{{2 \\gamma M}}{{R}}}}=2.37 \\mathrm{{~km}} / \\mathrm{{s}}^2 \\qquad (2)$
        In Eq. (1) and (2), $M$ and $R$ are the mass of the moon and its radius. In Eq. (1) if $M$ and $R$ represent the mass of the earth and its radius, then, using appendices, we can easily get
        $v_0=7.9 \\mathrm{{~km}} / \\mathrm{{s}} \\text {{ and }} v_c=11.2 \\mathrm{{~km}} / \\mathrm{{s}} \\text {{. }}$
        """ 
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_1_229(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        A spaceship approaches the Moon along a parabolic trajectory which is almost tangent to the Moon's surface. At the moment of the maximum approach the brake rocket was fired for a short time interval, and the spaceship was transferred into a circular orbit of a Moon satellite. Find how the spaceship velocity modulus increased in the process of braking.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        In a parabolic orbit, $E=0$
        So $\\displaystyle \\frac{{1}}{{2}} m v_i^2-\\frac{{\\gamma M m}}{{R}}=0 \\text {{ or, }} v_i=\\sqrt{{2}} \\sqrt{{\\frac{{\\gamma M}}{{R}}}}$
        where $M=$ mass of the Moon, $R=$ its radius. (This is just the escape velocity.) On the other hand in orbit
        $\\displaystyle m v_f^2 R=\\frac{{\\gamma M m}}{{R^2}} \\text {{ or }} v_f=\\sqrt{{\\frac{{\\gamma M}}{{R}}}}$
        Thus $\\displaystyle \\Delta v=(1-\\sqrt{{2}}) \\sqrt{{\\frac{{\\gamma M}}{{R}}}}=-0.70 \\mathrm{{~km}} / \\mathrm{{s}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_1_230(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        A spaceship is launched into a circular orbit close to the Earth's surface. What additional velocity has to be imparted to the spaceship to overcome the gravitational pull?
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        From 1.228 for the Earth surface
        $\\displaystyle \\dot{{v}}_0=\\sqrt{{\\frac{{\\gamma M}}{{R}}}} \\text {{ and }} v_e=\\sqrt{{\\frac{{2 \\gamma M}}{{R}}}}$
        Thus the sought additional velocity
        $\\displaystyle \\Delta v=v_e-v_0=\\sqrt{{\\frac{{\\gamma M}}{{R}}}}(\\sqrt{{2}}-1)=g R(\\sqrt{{2}}-1)$
        This 'kick' in velocity must be given along the direction of motion of the satellite in its orbit.
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate

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

        problem_s = f"""
        At what distance from the centre of the Moon is the point at which the strength of the resultant of the Earth's and Moon's gravitational fields is equal to zero? The Earth's mass is assumed to be $\\eta=81$ times that of the Moon, and the distance between the centres of these planets $n=60$ times greater than the radius of the Earth R.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Let $r$ be the sought distance, then
        $\\begin{{gathered}}
        \\frac{{\\gamma \\eta M}}{{(n R-r)^2}}=\\frac{{\\gamma M}}{{r^2}} \\text {{ or }} \\eta r^2=(n R-r)^2 \\\\
        \\text {{or }} \\quad \\sqrt{{\\eta}} r=(n R-r) \\text {{ or }} r=\\frac{{n R}}{{\\sqrt{{\\eta}}+1}}=3.8 \\times 10^4 \\mathrm{{~km}} .
        \\end{{gathered}}$

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

        problem_s = f"""
        What is the minimum work that has to be performed to bring a spaceship of mass $m=2.0 \\cdot 10^3 \\mathrm{{~kg}}$ from the surface of the Earth to the Moon?
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Between the earth and the moon, the potential energy of the spaceship will have a maximum at the point where the attractions of the earth and the moon balance each other. This maximum P.E. is approximately zero. We can also neglect the contribution of either body to the p.E. of the spaceship sufficiently near the other body. Then the minimum energy that must be imparted to the spaceship to cross the maximum of the P.E. is clearly (using $E$ to denote the earth)
        $\\displaystyle \\frac{{\\gamma M_E^m}}{{R_E}}$
        With this energy the spaceship will cross over the hump in the P.E. and coast down the hill of p.E. towards the moon and crashland on it. What the problem seeks is the minimum energy reguired for softlanding. That reguies the use of rockets to loving about the braking of the spaceship and since the kinetic energy of the gases ejected from the rocket will always be positive, the total energy required for softlanding is greater than that required for crashlanding. To calculate this energy we assume that the rockets are used fairly close to the moon when the spaceship has nealy attained its terminal velocity on the moon $\\displaystyle\\sqrt{{\\frac{{2 \\gamma M_O}}{{R_0}}}}$ where $M_0$ is the mass of the moon and $R_0$ is its radius. In general $d E=v d p$ and since the speed of the ejected gases is not less than the speed of the rocket, and momentum transfered to the ejected gases must equal the momentum of the spaceship the energy $E$ of the gass ejected is not less than the kinetic energy of spaceship
        $\\displaystyle \\frac{{\\gamma M_0 m}}{{R_0}}$
        Addding the two we get the minimum work done on the ejected gases to bring about the softlanding.
        $\\displaystyle A_{{\\min }} \\approx \\gamma m\\left(\\frac{{M_E}}{{R_E}}+\\frac{{M_0}}{{R_0}}\\right)$
        On substitution we get $1.3 \\times 10^8 \\mathrm{{~kJ}}$.
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_1_233(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Find approximately the third cosmic velocity $v_3$, i.e. the minimum velocity that has to be imparted to a body relative to the Earth's surface to drive it out of the Solar system. The rotation of the Earth about its own axis is to be neglected.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Assume first that the attraction of the earth can be neglected. Then the minimum velocity, that must be imparted to the body to escape from the Sun's pull, is, as in 1.230, equal to
        $(\\sqrt{{2}}-1) v_1$
        where $v_1^2=\\gamma M_s / r, r=$ radius of the earth's orbit, $M_s=$ mass of the Sun.
        In the actual case near the earth, the pull of the Sun is small and does not change much over distances, which are several times the radius of the Earth. The velocity $v_3$ in question is that which overcomes the earth's pull with sufficient velocity to escape the Sun's pull.
        Thus $\\displaystyle \\qquad \\frac{{1}}{{2}} m v_3^2-\\frac{{\\gamma M_E}}{{R}}=\\frac{{1}}{{2}} m(\\sqrt{{2}}-1)^2 v_1^2$
        where $R=$ radius of the earth, $M_E=$ mass of the earth.
        Writing $v_1^2=\\gamma M_E / R$, we get
        $v_3=\\sqrt{{2 v_2^2+(\\sqrt{{2}}-1)^2 v_1^2}}=16.6 \\mathrm{{~km}} / \\mathrm{{s}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate

    def _init_file_path(self, file_name):
        import pathlib
        from xv.util import locatePath
        rootFolder = pathlib.Path(__file__).parent.absolute()
        file_path = locatePath(file_name, 
                               parent_depth = 6,
                               rootFolder = rootFolder,
                               part_match = False,
                               search_type = 'file',
                               verbose = self.verbose,
                               )
        return os.path.join(rootFolder, file_path)