{ "metadata": { "name": "", "signature": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 3, Forced harmonic oscillator & resonance" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 1, page 135" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division\n", "from math import sqrt, degrees, atan, pi\n", "# Phase shift\n", "#given data :\n", "F0=25 # in N\n", "m=1 \n", "f0=F0/m \n", "K=1*10**3 # in N/m\n", "w0=sqrt(K/m) \n", "b=0.05 # in N-s/m\n", "r=b/(2*m) # in s**-1\n", "A=f0*10**3/sqrt(9*w0**4+(16*r**2*(w0)**2)) \n", "print \"The amplitude, A = %0.2f mm \" %A\n", "p=2*w0 \n", "fi=atan(2*r*p/(w0**2-p**2)) # radian \n", "fi = degrees(fi) # degree\n", "print \"Phase shift is\",round(fi,2),\"degree or\",round(fi*(pi/180),3),\"radian.\"\n", "#phase shift is converted wrong into radians" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The amplitude, A = 8.33 mm \n", "Phase shift is -0.06 degree or -0.001 radian.\n" ] } ], "prompt_number": 7 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2, page 136" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from numpy import array\n", "# A/Amax\n", "x1=array([0.99,0.98,0.97]) #\n", "wt=50 #\n", "wo=1 #assume\n", "fo=1 #assume\n", "for x in x1:\n", " a=((fo/((wo**2)*((1-x**2)**2+((1/wt**2)*x**2))**(1/2)))) #\n", " am=fo/((wo**2)*(1/wt**2)**(1/2)) #\n", " z=a/am #\n", " print \"For p/wo\",x,\", value of A/Amax is\",round(z,2)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "For p/wo 0.99 , value of A/Amax is 0.71\n", "For p/wo 0.98 , value of A/Amax is 0.45\n", "For p/wo 0.97 , value of A/Amax is 0.32\n" ] } ], "prompt_number": 9 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3, page 154" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from math import pi, sqrt\n", "# Reactance and impedence\n", "#given data :\n", "n=50 # in cycles\n", "w=2*pi*n # in rad/sec\n", "L=1/pi # in H\n", "XL=w*L \n", "print \"The reactance, XL = %0.0f ohm \" %XL\n", "R=100 # in ohm\n", "Z=sqrt(R**2+XL**2) \n", "print \"The impedence, Z = %0.1f ohm \" %Z" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The reactance, XL = 100 ohm \n", "The impedence, Z = 141.4 ohm \n" ] } ], "prompt_number": 11 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4, page 155" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from math import sqrt, pi\n", "# Current and Capacity\n", "#given data :\n", "E=110 # in V\n", "R=10 # in ohm\n", "L=1*10**-3 # in H\n", "C=1*10**-6 # in F\n", "n=10000 # in Hz\n", "w=2*pi*n \n", "I=E/sqrt(R**2+((w*L)-(1/(w*C)))**2) \n", "print \"The current, I = %0.2f A \" %I\n", "L1=1/(w**2*C) \n", "print \"The value of capacity, L1 = %0.2e F \" %L1\n", "#Capacitance is calculated wrong in the textbook" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The current, I = 2.29 A \n", "The value of capacity, L1 = 2.53e-04 F \n" ] } ], "prompt_number": 13 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5, page 155" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from math import sqrt\n", "# Resonent frequency and Separation\n", "#given data :\n", "L=1*10**-3 # in H\n", "C=0.1*10**-6 # in F\n", "w0=1/sqrt(L*C) \n", "print \"Resonant frequency, w0 = %0.e rad/s \" %w0\n", "R=10 # in ohm\n", "w2_w1=R/L \n", "print \"The separation = %0.e rad/s \" %w2_w1\n", "S=w0/w2_w1 \n", "print \"The sharpness = %0.f \" %S" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Resonant frequency, w0 = 1e+05 rad/s \n", "The separation = 1e+04 rad/s \n", "The sharpness = 10 \n" ] } ], "prompt_number": 16 } ], "metadata": {} } ] }