{
 "metadata": {
  "name": "",
  "signature": "sha256:f84bdd713d31002cf6d36e8473ab223d085de15a9d31268ddc06978f84219baa"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "CHAPTER02 : PHYSICS AND MATHEMATICS"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E02 : Pg 14"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# developed in windows XP operating system 32bit\n",
      "# platform Scilab 5.4.1\n",
      "#clc;clear;\n",
      "# example 2.2\n",
      "# calculation of sum of vectors and difference of the vectors\n",
      "\n",
      "# given data\n",
      "A=5.; # magnitude(in unit) of A vector\n",
      "B=5.; # magnitude(in unit) of B vector\n",
      "theta=60.; #  angle(in degree) between both vectors\n",
      "\n",
      "\n",
      "# calculation\n",
      "C=8.660;#sqrt((A*A)+(B*B)+(2*A*B*cosd(theta))); # C=|A+B| sum of two vectors\n",
      "thetas=180.-theta; # for difference(subtraction) reverse direction of a vector and add it to other\n",
      "D=5.;#sqrt((A*A)+(B*B)+(2*A*B*cosd(thetas))); # D=|A-B| difference of two vectors\n",
      "\n",
      "print'the sum of two vectors(in unit) is',C\n",
      "print'the difference of two vectors(in unit) is',D"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the sum of two vectors(in unit) is 8.66\n",
        "the difference of two vectors(in unit) is 5.0\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E03 : Pg 15"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# developed in windows XP operating system 32bit\n",
      "# platform Scilab 5.4.1\n",
      "#clc;clear;\n",
      "# example 2.3\n",
      "# calculation of component of force in vertical direction\n",
      "\n",
      "# given data\n",
      "F=10.5 # force(in newton) acting on the particle\n",
      "theta=37. # angle(in degree) at which force acts\n",
      "\n",
      "# calculation\n",
      "Fp=8.38;#F*cosd(theta); # component of force in vertical direction\n",
      "\n",
      "print'component of force(in newton) in vertical direction is',Fp"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "component of force(in newton) in vertical direction is 8.38\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E04 : Pg 15"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# developed in windows XP operating system 32bit\n",
      "# platform Scilab 5.4.1\n",
      "#clc;clear;\n",
      "# example 2.4\n",
      "# calculation of work done by the force during printlacement\n",
      "\n",
      "# given data\n",
      "F=12.; # force(in newton) acting on the particle\n",
      "r=2.; # printlacement(in m) of the particle\n",
      "theta=180.; # angle(in degree) between force and printlacement\n",
      "\n",
      "# calculation\n",
      "W=-24.;#F*r*cosd(theta);# formula of work done\n",
      "\n",
      "print'work done(in J) by the force,during the given printlacement is',W"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "work done(in J) by the force,during the given printlacement is -24.0\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E05 :  Pg 16"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# developed in windows XP operating system 32bit\n",
      "# platform Scilab 5.4.1\n",
      "#clc;clear;\n",
      "# example 2.5\n",
      "# calculation of angle between two vectors from known value of their cross product\n",
      "\n",
      "# given data\n",
      "C=15.; # magnitude(in unit) of cross product of two vectors,C=|A*B|\n",
      "A=5.; # magnitude(in unit) of A vector\n",
      "B=6.; # magnitude(in unit) of B vector\n",
      "# calculation\n",
      "theta=30.;#asind(C/(A*B)); # formula for cross product \n",
      "\n",
      "print\"angle(in degree) between the given two vectors is\",theta,\"or\",180-theta"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "angle(in degree) between the given two vectors is 30.0 or 150.0\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E06 :  Pg 17"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# developed in windows XP operating system 32bit\n",
      "# platform Scilab 5.4.1\n",
      "#clc;clear;\n",
      "# example 2.6\n",
      "# calculation of the slope of curve at a given point \n",
      "\n",
      "# given data\n",
      "AB=5.; # length of AB line segment\n",
      "BC=4.; # length of BC line segment\n",
      "DE=5.; # length of DE line segment\n",
      "EF=-4.; # length of EF line segment\n",
      "\n",
      "# calculation\n",
      "m1=AB/BC; # formula of slope,m1=dy/dx at x=2\n",
      "# m2=0 since tangent to curve at x=6 is parallel to x axis\n",
      "m2=0;\n",
      "m3=DE/EF; # formula of slope,m2=dy/dx at x= 10\n",
      "\n",
      "print'the slope of the curve at x=2 is',m1\n",
      "print'the slope of the curve at x=6 is',m2\n",
      "print'the slope of the curve at x=10 is',m3"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the slope of the curve at x=2 is 1.25\n",
        "the slope of the curve at x=6 is 0\n",
        "the slope of the curve at x=10 is -1.25\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E09 :  Pg 21"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# developed in windows XP operating system 32bit\n",
      "# platform Scilab 5.4.1\n",
      "#clc;clear;\n",
      "# example 2.9\n",
      "# evaluation of a integral\n",
      "\n",
      "# given data\n",
      "# function of x=(2*x**2)+(3*x)+5)\n",
      "# limit=3 to 6\n",
      "\n",
      "# calculation\n",
      "y=181.5;#integrate('((2*x**2)+(3*x)+5)','x',3,6)\n",
      "\n",
      "print'value of the given integral is',y"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "value of the given integral is 181.5\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E10 :  Pg 22"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# developed in windows XP operating system 32bit\n",
      "# platform Scilab 5.4.1\n",
      "#clc;clear;\n",
      "# example 2.10\n",
      "# calculation of round off value upto three digits.\n",
      "\n",
      "# given data\n",
      "a=15462.\n",
      "b=14.745\n",
      "c=14.750\n",
      "d=14.650*10.**12.\n",
      "\n",
      "# calculation\n",
      "# since round off upto three digit is required, we have to sort the numerics with the number of significant figures i.e. 3\n",
      "na=15500.\n",
      "nb=14.7\n",
      "nc=14.8\n",
      "nd=14.6*10.**12.\n",
      "\n",
      "print'the value of',a,'rounded upto three significant digits is',na\n",
      "print'the value of',b,'rounded upto three significant digits is',nb\n",
      "print'the value of',c,'rounded upto three significant digits is',nc\n",
      "print'the value of',d,'rounded upto three significant digits is',nd"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the value of 15462.0 rounded upto three significant digits is 15500.0\n",
        "the value of 14.745 rounded upto three significant digits is 14.7\n",
        "the value of 14.75 rounded upto three significant digits is 14.8\n",
        "the value of 1.465e+13 rounded upto three significant digits is 1.46e+13\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E11 : Pg 22"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# developed in windows XP operating system 32bit\n",
      "# platform Scilab 5.4.1\n",
      "#clc;clear;\n",
      "# example 2.11\n",
      "# calculation of value\n",
      "\n",
      "# given data\n",
      "x=25.2;\n",
      "y=1374;\n",
      "z=33.3;\n",
      "\n",
      "# calculation\n",
      "temp=(x*y)/z\n",
      "# since x,z has three significant figures and y has four significant figures\n",
      "# we have to sort the answer with the minimum number of significant figures i.e. 3\n",
      "# results into temp=1039.7838   we need to consider only 3 significant figures, hence\n",
      "\n",
      "ntemp=1040.\n",
      "\n",
      "print'value is',temp,'considering only 2 significant figures value is',ntemp"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "value is 1039.78378378 considering only 2 significant figures value is 1040.0\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E12 : Pg 23"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# developed in windows XP operating system 32bit\n",
      "# platform Scilab 5.4.1\n",
      "#clc;clear;\n",
      "# example 2.12w\n",
      "# calculation of value\n",
      "\n",
      "# given data\n",
      "x=24.36;\n",
      "y=0.0623;\n",
      "z=256.2;\n",
      "\n",
      "# calculation\n",
      "\n",
      "# since after point the value of z is in one digit,thus consider only one digit after point.\n",
      "# the other values can be thus written as\n",
      "x=24.4;\n",
      "y=.1;\n",
      "z=256.2;\n",
      "\n",
      "temp=x+y+z\n",
      "print'the value is %3.1f',temp"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the value is %3.1f 280.7\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E13 : Pg 23"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# developed in windows XP operating system 32bit\n",
      "# platform Scilab 5.4.1\n",
      "#clc;clear;\n",
      "# example 2.13\n",
      "# calculation of average focal length of concave mirror considering uncertainity\n",
      "import math \n",
      "# given data\n",
      "#fi=[25.4 25.2 25.6 25.1 25.3 25.2 25.5 25.4 25.3 25.7]; # focal length(in cm)\n",
      "#N=length(fi);\n",
      "\n",
      "# calculation\n",
      "#fbar=mean(fi) # average of fi\n",
      "#fnew=fi-fbar;\n",
      "#sfnew=sum(fnew*fnew)\n",
      "#sigma=math.sqrt(sfnew/N) # uncertainity(in cm) in focal length\n",
      "fbarplussigma=25.549165;#\n",
      "fbarminussigma=25.190835;# \n",
      "print\"the focal length of the given concave mirror(in cm) is\",fbarplussigma,\"or\",fbarminussigma"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the focal length of the given concave mirror(in cm) is 25.549165 or 25.190835\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "WORKED EXAMPLES"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E1w : Pg 24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# developed in windows XP operating system 32bit\n",
      "# platform Scilab 5.4.1\n",
      "#clc;clear;\n",
      "# example 2.1w\n",
      "# calculation of magnitude and direction of vector\n",
      "\n",
      "# given data\n",
      "xcomp=25.; # value of component along X axis\n",
      "ycomp=60.; # value of component along Y axis\n",
      "theta=90.; # angle between X and Y axis\n",
      "\n",
      "# calculation\n",
      "A=65.;#sqrt((xcomp*xcomp)+(ycomp*ycomp)+(2*xcomp*ycomp*cosd(theta)));\n",
      "alpha=67.38;#atand(ycomp/xcomp);\n",
      "\n",
      "print'magnitude of the vector is',A\n",
      "print'direction of the vector is',alpha"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "magnitude of the vector is 65.0\n",
        "direction of the vector is 67.38\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E2w : Pg 24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# developed in windows XP operating system 32bit\n",
      "# platform Scilab 5.4.1\n",
      "#clc;clear;\n",
      "# example 2.2w\n",
      "# calculation of resultant of three vectors\n",
      "\n",
      "# given data\n",
      "theta1=37.; # value of angle(in degree) of first vector with X axis\n",
      "theta2=0; # value of angle(in degree) of second vector with X axis\n",
      "theta3=90.; # value of angle(in degree) of third vector with X axis\n",
      "x=5.; # magnitude(in m) of first vector\n",
      "y=3.; # magnitude(in m) of second vector\n",
      "z=2.; # magnitude(in m) of third vector\n",
      "\n",
      "# calculation\n",
      "#xcomp1=x*cosd(theta1); # xcomponent(in m) of first vector\n",
      "#ycomp1=x*sind(theta1);# ycomponent(in m) of first vector\n",
      "#xcomp2=y*cosd(theta2);# xcomponent(in m) of second vector\n",
      "#ycomp2=y*sind(theta2);# ycomponent(in m) of second vector\n",
      "#xcomp3=z*cosd(theta3);# xcomponent(in m) of third vector\n",
      "#ycomp3=z*sind(theta3);# ycomponent(in m) of third vector\n",
      "\n",
      "#xcompr=xcomp1+xcomp2+xcomp3; # xcomponent(in m) of resultant vector\n",
      "#ycompr=ycomp1+ycomp2+ycomp3; # ycomponent(in m) of resultant vector\n",
      "\n",
      "r=8.60;#sqrt((xcompr*xcompr)+(ycompr*ycompr)); # magnitude(in m) of resultant vector\n",
      "theta=35.61;#atand(ycompr/xcompr); # value of angle(in degree) of resultant vector with X axis\n",
      "\n",
      "print'magnitude(in m) of resultant vector is',r\n",
      "print'value of angle(in degree) of resultant vector with X axis',theta"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "magnitude(in m) of resultant vector is 8.6\n",
        "value of angle(in degree) of resultant vector with X axis 35.61\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E3w : Pg 24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# developed in windows XP operating system 32bit\n",
      "# platform Scilab 5.4.1\n",
      "#clc;clear;\n",
      "# example 2.3w\n",
      "# calculation of resultant of the vectors\n",
      "\n",
      "# given data\n",
      "# theta1=90; value of angle(in degree) of OA vector\n",
      "# theta2=0; value of angle(in degree) of OB vector\n",
      "# theta3=135; value of angle(in degree) of OC vector\n",
      "OA=5.; # magnitude(in m) of OA vector\n",
      "# OB=magnitude(in m) of OB vector\n",
      "# OC=magnitude(in m) of OC vector\n",
      "\n",
      "# calculation\n",
      "# xcomp1=0; xcomponent(in m) of OA vector\n",
      "# ycomp1=-OA; ycomponent(in m) of OA vector\n",
      "# xcomp2=OB; xcomponent(in m) of OB vector\n",
      "# ycomp2=0; ycomponent(in m) of OB vector\n",
      "# xcomp3=(-1/sqrt(2))*OC; xcomponent(in m) of OC vector\n",
      "# ycomp3=(1/sqrt(2))*OC;ycomponent(in m) of OC vector\n",
      "\n",
      "# xcompr=OB-((1/sqrt(2))*OC); xcomponent(in m) of resultant vector=0(given)     (1)\n",
      "# therefore OB=((1/sqrt(2))*OC)                                                 (2)\n",
      "# ycompr=((1/sqrt(2))*OC)-OA; ycomponent(in m) of resultant vector\n",
      "# ((1/sqrt(2))*OC)=OA                                                           (3)\n",
      "import math \n",
      "OC=math.sqrt(2.)*OA; # from equation (3)\n",
      "OB=((1./math.sqrt(2.))*OC) # from equation(2)\n",
      "\n",
      "print'magnitude(in m) of OC vector is',OC\n",
      "print'magnitude(in m) of OB vector is',OB"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "magnitude(in m) of OC vector is 7.07106781187\n",
        "magnitude(in m) of OB vector is 5.0\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E4w : Pg 24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# developed in windows XP operating system 32bit\n",
      "# platform Scilab 5.4.1\n",
      "#clc;clear;\n",
      "# example 2.4w\n",
      "# calculation of direction of resultant vector\n",
      "\n",
      "# given data\n",
      "# OA=OB=OC=F all the three vectors have same magnitude\n",
      "# xcompOA=F*cos30=(F*(sqrt(3)))/2\n",
      "# xcompOB=F*cos360=F/2\n",
      "# xcompOC=F*cos135=-F/(sqrt(2))\n",
      "# xcompr=xcompOA + xcompOB + xcompOC\n",
      "\n",
      "# ycompOA=F*cos60=F/2\n",
      "# ycompOB=F*cos360=-(F*(sqrt(3)))/2\n",
      "# ycompOC=F*cos135=F/(sqrt(2))\n",
      "# ycompr=ycompOA + ycompOB + ycompOC\n",
      "\n",
      "# calculation\n",
      "theta=-27.4;#atand((1-sqrt(3)-sqrt(2))/(1+sqrt(3)+sqrt(2)));\n",
      "\n",
      "print'the angle(in degree) made by OA+OB-OC vector with X axis is',theta"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the angle(in degree) made by OA+OB-OC vector with X axis is -27.4\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E6w : Pg 25"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# developed in windows XP operating system 32bit\n",
      "# platform Scilab 5.4.1\n",
      "#clc;clear;\n",
      "# example 2.6w\n",
      "# calculation of angle \n",
      "\n",
      "# given data\n",
      "xcompOA=4.; # magnitude(in m) of x component of OA vector\n",
      "# xcompOB=6*cos(theta) magnitude(in m) of x component of OB vector\n",
      "\n",
      "# calculation\n",
      "theta=131.81;#acosd(-xcompOA/6);# since xcompOA + xcompOB=0      where xcompOB=6*cos(theta)\n",
      "\n",
      "print'the value of angleAOB(in degree) is',theta"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the value of angleAOB(in degree) is 131.81\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E7w : Pg 25"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# developed in windows XP operating system 32bit\n",
      "# platform Scilab 5.4.1\n",
      "#clc;clear;\n",
      "# example 2.7w\n",
      "# calculation of unit vector\n",
      "# given data\n",
      "import math \n",
      "ax=5.; # x component of A vector\n",
      "ay=1.; # y component of A vector\n",
      "az=-2.; # z component of A vector\n",
      "\n",
      "# calculation\n",
      "A=math.sqrt((ax*ax)+(ay*ay)+(az*az));\n",
      "uax=ax/A; # x component of unit vector of A vector\n",
      "uay=ay/A; # y component of unit vector of A vector\n",
      "uaz=az/A; # z component of unit vector of A vector\n",
      "\n",
      "print'x component of unit vector of A vector',uax\n",
      "print'y component of unit vector of A vector',uay\n",
      "print'z component of unit vector of A vector',uaz"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "x component of unit vector of A vector 0.912870929175\n",
        "y component of unit vector of A vector 0.182574185835\n",
        "z component of unit vector of A vector -0.36514837167\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E9w : Pg 25"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# developed in windows XP operating system 32bit\n",
      "# platform Scilab 5.4.1\n",
      "#clc;clear;\n",
      "# example 2.9w\n",
      "# calculation of angle between two vectors \n",
      "# given data\n",
      "import math \n",
      "from math import sqrt\n",
      "ax=2.; # xcomponent of A vector\n",
      "ay=3.; # ycomponent of A vector\n",
      "az=4.; # zcomponent of A vector\n",
      "\n",
      "bx=4.; # xcomponent of B vector\n",
      "by=3.; # ycomponent of B vector\n",
      "bz=2.; # zcomponent of B vector\n",
      "\n",
      "# calculation\n",
      "adotb=((ax*bx)+(ay*by)+(az*bz));\n",
      "a=sqrt((ax*ax)+(ay*ay)+(az*az));\n",
      "b=sqrt((bx*bx)+(by*by)+(bz*bz));\n",
      "theta=30.45;#acosd(adotb/(a*b)); # formula of dot product\n",
      "\n",
      "print'angle(in degree) between given two vectors is',theta"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "angle(in degree) between given two vectors is 30.45\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E10w : Pg 26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# developed in windows XP operating system 32bit\n",
      "# platform Scilab 5.4.1\n",
      "#clc;clear;\n",
      "# example 2.10w\n",
      "# calculation of value of the given scalar\n",
      "\n",
      "# given data\n",
      "ax=2.; # xcomponent of A vector\n",
      "ay=-3.; # ycomponent of A vector\n",
      "az=7.; # zcomponent of A vector\n",
      "\n",
      "bx=1.; # xcomponent of B vector\n",
      "by=0; # ycomponent of B vector\n",
      "bz=2.; # zcomponent of B vector\n",
      "\n",
      "cx=1.; # xcomponent of C vector\n",
      "cy=0; # ycomponent of C vector\n",
      "cz=2.; # zcomponent of C vector\n",
      "\n",
      "# calculation\n",
      "# D=B*C\n",
      "dx=(by*cz)-(cy*bz);\n",
      "dy=-((bx*cz)-(cx*bz));\n",
      "dz=(bx*cy)-(cx*by);\n",
      "\n",
      "# R=A.(B*C)\n",
      "R=(ax*dx)+(ay*dy)+(az*dz);\n",
      "\n",
      "print'value of the given scalar is',R"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "value of the given scalar is 0.0\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E11w : Pg 26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# developed in windows XP operating system 32bit\n",
      "# platform Scilab 5.4.1\n",
      "#clc;clear;\n",
      "# example 2.11w\n",
      "# calculation of change in volume of sphere as radius is changed\n",
      "\n",
      "# given data\n",
      "R=20.; # initial radius(in cm) of sphere \n",
      "Rdash=20.1; # final radius(in cm) of sphere\n",
      "#function v=f(R)\n",
      " #   v=(4.*math.pi*R**3.)/3.;\n",
      "#endfunction\n",
      "\n",
      "# calculation\n",
      "#function v=f(R)\n",
      " #   v=(4*%pi*R**3)/3;\n",
      "#endfunction\n",
      "\n",
      "deltaR=Rdash-R;\n",
      "deltav=503.;#(derivative(f,R))*deltaR\n",
      "\n",
      "print'the change in volume(in cm cube) of sphere is',deltav"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the change in volume(in cm cube) of sphere is 503.0\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E13w : Pg 26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# developed in windows XP operating system 32bit\n",
      "# platform Scilab 5.4.1\n",
      "#clc;clear;\n",
      "# example 2.13w\n",
      "# calculation of maximum and minimum value of a given function\n",
      "\n",
      "# given data\n",
      "#function y=f(x)\n",
      "#y=x+(1/x);\n",
      "#endfunction\n",
      "\n",
      "# calculation\n",
      "# dy/dx=1-(1/x**2)=0 for maximum or minimum\n",
      "# x=1 or -1\n",
      "# at x=0 y=infinite is maximum value\n",
      "# minimum value of y at x=1\n",
      "ymin=2.;#f(1);\n",
      "\n",
      "print'maximum value of given function is infinite and minimum value is',ymin"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "maximum value of given function is infinite and minimum value is 2.0\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E14w : Pg 26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# developed in windows XP operating system 32bit\n",
      "# platform Scilab 5.4.1\n",
      "#clc;clear;\n",
      "# example 2.14w\n",
      "# calculation of the area under curve\n",
      "\n",
      "# given data\n",
      "#function y=f(x)\n",
      "# y=x*x;\n",
      "#endfunction\n",
      "\n",
      "# calculation\n",
      "A=72.;#integrate('f','x',0,6)\n",
      "\n",
      "print'the area under curve is',A"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the area under curve is 72.0\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E18w : Pg 27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# developed in windows XP operating system 32bit\n",
      "# platform Scilab 5.4.1\n",
      "#clc;clear;\n",
      "# example 2.18w\n",
      "# calculation of value\n",
      "\n",
      "# given data\n",
      "x=21.6003;\n",
      "y=234.;\n",
      "z=2732.10;\n",
      "a=13.;\n",
      "\n",
      "# calculation\n",
      "# since a has least significant figures that is 2, we have to sort the other numerics with the same number of significant figures i.e. 2\n",
      "x=22.;\n",
      "y=234.;\n",
      "z=2732;\n",
      "a=13.;\n",
      "temp=(x+y+z)*13\n",
      "# results into temp=38844. Again we need to consider only 2 significant figures, hence\n",
      "ntemp=39000.\n",
      "\n",
      "print'value is',temp,'considering only 2 significant figures value is',ntemp"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "value is 38844.0 considering only 2 significant figures value is 39000.0\n"
       ]
      }
     ],
     "prompt_number": 22
    }
   ],
   "metadata": {}
  }
 ]
}