{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 01: Vectors and their use" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex1.1:pg-25" ] }, { "cell_type": "code", "execution_count": 21, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The Resultant R= 40.31 cm\n", "\n", "Theta= 120.0 degrees\n" ] } ], "source": [ " #Example 1_1\n", "import math \n", " #To add the given Displacements Graphically\n", "d1=25 #units in cm\n", "d2=10 #units in cm\n", "d3=30 #units in cm\n", "R=math.sqrt(d1**2+d2**2+d3**2) #units in cm\n", "theta1=30 #units in degrees\n", "theta2=90 #units in degrees\n", "theta3=120 #units in degrees\n", "theta=360-(theta1+theta2+theta3) #units in degrees\n", "print \"The Resultant R=\",round(R,2),\" cm\\n\"\n", "print \"Theta=\",round(theta),\" degrees\"\n", " #In text book the answer is printed wrong as R=49cm and theta=82 degrees but the correct answer is R=40.31cm and theta=120 degrees\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex1.2:pg-25" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The Resultant R= 6.72 Meters\n", "\n", "The Angle theta= 170.0 degrees\n" ] } ], "source": [ " #Example 1_2\n", "\n", "import math\n", " \n", " # To add the given vector displacements\n", "a=1 #units in meters\n", "b=3 #units in meters\n", "c=5 #units in meters\n", "d=6 #units in meters\n", "theta1=90 #units in degrees\n", "Rx_a=a*math.sin(theta1*math.pi/180) #units in meters\n", "Rx_b=round(b*math.cos(theta1*math.pi/180)) #units in meters\n", "theta2=37 #units in degrees\n", "Rx_c=-round(c*math.cos(theta2*math.pi/180)) #units in meters\n", "theta3=53 #units in degrees\n", "Rx_d=-d*math.cos(theta3*math.pi/180)\n", "Ry_a=round(a*math.cos(theta1*math.pi/180)) #units in meters\n", "Ry_b=round(c*math.sin(theta2*math.pi/180)) #units in meters\n", "Ry_c=round(c*math.sin(theta2*math.pi/180)) #units in meters\n", "Ry_d=-(d*math.sin(theta3*math.pi/180)) #units in meters\n", "Rx=Rx_a+Rx_b+Rx_c+Rx_d #units in meters\n", "Ry=Ry_a+Ry_b+Ry_c+Ry_d #units in meters\n", "R=sqrt(Rx**2+Ry**2) #units in meters\n", "phi=round(math.atan(Ry/-(Rx))*180/math.pi) #units in degrees\n", "phi=180-phi #units in degrees\n", "print \"The Resultant R=\",round(R,2),\" Meters\\n\"\n", "print \"The Angle theta=\",round(phi),\" degrees\"\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex1.3:pg-26" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Resultant R= 15.5 Meters\n", "\n", "Angle Theta= 19.0 Degrees\n" ] } ], "source": [ " #Example 1_3\n", "\n", "import math\n", " #To subtract vector B from Vector A\n", "Ax=8.7 #units in meters\n", "Ay=5 #units in meters\n", "Bx=-6 #units in meters\n", "By=0 #units in meters\n", "Rx=Ax-Bx #units in meters\n", "Ry=Ay-By #units in meters\n", "R=sqrt(Rx**2+Ry**2) #units in meters\n", "theta=round(math.atan(Ry/(Rx))*180/math.pi) #units in degrees\n", "print \"Resultant R=\",round(R,1),\" Meters\\n\"\n", "print \"Angle Theta=\",round(theta),\" Degrees\"\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex1.4:pg-30" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Volume V= 5.65e-10 Meter**3\n" ] } ], "source": [ " #Example 1_4\n", "import math\n", "\n", " #To calculate the Volume\n", "r=3*10**-5 #units in meters\n", "L=0.20 #units in meters\n", "V=math.pi*r**2*L #Units in meter**3\n", "print \"Volume V=\",round(V,12),\"Meter**3\"\n" ] } ], "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.11" } }, "nbformat": 4, "nbformat_minor": 0 }