{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 2:Primary sensing elements and transducers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 2.1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Displacement of the free end = 0.02 m\n"
     ]
    }
   ],
   "source": [
    "# 2.1\n",
    "import math;\n",
    "t=0.35;\n",
    "P=1500*10**3;\n",
    "E=180*10**9;\n",
    "r=36.5;\n",
    "x=16;\n",
    "y=3;\n",
    "a=math.pi*36.5*10**-3;\n",
    "da=(0.05*a*P/E)*((r/t)**0.2)*((x/y)**0.33)*((x/t)**3);\n",
    "print (\"Displacement of the free end = %.2f m\" % da)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 2.2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Natural length of spring = 90.00 mm\n",
      "Displacement of point C = 3.75 mm\n"
     ]
    }
   ],
   "source": [
    "# 2.2\n",
    "import math;\n",
    "P=100*10**3;\n",
    "A=1500*10**-6;\n",
    "F=P*A;\n",
    "Cs=F/3;\n",
    "Ls=Cs+40;\n",
    "print (\"Natural length of spring = %.2f mm\" % Ls)\n",
    "P1=10*10**3;\n",
    "F1=P1*A;\n",
    "Ss=3+2*.5;\n",
    "D=F1/Ss;\n",
    "print (\"Displacement of point C = %.2f mm\" % D)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Thickness = 0.21 mm\n",
      "Deflection at center for Pressure of 150 kN/m2= 0.0000 mm\n",
      "Natural frequency of the diaphragm =52051 rad/sec\n"
     ]
    }
   ],
   "source": [
    "# 2.3\n",
    "import math;\n",
    "D=15.0*10**-3;\n",
    "P=300*10**3;\n",
    "sm=300*10**6;\n",
    "t=(3*D**2*P/(16*sm))**0.5*10**3;\n",
    "print (\"Thickness = %.2f mm\" %t)\n",
    "P=150*10**3;\n",
    "v=0.28;\n",
    "E=200.0*10**9;\n",
    "dm=3.0*(1-v**2)*D**4*P/(256.0*E*t**3);\n",
    "print (\"Deflection at center for Pressure of 150 kN/m2= %.4f mm\" %dm)\n",
    "d=8900;\n",
    "wn=(20*t*10**-3/D**2)*(E/(3*d*(1-v**2)))**0.5;\n",
    "print (\"Natural frequency of the diaphragm =%.0f rad/sec\" %wn)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Angle of twist= 0.000236 rad\n"
     ]
    }
   ],
   "source": [
    "# 2.4\n",
    "import math;\n",
    "T=100;\n",
    "G=80*10**9;\n",
    "d=2*15*10**-3;\n",
    "th=16*T/(math.pi*G*d**3)\n",
    "print (\"Angle of twist= %.6f rad\" %th)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Reynoids number = 1697652.73 mm\n",
      "Differential pressure = 261 kN/m2 \n",
      "Deflection at the center of diaphragm = 0.02 micro m\n"
     ]
    }
   ],
   "source": [
    "# 2.5\n",
    "import math;\n",
    "d=60*10**-3;\n",
    "Q=80*10**-3;\n",
    "A=(math.pi/4)*d**2;\n",
    "v=Q/A;\n",
    "vi=10**-3;\n",
    "de=10**3;\n",
    "Re=v*de*d/vi;\n",
    "print (\"Reynoids number = %.2f mm\" %Re)\n",
    "d2=60*10**-3;\n",
    "d1=100*10**-3;\n",
    "A2=(math.pi/4)*d2**2;\n",
    "M=1/((1-(d2/d1)**2)**0.5);\n",
    "Cd=0.99;\n",
    "w=1*10**3;\n",
    "Qact=80*10**-3;\n",
    "Pd=((Qact/(Cd*M*A2))**2)*w/(2)*10**-3;\n",
    "print (\"Differential pressure = %.0f kN/m2 \" %Pd)\n",
    "Po=0.28;\n",
    "D=10*10**-3;\n",
    "E=206*10**9;\n",
    "t=0.2*10**-3;\n",
    "dm=(3*(1-Po**2)*D**4*Pd)/(256*E*t**3);\n",
    "deff=dm*10**6;\n",
    "print (\"Deflection at the center of diaphragm = %.2f micro m\" %deff)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Mean velocity of water = 4.47 m/s\n",
      "Velocity of air= 175.4 m/s\n"
     ]
    }
   ],
   "source": [
    "# 2.6\n",
    "import math;\n",
    "Pd=10*10**3;\n",
    "d=1000;\n",
    "VmeanW= (2*Pd/d)**0.5;\n",
    "print (\"Mean velocity of water = %.2f m/s\" %VmeanW)\n",
    "d=0.65;\n",
    "Va= (2*Pd/d)**0.5;\n",
    "print (\"Velocity of air= %.1f m/s\" %Va)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.7"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "let coefficient of discharge Cd=1\n",
      "Depth of flow = 0.3 m\n"
     ]
    }
   ],
   "source": [
    "# 2.7\n",
    "import math;\n",
    "print ('let coefficient of discharge Cd=1')\n",
    "H1=0.9;\n",
    "L=1.2;\n",
    "g=9.81;\n",
    "Q=(2.0/3)*L*(2*g)**0.5*(H1)**(1.5);\n",
    "th=45;\n",
    "H2=Q*(15.0/8)/(2.0*g)\n",
    "print (\"Depth of flow = %.1f m\" %H2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.8"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Uncertinity in discharge = 0.0125 m3/s\n"
     ]
    }
   ],
   "source": [
    "# 2.8\n",
    "Cd=0.6;\n",
    "H=0.5;\n",
    "dH=0.01;\n",
    "g=9.81;\n",
    "Q=(8.0/15)*Cd*(2*g)**0.5*(H)**(2.5);\n",
    "dQ=(2.5*dH/H)*Q;\n",
    "print (\"Uncertinity in discharge = %.4f m3/s\" %dQ)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.9"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Displacement = 5.75 mm\n",
      "Displacement = -12.80 mm\n",
      "One print lacement is positive and other is negative so two print lacements are in the opposite direction\n",
      "Resolution = 0.05 mm\n"
     ]
    }
   ],
   "source": [
    "# 2.9\n",
    "import math;\n",
    "Rnormal=10000.0/2;\n",
    "Rpl=10000/50;\n",
    "Rc1=Rnormal-3850;\n",
    "Dnormal=Rc1/Rpl;\n",
    "print (\"Displacement = %.2f mm\" %Dnormal)\n",
    "Rc2=Rnormal-7560;\n",
    "Dnormal=Rc2/Rpl;\n",
    "print (\"Displacement = %.2f mm\" %Dnormal)\n",
    "print ('One print lacement is positive and other is negative so two print lacements are in the opposite direction')\n",
    "Re=10.0*1/200;\n",
    "print (\"Resolution = %.2f mm\" %Re)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.11"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Output voltage = 3000.000000 V\n"
     ]
    }
   ],
   "source": [
    "#2.11\n",
    "import math;\n",
    "RAB=125;\n",
    "Rtotal=5000;\n",
    "R2=0.0\n",
    "R2=(75.0/125.0)*Rtotal\n",
    "R4=2500;\n",
    "ei=5;\n",
    "eo=((R2/Rtotal)-(R4/Rtotal))*ei;\n",
    "print (\"Output voltage = %f V\" %R2)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.12"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Maximum excitation voltage = 54.8 V\n",
      "Sensitivity  = 0.152 V/degree\n"
     ]
    }
   ],
   "source": [
    "# 2.12\n",
    "import math;\n",
    "Rm=10000;\n",
    "Rp=Rm/15;\n",
    "R=600;\n",
    "P=5;\n",
    "ei= (P*R)**0.5;\n",
    "print (\"Maximum excitation voltage = %.1f V\" %ei)\n",
    "S=ei/360;\n",
    "print (\"Sensitivity  = %.3f V/degree\" %S)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.13"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Resolution = 0.0005 mm\n"
     ]
    }
   ],
   "source": [
    "# 2.13\n",
    "import math;\n",
    "Rwga=1.0/400;\n",
    "Re=Rwga/5;\n",
    "print (\"Resolution = %.4f mm\" %Re)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.14"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Resolution of 1mm movement = 0.3125 degree/mm\n",
      "Required Resolution of 1mm movement = 0.300 degree/mm\n",
      "Since the resolution of potentiometer is higher than the resolution required so it is suitable for the application\n"
     ]
    }
   ],
   "source": [
    "# 2.14\n",
    "import math;\n",
    "mo=0.8;\n",
    "sr=250;\n",
    "sm=sr/mo;\n",
    "R=sm*1*10**-3;\n",
    "print (\"Resolution of 1mm movement = %.4f degree/mm\" %R)\n",
    "Rq=300.0/1000;\n",
    "print (\"Required Resolution of 1mm movement = %.3f degree/mm\" %Rq)\n",
    "print ('Since the resolution of potentiometer is higher than the resolution required so it is suitable for the application')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.15"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Power dissipation = 0.667 W\n",
      "Power dissipation = 0.650 W\n",
      "Since power dissipation is higher than the dissipation allowed so potentiometer is not suitable\n"
     ]
    }
   ],
   "source": [
    "# 2.15\n",
    "import math;\n",
    "Pd=(10.0**2)/150;\n",
    "print (\"Power dissipation = %.3f W\" %Pd)\n",
    "th_pot=80+Pd*30;\n",
    "PDa=(10*10**-3)*(th_pot-35);\n",
    "print (\"Power dissipation = %.3f W\" %PDa)\n",
    "print ('Since power dissipation is higher than the dissipation allowed so potentiometer is not suitable')\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.16"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Possion s ratio=1.600000\n"
     ]
    }
   ],
   "source": [
    "# 2.16\n",
    "import math;\n",
    "Gf=4.2;\n",
    "v=(Gf-1)/2;\n",
    "print ('Possion s ratio=%f' %v)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.17"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Change in resistance of nickel = 0.007 ohm\n",
      "Change in resistance of nicrome = -0.001 ohm\n"
     ]
    }
   ],
   "source": [
    "# 2.17\n",
    "import math;\n",
    "strain=-5*10**-6;\n",
    "Gf=-12.1;\n",
    "R=120;\n",
    "dR_nickel=Gf*R*strain;\n",
    "print (\"Change in resistance of nickel = %.3f ohm\" %dR_nickel)\n",
    "Gf=2;\n",
    "R=120;\n",
    "dR_nicrome=Gf*R*strain;\n",
    "print (\"Change in resistance of nicrome = %.3f ohm\" %dR_nicrome)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.18"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Percentage change in resistance = 0.1 \n"
     ]
    }
   ],
   "source": [
    "# 2.18\n",
    "import math;\n",
    "s=100.0*10**6;\n",
    "E=200.0*10**9;\n",
    "strain=s/E;\n",
    "Gf=2.0;\n",
    "r_per_unit=Gf*strain*100.0;\n",
    "print (\"Percentage change in resistance = %.1f \" %r_per_unit)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.19"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Gauge factor = 2.31 \n"
     ]
    }
   ],
   "source": [
    "#2.19\n",
    "import math;\n",
    "b=0.02;\n",
    "d=0.003;\n",
    "I=(b*d**3)/12;\n",
    "E=200*10**9;\n",
    "x=12.7*10**-3;\n",
    "l=0.25;\n",
    "F=3*E*I*x/l**3;\n",
    "x=0.15;\n",
    "M=F*x;\n",
    "t=0.003;\n",
    "s=(M*t)/(I*2);\n",
    "strain=s/E;\n",
    "dR=0.152;\n",
    "R=120;\n",
    "Gf=(dR/R)/strain;\n",
    "print (\"Gauge factor = %.2f \" %Gf)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.20"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " Change in length= 2.5 um \n",
      " Force= 2038.64 N \n"
     ]
    }
   ],
   "source": [
    "# 2.20\n",
    "import math;\n",
    "dR=0.013;\n",
    "R=240;\n",
    "l=0.1;\n",
    "Gf=2.2;\n",
    "dl=(dR/R)*l/Gf*10**6;\n",
    "print (\" Change in length= %.1f um \" %dl)\n",
    "\n",
    "strain=dl*10**-6/l;\n",
    "E=207*10**9;\n",
    "s=E*strain;\n",
    "A=4*10**-4;\n",
    "F=s*A;\n",
    "print (\" Force= %.2f N \" %F)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.21"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " alpha at o degree= 0.0085 /degree C \n",
      "5.5(1+0.0085(th-45))\n"
     ]
    }
   ],
   "source": [
    "# 2.21\n",
    "import math;\n",
    "th1=30;\n",
    "th2=60;\n",
    "th0=th1+th2/2;\n",
    "Rth1=4.8;\n",
    "Rth2=6.2;\n",
    "Rth0=5.5;\n",
    "ath0=(1/Rth0)*(Rth2-Rth1)/(th2-th1);\n",
    "print (\" alpha at o degree= %.4f /degree C \" %ath0)\n",
    "print ('5.5(1+0.0085(th-45))')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.22"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "alpha at o degree= 0.00182 /degree C \n",
      "Linear approximation is: Rth= 589.48(1+0.00182(th-115))\n"
     ]
    }
   ],
   "source": [
    "# 2.22\n",
    "import math;\n",
    "th1=100;\n",
    "th2=130;\n",
    "th0=th1+th2/2;\n",
    "Rth1=573.40;\n",
    "Rth2=605.52;\n",
    "Rth0=589.48;\n",
    "ath0=(1/Rth0)*(Rth2-Rth1)/(th2-th1);\n",
    "print (\"alpha at o degree= %.5f /degree C \" %ath0)\n",
    "print ('Linear approximation is: Rth= 589.48(1+0.00182(th-115))')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.23"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "resistance at 65 degree C= 115.68 ohm \n",
      " Temperature = 25.00 degree C \n"
     ]
    }
   ],
   "source": [
    "# 2.23\n",
    "import math;\n",
    "Rth0=100;\n",
    "ath0=0.00392;\n",
    "dth=65-25;\n",
    "R65=Rth0*(1+ath0*dth);\n",
    "print (\"resistance at 65 degree C= %.2f ohm \" %R65)\n",
    "th=(((150/100)-1)/ath0)+25;\n",
    "print (\" Temperature = %.2f degree C \" %th)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.24"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Resistance at 150 degree C=15.11 ohm\n"
     ]
    }
   ],
   "source": [
    "# 2.24\n",
    "import math;\n",
    "Rth0=10;\n",
    "ath0=0.00393;\n",
    "dth=150-20;\n",
    "R150=Rth0*(1+ath0*dth);\n",
    "print (\"Resistance at 150 degree C=%.2f ohm\" %R150)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.25"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Time= 109.95 s \n"
     ]
    }
   ],
   "source": [
    "# Calculate the time\n",
    "import math;\n",
    "th=30.0;\n",
    "th0=50;\n",
    "tc=120;\n",
    "t=-120*(math.log(1-(th/th0)));\n",
    "print (\"Time= %.2f s \" %t)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.26"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Resistance at 35 degree C= 50.00 ohm \n"
     ]
    }
   ],
   "source": [
    "#2.26\n",
    "import math;\n",
    "R25=100;\n",
    "ath=-0.05;\n",
    "dth=35-25;\n",
    "R35=R25*(1+ath*dth);\n",
    "print (\"Resistance at 35 degree C= %.2f ohm \" %R35)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.27"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Resistance at 40 degree C= 967.51 ohm \n",
      "Resistance at 100 degree C= 130.94 ohm \n"
     ]
    }
   ],
   "source": [
    "# 2.27\n",
    "import math;\n",
    "Ro=3980;\n",
    "Ta=273;\n",
    "#3980= a*3980*exp(b/273)\n",
    "Rt50=794;\n",
    "Ta50=273+50;\n",
    "#794= a*3980*exp(b/323)\n",
    "#on solving\n",
    "#a=30*10**-6, b=2843\n",
    "Ta40=273+40;\n",
    "Rt40=(30*10**-6)*3980*math.exp(2843/313);\n",
    "print (\"Resistance at 40 degree C= %.2f ohm \" %Rt40)\n",
    "Rt100=(30*10**-6)*3980*math.exp(2843/373);\n",
    "print (\"Resistance at 100 degree C= %.2f ohm \" %Rt100)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.28"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Change in temperature= 20.0 degree C \n"
     ]
    }
   ],
   "source": [
    "# 2.28\n",
    "import math;\n",
    "th=((1-1800/2000)/0.05)+70;\n",
    "dth=th-70;\n",
    "print (\"Change in temperature= %.1f degree C \" %dth)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.29"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Frequency of oscillation at 20 degree C = 25464.79 Hz \n",
      "Frequency of oscillation at 25 degree C = 31830.99 Hz \n",
      "Frequency of oscillation at 30 degree C = 42441.32 Hz \n"
     ]
    }
   ],
   "source": [
    "# 2.29\n",
    "import math;\n",
    "C=500*10**-12;\n",
    "R20=10000*(1-0.05*(20-25));\n",
    "f20=1/(2*math.pi*R20*C);\n",
    "print (\"Frequency of oscillation at 20 degree C = %.2f Hz \" %f20)\n",
    "R25=10000*(1-0.05*(25-25));\n",
    "f25=1/(2*math.pi*R25*C);\n",
    "print (\"Frequency of oscillation at 25 degree C = %.2f Hz \" %f25)\n",
    "R30=10000*(1-0.05*(30-25));\n",
    "f30=1/(2*math.pi*R30*C);\n",
    "print (\"Frequency of oscillation at 30 degree C = %.2f Hz \" %f30)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.30"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Sensitivity of thermocouple= 572.0 micro V/degree C\n",
      "Maximum output voltage= 0.06 V \n"
     ]
    }
   ],
   "source": [
    "# 2.30\n",
    "import math;\n",
    "Se_thermocouple=500-(-72);\n",
    "print (\"Sensitivity of thermocouple= %.1f micro V/degree C\" %Se_thermocouple)\n",
    "Vo=Se_thermocouple*100*10**-6;\n",
    "print (\"Maximum output voltage= %.2f V \" %Vo)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.31"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Required e.m.f.= 27.87 mV \n",
      "Temperature corresponding to 27.87 mV is 620 degree C\n"
     ]
    }
   ],
   "source": [
    "# 2.31\n",
    "import math;\n",
    "ET=27.07+0.8;\n",
    "print (\"Required e.m.f.= %.2f mV \" %ET)\n",
    "print ('Temperature corresponding to 27.87 mV is 620 degree C')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.32"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Series resistance=271.00 ohm\n",
      "Approximate error due to rise in resistance of 1 ohm in Re=-2.40 degree C\n",
      "Approximate error due to rise in Temp. of 10=-7.45 degree C\n"
     ]
    }
   ],
   "source": [
    "# 2.32\n",
    "import math;\n",
    "Rm=50;\n",
    "Re=12;\n",
    "E=33.3*10**-3;\n",
    "i=0.1*10**-3;\n",
    "Rs=(E/i)-Rm-Re;\n",
    "print (\"Series resistance=%.2f ohm\" %Rs)\n",
    "Re=13;\n",
    "i1=E/(Rs+Re+Rm);\n",
    "AE=((i1-i)/i)*800;\n",
    "print (\"Approximate error due to rise in resistance of 1 ohm in Re=%.2f degree C\" %AE)\n",
    "R_change=50*0.00426*10;\n",
    "i1=E/(Rs+Re+Rm+R_change);\n",
    "AE=((i1-i)/i)*800;\n",
    "print (\"Approximate error due to rise in Temp. of 10=%.2f degree C\" %AE)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Value of resistance R1=5.95 ohm\n",
      "Value of resistance R2=762.60 ohm\n"
     ]
    }
   ],
   "source": [
    "# 2.33\n",
    "import math;\n",
    "E_20=0.112*10**-3;# emf at 20degree C\n",
    "E_900=8.446*10**-3;\n",
    "E_1200=11.946*10**-3;\n",
    "E1=E_900-E_20;\n",
    "E2=E_1200-E_20;\n",
    "#E1=1.08*R1/(R1+2.5+R2      (i)\n",
    "#E2=1.08*(R1+2.5)/(R1+2.5+R2      (ii)\n",
    "#on solving (i) and (ii)\n",
    "R1=5.95;\n",
    "R2=762.6;\n",
    "print (\"Value of resistance R1=%.2f ohm\" %R1)\n",
    "print (\"Value of resistance R2=%.2f ohm\" %R2)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.34"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Value of resistance R1=5.95 ohm\n",
      "value of resistance RL>>Rl\n"
     ]
    }
   ],
   "source": [
    "# 2.34\n",
    "import math;\n",
    "th=20;\n",
    "Vz=2.73+th*10*10**-3;\n",
    "Voffset=-2.73;\n",
    "Vout=Vz+Voffset;\n",
    "Rbias=(5-0.2)/10**-3;\n",
    "Rzero=500;\n",
    "th=50;\n",
    "Vz=2.73+th*10*10**-3;\n",
    "VmaxT=Vz+Voffset;\n",
    "Vsupply=5;\n",
    "Rl=(VmaxT*Rbias)/(Vsupply-VmaxT);\n",
    "print (\"Value of resistance R1=%.2f ohm\" %R1)\n",
    "print ('value of resistance RL>>Rl')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.35"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Change in inductance=0.04 mH\n"
     ]
    }
   ],
   "source": [
    "# 2.35\n",
    "import math;\n",
    "L1=2;\n",
    "La=1-0.02;\n",
    "Lnew=2/La;\n",
    "dl=Lnew-L1;\n",
    "print (\"Change in inductance=%.2f mH\" %dl)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.36"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 93,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "percentage linearity=0.20 \n"
     ]
    }
   ],
   "source": [
    "# 2.36\n",
    "import math;\n",
    "linearity_percentage=(0.003/1.5)*100;\n",
    "print (\"percentage linearity=%.2f \" %linearity_percentage)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.37"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "senstivity of the LVDT=0.004 V/mm\n",
      "Senstivity of the instrument=1.0 V/mm\n",
      "resolution of instrument=0.001 mm\n"
     ]
    }
   ],
   "source": [
    "# 2.37\n",
    "import math;\n",
    "displacement=0.5;\n",
    "Vo=2*10**-3;\n",
    "Se_LVDT=Vo/displacement;\n",
    "print (\"senstivity of the LVDT=%.3f V/mm\" %Se_LVDT)\n",
    "Af=250;\n",
    "Se_instrument=Se_LVDT*Af;\n",
    "print (\"Senstivity of the instrument=%.1f V/mm\" %Se_instrument)\n",
    "sd=5/100;\n",
    "Vo_min=50/5;\n",
    "Re_instrument=1*1.0/1000;\n",
    "print (\"resolution of instrument=%.3f mm\" %Re_instrument)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.38"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "deflection=0.01 m\n",
      "minimum force=0.02 N\n",
      "maximum force=81.92 N\n"
     ]
    }
   ],
   "source": [
    "# 2.38\n",
    "import math;\n",
    "b=0.02;\n",
    "t=0.004;\n",
    "I=(1.0/12)*b*t**3;\n",
    "F=25;\n",
    "l=0.25;\n",
    "E=200.0*10**9;\n",
    "x=(F*l**3)/(3.0*E*I);\n",
    "print (\"deflection=%.2f m\" %x)\n",
    "DpF=x/F;\n",
    "Se=DpF*0.5*1000;\n",
    "Re=(10.0/1000)*(2.0/10);\n",
    "F_min=Re/Se;\n",
    "F_max=10/Se;\n",
    "print (\"minimum force=%.2f N\" %F_min)\n",
    "print (\"maximum force=%.2f N\" %F_max)\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.39"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "permittivity of the air e0=8.85*10**-12\n",
      "sensitivity of the transducer=-0.00 F/m\n"
     ]
    }
   ],
   "source": [
    "# 2.39\n",
    "import math;\n",
    "print ('permittivity of the air e0=8.85*10**-12')\n",
    "e0=8.85*10**-12;\n",
    "w=25.0*10**-3;\n",
    "d=0.25*10**-3;\n",
    "Se=-4.0*e0*w/d;\n",
    "print (\"sensitivity of the transducer=%.2f F/m\" %Se)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.40"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the value of the capacitance afte the application of pressure=446.55 pF\n"
     ]
    }
   ],
   "source": [
    "# 2.40\n",
    "import math;\n",
    "C1=370*10**-12;\n",
    "d1=3.5*10**-3;\n",
    "d2=2.9*10**-3;\n",
    "C2=C1*d1*10**12/d2;\n",
    "print (\"the value of the capacitance afte the application of pressure=%.2f pF\" %C2)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.41"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 114,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "change in frequency of the oscillator=-9.607692e+07 kHz\n"
     ]
    }
   ],
   "source": [
    "# 2.41\n",
    "import math;\n",
    "fo1=100*10**3;\n",
    "d1=4;\n",
    "d2=3.7;\n",
    "fo2=((d2/d1)**0.5)*fo1;\n",
    "dfo=fo1-fo2/10**-3;\n",
    "print (\"change in frequency of the oscillator=%e kHz\" %dfo)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.42"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Capacitance=33.9 pF\n",
      "change in Capacitance=3.4 pF\n"
     ]
    }
   ],
   "source": [
    "# 2.42\n",
    "import math;\n",
    "L_air=(3.1-3)/2;\n",
    "D_stress=100/L_air;\n",
    "e0=8.85*10**-12;\n",
    "l=20*10**-3;\n",
    "D2=3.1;\n",
    "D1=3;\n",
    "C=(2*math.pi)*e0*l*10**12/(math.log(D2/D1));\n",
    "print (\"Capacitance=%.1f pF\" %C)\n",
    "l=(20*10**-3)-(2*10**-3);\n",
    "C_new=(2*math.pi)*e0*l/(math.log(D2/D1));\n",
    "C_change=C-C_new*10**12;\n",
    "print (\"change in Capacitance=%.1f pF\" %C_change)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.43"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 116,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Time constant=0.02 s\n",
      "Phase shift=18.2 deg\n",
      "Series resistance=1140 Mohm\n",
      "Amplitude ratio=0.6 \n",
      "Voltage sensitivity=800000 V/m\n"
     ]
    }
   ],
   "source": [
    "#2.43\n",
    "import math;\n",
    "M=0.95;\n",
    "w=2*math.pi*20;\n",
    "tc=(1/w)*((M**2)/(1-M**2))**0.5;\n",
    "print (\"Time constant=%.2f s\" %tc)\n",
    "ph=((math.pi/2)-(math.atan(w*tc)))*(180/math.pi);\n",
    "print (\"Phase shift=%.1f deg\" %ph)\n",
    "C=(8.85*10**-12*300*10**-6)/(0.125*10**-3);\n",
    "R=tc*10**-6/C;\n",
    "print (\"Series resistance=%.0f Mohm\" %R)\n",
    "M=1/(1+(1/(2*math.pi*5*tc)**2))**0.5;\n",
    "print (\"Amplitude ratio=%.1f \" %M)\n",
    "Eb=100;\n",
    "x=0.125*10**-3;\n",
    "Vs=Eb/x;\n",
    "print (\"Voltage sensitivity=%d V/m\" %Vs)\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.44"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 101,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ratio of per unit change of capacitance to per unit change of diaplacement=1.11\n",
      " New ratio of per unit change of capacitance to per unit change of diaplacement=1.17\n"
     ]
    }
   ],
   "source": [
    "#2.44\n",
    "import math;\n",
    "e0=8.85*10**-12;\n",
    "A=500*10**-6;\n",
    "d=0.2*10**-3;\n",
    "C=e0*A/d;\n",
    "d1=0.18*10**-3;\n",
    "C_new=e0*A/d1;\n",
    "C_change=C_new-C;\n",
    "Ratio=(C_change/C)/(0.02/0.2);\n",
    "print (\"ratio of per unit change of capacitance to per unit change of diaplacement=%.2f\" %Ratio)\n",
    "d1=0.19*10**-3;\n",
    "e1=1;\n",
    "d2=0.01*10**-3;\n",
    "e2=8;\n",
    "C=(e0*A)/((d1/e1)+(d2/e2));\n",
    "d1_new=0.17*10**-3;\n",
    "C_new=(e0*A)/((d1_new/e1)+(d2/e2));\n",
    "C_change=C_new-C;\n",
    "Ratio=(C_change/C)/(0.02/0.2);\n",
    "print (\" New ratio of per unit change of capacitance to per unit change of diaplacement=%.2f\" %Ratio)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.47"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 102,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Output voltage=165 V\n",
      " Charge sensitivity=2.23 pC/N\n"
     ]
    }
   ],
   "source": [
    "# 2.47\n",
    "import math;\n",
    "g=0.055;\n",
    "t=2*10**-3;\n",
    "P=1.5*10**6;\n",
    "Eo=g*t*P;\n",
    "print (\"Output voltage=%.0f V\" %Eo)\n",
    "e=40.6*10**-12;\n",
    "d=e*g*10**12;\n",
    "print (\" Charge sensitivity=%.2f pC/N\" %d)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.48"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " Force=30 N\n"
     ]
    }
   ],
   "source": [
    "# 2.48\n",
    "import math;\n",
    "g=0.055;\n",
    "t=1.5*10**-3;\n",
    "Eo=100;\n",
    "P= Eo/(g*t);\n",
    "A=25*10**-6;\n",
    "F=P*A;\n",
    "print (\" Force=%.0f N\" %F)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.49"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " strain=0.0167 \n",
      " Charge=750 pC\n",
      " capacitance=250 pF\n"
     ]
    }
   ],
   "source": [
    "# 2.49\n",
    "import math;\n",
    "A=25*10**-6;\n",
    "F=5;\n",
    "P=F/A;\n",
    "d=150*10**-12;\n",
    "e=12.5*10**-9;\n",
    "g=d/(e);\n",
    "t=1.25*10**-3;\n",
    "Eo=(g*t*P);\n",
    "strain=P/(12*10**6);\n",
    "Q=d*F*10**12;\n",
    "C=Q/Eo;\n",
    "print (\" strain=%.4f \" %strain)\n",
    "print (\" Charge=%.0f pC\" %Q)\n",
    "print (\" capacitance=%.0f pF\" %C)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.50"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 106,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " peak voltage swing under open conditions=9.04 mV\n",
      " peak voltage swing under loaded conditions=1.52 mV\n",
      " Maximum change in crystal thickness=2.22 pm\n"
     ]
    }
   ],
   "source": [
    "# 2.50\n",
    "import math;\n",
    "d=2*10**-12;\n",
    "t=1*10**-3;\n",
    "Fmax=0.01;\n",
    "e0=8.85*10**-12;\n",
    "er=5;\n",
    "A=100*10**-6;\n",
    "Eo_peak_to_peak=2*d*t*Fmax*10**3/(e0*er*A);\n",
    "print (\" peak voltage swing under open conditions=%.2f mV\" %Eo_peak_to_peak)\n",
    "Rl=100*10**6;\n",
    "Cl=20*10**-12;\n",
    "d1=1*10**-3;\n",
    "Cp=e0*er*A/d1;\n",
    "C=Cp+Cl;\n",
    "w=1000;\n",
    "m=(w*Cp*Rl/(1+(w*C*Rl)**2)**0.5);\n",
    "El_peak_to_peak=(2*d*t*Fmax*10**3/(e0*er*A))*m;\n",
    "print (\" peak voltage swing under loaded conditions=%.2f mV\" %El_peak_to_peak)\n",
    "E=90*10**9;\n",
    "dt=2*Fmax*t*10**12/(A*E);\n",
    "print (\" Maximum change in crystal thickness=%.2f pm\" %dt)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.51"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 107,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " Minimum frequency=2028.29 rad/sec\n",
      " Phase shift=18.19 deg\n"
     ]
    }
   ],
   "source": [
    "# 2.51\n",
    "import math;\n",
    "M=0.95;\n",
    "tc=1.5*10**-3;\n",
    "w=(1/tc)*((M**2)/(1-M**2))**0.5;\n",
    "print (\" Minimum frequency=%.2f rad/sec\" %w)\n",
    "ph=((math.pi/2)-(math.atan(w*tc)))*(180/math.pi);\n",
    "print (\" Phase shift=%.2f deg\" %ph)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.52"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 108,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " Sensitivity of the transducer=40000000.00 V/m\n",
      " High frequency sensitivity =29629629.63 V/m\n",
      " Minimum frequency=358.68 sec\n",
      "now f=10Hz\n",
      " External shunt capacitance=0.05 pF\n",
      " new value of high frequency sensitivity=826073.26 V/m\n"
     ]
    }
   ],
   "source": [
    "#2.52\n",
    "import math;\n",
    "Kq=40*10**-3;\n",
    "Cp=1000*10**-12;\n",
    "K=Kq/Cp;\n",
    "print (\" Sensitivity of the transducer=%.2f V/m\" %K)\n",
    "Cc=300*10**-12;\n",
    "Ca=50*10**-12;\n",
    "C=Cp+Cc+Ca;\n",
    "Hf=Kq/C;\n",
    "print (\" High frequency sensitivity =%.2f V/m\" %Hf)\n",
    "R=1*10**6;\n",
    "tc=R*C;\n",
    "M=0.95;\n",
    "w=(1/tc)*((M**2)/(1-M**2))**0.5;\n",
    "f=w/(2*math.pi);\n",
    "print (\" Minimum frequency=%.2f sec\" %f)\n",
    "print ('now f=10Hz')\n",
    "f=10;\n",
    "w=2*math.pi*f;\n",
    "tc=(1/w)*((M**2)/(1-M**2))**0.5;\n",
    "C_new=tc/R;\n",
    "Ce=(C_new-C)*10**6;\n",
    "print (\" External shunt capacitance=%.2f pF\" %Ce)\n",
    "Hf_new=Kq/C_new;\n",
    "print (\" new value of high frequency sensitivity=%.2f V/m\" %Hf_new)\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.53"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 109,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Voltage just before t=2ms =1.00 mV\n",
      "(-2.2026841435311137, 'voltage just after t=2ms (mV)')\n",
      "Voltage just after t=2ms =-2.20 mV\n",
      "when t=10ms\n",
      "output voltage 10 ms after the application of impulse =0 mV\n"
     ]
    }
   ],
   "source": [
    "# 2.53\n",
    "import math;\n",
    "R=10**6;\n",
    "C=2500*10**-12;\n",
    "tc=R*C;\n",
    "t=2*10**-3;\n",
    "d=100*10**-12;\n",
    "F=0.1;\n",
    "el=10.0**3*(d*F*(math.exp(-t/tc))/C);\n",
    "print (\"Voltage just before t=2ms =%.2f mV\" %e1)\n",
    "el_after=10**3*(d*F*(math.exp(-t/tc)-1)/C);\n",
    "print (el_after,'voltage just after t=2ms (mV)')\n",
    "print (\"Voltage just after t=2ms =%.2f mV\" %el_after)\n",
    "print ('when t=10ms')\n",
    "t=10.0*10**-3;\n",
    "T=2.0*10\n",
    "e_10=10.0**3*(d*F*(math.exp((-T/tc)-1))*(math.exp(-(t-T))/tc)/C)\n",
    "print (\"output voltage 10 ms after the application of impulse =%.0f mV\" %e_10)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.54"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Let T=1\n",
      "Time constant =19.50 s\n",
      "as T=1 so time constant should be approximately equal to 20T\n"
     ]
    }
   ],
   "source": [
    "# 2.54\n",
    "import math;\n",
    "print ('Let T=1');\n",
    "T=1;\n",
    "el=0.95;\n",
    "tc=-T/math.log(el);\n",
    "print (\"Time constant =%.2f s\" %tc)\n",
    "print ('as T=1 so time constant should be approximately equal to 20T')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.55"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 111,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "output voltage =-0.75 mV\n"
     ]
    }
   ],
   "source": [
    "#2.55\n",
    "import math;\n",
    "Kh=-1*10**-6;\n",
    "I=3;\n",
    "B=0.5;\n",
    "t=2*10**-3;\n",
    "Eh=Kh*I*B*10**3/t;\n",
    "print (\"output voltage =%.2f mV\" %Eh)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.56"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 112,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "External resistance required =-999.997 ohm\n",
      "Dark current =0.29 mA\n"
     ]
    }
   ],
   "source": [
    "#2.56\n",
    "import math;\n",
    "R1=(30/10*10**-3)-1000;\n",
    "print (\"External resistance required =%.3f ohm\" %R1)\n",
    "Id=30.0*10**3/((2*10**3)+(100*10**3))\n",
    "print (\"Dark current =%.2f mA\" %Id)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Exa 2.57"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 113,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Potential of point b, Vb= 5.000000\n",
      "Potential of point d, Vd= 10.000000\n",
      "Outout voltage of bridge =-5.00 V\n"
     ]
    }
   ],
   "source": [
    "#2.57\n",
    "import math;\n",
    "Vb=10-(10.0/((2*10**3))*10**3);\n",
    "print ('Potential of point b, Vb= %f'%Vb)\n",
    "Vd=10-(10/((3*10**3))*2*10**3);\n",
    "print ('Potential of point d, Vd= %f' %Vd)\n",
    "Ebd=Vb-Vd;\n",
    "print (\"Outout voltage of bridge =%.2f V\" %Ebd)\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [Root]",
   "language": "python",
   "name": "Python [Root]"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}