'''
Created on 01-Apr-2021
@author: rishi_priyansh
'''

import random
import inspect
import traceback
from sympy import (symbols, Symbol)
import os

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
        
class EntropyManager(BaseManager):
    '''
    EntropyManager
    Example:
        ke = EntropyManager()
        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(EntropyManager, cls).__new__(cls, *args, **kwargs)
        for base_class in EntropyManager.__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_2_113',
			'_problem_2_114',
			'_problem_2_115',
			'_problem_2_116',
			'_problem_2_117',
			'_problem_2_118',
			'_problem_2_119',
			'_problem_2_120',
			'_problem_2_121',
			'_problem_2_122',
			'_problem_2_123',
			'_problem_2_124',
			'_problem_2_125',
			'_problem_2_126',
			'_problem_2_127',
			'_problem_2_128',
			'_problem_2_129',
			'_problem_2_130',
			'_problem_2_131',
			'_problem_2_132',
			'_problem_2_133',
			'_problem_2_134',
			'_problem_2_135',
			'_problem_2_136',
			'_problem_2_137',
			'_problem_2_138',
			'_problem_2_139',
			'_problem_2_140',
			'_problem_2_141',
			'_problem_2_142',
			'_problem_2_143',
			'_problem_2_144',
			'_problem_2_145',
			'_problem_2_146',
			'_problem_2_147',
			'_problem_2_148',
			'_problem_2_149',
			'_problem_2_150',
			'_problem_2_151',
			'_problem_2_152',
			'_problem_2_153',
			'_problem_2_154',
			'_problem_2_155',
			'_problem_2_156',
			'_problem_2_157',
			'_problem_2_158',
			'_problem_2_159',
            
			])
        pass
                
    def _problem_2_113(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        In which case will the efficiency of a Carnot cycle be higher: when the hot body tem perature is increased by $\\Delta T$, or when the cold body temperature is decreased by the same magnitude?
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        The efficiency is given by
        $\\displaystyle \\eta=\\frac{{T_1-T_2}}{{T_1}}, T_1>T_2$
        Now in the two cases the efficiencies are
        $\\begin{{aligned}}
        \\eta_h & =\\frac{{T_1+\\Delta T-T_2}}{{T_1+\\Delta T}}, \\quad T_1 \\text {{ increased }} \\\\
        \\eta_l & =\\frac{{T_1-T_2+\\Delta T}}{{T_1}}, T_2 \\text {{ decreased }}
        \\end{{aligned}}$
        Thus $\\qquad \\eta_h<n_l$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_114(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Hydrogen is used iu a Carnot cycle as a working substance. Find the efficiency of the cycle, if as a result of an adiabatic expansion
        (a) the gas volume increases $n=2.0$ times;
        (b) the pressure decreases $n=2.0$ times.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        For $\\displaystyle H_2, \\gamma=\\frac{{7}}{{5}}$
        $\\begin{{gathered}}
        p_1 V_1=p_2 V_2, p_3 V_3=p_4 V_4 \\\\
        p_2 V_2^\\gamma=p_3 V_3^\\gamma, p_1 V_1^\\gamma=p_4 V_4^\\gamma
        \\end{{gathered}}$
        Define $n$ by $V_3=n V_2$
        Then $p_3=p_2 n^{{-\\gamma}}$ so
        $p_4 V_4=p_3 V_3=p_2 V_2 n^{{1-\\gamma}}=p_1 V_1 n^{{1-\\gamma}}$
        $p_4 V_4^\\gamma=p_1 V_1^\\gamma$ so $V_4^{{1-\\gamma}}=V_1^{{1-\\gamma}} n^{{1-\\gamma}}$ or $V_4=n V_1$
        Also $\\displaystyle Q_1=p_2 V_2 \\ln \\frac{{V_2}}{{V_1}}, Q_2^{{\\prime}}=p_3 V_3 \\ln \\frac{{V_3}}{{V_4}} n^{{1-\\gamma}}=p_2 v_2 \\ln \\frac{{V_3}}{{v_4}}$
        Finally $\\displaystyle \\eta=1-\\frac{{Q_2}}{{Q_1}}=1-n^{{1-\\gamma}}=0 \\cdot 242$
        (b) Define $n$ by $\\displaystyle p_3=\\frac{{p_2}}{{n}}$
        $\\displaystyle p_2 V_2^\\gamma=\\frac{{p_2}}{{n}} V_3^\\gamma \\text {{ or }} V_3=n^{{1 / \\gamma}} V_2$
        So we get the formulae here by $n \\rightarrow n^{{1 / \\gamma}}$ in the previous case.
        $\\displaystyle \\eta=1-n^{{(1 / \\gamma)-1}}=1-n^{{-\\frac{{2}}{{7}}}} \\approx 0.18$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_115(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        A heat engine employing a Carnot cycle with an efficiency of $\\eta=10 \\%$ is used as a refrigerating machine, the thermal reservoirs being the same. Find its refrigerating efficiency $\\varepsilon$.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Used as a refrigerator, the refrigerating efficiency of a heat engine is given by 
        $\\displaystyle \\varepsilon=\\frac{{Q_2^{{\\prime}}}}{{A}}=\\frac{{Q_2^{{\\prime}}}}{{Q_1-Q_2}}=\\frac{{Q_2^{{\\prime}} / Q_1}}{{1-\\frac{{Q_2^{{\\prime}}}}{{Q_1}}}}=\\frac{{1-\\eta}}{{\\eta}}=9$ here, 
        where $\\eta$ is the efficiency of the heat engine.
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate

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

        problem_s = f"""
        An ideal gas goes through a cycle consisting of alternate isothermal and adiabatic curves (Fig. 2.2). The isothermal processes proceed at the temperatures $T_1, T_2$, and $T_3$. Find the efficiency of such a cycle, if in each isothermal expansion the gas volume încreases in the same proportion.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        file_name = 'problems-in-general-physics-fig-2-2.png'
        file_path = self._init_file_path(file_name)        
        problemTemplate.add_problem(file_path, 'image/jpg')
        
        soln_s = f"""
        Given $V_2=n V_1, V_4=n V_3$
        $Q_1=$ Heat taken at the upper temperature
        $=R T_1 \\ln n+R T_2 \\ln n=R\\left(T_1+T_2\\right) \\ln n$
        Now $\\displaystyle \\quad T_1 V_2^{{\\gamma-1}}=T_2 V_3^{{\\gamma-1}}$ or $V_3=\\left(\\frac{{T_1}}{{T_2}}\\right)^{{\\frac{{1}}{{\\gamma-1}}}} V_2$
        Similarly $\\displaystyle \\quad V_5=\\left(\\frac{{T_2}}{{T_3}}\\right)^{{\\frac{{1}}{{\\gamma-1}}}} V_4, V_6=\\left(\\frac{{T_1}}{{T_3}}\\right)^{{\\frac{{1}}{{\\gamma-1}}}} V_1$
        Thus $Q_2=$ heat ejected at the lower temperature $\\displaystyle =-R T_3 \\ln \\frac{{V_6}}{{V_5}}$
        $\\begin{{aligned}}
        &=-R T_3 \\ln \\left(\\frac{{T_1}}{{T_2}}\\right)^{{\\frac{{1}}{{\\gamma-1}}}} \\frac{{V_1}}{{V_4}}=-R T_3 \\ln \\left(\\frac{{T_1}}{{T_2}}\\right)^{{\\frac{{1}}{{\\gamma-1}}}} \\frac{{V_2}}{{n^2 V_3}} \\\\
        &=-R T_3 \\ln \\left(\\frac{{T_1}}{{T_2}}\\right)^{{\\frac{{1}}{{\\gamma-1}}}} \\frac{{1}}{{n^2}}\\left(\\frac{{T_1}}{{T_2}}\\right)^{{-\\frac{{1}}{{\\gamma-1}}}}=2 R T_3 \\ln n
        \\end{{aligned}}$
        Thus $\\displaystyle \\eta=1-\\frac{{2 T_3}}{{T_1+T_2}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_117(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Find the efficiency of a cycle consisting of two isochoric and two adiabatic lines, if the volume of the ideal gas changes $n=10$ times within the cycle. The working substance is nitrogen.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        $\\begin{{gathered}}
        Q_2^{{\\prime}}=C_V\\left(T_2-T_3\\right)=\\frac{{C_V}}{{R}} V_2\\left(p_2-p_3\\right) \\\\
        Q_1=\\frac{{C_V}}{{R}} V_1\\left(p_1-p_4\\right) \\\\
        \\text {{ Thus }} \\quad \\eta=1-\\frac{{V_2\\left(p_2-p_3\\right)}}{{V_1\\left(p_1-p_4\\right)}}
        \\end{{gathered}}$
        On the other hand,
        $\\displaystyle 6 p_1 V_1^\\gamma=p_2 V_2^\\gamma, p_3 V_2^\\gamma=p_4 V_1^\\gamma \\text {{ also }} V_2=n V_1$
        Thus $p_1=p_2 n^\\gamma, p_4=p_3 n^\\gamma$
        and $\\eta=1-n^{{1-\\gamma}}$, with $\\displaystyle \\gamma=\\frac{{7}}{{5}}$ for $N_2$ this is $\\eta=0.602$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_118(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Find the efficiency of a cycle consisting of two isobaric and two adiabatic lines, if the pressure changes $n$ times within the cycle. The working substance is an ideal gas whose adiabatic exponent is equal to $\\gamma$.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        $\\displaystyle Q_1=\\frac{{C_P}}{{R}} p_1\\left(V_2-V_1\\right), Q_2^{{\\prime}}=\\frac{{C_P}}{{R}} p_2\\left(V_3-V_4\\right)$
        So $\\displaystyle \\quad \\eta=1-\\frac{{p_2\\left(V_3-V_4\\right)}}{{p_1\\left(V_2-V_1\\right)}}$
        Now $\\displaystyle p_1=n p_2, p_1 V_2^\\gamma$ or $V_3=n^{{\\frac{{1}}{{\\gamma}}}} V_2$
        $\\displaystyle p_2 V_4^\\gamma=p_1 V_1^\\gamma$ or $V_4=n^{{\\frac{{1}}{{\\gamma}}}} V_1$
        so $\\displaystyle \\eta=1-\\frac{{1}}{{n}} \\cdot n^{{\\frac{{1}}{{\\gamma}}}}=1-n^{{\\frac{{1}}{{\\gamma}}-1}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_119(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        An ideal gas whose adiabatic exponent equals $\\gamma$ goes through a cycle consisting of two isochoric and two isobaric lines. Find the efficiency of such a cycle, if the absolute temperature of the gas rises $n$ times both in the isochoric heating and in the isobaric expansion.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Since the absolute temperature of the gas rises $n$ times both in the isochoric heating and in the isobaric expansion
        $p_1=n p_2$ and $V_2=n V_1$. Heat taken is
        $Q_1=Q_{{11}}+Q_{{12}}$
        where $\\displaystyle Q_{{11}}=C_p(n-1) T_1$ and $\\displaystyle Q_{{12}}=C_V T_1\\left(1-\\frac{{1}}{{n}}\\right)$
        Heat rejected is
        $\\begin{{aligned}}
        & Q_2^{{\\prime}}=Q_{{21}}^{{\\prime}}+Q_{{22}}^{{\\prime}} \\text {{ where }} \\\\
        & Q_{{21}}^{{\\prime}}=C_V T_1(n-1), Q_{{22}}^{{\\prime}}=C_p T_1\\left(1-\\frac{{1}}{{n}}\\right) \\\\
        & \\text {{Thus }} \\eta=1-\\frac{{Q_2^{{\\prime}}}}{{Q_1}}=1-\\frac{{C_V(n-1)+C_p\\left(1-\\frac{{1}}{{n}}\\right)}}{{C_p(n-1)+C_V\\left(1-\\frac{{1}}{{n}}\\right)}} \\\\
        & =1-\\frac{{\\left(n-1+\\gamma\\left(1-\\frac{{1}}{{n}}\\right)\\right.}}{{\\gamma(n-1)+\\left(1-\\frac{{1}}{{n}}\\right)}}=1-\\frac{{\\gamma}}{{\\gamma+\\frac{{1}}{{n}}}}=1-\\frac{{n+\\gamma}}{{1+n \\gamma}}
        \\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_2_120(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        An ideal gas goes through a cycle consisting of
        (a) isochoric, adiabatic, and isothermal lines;
        (b) isobaric, adiabatic, and isothermal lines,
        with the isothermal process proceeding at the minimum temperature of the whole cycle. Find the efficiency of each cycle if the absolute tem perature varies $n$-fold within the cycle.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        $\\begin{{aligned}}
        &\\text {{(a) Here }} p_2=n p_1, p_1 V_1=p_0 V_0 \\\\
        &n p_1 V_1^\\gamma=p_0 V_0^\\gamma \\\\
        &Q_2^{{\\prime}}=R T_0 \\ln \\frac{{V_0}}{{V_1}}, Q_1=C_V T_0(n-1)
        \\end{{aligned}}$
        But $\\displaystyle n V_1^{{\\gamma-1}}=V_0^{{\\gamma-1}}$ or, $V_1=V_0 n^{{\\frac{{-1}}{{\\gamma-1}}}}$
        $\\displaystyle Q_2^{{\\prime}}=R T_0 \\ln n^{{\\frac{{1}}{{\\gamma-1}}}}=\\frac{{R T_0}}{{\\gamma-1}} \\ln n$
        Thus $\\displaystyle \\eta=1-\\frac{{\\ln n}}{{n-1}}$, on using $C_V=\\frac{{R}}{{\\gamma-1}}$
        (b) Here $V_2=n V_1, p_1 V_1=p_0 V_0$
        and $p_1\\left(n V_1\\right)^\\gamma=p_0 V_0^\\gamma$
        i.e. $\\displaystyle n^\\gamma V_1^{{\\gamma-1}}=V_0^{{\\mu-1}}$ or $V_1=n^{{-\\frac{{\\gamma}}{{\\gamma-1}}}} V_0$
        Also $Q_1=C_p T_0(n-1), Q_2^{{\\prime}}=R T_0 \\ln \\frac{{V_0}}{{V_1}}$
        or $\\displaystyle Q_2^{{\\prime}}=R T_0 \\ln n \\frac{{\\gamma}}{{\\gamma-1}}=\\frac{{R \\gamma}}{{\\gamma-1}} T_0 \\ln n=C_p T_0 \\ln n$
        Thus $\\displaystyle \\quad \\eta=1-\\frac{{\\ln n}}{{n-1}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_121(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        The conditions are the same as in the foregoing problem with the exception that the isothermal process proceeds at the maximum temperature of the whole cycle.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Here the isothermal process proceeds at the maximum temperature instead of at the minimum temperature of the cycle as in 2.120 .
        (a) Here $\\displaystyle p_1 V_1=p_0 V_0, p_2=\\frac{{p_1}}{{n}}$
        $\\begin{{aligned}}
        & p_2 V_1^\\gamma=p_0 V_0^\\gamma \\text {{ or }} p_1 V_1^\\gamma=n p_0 V_0^\\gamma \\\\
        \\text{{i.e}} \\qquad & V_1^{{\\gamma-1}}=n V_0^{{\\gamma-1}} \\text {{ or }} V_1=V_0 n \\frac{{1}}{{\\gamma-1}}
        \\end{{aligned}}$
        $\\displaystyle Q_2^{{\\prime}}=C_V T_0\\left(1-\\frac{{1}}{{n}}\\right), Q_1=R T_0 \\ln \\frac{{V_1}}{{V_0}}=\\frac{{R T_0}}{{\\gamma-1}} \\ln n=C_V T_0 \\ln n$
        Thus $\\displaystyle \\eta=1-\\frac{{Q_2^{{\\prime}}}}{{Q_1}}=1-\\frac{{n-1}}{{n \\ln n}}$
        (b) Here $\\displaystyle V_2=\\frac{{V_1}}{{n}}, p_0 V_0=p_1 V_1$
        $\\begin{{aligned}}
        & p_0 V_0^\\gamma=p_1 V_2^\\gamma=p_1 n^{{-\\gamma}} V_1^\\gamma=V_0^{{\\prime-1}} n^{{-\\gamma}} V_1^{{\\gamma-1}} \\text {{ or }} V_1=n^{{(\\gamma / \\gamma-1)}} V_0 \\\\
        & Q_2^{{\\prime}}=C_p T_0\\left(1-\\frac{{1}}{{n}}\\right), Q_1=R T_0 \\ln \\frac{{V_1}}{{V_0}}=\\frac{{R \\gamma}}{{\\gamma-1}} T_0 \\ln n=C_p T_0 \\ln n \\\\
        \\end{{aligned}}$
        Thus $\\eta=1-\\frac{{n-1}}{{n \\ln n}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_122(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        An ideal gas goes through a cycle consisting of isothermal, polytropic, and adiabatic lines, with the isothermal process proceeding at the maximum temperature of the whole cycle. Find the efficiency of such a cycle if the absolute temperature varies $n$-fold within the cycle.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        The section from $\\left(\\dot{{p}}_1, V_1, T_0\\right)$ to $\\left(p_2, V_2, T_0 / n\\right)$ is a polytropic process of index $\\alpha$. We shall assume that the corresponding specific heat $C$ is + ve.
        Here, $\\displaystyle \\qquad d Q=C d T=C_V d T+p d V$
        Now $\\displaystyle \\qquad p V^\\alpha=$ constant or $T V^{{\\alpha-1}}=$ constant.
        so $\\displaystyle \\qquad p d V=\\frac{{R T}}{{V}} d V=-\\frac{{R}}{{\\alpha-1}} d T$
        Then $\\displaystyle \\qquad C=C_V-\\frac{{R}}{{\\alpha-1}}=R\\left(\\frac{{1}}{{\\gamma-1}}-\\frac{{1}}{{\\alpha-1}}\\right)$
        We have $\\displaystyle \\qquad p_1 V_1=R T_0=p_2 V_2=\\frac{{R T_0}}{{n}}=\\frac{{p_1 V_1}}{{n}}$
        $p_0 V_0=p_1 V_1=n p_2 V_2, p_0 V_0^\\gamma=p_2 V_2^\\gamma$
        $\\begin{{aligned}}
        & p_1 V_1^\\alpha=p_2^{{\\prime}} V_2^\\alpha \\quad \\text {{ or }} V_0^{{\\gamma-1}}=\\frac{{1}}{{n}} V_2^{{\\gamma-1}} \\text {{ or }} V_2=V_0 n^{{\\frac{{1}}{{\\gamma-1}}}} \\\\
        & V_1^{{\\alpha-1}}=\\frac{{1}}{{n}} V_2^{{\\alpha-1}} \\quad \\text {{ or }} \\quad V_1=n^{{-\\frac{{1}}{{\\alpha-1}}}} V_2=n \\frac{{1}}{{\\gamma-1}}-\\frac{{1}}{{\\alpha-1}} V_0
        \\end{{aligned}}$
        Now $Q_2^{{\\prime}}=C T_0\\left(1-\\frac{{1}}{{n}}\\right), Q_1=R T_0 \\ln \\frac{{V_1}}{{V_0}}=R T_0\\left(\\frac{{1}}{{\\gamma-1}}-\\frac{{1}}{{\\alpha-1}}\\right) \\ln n=C T_0 \\ln n$
        Thus $\\displaystyle \\qquad \\eta=1-\\frac{{n-1}}{{n \\ln n}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_123(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        An ideal gas with the adiabatic exponent $\\gamma$ goes through a direct (clockwise) cycle consisting of adiabatic, isobaric, and isochoric lines. Find the efficiency of the cycle if in the adiabatic process the volume of the ideal gas
        (a) increases $n$-fold; (b) decreases $n$-fold.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        (a) Here $\\displaystyle Q_2^{{\\prime}}=C_p\\left(T_1-\\frac{{T_1}}{{n}}\\right)=C_p T_1\\left(1-\\frac{{1}}{{n}}\\right), Q_1=C_V\\left(T_0-\\frac{{T_1}}{{n}}\\right)$
        Along the adiabatic line
        $\\begin{{gathered}}
        T_0 V_0^{{\\gamma-1}}=T_1\\left(n V_0\\right)^{{\\gamma-1}} \\text {{ or, }} T_0=T_1 n^{{\\gamma-1}} . \\\\
        \\text{{so }} \\qquad Q_1=C_V \\frac{{T_1}}{{n}}\\left(n^\\gamma-1\\right) . \\text {{ Thus }} \\eta=1-\\frac{{\\gamma(n-1)}}{{n^{{\\gamma-1}}}}
        \\end{{gathered}}$
        (b) Here $Q_2^{{\\prime}}=C_V\\left(n T_1-T_0\\right), Q_1=C_p \\cdot T_1(n-1)$
        Along the adiabatic line $T V^{{\\gamma-1}}=$ constant
        $\\displaystyle T_0 V_0^{{\\gamma-1}} =T_1\\left(\\frac{{V_0}}{{n}}\\right)^{{\\gamma-1}} \\text {{ or }} T_1=n^{{\\gamma-1}} T_0$
        Thus $\\displaystyle \\eta=1-\\frac{{n^\\gamma-1}}{{\\gamma n^{{\\gamma-1}}(n-1)}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_124(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Calculate the efficiency of a cycle consisting of isothermal, isobaric, and isochoric lines, if in the isothermal process the volume of the ideal gas with the adiabatic exponent $\gamma$
        (a) increases $n$-fold; (b) decreases $n$-fold.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        (a)
        $\\begin{{aligned}}
        &Q_2^{{\\prime}}=C_p T_0\\left(1-\\frac{{1}}{{n}}\\right), Q^{{\\prime \\prime}}_1=R T_0 \\ln n, Q_1^{{\\prime}}=C_V T_0\\left(1-\\frac{{1}}{{n}}\\right), Q_1=Q_1^{{\\prime}}+Q^{{\\prime \\prime}}_1 \\\\
        \\text{{So }}\\qquad \\eta=&1-\\frac{{Q_2^{{\\prime}}}}{{Q_1}}=1-\\frac{{C_p\\left(1-\\frac{{1}}{{n}}\\right)}}{{C_V\\left(1-\\frac{{1}}{{n}}\\right)+R \\ln n}} \\\\
        =&1-\\frac{{\\gamma}}{{1+\\frac{{R}}{{C_V}} \\frac{{n \\ln n}}{{n-1}}}}=1-\\frac{{\\gamma(n-1)}}{{n-1+(\\gamma-1) n \\ln n}}
        \\end{{aligned}}$
        (b) $\\displaystyle Q_1=C_P T_0(n-1), Q_2^{{\\prime \\prime}}=C_V T_0(n-1) \\quad Q^{{\\prime \\prime \\prime}}{{ }}_2=R T_0 \\ln n, Q_2^{{\\prime}}=Q_2^{{\\prime \\prime}}+Q^{{\\prime \\prime \\prime}}{{ }}_2$
        So $\\displaystyle \\eta=1-\\frac{{Q_2^{{\\prime}}}}{{Q_1}}=1-\\frac{{n-1+(\\gamma-1) \\ln n}}{{\\gamma(n-1)}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_125(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Find the efficiency of a cycle consisting of two isochoric and two isothermal lines if the volume varies $v$-fold and the absolute temperature $\\tau$-fold within the cycle. The working substance is an ideal gas with the adiabatic exponent $\\gamma$.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        We have
        $\\begin{{aligned}}
        & Q_1^{{\\prime}}=\\tau R T_0 \\ln v, Q_2^{{\\prime \\prime}}=C_V T_0(\\tau-1) Q_1=Q_1^{{\\prime}}+Q_1^{{\\prime \\prime}} \\text {{ and }} \\\\
        & Q_2^{{\\prime \\prime \\prime}}=R T_0 \\ln v, Q_1^{{\\prime \\prime}}=C_V T_0(\\tau-1)
        \\end{{aligned}}$
        as well as $Q_1=Q_1{{ }}^{{\\prime}}+Q_1{{ }}^{{\\prime \\prime}}$ and
        $Q_2^{{\\prime}}=Q_2^{{\\prime \\prime}}+Q_2{{ }}^{{\\prime \\prime \\prime}}$
        $\\begin{{aligned}}
        \\text {{So }} \\qquad \\eta&= 1-\\frac{{Q_2^{{\\prime}}}}{{Q_1}}+1=\\frac{{C_V(\\tau-1)+R \\ln v}}{{C_V(\\tau-1)+\\tau R \\ln v}} \\\\
        &=1-\\frac{{\\frac{{\\tau-1}}{{\\gamma-1}}+\\ln v}}{{\\frac{{\\tau-1}}{{\\gamma-1}}+\\tau \\ln v}}=\\frac{{(\\tau-1) \\ln v}}{{\\tau \\ln v+\\frac{{\\tau-1}}{{\\gamma-1}}}}
        \\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_2_126(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Find the efficiency of a cycle consisting of two isobaric and two isothermal lines if the pressure varies $n$-fold and the absolute temperature $\\tau$-fold within the cycle. The working substance is an ideal gas with the adiabatic exponent $\\gamma$.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Here $Q_1^{{\\prime \\prime}}=C_p T_0(\\tau-1), Q^{{\\prime}} 1^{{\\prime \\prime}}=\\tau R T_0 \\ln n$ and
        $Q_2^{{\\prime \\prime}}=C^p T_0(\\tau-1), Q_2^{{\\prime \\prime \\prime}}=R T_0 \\ln n$
        in addition to we have
        $\\begin{{aligned}}
        & Q_1=Q_1^{{\\prime}}+Q_1^{{\\prime \\prime}} \\text {{ and }} \\\\
        & Q_2^{{\\prime}}=Q_2^{{\\prime \\prime}}+Q_2^{{\\prime \\prime \\prime}}
        \\end{{aligned}}$
        $\\begin{{aligned}}
        \\text{{So }} \\qquad \\eta&=1-\\frac{{Q_2^{{\\prime}}}}{{Q_1}}=1-\\frac{{C_p(\\tau-1)+R \\ln n}}{{C_p(\\tau-1)+\\tau R \\ln n}}\\\\
        &=1-\\frac{{\\tau-1+\\left(1-\\frac{{1}}{{\\gamma}}\\right) \\ln n}}{{\\tau-1+\\left(1-\\frac{{1}}{{\\gamma}}\\right) \\tau \\ln n}}\\\\
        &=1-\\frac{{\\tau-1+\\left(1-\\frac{{1}}{{\\gamma}}\\right) \\ln n}}{{\\tau-1+\\left(1-\\frac{{1}}{{\\gamma}}\\right) \\tau \\ln n}}=\\frac{{(\\tau-1) \\ln n}}{{\\tau \\ln n+\\frac{{\\gamma(\\tau-1)}}{{\\gamma-1}}}}
        \\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_2_127(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        An ideal gas with the adiabatic exponent $\\gamma$ goes through a cycle (Fig. 2.3) within which the absolute temperature varies $\\boldsymbol{{\\tau}}$-fold. Find the efficiency of this cycle.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        file_name = 'problems-in-general-physics-fig-2-3.png'
        file_path = self._init_file_path(file_name)        
        problemTemplate.add_problem(file_path, 'image/jpg')
        
        soln_s = f"""
        Because of the linearity of the section $B C$ whose equation is
        $\\displaystyle \\frac{{p}}{{p_0}}=\\frac{{v V}}{{V_0}}(=p=\\alpha V)$
        We have $\\displaystyle \\frac{{\\tau}}{{v}}=v$ or $v=\\sqrt{{\\tau}}$
        Here $Q_2^{{\\prime \\prime}}=C_V T_0(\\sqrt{{\\tau}}-1)$
        $\\displaystyle Q_2^{{\\prime \\prime \\prime}}=C_p T_0\\left(1-\\frac{{1}}{{\\sqrt{{\\tau}}}}\\right)=C_p \\frac{{T_0}}{{\\sqrt{{\\tau}}}}(\\sqrt{{\\tau}}-1)$
        Thus $\\displaystyle Q_2^{{\\prime}}=Q_2^{{\\prime \\prime}}+Q_2^{{\\prime \\prime \\prime}}=\\frac{{R T_0}}{{\\gamma-1}}(\\sqrt{{\\tau}}-1)\\left(1+\\frac{{\\gamma}}{{\\sqrt{{\\tau}}}}\\right)$
        Along $B C$, the specific heat $C$ is given by
        $\\displaystyle C d T=C_V d T+p d V=C_V d T+d\\left(\\frac{{1}}{{2}} \\alpha V^2\\right)=\\left(C_V+\\frac{{1}}{{2}} R\\right) d T$
        Thus $\\displaystyle \\qquad Q_1=\\frac{{1}}{{2}} R T_0 \\frac{{\\gamma+1}}{{\\gamma-1}} \\frac{{\\tau-1}}{{\\sqrt{{\\tau}}}}$
        Finally $\\displaystyle \\quad \\eta=1-\\frac{{Q_2^{{\\prime}}}}{{Q_1}}=1-2 \\frac{{\\sqrt{{\\tau}}+\\gamma}}{{\\sqrt{{\\tau}}+1}} \\frac{{1}}{{\\gamma+1}}=\\frac{{(\\gamma-1)(\\sqrt{{\\tau}}-1)}}{{(\\gamma+1)(\\sqrt{{\\tau}}+1)}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_128(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Making use of the Clausius inequality, demonstrate that all cycles having the same maximum temperature $T_{{\\max }}$ and the same minimum temperature $T_{{m i n}}$ are less efficient compared to the Carnot cycle with the same $T_{{\\max }}$ and $T_{{\\min }}$.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        We write Claussius inequality in the form
        $\\displaystyle \\int \\frac{{d_1 Q}}{{T}}-\\int \\frac{{d_2 Q}}{{T}} \\leq 0$
        where $d Q$ is the heat transeferred to the system but $d_2 Q$ is heat rejected by the system, both are $+v e$ and this explains the minus sign before $d_2 Q$,
        In this inequality $T_{{\\max }}>T>T_{{\\min }}$ and we can write
        $\\begin{{aligned}}
        &&&\\int \\frac{{d_1 Q}}{{T_{{\\max }}}}-\\int \\frac{{d_2 Q}}{{T_{{\\min }}}}<0 \\\\
        &\\text{{Thus }} \\qquad &&\\frac{{Q_1}}{{T_{{\\max }}}}<\\frac{{Q_2^{{\\prime}}}}{{T_{{\\min }}}} \\text {{ or }} \\frac{{T_{{\\min }}}}{{T_{{\\max }}}}<\\frac{{Q_2^{{\\prime}}}}{{Q_1}} \\\\
        &\\text{{or }} \\qquad &&\\eta=1-\\frac{{Q_2^{{\\prime}}}}{{Q_1}}<1-\\frac{{T_{{\\min }}}}{{T_{{\\max }}}}=\\eta_{{\\text {{carnot }}}}
        \\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_2_129(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Making use of the Carnot theorem, show that in the case of a physically uniform substance whose state is defined by the parameters $T$ and $V$
        $(\\partial U / \\partial V)_T=T(\\partial p / \\partial T)_V-p$
        where $U(T, V)$ is the internal energy of the substance.
        Instruction. Consider the infinitesimal Carnot cycle in the variables $p, V$.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        We consider an infinitesimal carnot cycle with isothermal process at temperatures $T+d T$ and $T$.
        Let $\\delta A$ be the work done in the cycle and $\\delta Q$, be the heat received at the higher temperature. Then by Carnot's theorem
        $\\displaystyle \\frac{{\\delta A}}{{\\delta Q_1}}=\\frac{{d T}}{{T}}$
        On the other hand $\\displaystyle \\delta A=d p d V=\\left(\\frac{{\\partial p}}{{\\partial T}}\\right)_v d T d V$ 
        while $\\displaystyle \\delta Q_1=d U_{{12}}+p d V=\\left[\\left(\\frac{{\\partial U}}{{\\partial V}}\\right)_T+p\\right] d V$ 
        Hence $\\displaystyle \\left(\\frac{{\\partial U}}{{\\partial V}}\\right)_T+p=T\\left(\\frac{{\\partial p}}{{\\partial T}}\\right)_V$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_130(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Find the entropy increment of one mole of carbon dioxide when its absolute temperature increases $n=2.0$ times if the process of heating is
        (a) isochoric; (b) isobaric.
        The gas is to be regarded as ideal.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        (a) In an isochoric process the entropy change will be
        $\\displaystyle \\Delta S=\\int_{{T_i}}^{{T_f}} \\frac{{C_V d T}}{{T}}=C_V \\ln \\frac{{T_f}}{{T_i}}=C_V \\ln n=\\frac{{R \\ln n}}{{\\gamma-1}}$
        For carbon dioxide $\\gamma=1.30$
        so, $\\Delta S=19.2 \\mathrm{{Joule}} /{{ }}^{{\\circ}} \\mathrm{{K}}-\\mathrm{{mole}}$
        (b) For an isobaric process,
        $\\begin{{aligned}}
        \\Delta S&= C_p \\ln \\frac{{T_f}}{{T_t}}=C_p \\ln n=\\frac{{\\gamma R \\ln n}}{{\\gamma-1}} \\\\
        & =25 \\text {{ Joule }} /{{ }}^{{\\circ}} \\mathrm{{K}}-\\text {{ mole }}
        \\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_2_131(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        The entropy of $v=4.0$ moles of an ideal gas increases by $\\Delta S=23 \\mathrm{{~J}} / \\mathrm{{K}}$ due to the isothermal expansion. How many times should the volume $v=4.0$ moles of the gas be increased?
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        In an isothermal expansion
        $\\displaystyle \\Delta S=v R \\ln \\frac{{V_f}}{{V_i}}$
        so, $\\displaystyle \\frac{{V_f}}{{V_i}}=e^{{\\Delta S / V R}}=2.0$ times
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_132(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Two moles of an ideal gas are cooled isochorically and then expanded isobarically to lower the gas temperature back to the initial value. Find the entropy increment of the gas if in this process the gas pressure changed $n=3.3$ times.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        The entropy change depends on the final \\& initial states only, so we can calculate it directly along the isotherm, it is $\\Delta S=2 R \\ln n=20 \\mathrm{{~J}} /{{ }}^{{\\circ}} \\mathrm{{K}}$
        (assuming that the final volume is $n$ times the inital volume)
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_133(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Helium of mass $m=1.7 \\mathrm{{~g}}$ is expanded adiabatically $n=3.0$ times and then compressed isobarically down to the initial volume. Find the entropy increment of the gas in this process.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        If the initial temperature is $T_0$ and volume is $V_0$ then in adiabatic expansion.
        $\\displaystyle T V^{{\\gamma-1}}=T_0 V_0^{{\\gamma-1}}$
        so, $\\displaystyle T=T_0 n^{{1-\\gamma}}=T_1 \\text {{ where }} n=\\frac{{V_1}}{{V_0}}$
        $V_1$ being the volume at the end of the adiabatic process. There is no entropy change in this process. Next the gas is compressed isobarically and the net entropy change is
        $\\displaystyle\\Delta S=\\left(\\frac{{m}}{{M}} C_p\\right) \\ln \\frac{{T_f}}{{T_1}}$
        But $\\displaystyle\\frac{{V_1}}{{T_1}}=\\frac{{V_0}}{{T_f}}, \\quad \\text {{ or }} \\quad T_f=T_1 \\frac{{V_0}}{{V_1}}=T_0 n^{{-\\gamma}}$
        So $\\displaystyle\\Delta S=\\left(\\frac{{m}}{{M}} C_p\\right) \\ln \\frac{{1}}{{n}}=-\\frac{{m}}{{M}} C_p \\ln n=-\\frac{{m}}{{M}} \\frac{{R \\gamma}}{{\\gamma-1}} \\ln n=-9.7 \\mathrm{{~J}} / \\mathrm{{K}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_134(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Find the entropy increment of $v=2.0$ moles of an ideal gas whose adiabatic exponent $\\gamma=1.30$ if, as a result of a certain process, the gas volume increased $\\alpha=2.0$ times while the pressure dropped $\\beta=3.0$ times.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        The entropy change depends on the initial and final state only so can be calculated for any process whatsoever.
        We choose to evaluate the entropy change along the pair of lines shown above. Then
        $\\displaystyle \\Delta S=\\int_{{T_0}}^{{\\frac{{T_0}}{{\\beta}}}} \\frac{{v C_V d T}}{{T}}+\\int_{{\\frac{{T_0}}{{\\beta}}}}^{{\\frac{{\\alpha T_0}}{{\\beta}}}} v C_p \\frac{{d T}}{{T}}$
        $\\displaystyle =\\left(-C_V \\ln \\beta+C_p \\ln \\alpha\\right) v=\\frac{{v R}}{{\\gamma-1}}(\\gamma \\ln \\alpha-\\ln \\beta) \\approx-11 \\frac{{\\text {{ Joule }}}}{{{{ }}^{{\\circ}} \\mathrm{{K}}}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_135(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Vessels 1 and 2 contain $v=1.2$ moles of gaseous helium. The ratio of the vessels' volumes $V_2 / V_1=\\alpha=2.0$, and the ratio of the absolute temperatures of helium in them $T_1 / T_2=\\beta=1.5$. Assuming the gas to be ideal, find the difference of gas entropies in these vessels, $S_2-S_1$.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        To calculate the required entropy difference we only have to calculate the entropy difference for a process in which the state of the gas in vessel 1 is changed to that in vessel 2 .
        $\\begin{{aligned}}
        \\Delta S & = v\\left(\\int_{{T_1}}^{{\\frac{{T_1}}{{\\alpha \\beta}}}} C_V \\frac{{d T}}{{T}} + \\int_{{\\frac{{T_1}}{{\\alpha \\beta}}}}^{{\\frac{{T_1}}{{\\beta}}}} C_p \\frac{{d T}}{{T}}\\right)\\\\
        & =v\\left(C_p \\ln \\alpha-C_V \\ln \\alpha \\beta\\right) \\\\
        & =v\\left(R \\ln \\alpha-\\frac{{R}}{{\\gamma-1}} \\ln \\beta\\right)=v R\\left(\\ln \\alpha-\\frac{{\\ln \\beta}}{{\\gamma-1}}\\right) \\\\
        \\end{{aligned}}$
        With $\\displaystyle \\gamma=\\frac{{5}}{{3}}, \\alpha=2$ and $\\beta=1.5, v=1 \\cdot 2$, 
        this gives $\\Delta S=0.85 \\mathrm{{Joule}} /{{ }}^{{\\circ}} \\mathrm{{K}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate

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

        problem_s = f"""
        One mole of an ideal gas with the adiabatic exponent $\gamma$ goes through a polytropic process as a result of which the absolute temperature of the gas increases $\tau$-fold. The polytropic constant equals $n$. Find the entropy increment of the gas in this process.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        For the polytropic process with index $n$
        $p V^n=\\text {{ constant }}$
        Along this process (See 2.122)
        $\\begin{{gathered}}
        C=R\\left(\\frac{{1}}{{\\gamma-1}}-\\frac{{1}}{{n-1}}\\right)=\\frac{{n-\\gamma}}{{(\\gamma-1)(n-1)}} \\cdot R \\\\
        \\text{{So }} \\qquad \\Delta S=\\int_{{T_0}}^{{\\tau T_0}} C \\frac{{d T}}{{T}}=\\frac{{n-\\gamma}}{{(\\gamma-1)(n-1)}} R \\ln \\tau
        \\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_2_137(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        The expansion process of $v=2.0$ moles of argon proceeds so that the gas pressure increases in direct proportion to its volume. Find the entropy increment of the gas in this process provided its volume increases $\\alpha=2.0$ times.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        The process in question may be written as
        $\\displaystyle \\frac{{p}}{{p_0}}=\\alpha \\frac{{V}}{{V_0}}$
        where $\\alpha$ is a constant and $p_0, V_0$ are some reference values. For this process (see 2.127) the specific heat is
        $\\displaystyle C=C_V+\\frac{{1}}{{2}} R=R\\left(\\frac{{1}}{{\\gamma-1}}+\\frac{{1}}{{2}}\\right)=\\frac{{1}}{{2}} R \\frac{{\\gamma+1}}{{\\gamma-1}}$
        Along the line volume increases $\\alpha$ times then so does the pressure. The temperature must then increase $\\alpha^2$ times. Thus
        $\\begin{{gathered}}
        \\Delta S=\\int_{{T_0}}^{{\\alpha^2 T_0}} v C \\frac{{d T}}{{T}}=\\frac{{v R}}{{2}} \\frac{{\\gamma+1}}{{\\gamma-1}} \\ln \\alpha^2=v R \\frac{{\\gamma+1}}{{\\gamma-1}} \\ln \\alpha \\\\
        \\text{{if }}\\qquad v=2, \\gamma=\\frac{{5}}{{3}}, \\alpha=2, \\Delta S=46.1 \\mathrm{{ Joule}} /{{ }}^{{\\circ}} \\mathrm{{K}}
        \\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_2_138(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        An ideal gas with the adiabatic exponent $\\gamma$ goes through a process $p=p_0-\\alpha V$, where $p_0$ and $\\alpha$ are positive constants, and $V$ is the volume. At what volume will the gas entropy have the maximum value?
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Let $\\left(p_1, V_1\\right)$ be a reference point on the line
        $p=p_0-\\alpha V$
        and let $(p, V)$ be any other point.
        The entropy difference
        $\\begin{{gathered}}
        \\Delta S=S(p, V)-S\\left(p_1, V_1\\right) \\\\
        =C_V \\ln \\frac{{p}}{{p_1}}+C_p \\ln \\frac{{V}}{{V_1}}=C_V \\ln \\frac{{p_0-\\alpha V}}{{p_1}}+C_p \\ln \\frac{{V}}{{V_1}}
        \\end{{gathered}}$
        For an exetremum of $\\Delta S$
        $\\displaystyle \\frac{{\\partial \\Delta S}}{{\\partial V}}=\\frac{{-\\alpha C_V}}{{p_0-\\alpha V}}+\\frac{{C_p}}{{V}}=0$
        or $\\displaystyle C_p\\left(p_0-\\alpha V\\right)-\\alpha V C_V=0$
        or $\\displaystyle \\gamma\\left(p_0-\\alpha V\\right)-\\alpha V=0$ or $\\displaystyle V=V_m=\\frac{{\\gamma p_0}}{{\\alpha(\\gamma+1)}}$
        This gives a maximum of $\\Delta S$ because $\\displaystyle \\frac{{\\partial^2 \\Delta S}}{{\\partial V^2}}<0$
        (Note :- a maximum of $\\Delta S$ is a maximum of $S(p, V)$ )
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_139(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        One mole of an ideal gas goes through a process in which the entropy of the gas changes with temperature $T$ as $S=a T+C_V \\ln T$, where $a$ is a positive constant, $C_V$ is the molar heat capacity of this gas at constant volume. Find the volume dependence of the gas temperature in this process if $T=T_0$ at $V=V_0$.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Along the process line $: S=a T+C_V \\ln T$
        or the specific heat is $\\displaystyle : C=T \\frac{{d S}}{{d T}}=a T+C_v$
        On the other hand : $d Q=C d T=C_V d T+p d V$ for an ideal gas.
        Thus, $\\displaystyle p d V=\\frac{{R T}}{{V}} d V=d T d T$
        or $\\displaystyle \\frac{{R}}{{a}} \\frac{{d V}}{{V}}=d T \\text {{ or, }} \\frac{{R}}{{a}} \\ln V+\\text {{ constant }}=T$
        Using $\\displaystyle T=T_0 \\text {{ when }} V=V_0 \\text {{, we get, }} T=T_0+\\frac{{R}}{{a}} \\ln \\frac{{V}}{{V_0}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_140(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Find the entropy increment of one mole of a Van der Waals gas due to the isothermal variation of volume from $V_1$ to $V_2$. The Van der Waals corrections are assumed to be known.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        For a Vander Waal gas
        $\\displaystyle \\left(p+\\frac{{a}}{{V^2}}\\right)(V-b)=R T$
        The entropy change along an isotherm can be calculated from
        $\\displaystyle \\Delta S=\\int_{{V_1}}^{{v_2}}\\left(\\frac{{\\partial S}}{{\\partial V}}\\right)_T d V$
        It follows from (2.129) that
        $\\displaystyle \\left(\\frac{{\\partial S}}{{\\partial V}}\\right)_T=\\left(\\frac{{\\partial p}}{{\\partial T}}\\right)_V=\\frac{{R}}{{V-b}}$
        assuming $a, b$ to be known constants.
        Thus $\\displaystyle \\Delta S=R \\ln \\frac{{V_2-b}}{{V_1-b}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_141(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        One mole of a Van der Waals gas which had initially the volume $V_1$ and the temperature $T_1$ was transferred to the state with the volume $V_2$ and the temperature $T_2$. Find the corresponding entropy increment of the gas, assuming its molar heat capacity $C_{{\\mathrm{{V}}}}$ to be known.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        We use,
        $\\begin{{aligned}}
        \\Delta S & =\\int_{{V_1, T_1}}^{{V_2, T_2}} d S(V, T)=\\int_{{T_1}}^{{T_2}}\\left(\\frac{{\\partial S}}{{\\partial T}}\\right)_{{V_1}} d T+\\int_{{V_1}}^{{V_2}}\\left(\\frac{{\\partial S}}{{\\partial V}}\\right)_{{T=T_2}} d V \\\\
        & =\\int_{{T_1}}^{{T_2}} \\frac{{C_V d T}}{{T}}+\\int_{{V_1}} \\frac{{R}}{{V-b}} d V=C_V \\ln \\frac{{T_2}}{{T_1}}+R \\ln \\frac{{V_2-b}}{{V_1-b}}
        \\end{{aligned}}$
        assuming $C_V, a, b$ to be known constants.
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_142(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        At very low temperatures the heat capacity of crystals is equal to $C=a T^3$, where $a$ is a constant. Find the entropy of a crystal as a function of temperature in this temperature interval.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        We can take $S \\rightarrow 0$ as $T \\rightarrow 0$ Then
        $\\displaystyle S=\\int_0^T C \\frac{{d T}}{{T}}=\\int_0^T a T^2 d T=\\frac{{1}}{{3}} a T^3$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_143(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Find the entropy increment of an aluminum bar of mass $m=3.0 \\mathrm{{~kg}}$ on its heating from the temperature $T_1=300 \\mathrm{{~K}}$ up to $T_2=600 \\mathrm{{~K}}$ if in this temperature interval the specific heat capacity of aluminum varies as $c=a+b T$, where $a=0.77 \\mathrm{{~J}} /(\\mathrm{{g}} \\cdot \\mathrm{{K}})$, $b=0.46 \\mathrm{{~mJ}} /\\left(\\mathrm{{g}} \\cdot \\mathrm{{K}}^2\\right)$
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        $\\displaystyle \\Delta S=\\int_{{T_1}}^{{T_2}} \\frac{{C d T}}{{T}}=\\int_{{T_1}}^{{T_2}} \\frac{{m(a+b T)}}{{T}} d T=m b\\left(T_2-T_1\\right)+m a \\ln \\frac{{T_2}}{{T_1}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_144(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        In some process the temperature of a substance depends on its entropy $S$ as $T=a S^n$, where $a$ and $n$ are constants. Find the corresponding heat capacity $C$ of the substance as a function of $S$. At what condition is $C<0$ ?
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Here $T=a S^n$ or $\\displaystyle S=\\left(\\frac{{T}}{{a}}\\right)^{{\\frac{{1}}{{n}}}}$
        Then $\\displaystyle C=T \\frac{{1}}{{n}} \\frac{{T^{{\\frac{{1}}{{n}}-1}}}}{{a^{{1 / n}}}}=\\frac{{S}}{{n}}$
        Clearly $C<0$ if $n<0$.
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_145(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Find the temperature $T$ as a function of the entropy $S$ of a substance for a polytropic process in which the heat capacity of the substance equals $C$. The entropy of the substance is known to be equal to $S_0$ at the temperature $T_0$. Draw the approximate plots $T(S)$ for $C>0$ and $C<0$.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        We know,
        $\\displaystyle S-S_0=\\int_{{T_0}}^T \\frac{{C d T}}{{T}}=C \\ln \\frac{{T}}{{T_0}}$
        assuming $C$ to be a known constant.
        Then $\\displaystyle \\quad T=T_0 \\exp \\left(\\frac{{S-S_0}}{{C}}\\right)$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate

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

        problem_s = f"""
        One mole of an ideal gas with heat capacity $C_V$ goes through a process in which its entropy $S$ depends on $T$ as $S=\\alpha / T$, where $\\alpha$ is a constant. The gas temperature varies from $T_1$ to $T_2$. Find:
        (a) the molar heat capacity of the gas as a function of its temperature;
        (b) the amount of heat transferred to the gas;
        (c) the work performed by the gas.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        (a) $\\displaystyle C=T \\frac{{d S}}{{d T}}=-\\frac{{\\alpha}}{{T}}$
        (b) $\\displaystyle Q=\\int_{{T_1}}^{{T_2}} C d T=\\alpha \\ln \\frac{{T_1}}{{T_2}}$
        (c) $\\displaystyle W=\\Delta Q-\\Delta U \\quad=\\alpha \\ln \\frac{{T_1}}{{T_2}}+C_V\\left(T_1-T_2\\right.$
        Since for an ideal gas $C_V$ is constant and $\\Delta U=C_V\\left(T_2-T_1\\right)$
        ( $U$ does not depend on $V$ )
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_147(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        A working substance goes through a cycle within which the absolute temperature varies $n$-fold, and the shape of the cycle is shown in (a) Fig. $2.4 a$; (b) Fig. $2.4 b$, where $T$ is the absolute temperature, and $S$ the entropy. Find the efficiency of each cycle.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        file_name = 'problems-in-general-physics-fig-2-4.png'
        file_path = self._init_file_path(file_name)        
        problemTemplate.add_problem(file_path, 'image/jpg')
        
        soln_s = f"""
        (a) We have from the definition
        $\\begin{{aligned}}
        Q & =\\int T d S=\\text {{ area under the curve }} \\\\
        Q_1 & =T_0\\left(S_1-S_0\\right) \\\\
        Q_2^{{\\prime}} & =\\frac{{1}}{{2}}\\left(T_0+T_1\\right)\\left(S_1-S_0\\right)
        \\end{{aligned}}$
        Thus, using $T_1=\\frac{{T_0}}{{n}}$,
        $\\displaystyle \\eta=1-\\frac{{T_0+T_1}}{{2 T_0}}=1-\\frac{{1+\\frac{{1}}{{n}}}}{{2}}=\\frac{{n-1}}{{2 n}}$
        $\\begin{{aligned}}
        & \\text {{(b) Here }} Q_1=\\frac{{1}}{{2}}\\left(S_1-S_0\\right)\\left(T_1+T_0\\right) \\\\
        & Q_2^{{\\prime}}=T_1\\left(S_1-S_0\\right) \\\\
        & \\eta=1-\\frac{{2 T_1}}{{T_1+T_0}}=\\frac{{T_0-T_1}}{{T_0-T_1}}=\\frac{{n-1}}{{n+1}}
        \\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_2_148(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        One of the two thermally insulated vessels interconnected by a tube with a valve contains $v=2.2$ moles of an ideal gas. The other vessel is evacuated. The valve having been opened, the gas increased its volume $n=3.0$ times. Find the entropy increment of the gas.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        In this case, called free expansion no work is done and no heat is exchanged. So internal energy must remain unchanged $U_f=U_i$. For an ideal gas this implies constant temperature $T_f=T_i$. The process is irreversible but the entropy change can be calculated by considering a reversible isothermal process. Then, as before
        $\\displaystyle \\Delta S=\\int \\frac{{d Q}}{{T}}=\\int_{{v_1}}^{{v_2}} \\frac{{p d V}}{{T}}=v R \\ln n=20 \\cdot 1 \\mathrm{{~J}} / \\mathrm{{K}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_149(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        A weightless piston divides a thermally insulated cylinder into two equal parts. One part contains one mole of an ideal gas with adiabatic exponent $\\gamma$, the other is evacuated. The initial gas temperature is $T_0$. The piston is released and the gas fills the whole volume of the cylinder. Then the piston is slowly displaced back to the initial position. Find the increment of the internal energy and the entropy of the gas resulting from these two processes.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        The process consists of two parts. The first part is free expansion in which $U_f=U_i$. The second part is adiabatic compression in which work done results in change of internal energy. Obviously,
        $\\displaystyle 0=U_F-U_f+\\int_{{V_f}}^{{v_0}} p d V, V_f=2 V_0$
        Now in the first part $p_f=\\frac{{1}}{{2}} p_0, V_f=2 V_\\theta$, because there is no change of temperature.
        In the second part, $p V^\\gamma=\\frac{{1}}{{2}} p_0\\left(2 V_0\\right)^\\gamma=2^{{\\gamma-1}} p_0 V_0^\\gamma$
        $\\begin{{gathered}}
        \\int_{{2 V_0}}^{{V_0}} p d V=\\int_{{2 V_0}} \\frac{{2^{{\\gamma-1}} p_0 V_0^\\gamma}}{{V^\\gamma}} d V=\\left[\\frac{{2^{{\\gamma-1}} p_0 V_0^\\gamma}}{{-\\gamma+1}} V^{{1-\\gamma}}\\right]_{{2 V_0}}^{{V_0}} \\\\
        =2^{{\\gamma-1}} p_0 V_0^\\gamma V_0^{{-\\gamma+1}} \\frac{{2^{{-\\gamma+1}}-1}}{{\\gamma-1}}=-\\frac{{\\left(2^{{\\gamma-1}}-1\\right.}}{{\\gamma-1}} R T \\\\
        \\text{{Thus }}\\qquad \\Delta U=U_F-U_i=\\frac{{R T_0}}{{\\gamma-1}}\\left(2^{{\\gamma-1}}-1\\right)
        \\end{{gathered}}$

        The entropy change $\\Delta S=\\Delta S_I+\\Delta S_{{I I}}$
        $\\Delta S_I=R \\ln 2$ and $\\Delta S_{{I I}}=0$ as the process is reversible adiabatic. Thus $\\Delta S=R \\ln 2$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_150(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        An ideal gas was expanded from the initial state to the volume $V$ without any heat exchange with the surrounding bodies. Will the final gas pressure be the same in the case of (a) a fast and in the case of (b) a very slow expansion process?
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        In all adiabatic processes
        $Q=U_f-U_i+A=0$
        by virtue of the first law of thermodynamics. Thus,
        $U_f=U_i-A$
        For a slow process, $\\displaystyle A^{{\\prime}}=\\int_{{V_0}}^{{V}} p d V$ where for a quasistatic adiabatic process $p V^\\gamma=$ constant.
        On the other hand for a fast process the external work done is $A^{{\\prime \\prime}}<A^{{\\prime}}$. In fact $A^{{\\prime \\prime}}=0$ for free expansion. Thus $U_f^{{\\prime}}$ (slow) $<U_f^{{\\prime \\prime}}$ (fast)
        Since $U$ depends on temperature only, $T_f<T_f^{{\\prime}}$
        Consequently, $p_f^{{\\prime \\prime}}>p_f^{{\\prime}}$
        (From the ideal gas equation $p V=R T$ )
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_151(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        A thermally insulated vessel is partitioned into two parts so that the volume of one part is $n=2.0$ times greater than that of the other. The smaller part contains $v_1=0.30$ mole of nitrogen, and the greater one $v_2=0.70$ mole of oxygen. The temperature of the gases is the same. A hole is punctured in the partition and the gases are mixed. Find the corresponding increment of the system's entropy, assuming the gases to be ideal.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Let $V_1=V_0, V_2=n V_0$
        Since the temperature is the same, the required entropy change can be calculated by considering isothermal expansion of the gas in either parts into the whole vessel.
        Thus
        $\\begin{{aligned}}
        \\Delta S & =\\Delta S_I+\\Delta S_{{I I}}=v_1 R \\ln \\frac{{V_1+V_2}}{{V_1}}+v_2 R \\ln \\frac{{V_1+V_2}}{{V_2}} \\\\
        & =v_1 R \\ln (1+n)+v_2 R \\ln \\frac{{1+n}}{{n}}=5 \\cdot 1 \\mathrm{{~J}} / \\mathrm{{K}}
        \\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_2_152(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        A piece of copper of mass $m_1=300 \\mathrm{{~g}}$ with initial temperature $t_1=97{{ }}^{{\\circ}} \\mathrm{{C}}$ is placed into a calorimeter in which the water of mass $m_2=100 \\mathrm{{~g}}$ is at a temperature $t_2=7^{{\\circ}} \\mathrm{{C}}$. Find the entropy increment of the system by the moment the temperatures equalize. The heat capacity of the calorimeter itself is negligibly small.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Let $c_1=$ specific heat of copper specific heat of water $=c_2$
        Then $\\displaystyle \\Delta S=\\int_{{7+273}}^{{T_0}} \\frac{{c_2 m_2 d T}}{{T}}-\\int_{{T_0}}^{{97+273}} \\frac{{m_1 c_1 d T}}{{T}}=m_2 c_2 \\ln \\frac{{T_0}}{{280}}-m_1 c_1 \\ln \\frac{{370}}{{T_0}}$
        $T_0$ is found from
        $\\begin{{aligned}}
        & c_2 m_2\\left(T_0-280\\right)=m_1 c_1\\left(370-T_0\\right) \\text {{ or }} T_0=\\frac{{280 m_2 c_2+370 m_1 c_1}}{{c_2 m_2+m_1 c_1}} \\\\
        & \\text {{using }} \\quad c_1=0.39 \\mathrm{{~J}} / \\mathrm{{g}}{{ }}^{{\\circ}} \\mathrm{{K}}, c_2=4.18 \\mathrm{{~J}} / \\mathrm{{g}}{{ }}^{{\\circ}} \\mathrm{{K}} \\\\
        & T_0 \\approx 300^{{\\circ}} \\mathrm{{K}} \\text {{ and }} \\Delta S=28.4-24.5 \\cong 3.9 \\mathrm{{~J}} /{{ }}^{{\\circ}} \\mathrm{{K}}
        \\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_2_153(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Two identical thermally insulated vessels interconnected by a tube with a valve contain one mole of the same ideal gas each. The gas temperature in one vessel is equal to $T_1$ and in the other, $T_2$. The molar heat capacity of the gas of constant volume equals $C_V$. The valve having been opened, the gas comes to a new equilibrium state. Find the entropy increment $\\Delta S$ of the gas. Demonstrate that $\\Delta S>0$
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        For an ideal gas the internal energy depends on temperature only. We can consider the process in question to be one of simultaneous free expansion. Then the total energy $U=U_1+U_2$. Since $\\displaystyle U_1=C_V T_1, U_2=C_V T_2, U=2 C_V \\frac{{T_1+T_2}}{{2}}$ and $\\left(T_1+T_2\\right) / 2$ is the final temperature. The entropy change is obtained by considering isochoric processes because in effect, the gas remains confined to its vessel.
        $\\begin{{aligned}}
        &\\Delta S=\\int_{{T_1}}^{{\\left(T_1+T_2\\right) / 2}} \\frac{{C_V d T}}{{T}}-\\int_{{\\left(T_1+T_2\\right) / 2}}^{{T_2}} C_V \\frac{{d T}}{{T}}=C_V \\ln \\frac{{\\left(T_1+T_2\\right)^2}}{{4 T_1 T_2}} \\\\
        &\\text{{Since}} \\qquad \\left(T_1+T_2\\right)^2=\\left(T_1-T_2\\right)^2+4 T_1 T_2, \\Delta S>0
        \\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_2_154(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        $N$ atoms of gaseous helium are enclosed in a cubic vessel of volume $1.0 \\mathrm{{~cm}}^3$ at room temperature. Find:
        (a) the probability of atoms gathering in one half of the vessel;
        (b) the approximate numerical value of $N$ ensuring the occurrence of this event within the time interval $t \\approx 10^{{10}}$ years (the age of the Universe).
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        (a) Each atom has a probability $\\frac{{1}}{{2}}$ to be in either campartment. Thus
        $p=2^{{-N}}$
        (b) Typical atomic velocity at room temperature is $\\sim 10^5 \\mathrm{{~cm}} / \\mathrm{{s}}$ so it takes an atom $10^{{-5}} \\mathrm{{sec}}$ to cross the vessel. This is the relevant time scale for our problem. Let $T=10^{{-5}} \\mathrm{{sec}}$, then in time $t$ there will be $t / T$ crossing or arrangements of the atoms. This will be large enough to produce the given arrangement if
        $\\displaystyle \\frac{{t}}{{\\tau}} 2^{{-N}} \\sim 1 \\text {{ or }} N \\sim \\frac{{\\ln t / \\tau}}{{\\ln 2}} \\sim 75$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_155(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Find the statistical weight of the most probable distribution of $N=10$ identical molecules over two halves of the cylinder's volume. Find also the probability of such a distribution.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        The statistical weight is
        $\\displaystyle N_{{C_{{N / 2}}}}=\\frac{{N !}}{{N / 2 ! \\frac{{N}}{{2}} !}}=\\frac{{10 \\times 9 \\times 8 \\times 7 \\times 6}}{{8 \\times 4 \\times 3 \\times 2}}=252$
        The probability distribution is
        $N_{{C_{{N / 2}}}} 2^{{-N}}=252 \\times 2^{{-10}}=24.6 \\%$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate

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

        problem_s = f"""
        A vessel contains $N$ molecules of an ideal gas. Dividing mentally the vessel into two halves $A$ and $B$, find the probability that the half $A$ contains $n$ molecules. Consider the cases when $N=5$ and $n=0,1,2,3,4,5$.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        The probabilites that the half $\\boldsymbol{{A}}$ contains $\\boldsymbol{{n}}$ molecules is
        $\\displaystyle N_{{c_n}} \\times 2^{{-N}}=\\frac{{N !}}{{n !(N-n) !}} 2^{{-N}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_157(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        A vessel of volume $V_0$ contains $N$ molecules of an ideal gas. Find the probability of $n$ molecules getting into a certain separated part of the vessel of volume $V$. Examine, in particular, the case $V=V_0 / 2$
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        The probability of one molecule being confined to the marked volume is
        $\\displaystyle p=\\frac{{V}}{{V_0}}$
        We can choose this molecule in many $\\left(N_{{C_1}}\\right)$ ways. The probability that $n$ molecules get confined to the marked volume is cearly
        $\\displaystyle N_{{C_n}} p^n(1-p)^{{N-n}}=\\frac{{N !}}{{n !(N-n) !}} p^n(1-p)^{{N-n}}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_158(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        An ideal gas is under standard conditions. Find the diameter of the sphere within whose volume the relative fluctuation of the number of molecules is equal to $\\eta=1.0 \\cdot 10^{{-3}}$. What is the average number of molecules inside such a sphere?
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        In a sphere of diameter $d$ there are
        $\\displaystyle N=\\frac{{\\pi d^3}}{{6}} n_0 \\quad \\text {{ molecules }}$
        where $n_0=$ Loschmidt's number $=$ No. of molecules per unit volume $(1 \\mathrm{{cc}})$ under NTP. The relative fluctuation in this number is
        $\\displaystyle \\frac{{\\partial N}}{{N}}=\\frac{{\\sqrt{{N}}}}{{N}}=\\frac{{1}}{{\\sqrt{{N}}}}=\\eta$
        or $\\displaystyle \\frac{{1}}{{\\eta^2}}=\\frac{{\\pi}}{{6}} d^3 n_0$ or $\\displaystyle d^3=\\frac{{6}}{{\\pi n_0 \\eta^2}}$ or $d\\displaystyle =\\left(\\frac{{6}}{{\\pi \\eta^2 n_0}}\\right)^{{1 / 3}}=0.41 \\mu \\mathrm{{m}}$
        The average number of molecules in this sphere is $\\displaystyle \\frac{{1}}{{\\eta^2}}=10^6$

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

        problem_s = f"""
        One mole of an ideal gas consisting of monatomic molecules is enclosed in a vessel at a temperature $T_0=300 \\mathrm{{~K}}$. How many times and in what way will the statistical weight of this system (gas) vary if it is heated isochorically by $\\Delta T=1.0 \\mathrm{{~K}}$ ?
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        For a monoatomic gas $C_V=\\frac{{3}}{{2}} R$ per mole
        The entropy change in the process is
        $\\displaystyle \\Delta S=S-S_0=\\int_{{T_0}}^{{T_0 + \\Delta T}} C_V \\frac{{d T}}{{T}}=\\frac{{3}}{{2}} R \\ln \\left(1+\\frac{{\\Delta T}}{{T_0}}\\right)$
        Now from the Boltzmann equation
        $\\begin{{gathered}}
        S=k \\ln \\Omega \\\\
        \\frac{{\\Omega}}{{\\Omega_0}}=e^{{\\left(S-S_0\\right) / k}}=\\left(1+\\frac{{\\Delta T}}{{T_0}}\\right)^{{\\frac{{3 N_A}}{{2}}}}=\\left(1+\\frac{{1}}{{300}}\\right)^{{\\frac{{3 \\times 6}}{{2}} \\times 10^{{23}}}}=10^{{13}} \\times 10^{{21}}
        \\end{{gathered}}$
        Thus the statistical weight increases by this factor.
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _sample(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        """
        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)
    
