'''
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
import os

from xv.km.managers import BaseManager
from xv.km.kelements import KProblemTemplate
        
class HeatCapacityManager(BaseManager):
    '''
    HeatCapacityManager
    Example:
        ke = HeatCapacityManager()
        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(HeatCapacityManager, cls).__new__(cls, *args, **kwargs)
        for base_class in HeatCapacityManager.__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_26',
			'_problem_2_27',
			'_problem_2_28',
			'_problem_2_29',
			'_problem_2_30',
			'_problem_2_31',
			'_problem_2_32',
			'_problem_2_33',
			'_problem_2_34',
			'_problem_2_35',
			'_problem_2_36',
			'_problem_2_37',
			'_problem_2_38',
			'_problem_2_39',
			'_problem_2_40',
			'_problem_2_41',
			'_problem_2_42',
			'_problem_2_43',
			'_problem_2_44',
			'_problem_2_45',
			'_problem_2_46',
			'_problem_2_47',
			'_problem_2_48',
			'_problem_2_49',
			'_problem_2_50',
			'_problem_2_51',
			'_problem_2_52',
			'_problem_2_53',
			'_problem_2_54',
			'_problem_2_55',
			'_problem_2_56',
			'_problem_2_57',
			'_problem_2_58',
			'_problem_2_59',
			'_problem_2_60',
			'_problem_2_61',
            ])
        pass


    def _problem_2_26(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        problem_s = f"""
        Demonstrate that the interval energy U of the air in a room is independent of temperature provided the outside pressure p is constant. Calculate U, if p is equal to the normal atmospheric pressure and the room's volume is equal to V = 40 $m_3$. 
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Internal energy of air, treating as an ideal gas
        $U=\\frac{{m}}{{M}} C_{{V}} T=\\frac{{m}}{{M}} \\frac{{R}}{{\\gamma-1}} T=\\frac{{p V}}{{\\gamma-1}} \\qquad (1)$
        Using
        $C_{{V}}=\\frac{{R}}{{\\gamma-1}}, \\quad \\text {{ since }} C_{{p}}-C_{{V}}=R \\text {{ and }} \\frac{{C_{{p}}}}{{C_{{V}}}}=\\gamma$
        Thus at constant pressure $U=$ constant, because the volume of the room is a constant. Puting the value of $p=p_{{\\text {{atm }}}}$ and $V$ in Eq. (1), we get $U=10 \\mathrm{{MJ}}$.
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate

    def _problem_2_27(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        problem_s = f"""
        A thermally insulated vessel containing a gas whose molar mass is equal to M and the ratio of specific heats $C_p / C_v = \\gamma$ moves with a velocity v. Find the gas temperature increment resulting from the sudden stoppage of the vessel.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        From energy conservation
        $U_{{t}}+\\frac{{1}}{{2}}(v M) v^{{2}}=U_{{f}}$
        or,
        $\\Delta U=\\frac{{1}}{{2}} v M v^{{2}} \\quad (1)$
        But from $U=v \\frac{{R T}}{{\\gamma-1}},$
        $\\Delta U=\\frac{{v R}}{{\\gamma-1}} \\Delta T \\quad \\text{{(trom the previous problem)}} \\quad (2)$ 
        Hence from Eqs. (1) and (2).
        $\\Delta T=\\frac{{M v^{{2}}(\\gamma-1)}}{{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_2_28(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        problem_s = f"""
        Two thermally insulated vessels 1 and 2 are filled with air and connected by a short tube equipped with a valve. The volumes of the vessels, the pressures and temperatures of air in them are known ($V_1$, $p_1$, $T_1$ and $V_2$, $p_2$, $T_2$). Find the air temperature and pressure established after the opening of the valve. 
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        On opening the valve, the air will flow from the vessel at heigher pressure to the vessel at lower pressure till both vessels have the same air pressure. If this air pressure is $p$, the total volume of the air in the two vessels will be $\\left(V_{{1}}+V_{{2}}\\right)$. Also if $v_{{1}}$ and $v_{{2}}$ be the number of moles of air initially in the two vessels, we have
        $p_{{1}} V_{{1}}=v_{{1}} R T_{{1}} \\text {{ and }} p_{{2}} V_{{2}}=v_{{2}} R T_{{2}} \\qquad (1)$
        After the air is mixed up, the total number of moles are $\\left(v_{{1}}+v_{{2}}\\right)$ and the mixture is at -temperature $T$
        Hence $p\\left(V_{{1}}+V_{{2}}\\right)=\\left(v_{{1}}+v_{{2}}\\right) R T \\qquad (2)$
        Let us look at the two portions of air as one single system. Since this system is contained in a thermally insulated vessel, no heat exchange is involved in the process. That is, total heat transfer for the combined system $Q=0$
        Moreover, this combined system does not perform mechanical work either. The walls of the containers are rigid and there are no pistons etc to be pushed, looking at the total system, we know $A=0$.
        Hence, internal energy of the combined system does not change in the process. Initially energy of the combined system is equal to the sum of internal energies of the two portions of air :
        $U_{{i}}=U_{{1}}+U_{{2}}=\\frac{{v_{{1}} R T_{{1}}}}{{\\gamma-1}}+\\frac{{v_{{2}} R T_{{2}}}}{{\\gamma-1}} \\qquad (3)$
        Final internal energy of $\\left(n_{{1}}+n_{{2}}\\right)$ moles of air at temperature $T$ is given by
        $U_{{f}}=\\frac{{\\left(v_{{1}}+v_{{2}}\\right) R T}}{{\\gamma-1}} \\quad (4)$
        Therefore, $U_{{i}}=U_{{f}}$ implies :
        $T=\\frac{{v_{{1}} T_{{1}}+v_{{2}} T_{{2}}}}{{v_{{1}}+v_{{2}}}}=\\frac{{p_{{1}} V_{{1}}+p_{{2}} V_{{2}}}}{{\\left(p_{{1}} V_{{1}} / T_{{1}}\\right)+\\left(p_{{2}} V_{{2}} / T_{{2}}\\right)}}=T_{{1}} T_{{2}} \\frac{{p_{{1}} V_{{1}}+p_{{2}} V_{{2}}}}{{p_{{1}} V_{{1}} T_{{2}}+p_{{2}} V_{{2}} T_{{2}}}}$
        From (2), therefore, final pressure is given by :
        $p=\\frac{{v_{{1}}+v_{{2}}}}{{V_{{1}}+V_{{2}}}} R T=\\frac{{R}}{{V_{{1}}+V_{{2}}}}\\left(v_{{1}} T_{{1}}+v_{{2}} T_{{2}}\\right)=\\frac{{p_{{1}} V_{{1}}+p_{{2}} V_{{2}}}}{{V_{{1}}+V_{{2}}}}$
        This process in an example of free adiabatic expansion of ideal gas.

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

    def _problem_2_29(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        problem_s = f"""
        Gaseous hydrogen contained initially under standard conditions in a sealed vessel of volume V = 5.0 1 was cooled by $\\Delta T$= 55 K . Find how much the internal energy of the gas will change and what amount of heat will be lost by the gas. 
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        By the first law of thermodynamics,
        $Q=\\Delta U+A$
        Here $A=0$, as the volume remains constant,
        So, $Q=\\Delta U=\\frac{{v R}}{{\\gamma-1}} \\Delta T$
        From gas law,
        $p_{{0}} V=v R T_{{0}}$
        So, $\\Delta U=\\frac{{p_{{0}} V \\Delta T}}{{T_{{0}}(\\gamma-1)}}=-0.25 \\mathrm{{~kJ}}$
        Hence amount of heat lost $=-\\Delta U=0.25 \\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_2_30(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        problem_s = f"""
        What amount of heat is to be transferred to nitrogen in the isobaric heating process for that gas to perform the work A = 2.0 J?
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        By the first law of thermodynamics $Q=\\Delta U+A$
        But
        $\\begin{{gathered}}
        \\Delta U=\\frac{{p \\Delta V}}{{\\gamma-1}}=\\frac{{A}}{{\\gamma-1}}(\\text {{ as }} p \\text {{ is constant }}) \\\\
        Q=\\frac{{A}}{{\\gamma-1}}+A=\\frac{{\\gamma \\cdot A}}{{\\gamma-1}}=\\frac{{1 \\cdot 4}}{{1 \\cdot 4-1}} \\times 2=7 \\mathrm{{~J}}
        \\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_31(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        As a result of the isobaric heating by $\\Delta T=72 \\mathrm{{~K}}$ one mole of a certain ideal gas obtains an amount of heat $Q=1.60 \\mathrm{{~kJ}}$. Find the work performed by the gas, the increment of its internal energy, and the value of $\\gamma=C_p / C_V$.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Under isobaric process $A=p \\Delta V=R \\Delta T$ (as $v=1$ ) $=0.6 \\mathrm{{~kJ}}$ From the first law of thermodynamics
        $\\displaystyle \\Delta U=Q-A=Q-R \\Delta T=1 \\mathrm{{~kJ}}$
        Again increment in internal energy $\\Delta U=\\frac{{R \\Delta T}}{{\\gamma-1}}$, for $v=1$
        Thus $\\displaystyle Q-R \\Delta T=\\frac{{R \\Delta T}}{{\\gamma-1}} \\quad \\text {{ or }} \\quad \\gamma=\\frac{{Q}}{{Q-R \\Delta T}}=1.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_32(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Two moles of a certain ideal gas at a temperature $T_0=300 \\mathrm{{~K}}$ were cooled isochorically so that the gas pressure reduced $n=2.0$ times. Then, as a result of the isobaric process, the gas expanded till its temperature got back to the initial value. Find the total amount of heat absorbed by the gas in this process.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Let $v=2$ moles of the gas. In the first phase, under isochoric process, $A_1=0$, therefore from gas law if pressure is reduced $n$ times so that temperature i.e. new temperature becomes $T_0 / n$.
        Now from first law of thermodynamics
        $\\begin{{aligned}}
        Q_1&=\\Delta U_1=\\frac{{v R \\Delta T}}{{\\gamma-1}} \\\\
        &=\\frac{{v R}}{{\\gamma-1}}\\left(\\frac{{T_o}}{{n}}-T_0\\right)=\\frac{{v R T_0(1-n)}}{{n(\\gamma-1)}}
        \\end{{aligned}}$
        During the second phase (under isobaric process),
        $\\displaystyle A_2=p \\Delta V=v R \\Delta T$
        Thus from first law of thermodynamics :
        $\\begin{{aligned}}
        Q_2&=\\Delta U_2+A_2=\\frac{{v R \\Delta T}}{{\\gamma-1}}+v R \\Delta T \\\\
        &=\\frac{{v R\\left(T_0-\\frac{{T_0}}{{n}}\\right) \\gamma}}{{\\gamma-1}}=\\frac{{v R T_0(n-1) \\gamma}}{{n(\\gamma-1)}}
        \\end{{aligned}}$
        Hence the total amount of heat absorbed
        $\\begin{{aligned}}
        Q & =Q_1+Q_2=\\frac{{v R T_0(1-n)}}{{n(\\gamma-1)}}+\\frac{{v R T_0(n-1) \\gamma}}{{n(\\gamma-1)}} \\\\
        & =\\frac{{v R T_0(n-1) \\gamma}}{{n(\\gamma-1)}}(-1+\\gamma)=v R T_0\\left(1-\\frac{{1}}{{n}}\\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_2_33(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Calculate the value of $\\gamma=C_p / C_V$ for a gaseous mixture consisting of $v_1=2.0$ moles of oxygen and $v_2=3.0$ moles of carbon dioxide. The gases are assumed to be ideal.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Total no. of moles of the mixture $v=v_1+v_2$
        At a certain temperature, $U=U_1+U_2$ or $v C_V=v_1 C_{{V_1}}+v_2 C_{{V_2}}$
        Thus $C_V=\\frac{{v_1 C_{{V_1}}+v_2 C_{{V_2}}}}{{v}}=\\frac{{\\left(v_1 \\frac{{R}}{{\\gamma_1-1}}+v_2 \\frac{{R}}{{\\gamma_2-1}}\\right)}}{{v}}$
        $\\begin{{gathered}}
        &\\text{{Similarly }}& C_P=\\frac{{v_1 C_{{p_1}}+v_2 C_{{p_2}}}}{{v}} \\\\
        &&=\\frac{{v_1 \\gamma_1 C_{{V_1}}+v_2 \\gamma_2 C_{{V_2}}}}{{v}}=\\frac{{\\left(v_1 \\frac{{\\gamma_1 R}}{{\\gamma_1-1}}+v_2 \\frac{{\\gamma_2 R}}{{\\gamma_2-1}}\\right)}}{{v}} \\\\
        &\\text{{Similarly }}& \\gamma=\\frac{{C_P}}{{C_V}}=\\frac{{v_1 \\frac{{\\gamma_1}}{{\\gamma_1-1}} R+v_2 \\frac{{\\gamma_2}}{{\\gamma_2-1}} R}}{{v_1 \\frac{{R}}{{\\gamma_1-1}}+v_2 \\frac{{R}}{{\\gamma_2-1}}}} \\\\
        &&=\\frac{{v_1 \\gamma_1\\left(\\gamma_2-1\\right)+v_2 \\gamma_2\\left(\\gamma_1-1\\right)}}{{v_1\\left(\\gamma_2-1\\right)+v_2\\left(\\gamma_1-1\\right)}}
        \\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_34(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Find the specific heat capacities $c_V$ and $c_p$ for a gaseous mixture consisting of $7.0 \\mathrm{{~g}}$ of nitrogen and $20 \\mathrm{{~g}}$ of argon. The gases are assumed to be ideal.

        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        From the previous problem
        $\\displaystyle C_v=\\frac{{v_1 \\frac{{R}}{{\\gamma_1-1}}+v_2 \\frac{{R}}{{\\gamma_2-1}}}}{{v_1+v_2}}=15 \\cdot 2 \\mathrm{{~J}} / \\mathrm{{mole}} . \\mathrm{{K}}$
        $\\displaystyle C_p=\\frac{{v_1 \\frac{{\\gamma_1 R}}{{\\gamma_1-1}}+v_2 \\frac{{\\gamma_2 R}}{{\\gamma_2-1}}}}{{v_1+v_2}}=23.85 \\mathrm{{~J}} / \\mathrm{{mole}} . \\mathrm{{K}}$
        Now molar mass of the mixture $\\displaystyle (M)=\\frac{{\\text {{ Total mass }}}}{{\\text {{ Total number of moles }}}}=\\frac{{20+7}}{{\\frac{{1}}{{2}}+\\frac{{1}}{{4}}}}=36$
        Hence $\\displaystyle \\quad c_V=\\frac{{C_V}}{{M}}=0.42 \\mathrm{{~J}} / \\mathrm{{g}} \\cdot \\mathrm{{K}}$ and $c_p=\\frac{{C_p}}{{M}}=0.66 \\mathrm{{~J}} / \\mathrm{{g}} \\cdot \\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_35(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        One mole of a certain ideal gas is contained under a weightless piston of a vertical cylinder at a temperature $T$. The space over the piston opens into the atmosphere. What work has to be performed in order to increase isothermally the gas volume under the piston $n$ times by slowly raising the piston? The friction of the piston against the cylinder walls is negligibly small.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Let $S$ be the area of the piston and $F$ be the force exerted by the external agent. Then, $F+p S=p_0 S$ (Fig.) at an arbitrary instant of time. Here $p$ is the pressure at the instant the volume is $V$. (Initially the pressure inside is $p_0$ )
        $\\begin{{aligned}}
        A \\text{{(Work done by the agent)}}& =\\int_{{V_0}}^{{\\eta v_0}} F d x \\\\
        & =\\int_{{V_0}}^{{\\eta V_0}}\\left(p_0-p\\right) S \\cdot d x=\\int_{{V_0}}^{{\\eta V_0}}\\left(p_0-p\\right) d V \\\\
        & =p_0(\\eta-1) V_0-\\int_{{V_0}}^{{\\eta V_0}} p d V=p_0(\\eta-1) V_0-\\int_{{V_0}}^{{\\eta V_0}} v R T \\cdot \\frac{{d V}}{{V}} \\\\
        & =(\\eta-1) p_0 V_0-n R T \\ln \\eta=(\\eta-1) v R T-v R T \\ln \\eta \\\\
        & =v R T(\\eta-1-\\ln \\eta)=R T(\\eta-1-\\ln \\eta)(\\text {{ For }} v=1 \\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_36(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        A piston can freely move inside a horizontal cylinder closed from both ends. Initially, the piston separates the inside space of the cylinder into two equal parts each of volume $V_0$, in which an ideal gas is contained under the same pressure $p_0$ and at the same temperature. What work has to be performed in order to increase isothermally the volume of one part of gas $\\eta$ times compared to that of the other by slowly moving the piston?
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Let the agent move the piston to the right by $x$. In equilibirium position,
        $p_1 S+F_{{\\text {{agent }}}}=p_2 S, \\text {{ or, }} \\quad F_{{\\text {{agent }}}}=\\left(p_2-p_1\\right) S$
        Work done by the agent in an infinitesmal change $d x$ is
        $F_{{\\text {{agent }}}} \\cdot d x=\\left(p_2-p_1\\right) S d x=\\left(p_2-p_1\\right) d V$
        By applying $p V=$ constant, for the two parts,
        $p_1\\left(V_0+S x\\right)=p_0 V_0 \\text {{ and }} p_2\\left(V_0-S x\\right)=p_0 V_0$
        So, $\\displaystyle p_2-p_1=\\frac{{p_0 V_0 2 S x}}{{V_0^2-S^2 x^2}}=\\frac{{2 p_0 V_0 V}}{{V_0^2-V^2}}(\\text {{ where }} S x=V \\text {{ ) }}$
        When the volume of the left end is $\\eta$ times the volume of the right end
        $\\displaystyle \\left(V_0+V\\right)=\\eta\\left(V_0-V\\right), \\text {{ or, }} V=\\frac{{\\eta-1}}{{\\eta+1}} V_0$
        $\\begin{{aligned}}
        A=& \\int_0^V\\left(p_2-p_1\\right) d V =\\int_0^V \\frac{{2 p_0 V_0 V}}{{V_0^2-V^2}} d V=-p_0 V_0\\left[\\ln \\left(V_0^2-V^2\\right)\\right]_0^V \\\\
        & =-p_0 V_0\\left[\\ln \\left(V_0^2-V^2\\right)-\\ln V_0^2\\right] \\\\
        & =-p_0 V_0\\left[\\ln \\left\\{{V_0^2-\\left(\\frac{{\\eta-1}}{{\\eta+1^2}}\\right) V_0^2\\right\\}}-\\ln V_0^2\\right] \\\\
        & =-p_0 V_0\\left(\\ln \\frac{{4 \\eta}}{{(\\eta+1)^2}}\\right)=p_0 V_0 \\ln \\frac{{(\\eta+1)^2}}{{4 \\eta}}
        \\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_37(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Three moles of an ideal gas being initially at a temperature $T_0=273 \\mathrm{{~K}}$ were isothermally expanded $n=5.0$ times its initial volume and then isochorically heated so that the pressure in the final state became equal to that in the initial state. The total amount of heat transferred to the gas during the process equals $Q=80 \\mathrm{{~kJ}}$. Find the ratio $\\gamma=C_p / C_V$ for this gas.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        In the isothermal process, heat transfer to the gas is given by
        $\\displaystyle Q_1=v R T_0 \\ln \\frac{{V_2}}{{V_1}}=v R T_0 \\ln \\eta\\left(\\text {{ For }} \\eta=\\frac{{V_2}}{{V_1}}=\\frac{{p_1}}{{p_2}}\\right)$
        In the isochoric process, $A=0$
        Thus heat transfer to the gas is given by
        $\\displaystyle Q_2=\\Delta U=v C_V \\Delta T=\\frac{{\\nu R}}{{\\gamma-1}} \\Delta T \\quad\\left(\\text {{ for }} C_V=\\frac{{R}}{{\\gamma-1}}\\right)$
        But $\\displaystyle \\quad \\frac{{p_2}}{{p_1}}=\\frac{{T_0}}{{T}}$, or, $T=T_0 \\frac{{p_1}}{{p_2}}=\\eta T_0\\left(\\right.$ for $\\left.\\eta=\\frac{{p_1}}{{p_2}}\\right)$
        or, $\\displaystyle \\quad \\Delta T=\\eta T_0-T_0=(\\eta-1) T_0$ so, $Q_2=\\frac{{v R}}{{\\gamma-1}} \\cdot(\\eta-1) T_0$
        Thus, net heat transfer to the gas
        $\\displaystyle Q=v R T_0 \\ln \\eta+\\frac{{v R}}{{\\gamma-1}} \\cdot(\\eta-1) T_0$
        or, $\\displaystyle \\quad \\frac{{Q}}{{v R T_0}}=\\ln \\eta+\\frac{{\\eta-1}}{{\\gamma-1}}$, or, $\\frac{{Q}}{{v R T_0}}-\\ln \\eta=\\frac{{\\eta-1}}{{\\gamma-1}}$
        or, $\\displaystyle \\quad \\gamma=1+\\frac{{\\eta-1}}{{\\frac{{Q}}{{v R T_0}}-\\ln \\eta}}=1+\\frac{{6-1}}{{\\left(\\frac{{80 \\times 10^3}}{{3 \\times 8.314 \\times 273}}\\right)-\\ln 6}}=1 \\cdot 4$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_38(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Draw the approximate plots of isochoric, isobaric, isothermal, and adiabatic processes for the case of an ideal gas, using the following variables:
        (a) $p, T ;$; 
        (b) $V, T$.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        (a) From ideal gas law $\\displaystyle p=\\left(\\frac{{v R}}{{V}}\\right) T=k T\\left(\\text{{where }} k=\\frac{{v R}}{{V}}\\right)$
        For isochoric process, obviously $k=$ constant, thus $p=k T$, represents a straight line passing through the origin and its slope becomes $k$.
        For isobaric process $p=$ constant, thus on $p-T$ curve, it is a horizontal straight line parallel to $T$-axis, if $T$ is along horizontal (or $x$-axis)
        For isothermal process, $T=$ constant, thus on $p-T$ curve, it represents a vertical straight line if $T$ is taken along horizontal (or $x$-axis)
        For adiabatic process $T^\\gamma p^{{1-\\gamma}}=$ constant
        After diffrentiating, we get $(1-\\gamma) p^{{-\\gamma}} d p \\cdot T^\\gamma+\\gamma p^{{1-\\gamma}} \\cdot T^{{\\gamma-1}} \\cdot d T=0$
        $\\displaystyle \\frac{{d p}}{{d T}}=\\left(\\frac{{\\gamma}}{{1-\\gamma}}\\right)\\left(\\frac{{p^{{1-\\gamma}}}}{{p^{{-\\gamma}}}}\\right)\\left(\\frac{{T^{{\\gamma-1}}}}{{T^\\psi}}\\right)=\\left(\\frac{{\\gamma}}{{\\gamma-1}}\\right) \\frac{{p}}{{T}}$
        The approximate plots of isochoric, isobaric, isothermal, and adiabatic processess are drawn in the answersheet.
        (b) As $p$ is not considered as variable, we have from ideal gas law
        $\\displaystyle V=\\frac{{v R}}{{p}} T=k^{{\\prime}} T\\left(\\text {{ where }} k^{{\\prime}}=\\frac{{v R}}{{p}}\\right)$
        On $V-T$ co-ordinate system let us, take $T$ along $x$ - axis.
        For isochoric process $V=$ constant, thus $k^{{\\prime}}=$ constant and $V=k^{{\\prime}} T$ obviously represents a straight line pasing through the origin of the co-ordinate system and $k^{{\\prime}}$ is its slope.
        For isothermal process $T=$ constant. Thus on the stated co- ordinate system it represents a straight line parallel to the $V$-axis.
        For adiabatic process $T V^{{\\gamma-1}}=$ constant
        After differentiating, we get $(\\gamma-1) V^{{\\gamma-2}} d V \\cdot T+V^{{\\gamma-1}} d T=0$
        $\\displaystyle \\frac{{d V}}{{d T}}=-\\left(\\frac{{1}}{{\\gamma-1}}\\right) \\cdot \\frac{{V}}{{T}}$
        The approximate plots of isochoric, isobaric, isothermal and adiabatic processess are drawn in the answer sheet.
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_39(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        One mole of oxygen being initially at a temperature $T_0=$ $=290 \\mathrm{{~K}}$ is adiabatically compressed to increase its pressure $\\eta=10.0$ times. Find:
        (a) the gas temperature after the compression;
        (b) the work that has been performed on the gas.
        
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        (a) According to $T-p$ relation in adiabatic process, $T^\\psi=k p^{{\\gamma-1}}$ (where $k=$ constant) and
        $\\displaystyle \\left(\\frac{{T_2}}{{T_1}}\\right)^\\gamma=\\left(\\frac{{p_2}}{{p_1}}\\right)^{{\\gamma-1}} \\text {{ So, }} \\frac{{T^\\psi}}{{T_0^\\psi}}=\\eta^{{\\gamma-1}}\\left(\\text {{ for }} \\eta=\\frac{{p_2}}{{p_1}}\\right)$
        Hence $\\displaystyle T=T_0 \\cdot \\eta \\frac{{\\gamma-1}}{{\\gamma}}=290 \\times 10^{{(1.4-1) 1.4}}=0.56 \\mathrm{{kK}}$
        (b) Using the solution of part (a), sought work done
        $\\displaystyle A=\\frac{{v R \\Delta T}}{{\\gamma-1}}=\\frac{{v R T_0}}{{\\gamma-1}}\\left(\\eta^{{(\\gamma-1 / \\gamma}}-1\\right)=5.61 \\mathrm{{~kJ}} \\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_2_40(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        problem_s = f"""
        A certain mass of nitrogen was compressed $\\eta=5.0$ times (in terms of volume), first adiabatically, and then isothermally. In both cases the initial state of the gas was the same. Find the ratio of the respective works expended in each compression.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Let $\\left(p_0, V_0, T_0\\right)$ be the initial state of the gas.
        We know $\\displaystyle A_{{\\text {{adia }}}}=\\frac{{-v R \\Delta T}}{{\\gamma-1}}$ (work done by the gas)
        But from the equation $T V^{{\\gamma-1}}=$ constant, we get $\\Delta T=T_0\\left(\\eta^{{\\gamma-1}}-1\\right)$
        Thus $\\displaystyle A_{{\\text {{adia }}}}=\\frac{{-\\nu R T_0\\left(\\eta^{{\\gamma-1}}-1\\right)}}{{\\gamma-1}}$
        On the other hand, we know $\\displaystyle A_{{i s o}}=v R T_0 \\ln \\left(\\frac{{1}}{{\\eta}}\\right)=-v R T_0 \\ln \\eta$ (work done by the gas)
        Thus $\\displaystyle \\frac{{A_{{\\text {{adia }}}}}}{{A_{{\\text {{iro }}}}}}=\\frac{{\\eta^{{\\gamma-1}}-1}}{{(\\gamma-1) \\ln \\eta}}=\\frac{{5^{{0.4}}-1}}{{0 \\cdot 4 \\times \\ln 5}}=1 \\cdot 4$

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

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

        problem_s = f"""
        A heat-conducting piston can freely move inside a closed thermally insulated cylinder with an ideal gas. In equilibrium the piston divides the cylinder into two equal parts, the gas temperature being equal to $T_0$. The piston is slowly displaced. Find the gas temperature as a function of the ratio $\\eta$ of the volumes of the greater and smaller sections. The adiabatic exponent of the gas is equal to $\\gamma$.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Since here the piston is conducting and it is moved slowly the temperature on the two sides increases and maintained at the same value.
        Elementary work done by the agent $=$ Work done in compression - Work done in expansion i.e. $d A=p_2 d V-p_1 d V=\\left(p_2-p_1\\right) d V$
        where $p_1$ and $p_2$ are pressures at any instant of the gas on expansion and compression side respectively.
        From the gas law $p_1\\left(V_0+S x\\right)=v R T$ and $p_2\\left(V_0-S x\\right)=v R T$, for each section ( $x$ is the displacement of the piston towards section 2)
        $\\begin{{aligned}}
        &\\text{{So, }} \\qquad p_2-p_1=v R T \\frac{{2 S x}}{{V_0^2-S^2 x^2}}=v R T \\cdot \\frac{{2 V}}{{V_0^2-V^2}}(\\text {{ as }} S x=V) \\\\
        &\\text{{So, }}\\qquad d A=v R T \\frac{{2 V}}{{V_0^2-V^2}} d V
        \\end{{aligned}}$
        Also, from the first law of thermodynamics
        $\\displaystyle d A=-d U=-2 v \\frac{{R}}{{\\gamma-1}} d T \\left(\\text {{ as }} d Q=0\\right)$
        So, work done on the gas $\\displaystyle =-d A=2 v \\cdot \\frac{{R}}{{\\gamma-1}} d T$
        Thus $\\displaystyle \\quad 2 v \\frac{{R}}{{\\gamma-1}} d T=v R T \\frac{{2 V \\cdot d V}}{{V_0^2-V^2}}$
        or, $\\displaystyle \\quad \\frac{{d T}}{{T}}=\\gamma-1 \\frac{{V d V}}{{V_0^2-V^2}}$
        When the left end is $\\eta$ times the volume of the right end.
        $\\left(V_0+V\\right)=\\eta\\left(V_0-V\\right) \\text {{ or }} V=\\frac{{\\eta-1}}{{\\eta+1}} V_0$
        On integrating or
        $\\displaystyle \\int_{{T_0}}^T \\frac{{d T}}{{T}}=(\\gamma-1) \\int_0^v \\frac{{V d V}}{{V_0^2-V^2}}$
        $\\begin{{gathered}}
        \\ln \\frac{{T}}{{T_0}}=(\\gamma-1)\\left[-\\frac{{1}}{{2}} \\ln \\left(V_0^2-V^2\\right)\\right]_0^V \\\\
        \\left.=-\\frac{{\\gamma-1}}{{2}}\\left[\\ln \\left(V_0^2-V^2\\right)-\\ln V_0^2-V^2\\right)-\\ln V_0^2\\right] \\\\
        =\\frac{{\\gamma-1}}{{2}}\\left[\\ln V_0^2-\\ln V_0^2\\left\\{{1-\\left(\\frac{{\\eta-1}}{{\\eta+1}}\\right)\\right\\}}=\\frac{{\\gamma-1}}{{2}} \\ln \\frac{{(\\eta+1)^2}}{{4 \\eta}}\\right. \\\\
        T=T_0\\left(\\frac{{(\\eta+1)^2}}{{4 \\eta}}\\right)^{{\\frac{{\\gamma-1}}{{2}}}}
        \\end{{gathered}}$
        Hence
        $\\displaystyle T=T_0\\left(\\frac{{(\\eta+1)^2}}{{4 \\eta}}\\right)^{{\\frac{{\\gamma-1}}{{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_42(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Find the rate $v$ with which helium flows out of a thermally insulated vessel into vacuum through a small hole. The flow rate of the gas inside the vessel is assumed to be negligible under these conditions. The temperature of helium in the vessel is $T=1,000 \\mathrm{{~K}}$.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        From energy conservation as in the derivation of Bernoullis theorem it reads
        $\\displaystyle \\frac{{p}}{{\\rho}}+\\frac{{1}}{{2}} v^2+g z+u+Q_d=\\text {{ constant }} \\qquad (1)$
        In the Eq. (1) $u$ is the internal energy per unit mass and in this case is the thermal energy per unit mass of the gas. As the gas vessel is thermally insulated $Q_d=0$, also in our case.
        Just inside the vessel $\\displaystyle u=\\frac{{C_V T}}{{M}}=\\frac{{R T}}{{M(\\gamma-1)}}$ also $\\displaystyle \\frac{{p}}{{\\rho}}=\\frac{{R T}}{{M}}$. Inside the vessel $v=0$ also. Just outside $p=0$, and $u=0$. Ingeneral $g z$ is not very significant for gases.
        Thus applying Eq. (1) just inside and outside the hole, we get
        $\\displaystyle \\begin{{aligned}}
        \\frac{{1}}{{2}} v^2 & =\\frac{{P}}{{\\rho}}+u \\\\
        & =\\frac{{R T}}{{M}}+\\frac{{R T}}{{M(\\gamma-1)}}=\\frac{{\\gamma R T}}{{M(\\gamma-1)}}
        \\end{{aligned}}$
        Hence $\\displaystyle \\quad v^2=\\frac{{2 \\gamma R T}}{{M(\\gamma-1)}}$ or, $\\quad v=\\sqrt{{\\frac{{2 \\gamma R T}}{{M(\\gamma-1)}}}}=3.22 \\mathrm{{~km}} / \\mathrm{{s}}$
        Note : The velocity here is the velocity of hydrodynamic flow of the gas into vaccum. This requires that the diameter of the hole is not too small $(D>$ mean free path $l$. In the opposite case $(D<<l)$ the flow is called effusion. Then the above result does not apply and kinetic theory methods are needed.
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_43(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        The volume of one mole of an ideal gas with the adiabatic exponent $\\gamma$ is varied according to the law $V=a / T$, where $a$ is a constant. Find the amount of heat obtained by the gas in this process if the gas temperature increased by $\\Delta T$.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        The differential work done by the gas
        $\\begin{{gathered}}
        d A=p d V=\\frac{{v R T^2}}{{a}}\\left(-\\frac{{a}}{{T^2}}\\right) d T=-v R d T \\\\
        \\left(\\text {{ as }} p V=v R T \\text {{ and }} V=\\frac{{a}}{{T}}\\right) \\\\
        A+\\Delta T \\\\
        A=-\\int_T v R d T=-v R \\Delta T
        \\end{{gathered}}$
        From the first law of thermodynamics
        $\\begin{{gathered}}
        Q=\\Delta U+A=\\frac{{v R}}{{\\gamma-1}} \\Delta T-v R \\Delta T \\\\
        =v R \\Delta T \\cdot \\frac{{2-\\gamma}}{{\\gamma-1}}=R \\Delta T \\cdot \\frac{{2-\\gamma}}{{\\gamma-1}}(\\text {{ for }} v=1 \\mathrm{{~mole}})
        \\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_44(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Demonstrate that the process in which the work performed by an ideal gas is proportional to the corresponding increment of its internal energy is described by the equation $p V^n=$ const, where $n$ is a constant.

        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        According to the problem : $A \\alpha U$ or $d A=a U$ (where $a$ is proportionality constant)
        or, $\\displaystyle p d V=\\frac{{a \\vee R d T}}{{\\gamma-1}} \\qquad(1)$
        From ideal gas law, $p V=v R T$, on differentiating
        $\\displaystyle p d V+V d p=v R d T \\qquad(2)$
        Thus from (1) and (2)
        $\\displaystyle p d V=\\frac{{a}}{{\\gamma-1}}(p d V+V d p)$
        or, $\\displaystyle p d V\\left(\\frac{{a}}{{\\gamma-1}}-1\\right)+\\frac{{a}}{{\\gamma-1}} V d p=0$
        or, $\\displaystyle p d V(k-1)+k V d p=0$ (where $k=\\frac{{a}}{{\\gamma-1}}=$ another constant)
        or, $\\displaystyle p d V \\frac{{k-1}}{{k}}+V d p=0$
        or, $\\displaystyle p d V n+V d p=0$ (where $\\frac{{k-1}}{{k}}=n=$ ratio)
        Dividing both the sides by $p V$
        $\\displaystyle n \\frac{{d V}}{{V}}+\\frac{{d p}}{{p}}=0$
        On integrating $n \\ln V+\\ln p=\\ln C$ (where $C$ is constant) or,
        $\\displaystyle \\ln \\left(p V^n\\right)=\\ln C \\text {{ or, }} p V^n=C \\text {{ (const.) }}$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_45(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Find the molar heat capacity of an ideal gas in a polytropic process $p V^n=$ const if the adiabatic exponent of the gas is equal to $\\gamma$. At what values of the polytropic constant $n$ will the heat capacity of the gas be negative?
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        In the polytropic process work done by the gas
        $\\displaystyle A=\\frac{{v R\\left[T_i-T_f\\right]}}{{n-1}}$
        (where $T_i$ and $T_f$ are initial and final temperature of the gas like in adiabatic process) and
        $\\displaystyle \\Delta U=\\frac{{v R}}{{\\gamma-1}}\\left(T_f-T_i\\right)$
        By the first law of thermodynamics $Q=\\Delta U+A$
        $\\begin{{gathered}}
        =\\frac{{v R}}{{\\gamma-1}}\\left(T_f-T_i\\right)+\\frac{{v R}}{{n-1}}\\left(T_i-T_f\\right) \\\\
        =\\left(T_f-T_i\\right) v R\\left[\\frac{{1}}{{\\gamma-1}}-\\frac{{1}}{{n-1}}\\right]=\\frac{{v R[n-\\gamma]}}{{(n-1)(\\gamma-1)}} \\Delta T
        \\end{{gathered}}$
        According to definition of molar heat capacity when number of moles $v=1$ and $\\Delta T=1$ then $Q=$ Molar heat capacity.
        Here, $\\displaystyle C_n=\\frac{{R(n-\\gamma)}}{{(n-1)(\\gamma-1)}}<0 \\text {{ for }} 1<n<\\gamma$
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_46(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        In a certain polytropic process the volume of argon was increased $\\alpha=4.0$ times. Simultaneously, the pressure decreased $\\beta=8.0$ times. Find the molar heat capacity of argon in this process, assuming the gas to be ideal.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Let the process be polytropic according to the law $p V^n=$ constant 
        Thus, $\\displaystyle p_f V_f^n=p_i V_i^n \\quad \\text {{ or, }} \\quad\\left(\\frac{{p_i}}{{p_f}}\\right)=\\beta$
        So, $\\displaystyle \\alpha^n=\\beta \\text {{ or }} \\ln \\beta=n \\ln \\alpha \\text {{ or }} n=\\frac{{\\ln \\beta}}{{\\ln \\alpha}}$
        In the polytropic process molar heat capacity is given by
        $\\begin{{aligned}}
        C_n & =\\frac{{R(n-\\gamma)}}{{(n-1)(\\gamma-1)}}=\\frac{{R}}{{\\gamma-1}}-\\frac{{R}}{{n-1}} \\\\
        & =\\frac{{R}}{{\\gamma-1}}-\\frac{{R \\ln \\alpha}}{{\\ln \\beta-\\ln \\alpha}}, \\text {{ where }} n=\\frac{{\\ln \\beta}}{{\\ln \\alpha}}
        \\end{{aligned}}$
        So, $\\displaystyle C_n=\\frac{{8.314}}{{1 \\cdot 66-1}}-\\frac{{8 \\cdot 314 \\ln 4}}{{\\ln 8-\\ln 4}}=-42 \\mathrm{{~J}} / \\mathrm{{mol}} . \\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_47(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        One mole of argon is expanded polytropically, the polytropic constant being $n=1.50$. In the process, the gas temperature changes by $\\Delta T=-26 \\mathrm{{~K}}$. Find:
        (a) the amount of heat obtained by the gas;
        (b) the work performed by the gas.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        (a) Increment of internal energy for $\\Delta T$, becomes
        $\\displaystyle \\Delta U=\\frac{{\\gamma R \\Delta T}}{{\\gamma-1}}=\\frac{{R \\Delta T}}{{\\gamma-1}}=-324 \\mathrm{{~J}}(\\text {{ as }} v=1 \\mathrm{{~mole}})$
        From first law of thermodynamics
        $\\displaystyle Q=\\Delta U+A=\\frac{{R \\Delta T}}{{\\gamma-1}}-\\frac{{R \\Delta T}}{{n-1}}=0.11 \\mathrm{{~kJ}}$
        $\\begin{{aligned}}
        \\text {{(b) Sought work done, }} A_n&=\\int p d V=\\int_{{V_i}}^{{V_f}} \\frac{{k}}{{V^n}} d V \\\\
        &\\text {{ (where }} \\left.p V^n=k=p_i V_i^n=p_f V_f^n\\right) \\\\
        &=\\frac{{k}}{{1-n}}\\left(V_f^{{1-n}}-V_i^{{1-n}}\\right)=\\frac{{\\left(p_f V_f^n V_f^{{1-n}}-p_i V_i^n V_i^{{1-n}}\\right)}}{{1-n}} \\\\
        &=\\frac{{p_f V_f-p_i V_i}}{{1-n}}=\\frac{{v R\\left(T_f-T_i\\right)}}{{1-n}} \\\\
        &=\\frac{{v R \\Delta T}}{{n-1}}=-\\frac{{R \\Delta T}}{{n-1}}=0.43 \\mathrm{{~kJ}} \\left(\\text {{ as }} v=1 \\mathrm{{~mole}}\\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_2_48(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        An ideal gas whose adiabatic exponent equals $\\gamma$ is expanded according to the law $p=\\alpha V$, where $\\alpha$ is a constant. The initial volume of the gas is equal to $V_0$. As a result of expansion the volume increases $\\eta$ times. Find:
        (a) the increment of the internal energy of the gas;
        (b) the work performed by the gas;
        (c) the molar heat capacity of the gas in the process.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Law of the process is $p=\\alpha V$ or $p V^{{-1}}=\\alpha$ so the process is polytropic of index $n=-1$
        As $p=\\alpha V$ so, $p_i=\\alpha V_0$ and $p_f=\\alpha \\eta V_0$
        (a) Increment of the internal energy is given by
        $\\displaystyle \\Delta U=\\frac{{v R}}{{\\gamma-1}}\\left[T_f-T_i\\right]=\\frac{{p_f V_f-p_i V_i}}{{\\gamma-1}}$
        (b) Work done by the gas is given by
        $\\begin{{aligned}}
        A & =\\frac{{p_i V_i-p_f V_f}}{{n-1}}=\\frac{{\\alpha V_0^2-\\alpha \\eta V_0 \\cdot \\eta V_0}}{{-1-1}} \\\\
        & =\\frac{{\\alpha V_0^2\\left(1-\\eta^2\\right)}}{{-2}}=\\frac{{1}}{{2}} \\alpha V_0^2\\left(\\eta^2-1\\right)
        \\end{{aligned}}$
        (c) Molar heat capacity is given by
        $\\displaystyle C_n=\\frac{{R(n-\\gamma)}}{{(n-1)(\\gamma-1)}}=\\frac{{R(-1-\\gamma)}}{{(-1-1)(\\gamma-1)}}=\\frac{{R}}{{2}} \\frac{{\\gamma+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_49(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        An ideal gas whose adiabatic exponent equals $\\gamma$ is expanded so that the amount of heat transferred to the gas is equal to the decrease of its internal energy. Find:
        (a) the molar heat capacity of the gas in this process;
        (b) the equation of the process in the variables $T, V$;
        (c) the work performed by one mole of the gas when its volume increases $\\eta$ times if the initial temperature of the gas is $T_0$.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        (a) $\\displaystyle \\Delta U=\\frac{{v R}}{{\\gamma-1}} \\Delta T$ and $Q=v C_n \\Delta T$
        where $C_n$ is the molar heat capacity in the process. It is given that $Q=-\\Delta U$
        So, $\\displaystyle C_n \\Delta T=\\frac{{R}}{{\\gamma-1}} \\Delta T, \\quad \\text {{ or }} \\quad C_n=-\\frac{{R}}{{\\gamma-1}}$
        (b) By the first law of thermodynamics, $d Q=d U+d A$,
        or, $2 d Q=d A(\\text {{ as }} d Q=-d U)$
        $\\displaystyle 2 v C_n d T=p d V, \\text {{ or, }} \\frac{{2 R v}}{{\\gamma-1}} d T+p d V=0$
        So, $\\displaystyle \\frac{{2 R V}}{{\\gamma-1}} d T+\\frac{{\\nu R T}}{{V}} d V=0, \\quad \\text {{ or, }} \\frac{{2 d T}}{{(\\gamma-1) T}}+\\frac{{d V}}{{V}}=0$
        or, $\\displaystyle \\frac{{d T}}{{T}}+\\frac{{\\gamma-1}}{{2}} \\frac{{d V}}{{V}}=0, \\text {{ or, }} T V^{{(\\gamma-1) / 2}}=\\text {{ constant. }}$
        (c) We know $\\displaystyle C_n=\\frac{{(n-\\gamma) R}}{{(n-1)(\\gamma-1)}}$
        But from part (a), we have $\\displaystyle C_n=-\\frac{{R}}{{\\gamma-1}}$
        Thus
        $\\begin{{gathered}}
        -\\frac{{R}}{{\\gamma-1}}=\\frac{{(n-\\gamma) R}}{{(n-1)(\\gamma-1)}} \\text {{ which yields }} \\\\
        n=\\frac{{1+\\gamma}}{{2}}
        \\end{{gathered}}$
        From part (b); we know $T V^{{(\\gamma-1) / 2}}=$ constant
        So, $\\displaystyle \\quad \\frac{{T_o}}{{T}}=\\left(\\frac{{V}}{{V_0}}\\right)^{{(\\gamma-1) / 2}}=\\eta^{{(\\gamma-1) / 2}}$ (where $T$ is the final temperature)
        Work done by the gas for one mole is given by
        $\\displaystyle A=R \\frac{{\\left(T_0-T\\right)}}{{n-1}}=\\frac{{2 R T_0\\left[1-\\eta^{{(1-\\gamma) / 2}}\\right]}}{{\\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_50(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        problem_s = f"""
        One mole of an ideal gas whose adiabatic exponent equals $\\gamma$ undergoes a process in which the gas pressure relates to the temperature as $p=a T^\\alpha$, where $a$ and $\\alpha$ are constants. Find:
        (a) the work performed by the gas if its temperature gets an increment $\\Delta T$
        (b) the molar heat capacity of the gas in this process; at what value of $\\alpha$ will the heat capacity be negative?
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Given $p=a T^\\alpha$ (for one mole of gas)
        So, $\\displaystyle p T^{{-\\alpha}}=a \\text {{ or, }} p\\left(\\frac{{p V}}{{R}}\\right)^{{-\\alpha}}=a,$
        or, $\\displaystyle p^{{1-\\alpha}} V^{{-\\alpha}}=a R^{{-\\alpha}} \\text {{ or, }} p V^{{\\alpha /(\\alpha-1)}}=\\text {{ constant }}$
        Here polytropic exponent $n=\\frac{{\\alpha}}{{\\alpha-1}}$
        (a) In the polytropic process for one mole of gas :
        $\\displaystyle A=\\frac{{R \\Delta T}}{{1-n}}=\\frac{{R \\Delta T}}{{\\left(1-\\frac{{\\alpha}}{{\\alpha-1}}\\right)}}=R \\Delta T(1-\\alpha)$
        (b) Molar heat capacity is given by
        $\\displaystyle C=\\frac{{R}}{{\\gamma-1}}-\\frac{{R}}{{n-1}}=\\frac{{R}}{{\\gamma-1}}-\\frac{{R}}{{\\frac{{\\alpha}}{{\\alpha-1}}-1}}=\\frac{{R}}{{\\gamma-1}}+R(1-\\alpha)$

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

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

        problem_s = f"""
        An ideal gas with the adiabatic exponent $\\gamma$ undergoes a process in which its internal energy relates to the volume as $U=a V^\\alpha$, where $a$ and $\\alpha$ are constants. Find:
        (a) the work performed by the gas and the amount of heat to be transferred to this gas to increase its internal energy by $\\Delta U$;
        (b) the molar heat capacity of the gas in this process.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Given $U=a V^\\alpha$
        $\\begin{{aligned}}
        &\\text{{or, }} \\qquad& &v C_V T=a V^\\alpha, \\text {{ or, }} v C_V \\frac{{p V}}{{v R}}=a V^\\alpha \\\\
        &\\text{{or, }} \\qquad& &a V^\\alpha \\cdot \\frac{{R}}{{C_V}} \\cdot \\frac{{1}}{{p V}}=1, \\text {{ or, }} V^{{\\alpha-1}} \\cdot p^{{-1}}=\\frac{{C_V}}{{R a}} \\\\
        &\\text{{or, }} \\qquad& &p V^{{1-\\alpha}}=\\frac{{R a}}{{C_V}}=\\text {{ constant }}=a(\\gamma-1)\\left[\\text {{ as }} C_V=\\frac{{R}}{{\\gamma-1}}\\right]
        \\end{{aligned}}$
        So polytropric index $n=1-\\alpha$.
        (a) Work done by the gas is given by
        $\\displaystyle A=\\frac{{-v R \\Delta T}}{{n-1}} \\text {{ and }} \\Delta U=\\frac{{v R \\Delta T}}{{\\gamma-1}}$
        Hence $\\displaystyle \\quad A=\\frac{{-\\Delta U(\\gamma-1)}}{{n-1}}=\\frac{{\\Delta U(\\gamma-1)}}{{\\alpha}}$ (as $n=1-\\alpha$ )
        By the first law of thermodynamics, $Q=\\Delta U+A$
        $\\displaystyle =\\Delta U+\\frac{{\\Delta U(\\gamma-1)}}{{\\alpha}}=\\Delta U\\left[1+\\frac{{\\gamma-1}}{{\\alpha}}\\right]$
        (b) Molar heat capacity is given by
        $\\begin{{aligned}}
        C&= \\frac{{R}}{{\\gamma-1}}-\\frac{{R}}{{n-1}}=\\frac{{R}}{{\\gamma-1}}-\\frac{{R}}{{1-\\alpha-1}} \\\\
        &=\\frac{{R}}{{\\gamma-1}}+\\frac{{R}}{{\\alpha}}(\\text {{ as }} n=1-\\alpha)
        \\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_52(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        An ideal gas has a molar heat capacity $C_V$ at constant volume. Find the molar heat capacity of this gas as a function of its volume $V$, if the gas undergoes the following process:
        (a) $T=T_0 \\mathrm{{e}}^{{\\alpha V}}$
        (b) $p=p_0 \\mathrm{{e}}^{{\\alpha V}}$
        where $T_0, p_0$, and $\\alpha$ are constants.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        (a) By the first law of thermodynamics
        $\\displaystyle d Q=d U+d A=v C_V d T+p d V$
        Molar specific heat according to definition
        $\\displaystyle \\begin{{gathered}}
        C=\\frac{{d Q}}{{v d T}}=\\frac{{C_V d T+p d V}}{{v d T}} \\\\
        =\\frac{{v C_V d T+\\frac{{v R T}}{{V}} d V}}{{v d T}}=C_V+\\frac{{R T}}{{V}} \\frac{{d V}}{{d T}}
        \\end{{gathered}}$
        We have $\\displaystyle T=T_0 e^{{\\alpha V}}$
        After differentiating, we get $d T=\\alpha T_0 e^{{\\alpha V}} \\cdot d V$
        So, $\\displaystyle \\frac{{d V}}{{D T}}=\\frac{{1}}{{\\alpha T_0 e^{{\\alpha V}}}}$
        Hence $\\displaystyle \\quad C=C_V+\\frac{{R T}}{{V}} \\cdot \\frac{{1}}{{\\alpha T_0 e^{{\\alpha V}}}}=C_V+\\frac{{R T_0 e^{{\\alpha V}}}}{{\\alpha V T_0 e^{{\\alpha \\nu}}}}=C_V+\\frac{{R}}{{\\alpha V}}$
        (b) Process is $p=p_0 e^{{\\alpha V}}$
        $\\displaystyle p=\\frac{{R T}}{{V}}=p_0 e^{{\\alpha V}}$
        or, $\\displaystyle T=\\frac{{p_0}}{{R}} e^{{\\alpha V}} \\cdot V$
        So, $\\displaystyle C=C_V+\\frac{{R T}}{{V}} \\frac{{d V}}{{d T}}=C_V+p_0 e^{{\\alpha V}} \\cdot \\frac{{R}}{{p_0 e^{{\\alpha V}}(1+\\alpha V)}}=C_V+\\frac{{R}}{{1+\\alpha 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_53(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        One mole of an ideal gas whose adiabatic exponent equals $\\gamma$ undergoes a process $p=p_0+\\alpha / V$, where $p_0$ and $\\alpha$ are positive constants. Find:
        (a) heat capacity of the gas as a function of its volume;
        (b) the internal energy increment of the gas, the work performed by it, and the amount of heat transferred to the gas, if its volume increased from $V_1$ to $V_2$.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Using 2.52
        (a) $\\displaystyle C=C_V+\\frac{{R T}}{{V}} \\frac{{d V}}{{d T}}=C_V+\\frac{{p d V}}{{d T}}$ (for one mole of gas)
        We have $\\displaystyle \\quad p=p_0+\\frac{{\\alpha}}{{V}}, \\quad$ or, $\\displaystyle \\quad \\frac{{R T}}{{V}}=p_0+\\frac{{\\alpha}}{{V}}, \\quad$ or, $\\displaystyle \\quad R T=p_0 V+\\alpha$
        Therefore $\\displaystyle R d T=p_0 d V, \\text {{ So, }} \\frac{{d V}}{{d T}}=\\frac{{R}}{{p_0}}$
        $\\begin{{aligned}}
        \\text{{Hence }}\\quad C &= C_V+\\left(p_0+\\frac{{\\alpha}}{{V}}\\right) \\cdot \\frac{{R}}{{p_0}}=\\frac{{R}}{{\\gamma-1}}+\\left(1+\\frac{{\\alpha}}{{p_0 V}}\\right) R \\\\
        &=\\left(R+\\frac{{R}}{{\\gamma-1}}\\right)+\\frac{{\\alpha R}}{{p_0 V}}=\\frac{{\\gamma R}}{{\\gamma-1}}+\\frac{{\\alpha R}}{{p_0 V}}
        \\end{{aligned}}$
        (b) Work done is given by
        $\\begin{{gathered}}
        A=\\int_{{V_1}}^{{V_2}}\\left(p_0+\\frac{{\\alpha}}{{V}}\\right) d V=p_0\\left(V_2-V_1\\right)+\\alpha \\ln \\frac{{V_2}}{{V_1}} \\\\
        \\Delta U=C_V\\left(T_2-T_1\\right)=C_V\\left(\\frac{{p_2 V_2}}{{R}}-\\frac{{p_1 V_1}}{{R}}\\right) \\text {{ (for one mole) }} \\\\
        =\\frac{{R}}{{(\\gamma-1) R}}\\left(p_2 V_2-p_1 V_1\\right) \\\\
        =\\frac{{1}}{{\\gamma-1}}\\left[\\left(p_0+\\alpha V_2\\right) V_2-\\left(p_0+\\frac{{\\alpha}}{{V_1}}\\right) V_1\\right]=\\frac{{p_0\\left(V_2-V_1\\right)}}{{\\gamma-1}}
        \\end{{gathered}}$
        By the first law of thermodynamics $Q=\\Delta U+A$
        $\\begin{{gathered}}
        =p_0\\left(V_2-V_1\\right)+\\alpha \\ln \\frac{{V_2}}{{V_1}}+\\frac{{p_0\\left(V_2-V_1\\right)}}{{(\\gamma-1)}} \\\\
        =\\frac{{\\gamma p_0\\left(V_2-V_1\\right)}}{{\\gamma-1}}+\\alpha \\ln \\frac{{V_2}}{{V_1}}
        \\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_54(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        One mole of an ideal gas with heat capacity at constant pressure $C_p$ undergoes the process $T=T_0+\\alpha V$, where $T_0$ and $\\alpha$ are constants. Find:
        (a) heat capacity of the gas as a function of its volume;
        (b) the amount of heat transferred to the gas, if its volume increased from $V_1$ to $V_2$.

        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        (a) Heat capacity is given by
        $\\displaystyle C=C_V+\\frac{{R T}}{{V}} \\frac{{d V}}{{d T}} \\text {{ (see solution of 2.52) }}$
        We have $\\displaystyle T=T_0+\\alpha V \\quad \\text {{ or, }} \\quad V=\\frac{{T}}{{\\alpha}}-\\frac{{T_0}}{{\\alpha}}$
        After differentiating, we get, $\\frac{{d V}}{{d T}}=\\frac{{1}}{{\\alpha}}$
        $\\begin{{aligned}}
        \\text {{Hence }} \\quad C&=C_V+\\frac{{R T}}{{V}} \\cdot \\frac{{1}}{{\\alpha}}=\\frac{{R}}{{\\gamma-1}}+\\frac{{R\\left(T_0+\\alpha V\\right)}}{{V}} \\cdot \\frac{{1}}{{\\alpha}} \\\\
        &=\\frac{{R}}{{\\gamma-1}}+R\\left(\\frac{{T_0}}{{\\alpha V}}+1\\right)=\\frac{{\\gamma R}}{{\\gamma-1}}+\\frac{{R T_0}}{{\\alpha V}}=C_V+\\frac{{R T}}{{\\alpha V}}=C_p+\\frac{{R T_0}}{{\\alpha V}}
        \\end{{aligned}}$
        (b) Given $T=T_0+\\alpha V$
        As $\\displaystyle T=\\frac{{p V}}{{R}}$ for one mole of gas
        $\\begin{{gathered}}
        p=\\frac{{R}}{{V}}\\left(T_0+\\alpha V\\right)=\\frac{{R T}}{{V}}=\\alpha R \\\\
        \\text{{Now}} \\qquad A=\\int_{{V_1}}^{{V_2}} p d V=\\int_{{V_1}}^{{v_2}}\\left(\\frac{{R T_0}}{{v}}+\\alpha R\\right) d V \\text {{ (for one mole) }}
        \\end{{gathered}}$
        $\\begin{{gathered}}
        =R T_0 \\ln \\frac{{V_2}}{{V_1}}+\\alpha\\left(V_2-V_1\\right) \\\\
        \\Delta U=C_V\\left(T_2-T_1\\right) \\\\
        =C_V\\left[T_0+\\alpha V_2-T_0 \\alpha V_1\\right]=\\alpha C_V\\left(V_2-V_1\\right)
        \\end{{gathered}}$
        By the first law of thermodynamics $Q=\\Delta U+A$
        $\\begin{{gathered}}
        =\\frac{{\\alpha R}}{{\\gamma-1}}\\left(V_2-V_1\\right)+R T_0 \\ln \\frac{{V_2}}{{V_1}}+\\alpha R\\left(V_2-V_1\\right) \\\\
        =\\alpha R\\left(V_2-V_1\\right)\\left[1+\\frac{{1}}{{\\gamma-1}}\\right]+R T_0 \\ln \\frac{{V_2}}{{V_1}} \\\\
        =\\alpha C_p\\left(V_2-V_1\\right)+R T_0 \\ln \\frac{{V_2}}{{V_1}}
        \\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_55(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        For the case of an ideal gas find the equation of the process (in the variables $T, V$ ) in which the molar heat capacity varies as:
        (a) $C=C_V+\\alpha T$
        (b) $C=C_V+\\beta V$;
        (c) $C=C_v+a p$, where $\\alpha, \\beta$, and $a$ are constants.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        Heat capacity is given by $\\displaystyle C=C_V+\\frac{{R T}}{{V}} \\frac{{d V}}{{d T}}$
        (a) Given $C=C_V+\\alpha T$
        So, $\\displaystyle C_V+\\alpha T=C_V+\\frac{{R T}}{{V}} \\frac{{d V}}{{d T}}$ or, $\\displaystyle \\frac{{\\alpha}}{{R}} d T=\\frac{{d V}}{{V}}$
        Integrating both sides, we get $\\displaystyle \\frac{{\\alpha}}{{R}} T=\\ln V+\\ln C_0=\\operatorname{{In}} V C_0, C_0$ is a constant. 
        Or, $\\displaystyle \\quad V \\cdot C_0=e^{{\\alpha T / R}}$ or $V \\cdot e^{{\\alpha T / R}}=\\frac{{1}}{{C_0}}=$ constant
        (b) $C=C_V+\\beta V$
        and $\\displaystyle \\quad C=C_V+\\frac{{R T}}{{V}} \\frac{{d V}}{{d T}} \\text {{ so, }} C_V \\frac{{R T}}{{V}} \\frac{{d V}}{{d T}}=C_V+\\beta V$
        or, $\\displaystyle \\quad \\frac{{R T}}{{V}} \\frac{{d V}}{{d T}}=\\beta V$ or, $\\displaystyle \\frac{{d V}}{{V^2}}=\\frac{{\\beta}}{{R}} \\frac{{d T}}{{T}}$ or, $\\displaystyle \\quad V^{{-2}}=\\frac{{d T}}{{T}}$
        Integrating both sides, we get $\\displaystyle \\frac{{R}}{{\\beta}} \\frac{{V^{{-1}}}}{{\\beta-1}}=\\ln T+\\ln C_0=\\ln T \\cdot C_0$
        So, $\\displaystyle \\ln T \\cdot C_0=-\\frac{{R}}{{\\beta V}} \\quad T \\cdot C_0=e^{{-R / \\beta V}}$ or, $\\displaystyle T e^{{-R / \\beta V}}=\\frac{{1}}{{C_0}}=$ constant
        (c) $\\displaystyle C=C_V+a p$ and $\\displaystyle C=C_V+\\frac{{R T}}{{V}} \\frac{{d V}}{{d T}}$
        So, $\\displaystyle C_V+a p=C_V+\\frac{{R T}}{{V}} \\frac{{d V}}{{d T}} \\quad \\text {{ so, }} \\quad a p=\\frac{{R T}}{{V}} \\frac{{d V}}{{d T}}$
        or, $\\displaystyle a \\frac{{R T}}{{V}}=\\frac{{R T}}{{V}} \\frac{{d V}}{{d T}}$ (as $\\displaystyle p=\\frac{{R T}}{{V}}$ for one mole of gas)
        or, $\\displaystyle \\frac{{d V}}{{d T}}=a \\text {{ or, }} d V=a d T \\text {{ or, }} d T=\\frac{{d V}}{{a}}$
        So, $\\displaystyle T=\\frac{{V}}{{a}}+$ constant or $V-a T=$ constant
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')
        
        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
    
    def _problem_2_56(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        An ideal gas has an adiabatic exponent $\\gamma$. In some process its molar heat capacity varies as $C=\\alpha / T$, where $\\alpha$ is a constant. Find:
        (a) the work performed by one mole of the gas during its heating from the temperature $T_0$ to the temperature $\\eta$ times higher;
        (b) the equation of the process in the variables $p, V$.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        (a) By the first law of thermodynamics $A=Q-\\Delta U$
        or, $\\displaystyle =C d T-C_V d T=\\left(C-C_V\\right) d T \\text {{ (for one mole) }}$
        Given $\\displaystyle C=\\frac{{\\alpha}}{{T}}$
        $\\begin{{aligned}}
        \\text{{So, }}\\qquad A & =\\int_{{T_0}}^{{\\eta T_0}}\\left(\\frac{{\\alpha}}{{T}}-C_V\\right) d T=\\alpha \\ln \\frac{{\\eta T_0}}{{T_0}}-C_V\\left(\\eta T_0-T_0\\right) \\\\
        & =\\alpha \\ln \\eta-C_V T_0(\\eta-1)=\\alpha \\ln \\eta+\\frac{{R T}}{{\\gamma-1}}(\\eta-1)
        \\end{{aligned}}$
        (b) $\\displaystyle C=+\\frac{{d Q}}{{d T}}=\\frac{{R T}}{{V}} \\frac{{d V}}{{d T}}+C_V$
        $\\begin{{aligned}}
        &\\text{{Given }} \\qquad C=\\frac{{\\alpha}}{{T}}, \\text {{ so }} C_V+\\frac{{R T}}{{V}} \\frac{{d V}}{{d T}}=\\frac{{\\alpha}}{{T}} \\\\
        &\\text{{or }} \\qquad \\frac{{R}}{{\\gamma-1}} \\frac{{1}}{{R T}}+\\frac{{d V}}{{V}}=\\frac{{\\alpha}}{{R T^2}} d T \\\\
        &\\text{{or }} \\qquad \\frac{{d V}}{{V}}=\\frac{{\\alpha}}{{R T^2}} d T-\\frac{{1}}{{\\gamma-1}} \\cdot \\frac{{d T}}{{T}} \\\\
        &\\text{{or }} \\qquad (\\gamma-1) \\frac{{d V}}{{V}}=\\frac{{\\alpha(\\gamma-1)}}{{R T^2}} d T-\\frac{{d T}}{{T}}
        \\end{{aligned}}$
        Integrating both sides, we get
        $\\begin{{aligned}}
        \\text {{ or, }} \\qquad & (\\gamma-1) \\ln V=-\\frac{{\\alpha(\\gamma-1)}}{{R T}}-\\ln T+\\ln K \\\\
        \\text {{ or, }} \\qquad & \\ln V^{{\\gamma-1}} \\frac{{T}}{{K}}=\\frac{{-\\alpha(\\gamma-1)}}{{R T}} \\\\
        & \\ln V^{{\\gamma-1}} \\cdot \\frac{{p V}}{{R K}}=\\frac{{-\\alpha(\\gamma-1)}}{{p V}} \\\\
        \\text {{ or, }} \\qquad & p V^{{\\gamma}}=e^{{-\\alpha(\\gamma-1) / p V}}\\\\
        \\text {{ or, }} \\qquad & p V^{{\\gamma e^{{-\\alpha(\\gamma-1) / p V}}}}=R K=\\text {{ constant }}
        \\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_57(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        Find the work performed by one mole of a Van der Waals gas during its isothermal expansion from the volume $V_1$ to $V_2$ at a temperature $T$.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        The work done is
        $\\begin{{aligned}}
        A & =\\int_{{V_1}}^{{V_2}} p d V=\\int_{{V_1}}^{{V_2}}\\left(\\frac{{R T}}{{v-b}}-\\frac{{a}}{{V^2}}\\right) d V \\\\
        & =R T \\ln \\frac{{V_2-b}}{{V_1-b}}+a\\left(\\frac{{1}}{{V_2}}-\\frac{{1}}{{V_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_2_58(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        One mole of oxygen is expanded from a volume $V_1=$ $=1.00 \\mathrm{{l}}$ to $V_2=5.0 \\mathrm{{l}}$ at a constant temperature $T=280 \\mathrm{{~K}}$. Calculate:
        (a) the increment of the internal energy of the gas;
        (b) the amount of the absorbed heat.
        The gas is assumed to be a Van der Waals gas.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        (a) The increment in the internal energy is
        $\\displaystyle \\Delta U=\\int_{{V_1}}^{{v_1}}\\left(\\frac{{\\partial U}}{{\\partial V}}\\right)_T d V$
        But from second law
        $\\displaystyle \\left(\\frac{{\\partial U}}{{\\partial V}}\\right)_T=T\\left(\\frac{{\\partial S}}{{\\partial V}}\\right)_T-p=T\\left(\\frac{{\\partial p}}{{\\partial T}}\\right)_V-p$
        On the other hand
        $\\displaystyle p=\\frac{{R T}}{{V-b}}-\\frac{{a}}{{V^2}}$
        or,
        $\\displaystyle T\\left(\\frac{{\\partial p}}{{\\partial T}}\\right)_V=\\frac{{R T}}{{V-b}} \\text {{ and }}\\left(\\frac{{\\partial U}}{{\\partial V}}\\right)_t=\\frac{{a}}{{V^2}}$
        So,
        $\\displaystyle \\Delta U=a\\left(\\frac{{1}}{{V_1}}-\\frac{{1}}{{V_2}}\\right)$
        (b) From the first law
        $\\displaystyle Q=A+\\Delta U=R T \\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_59(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        For a Van der Waals gas find:
        (a) the equation of the adiabatic curve in the variables $T, V$;
        (b) the difference of the molar heat capacities $C_p-C_V$ as a function of $T$ and $V$.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        (a) From the first law for an adiabatic
        $d Q=d U+p d V=0$
        From the previous problem
        $\\begin{{aligned}}
        &d U=\\left(\\frac{{\\partial U}}{{\\partial T}}\\right)_V d T+\\left(\\frac{{\\partial U}}{{\\partial V}}\\right)_T d V=C_V d T+\\frac{{a}}{{V^2}} d V \\\\
        &\\text{{So, }} \\qquad 0=C_V d T+\\frac{{R T d V}}{{V-b}}
        \\end{{aligned}}$
        This equation can be integrated if we assume that $C_V$ and $b$ are constant then
        $\\displaystyle \\begin{{array}}{{ll}}
        \\displaystyle \\frac{{R}}{{C_V}} \\frac{{d V}}{{V-b}}+\\frac{{d T}}{{T}}=0, \\text {{ or, }} & \\displaystyle \\ln T+\\frac{{R}}{{C_V}} \\ln (V-b)=\\text {{ constant }} \\\\
        \\text {{ or, }} & T(V-b)^{{R / c_v}}=\\text {{ constant }}
        \\end{{array}}$
        (b) We use $\\displaystyle \\qquad d U=C_V d T+\\frac{{a}}{{V^2}} d V$
        Now, $\\displaystyle \\qquad d Q=C_V d T+\\frac{{R T}}{{V-b}} d V$
        So along constant $\\displaystyle \\qquad p, \\quad C_p=C_V+\\frac{{R T}}{{V-b}}\\left(\\frac{{\\partial V}}{{\\partial T}}\\right)_p$
        Thus $\\displaystyle \\qquad C_p-C_V=\\frac{{R T}}{{V-b}}\\left(\\frac{{\\partial V}}{{\\partial T}}\\right)_p, \\text {{ But }} p=\\frac{{R T}}{{V-b}}-\\frac{{a}}{{V^2}}$
        On differentiating, $\\displaystyle \\qquad 0=\\left(-\\frac{{R T}}{{(V-b)^2}}+\\frac{{2 a}}{{V^2}}\\right)\\left(\\frac{{\\partial V}}{{\\partial T}}\\right)_p+\\frac{{R}}{{V-b}}$
        or, $\\displaystyle \\qquad T\\left(\\frac{{\\partial V}}{{\\partial T}}\\right)_P=\\frac{{R T / V-b}}{{\\frac{{R T}}{{(V-b)^2}}-\\frac{{2 a}}{{V^3}}}}=\\frac{{V-b}}{{1-\\frac{{2 a(V-b)^2}}{{R T V^3}}}}$
        and $\\displaystyle \\qquad C_p-C_V=\\frac{{R}}{{1-\\frac{{2 a(V-b)^2}}{{R T V^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_60(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        problem_s = f"""
        Two thermally insulated vessels are interconnected by a tube equipped with a valve. One vessel of volume $V_1=101$ contains $v=2.5$ moles of carbon dioxide. The other vessel of volume $V_2=$ 1001 is evacuated. The valve having been opened, the gas adiabatically expanded. Assuming the gas to obey the Van der Waals equation, find its temperature change accompanying the expansion.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        From the first law
        $Q=U_f-U_i+A=0$, as the vessels are themally insulated.
        As this is free expansion, $A=0$, so, $U_f=U_i$
        But $\\displaystyle \\qquad U=v C_V T-\\frac{{a v^2}}{{V}}$
        So, $\\displaystyle \\qquad C_V\\left(T_f-T_i\\right)=\\left(\\frac{{a}}{{V_1+V_2}}-\\frac{{a}}{{V_1}}\\right) v=\\frac{{-a V_2 v}}{{V_1\\left(V_1+V_2\\right)}}$
        or, $\\displaystyle \\qquad \\Delta T=\\frac{{-a(\\gamma-1) V_2 v}}{{R V_1\\left(V_1+V_2\\right)}}$
        Substitution gives $\\Delta T=-3 \\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_61(self, *args, **kwargs):
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')

        problem_s = f"""
        What amount of heat has to be transferred to $v=3.0$ moles of carbon dioxide to keep its temperature constant while it expands into vacuum from the volume $V_1=5.0 \\mathrm{{l}}$ to $V_2=10 \\mathrm{{l}}$ ? The gas is assumed to be a Van der Waals gas.
        """
        problemTemplate.add_problem(problem_s.strip(), 'text/html')
        
        soln_s = f"""
        $Q=U_f-U_i+A=U_f-U_i, \\quad$ (as $A=0$ in free expansion).
        So at constant temperature.
        $\\begin{{aligned}}
        Q & =\\frac{{-a v^2}}{{V_2}}-\\left(-\\frac{{a v^2}}{{V_1}}\\right)=a v^2 \\frac{{V_2-V_1}}{{V_1 \\cdot V_2}} \\\\
        & =0.33 \\mathrm{{~kJ}} \\text {{ from the given data. }}
        \\end{{aligned}}$
        """
        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)
    
