From 47d7279a724246ef7aa0f5359cf417992ed04449 Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Wed, 3 Jun 2015 15:27:17 +0530 Subject: add books --- .../Chapter9.ipynb | 1115 ++++++++++++++++++++ 1 file changed, 1115 insertions(+) create mode 100755 Quantitative_Aptitude_for_Competitive_Examinations/Chapter9.ipynb (limited to 'Quantitative_Aptitude_for_Competitive_Examinations/Chapter9.ipynb') diff --git a/Quantitative_Aptitude_for_Competitive_Examinations/Chapter9.ipynb b/Quantitative_Aptitude_for_Competitive_Examinations/Chapter9.ipynb new file mode 100755 index 00000000..b7d05043 --- /dev/null +++ b/Quantitative_Aptitude_for_Competitive_Examinations/Chapter9.ipynb @@ -0,0 +1,1115 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 9: Mixtures" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.1, Page number 9.4" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "proportion to be mixed is 4\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c1=9.5; #cost of oil per kg(Rs)\n", + "c2=10; #cost of another oil(Rs)\n", + "Cm=9.6; #cost of mixture(Rs)\n", + "\n", + "#Calculation\n", + "q1byq2=(c2-Cm)/(Cm-c1); #proportion to be mixed\n", + "\n", + "#Result\n", + "print \"proportion to be mixed is\",int(q1byq2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.2, Page number 9.4" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "proportion to be mixed is 0.666666666667\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c1=25; #percentage of alcohol(%)\n", + "c2=50; #percentage of alcohol(%)\n", + "Cm=40; #alcohol strength(%)\n", + "\n", + "#Calculation\n", + "q1byq2=(c2-Cm)/(Cm-c1); #proportion to be mixed\n", + "\n", + "#Result\n", + "print \"proportion to be mixed is\",q1byq2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.3, Page number 9.5" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "quantity of money lent at 8% is 400.0 Rs\n", + "quantity of money lent at 10% is 600.0 Rs\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c1=8; #first part(%)\n", + "c2=10; #second part(%)\n", + "Cm=9.2; #yearly average(%)\n", + "A=1000; #amount(Rs)\n", + "\n", + "#Calculation\n", + "q1=c2-Cm;\n", + "q2=Cm-c1; \n", + "A1=q1*A/(q1+q2); #quantity of money lent at 8%(Rs)\n", + "A2=q2*A/(q1+q2); #quantity of money lent at 10%(Rs)\n", + "\n", + "#Result\n", + "print \"quantity of money lent at 8% is\",A1,\"Rs\"\n", + "print \"quantity of money lent at 10% is\",A2,\"Rs\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.4, Page number 9.5" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "amount of water to be added is 5.0 litres\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c1=0; #pure milk(litres)\n", + "c2=3.6; #cost of pure milk(Rs)\n", + "Cm=3; #cost of mixture(Rs)\n", + "\n", + "#Calculation\n", + "q1byq2=(Cm-c1)/(c2-Cm); #amount of water to be added(litres)\n", + "\n", + "#Result\n", + "print \"amount of water to be added is\",q1byq2,\"litres\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.5, Page number 9.5" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "amount of salt is 20.0 kg\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c1=24; #cost of salt(paise)\n", + "c2=42; #cost of salt(paise)\n", + "c=40; #cost of mixture(paise)\n", + "e=25; #efficiency(%) \n", + "\n", + "#Calculation\n", + "Cm=c*100/(100+e); #cost price of mixture(paise)\n", + "q1byq2=(Cm-c1)/(c2-Cm); #proportion to be mixed\n", + "q=q1byq2*e; #amount of salt(kg)\n", + "\n", + "#Result\n", + "print \"amount of salt is\",q,\"kg\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.6, Page number 9.5" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "strength of alcohol is 16.6666666667 %\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "a=5; #amount of alcohol solution(litres)\n", + "p=20/100; #percentage of solution\n", + "\n", + "#Calculation\n", + "A=p*a; #amount of alcohol(litre)\n", + "S=A*100/(A+a); #strength of alcohol(%)\n", + "\n", + "#Result\n", + "print \"strength of alcohol is\",S,\"%\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.7, Page number 9.6" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "amount of water to be added is 5.0 litres\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "p1=90/100; #percentage of milk in mixture(%)\n", + "p2=10/100; #percentage of water in mixture(%)\n", + "a=40; #amount of mixture(litres)\n", + "p_2=20; #new percent of water(%)\n", + "\n", + "#Calculation\n", + "A=(p1*a*p_2/(100-p_2))-(p2*a); #amount of water to be added(litres)\n", + "\n", + "#Result\n", + "print \"amount of water to be added is\",A,\"litres\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.8, Page number 9.6" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "amount of pure milk is 25.0 litres\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c1=0; \n", + "c2=3.0; #cost of pure milk(Rs)\n", + "e=20/100; #efficiency(%) \n", + "\n", + "#Calculation\n", + "Cm=c2/(1+e); #CP of mixture(Rs)\n", + "q1byq2=(Cm-c1)/(c2-Cm); #proportion to be mixed\n", + "A=q1byq2**2; #amount of pure milk(litres)\n", + "\n", + "#Result\n", + "print \"amount of pure milk is\",A,\"litres\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.9, Page number 9.6" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "selling price of mixture is Rs 7.04 per kg\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "a1=6; #amount of tea(kg)\n", + "p1=6; #cost of tea(Rs)\n", + "a2=4; #amount of tea(kg)\n", + "p2=7; #cost of tea(Rs)\n", + "p=10/100; #profit(p)\n", + "\n", + "#Calculation\n", + "cp=((a1*p1)+(a2*p2))/(a1+a2); #cost price of mixture(Rs)\n", + "sp=(1+p)*cp; #selling price of mixture(Rs)\n", + "\n", + "#Result\n", + "print \"selling price of mixture is Rs\",sp,\"per kg\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.10, Page number 9.6" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "strength of acid in mixture is 60.0 %\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "p1=20; #percentage of sulphuric acid(%)\n", + "q1=5; #amount of acid(litres)\n", + "p2=100; #percentage of pure sulphuric acid(%)\n", + "q2=5; #amount of acid(litres)\n", + "\n", + "#Calculation\n", + "s=((p1*q1)+(p2*q2))/(q1+q2); #strength of acid in mixture(%)\n", + "\n", + "#Result\n", + "print \"strength of acid in mixture is\",s,\"%\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.11, Page number 9.6" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "cost price of 1st liquid is Rs 10.8 per litre\n", + "cost price of 2nd liquid is Rs 8.8 per litre\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "q1=3\n", + "q2=2; \n", + "c=11; #cost at which mixture is sold(Rs)\n", + "p=10/100; #profit(%)\n", + "\n", + "#Calculation\n", + "Cm=c/(1+p); #cost price of mixture(Rs)\n", + "x=((q2*Cm)+(q1*Cm)+(q2*q2))/(q1+q2); #cost price of 1st liquid(Rs)\n", + "x2=x-q2; #cost price of 2nd liquid(Rs)\n", + "\n", + "#Result\n", + "print \"cost price of 1st liquid is Rs\",x,\"per litre\"\n", + "print \"cost price of 2nd liquid is Rs\",x2,\"per litre\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.12, Page number 9.7" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "alcohol and water are in the proportion of 1.4\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "a=2;\n", + "b=1; #proportion of 1st mixture of alcohol and water\n", + "x=1;\n", + "y=1; #proportion of 2nd mixture of alcohol and water\n", + "\n", + "#Calculation\n", + "q1=(a/(a+b))+(x/(x+y)); #quantity of alcohol in 3rd glass\n", + "q2=(b/(a+b))+(y/(x+y)); #quantity of water in 3rd glass\n", + "\n", + "#Result\n", + "print \"alcohol and water are in the proportion of\",q1/q2 " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.13, Page number 9.7" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "gain made on sale of 5 quintals is Rs 110.0\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c1=2.10; #cost price of coffee(Rs)\n", + "q1=15; #quantity of coffee(parts)\n", + "c2=0.98; #cost price of chicory(Rs)\n", + "q2=1; #quantity of chicory(part)\n", + "s=2.25; #selling price per kg(Rs)\n", + "a=500; #amount(kg)\n", + "\n", + "#Calculation\n", + "Cm=((c1*q1)+(c2*q2))/(q1+q2); #cost price of mixture(Rs)\n", + "p=(s-Cm)*a; #gain made on sale of 5 quintals(Rs)\n", + "\n", + "#Result\n", + "print \"gain made on sale of 5 quintals is Rs\",p" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.14, Page number 9.8" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "percentage of alcohol is 28.0 %\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "qa=35; #percentage of alcohol by weight\n", + "qw=25; #weight of water(gms)\n", + "m=100; #total mixture(g)\n", + "\n", + "#Calculation\n", + "p=qa*100/(m+qw); #percentage of alcohol(%)\n", + "\n", + "#Result\n", + "print \"percentage of alcohol is\",p,\"%\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.15, Page number 9.8" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "quantity of the butt stolen is 0.57\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "Cm=24; #strength of butt(%)\n", + "c1=18; #percentage of spirit(%)\n", + "c2=32; #percentage of spirit(%)\n", + "\n", + "#Calculation\n", + "q1=Cm-c1; #quantity of 32% spirit\n", + "q2=c2-Cm; #quantity of 18% spirit\n", + "f=q2/(q1+q2); #quantity of the butt stolen\n", + "\n", + "#Result\n", + "print \"quantity of the butt stolen is\",round(f,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.16, Page number 9.8" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "quantity of water added is 22.0 litres\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "m=66; #mixture of milk(litres)\n", + "a=5;\n", + "b=1; #ratio of milk and water\n", + "x=5;\n", + "y=3; #new ratio \n", + "\n", + "#Calculation\n", + "x1=a*m*y/(a+b);\n", + "x2=a*m/(x+b);\n", + "x=(x1-x2)/a; #quantity of water added(litres)\n", + "\n", + "#Result\n", + "print \"quantity of water added is\",x,\"litres\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.17, Page number 9.8" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "amount of dry fruit obtained is 35.0 kg\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "qw1=72/100; #content of water in fresh fruit(%)\n", + "a=100; #amount of fresh fruit(kg)\n", + "qw2=20/100; #content of water in dry fruit(%)\n", + "\n", + "#Calculation\n", + "x=(1-qw1)*a/(1-qw2); #amount of dry fruit obtained(kg)\n", + "\n", + "#Result\n", + "print \"amount of dry fruit obtained is\",x,\"kg\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.18, Page number 9.8" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "quantity of fresh water to be added is 40.0 kg\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "qs=5/100; #content of salt by water(%)\n", + "a=60; #amount of sea water(kg)\n", + "q=3; #content of salt in solution(%)\n", + "\n", + "#Calculation\n", + "x=((qs*a*100)-(q*a))/q; #quantity of fresh water to be added(kg)\n", + "\n", + "#Result\n", + "print \"quantity of fresh water to be added is\",x,\"kg\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.19, Page number 9.9" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "amount of first alloy is 7.0 kg\n", + "amount of second alloy is 21.0 kg\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "qa=1; #copper in 1st alloy\n", + "qb=1; #copper in 2nd alloy\n", + "x=3;\n", + "y=4; #ratio of copper to zinc\n", + "a=5;\n", + "b=2; #ration of copper to zinc in new alloy\n", + "q=28; #quantity of new alloy(kg) \n", + "\n", + "#Calculation\n", + "Cm=qa/(qa+qb); #copper in new alloy\n", + "c1=x/(x+y); #copper in 2nd alloy\n", + "c2=a/(a+b); #copper in 1st alloy\n", + "q1=(Cm-c1);\n", + "q2=(c2-Cm);\n", + "a1=q1*q/(q1+q2); #amount of 1st alloy(kg)\n", + "a2=q-a1; #amount of second alloy(kg)\n", + "\n", + "#Result\n", + "print \"amount of first alloy is\",a1,\"kg\"\n", + "print \"amount of second alloy is\",a2,\"kg\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.20, Page number 9.9" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "weight of new alloy is 35.0 kg\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "a1=4;\n", + "b1=1; #relation of copper and zinc\n", + "a2=1;\n", + "b2=3; #relation of copper and zinc\n", + "a3=3;\n", + "b3=2; #ratio of copper to zinc \n", + "q1=10; #amount of 1st alloy(kg)\n", + "q2=16; #amount of 2nd alloy(kg)\n", + "\n", + "#Calculation\n", + "c1=a1*q1/(a1+b1); #copper in 1st alloy\n", + "c2=a2*q2/(a2+b2); #copper in 2nd alloy\n", + "x=(a3*(q1+q2))-((a3+b3)*(c1+c2)); \n", + "w=(x/2)+q1+q2; #weight of new alloy(kg)\n", + "\n", + "#Result\n", + "print \"weight of new alloy is\",w,\"kg\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.21, Page number 9.10" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "number of boys is 33.0\n", + "number of girls is 12.0\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "a=39; #amount(Rs)\n", + "s=45; #number of boys and girls\n", + "c1=50/100; #amount girl gets(Rs)\n", + "c2=1; #amount boy gets(Rs)\n", + "\n", + "#Calculation\n", + "Cm=a/s;\n", + "qb=(Cm-c1); #number of boys in ratio\n", + "qg=(c2-Cm); #number of girls in ratio\n", + "b=qb*s/(qb+qg); #number of boys\n", + "g=s-b; #number of girls\n", + "\n", + "#Result\n", + "print \"number of boys is\",b\n", + "print \"number of girls is\",g" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.22, Page number 9.10" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "quantity of mixture released is 2.0 litres\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "co=9/100; #content of oxygen\n", + "vo=16/100; #volume of oxygen\n", + "q=8; #quantity of cylinder(litre)\n", + "\n", + "#Calculation\n", + "r=math.sqrt(co*q/(vo*q));\n", + "R=q*(1-r); #quantity of mixture released(litres)\n", + "\n", + "#Result\n", + "print \"quantity of mixture released is\",R,\"litres\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.23, Page number 9.10" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "amount of milk left is 72.9 kg\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "x0=100; #original amount of milk(kg)\n", + "xr=10; #amount of milk removed(kg)\n", + "n=3; #number of operations\n", + "\n", + "#Calculation\n", + "a=x0*(1-(xr/x0))**n; #amount of milk left(kg)\n", + "\n", + "#Result\n", + "print \"amount of milk left is\",a,\"kg\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.24, Page number 9.11" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ratio of dettol and water is 0.25\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "x0=1; #quantity of dettol(litre)\n", + "xr=1/3; #quantity of dettol removed(litre)\n", + "n=4; #number of operations\n", + "\n", + "#Calculation\n", + "Aa=(1-(xr/x0))**n; #amount of dettol left(litre)\n", + "Ba=1-Aa; #amount of water left(litre)\n", + "r=Aa/Ba; #ratio of dettol and water \n", + "\n", + "#Result\n", + "print \"ratio of dettol and water is\",round(r,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.25, Page number 9.12" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "part of the mixture taken out is 0.2\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "a1=5; #parts of after shave lotion\n", + "b1=3; #parts of water\n", + "Al=1/2; #amount of after shave lotion\n", + "\n", + "#Calculation\n", + "Ap=a1/(a1+b1); #amount of after shave lotion present\n", + "R=1-(Al/Ap); #part of the mixture taken out\n", + "\n", + "#Result\n", + "print \"part of the mixture taken out is\",R" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example number 9.26, Page number 9.12" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "three kinds of rice are mixed in the ratio 11.0 : 77.0 : 7.0\n" + ] + } + ], + "source": [ + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c1=12; #cost price of 1st variety(Rs)\n", + "c2=14.40; #cost price of 2nd variety(Rs)\n", + "c3=17.40; #cost price of 3rd variety(Rs)\n", + "Cm=14.10; #cost price of mixture(Rs)\n", + "f=11.11; #factor to be rounded off\n", + "\n", + "#Calculation\n", + "q1=(c2-Cm)*(c3-Cm)*f; #quantity of 1st variety(kg)\n", + "q2=(Cm-c1)*(c3-Cm)*f; #quantity of 2nd variety(kg)\n", + "q3=(c2-Cm)*(Cm-c1)*f; #quantity of 3rd variety(kg)\n", + "\n", + "\n", + "#Result\n", + "print \"three kinds of rice are mixed in the ratio\",round(q1),\":\",round(q2),\":\",round(q3)" + ] + } + ], + "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 +} -- cgit