{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 17: Banker's discount"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 17.1, Page number 17.2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "true discount is 50.0 Rs\n",
      "banker's discount is 51.0 Rs\n",
      "banker's gain is 1.0 Re\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "P=2550;    #principal(Rs)\n",
    "R=8;       #rate(%)\n",
    "T=3/12;       #time(yrs)\n",
    "\n",
    "#Calculation\n",
    "TD=P*R*T/(100+(R*T));    #true discount(Rs)\n",
    "BD=P*R*T/100;        #banker's discount(Rs)\n",
    "BG=BD-TD;     #banker's gain(Re)\n",
    "\n",
    "#Result\n",
    "print \"true discount is\",TD,\"Rs\"\n",
    "print \"banker's discount is\",BD,\"Rs\"\n",
    "print \"banker's gain is\",BG,\"Re\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 17.2, Page number 17.2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "principal is 1055.0 Rs\n",
      "answer given in the book is wrong\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "R=6;       #rate(%)\n",
    "T=11/12;       #time(yrs)\n",
    "BD=58.025;        #banker's discount(Rs)\n",
    "\n",
    "#Calculation\n",
    "P=BD*100/(R*T);    #principal(Rs)\n",
    "\n",
    "#Result\n",
    "print \"principal is\",P,\"Rs\"\n",
    "print \"answer given in the book is wrong\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 17.3, Page number 17.2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "banker's discount is 20.6 Rs\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "R=4;       #rate(%)\n",
    "T=9/12;       #time(yrs)\n",
    "TD=20;    #true discount(Rs)\n",
    "\n",
    "#Calculation\n",
    "BD=TD*(1+(R*T/100));        #banker's discount(Rs)\n",
    "\n",
    "#Result\n",
    "print \"banker's discount is\",BD,\"Rs\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 17.4, Page number 17.3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "banker's gain is 3.0 Rs\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "R=3;       #rate(%)\n",
    "T=2;       #time(yrs)\n",
    "TD=50;    #true discount(Rs)\n",
    "\n",
    "#Calculation\n",
    "BG=TD*R*T/100;     #banker's gain(Rs)\n",
    "\n",
    "#Result\n",
    "print \"banker's gain is\",BG,\"Rs\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 17.5, Page number 17.3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time is 1.0 yr\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "P1=1000;     #principal(Rs)\n",
    "P2=1050;     #principal(Rs)\n",
    "R=5;      #rate(%)\n",
    "\n",
    "#Calculation\n",
    "T=((P2*R*100/(P1*R))-100)/R;      #time(yrs)\n",
    "\n",
    "#Result\n",
    "print \"time is\",T,\"yr\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 17.6, Page number 17.3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "banker's discount is 108.0 Rs\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "TD=90;    #true discount(Rs)\n",
    "P=540;     #principal(Rs)\n",
    "\n",
    "#Calculation\n",
    "BD=((TD**2)/(P-TD))+TD;     #banker's discount(Rs)\n",
    "\n",
    "#Result\n",
    "print \"banker's discount is\",BD,\"Rs\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 17.7, Page number 17.3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "principal is 1650.0 Rs\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "R=5;       #rate(%)\n",
    "T=2;       #time(yrs)\n",
    "BG=15;     #banker's gain(Rs)\n",
    "\n",
    "#Calculation\n",
    "P=BG*100*(100+(R*T))/((R*T)**2);     #principal(Rs)\n",
    "\n",
    "#Result\n",
    "print \"principal is\",P,\"Rs\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 17.8, Page number 17.3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "present worth of bill is 2000.0 Rs\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "R=2;       #rate(%)\n",
    "T=5;       #time(yrs)\n",
    "BG=20;     #banker's gain(Rs)\n",
    "\n",
    "#Calculation\n",
    "PW=BG*(100**2)/((R*T)**2);     #present worth of bill(Rs)\n",
    "\n",
    "#Result\n",
    "print \"present worth of bill is\",PW,\"Rs\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 17.9, Page number 17.3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "true discount is 500.0 Rs\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "BG=25;     #banker's gain(Rs)\n",
    "PW=10000;     #present worth of bill(Rs)\n",
    "\n",
    "#Calculation\n",
    "TD=math.sqrt(PW*BG);    #true discount(Rs)\n",
    "\n",
    "#Result\n",
    "print \"true discount is\",TD,\"Rs\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 17.10, Page number 17.3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "sum is 120.0 Rs\n",
      "answer given in the book is wrong\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "BD=40;    #banker's discount(Rs) \n",
    "TD=30;    #true discount(Rs)\n",
    "\n",
    "#Calculation\n",
    "P=BD*TD/(BD-TD);      #sum(Rs)\n",
    "\n",
    "#Result\n",
    "print \"sum is\",P,\"Rs\"\n",
    "print \"answer given in the book is wrong\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 17.11, Page number 17.4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "rate is 7.0 %\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "BD=1;      #assume\n",
    "BG=(7/57)*BD;    #banker's gain(Rs)\n",
    "T=2;       #time(yrs)\n",
    "\n",
    "#Calculation\n",
    "R=BG*100/((BD-BG)*T);     #rate(%)\n",
    "\n",
    "#Result\n",
    "print \"rate is\",R,\"%\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 17.12, Page number 17.4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "rate is 2.0 %\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "BDbyTD=21/20;       #ratio of BD and TD\n",
    "T=5/2;       #time(yrs)\n",
    "\n",
    "#Calculation\n",
    "R=(BDbyTD-1)*100/T;     #rate(%)\n",
    "\n",
    "#Result\n",
    "print \"rate is\",R,\"%\""
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "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.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}