summaryrefslogtreecommitdiff
path: root/sample_notebooks/Preeti/Chapter15.ipynb
diff options
context:
space:
mode:
authorTrupti Kini2016-03-19 23:30:16 +0600
committerTrupti Kini2016-03-19 23:30:16 +0600
commitfbf7bfe3ae79ca0913b5ed72666546284798450b (patch)
tree9a5bb98e0508e8b985123d3a5c342f141c48d4b7 /sample_notebooks/Preeti/Chapter15.ipynb
parent877fd05b28e6762d15d530a5aaacf5ca2a25e90a (diff)
downloadPython-Textbook-Companions-fbf7bfe3ae79ca0913b5ed72666546284798450b.tar.gz
Python-Textbook-Companions-fbf7bfe3ae79ca0913b5ed72666546284798450b.tar.bz2
Python-Textbook-Companions-fbf7bfe3ae79ca0913b5ed72666546284798450b.zip
Added(A)/Deleted(D) following books
A sample_notebooks/Preeti/Chapter15.ipynb
Diffstat (limited to 'sample_notebooks/Preeti/Chapter15.ipynb')
-rw-r--r--sample_notebooks/Preeti/Chapter15.ipynb354
1 files changed, 354 insertions, 0 deletions
diff --git a/sample_notebooks/Preeti/Chapter15.ipynb b/sample_notebooks/Preeti/Chapter15.ipynb
new file mode 100644
index 00000000..30a222a9
--- /dev/null
+++ b/sample_notebooks/Preeti/Chapter15.ipynb
@@ -0,0 +1,354 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 15 : Alternating voltage & current"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example No. 15_1 Page No: 546"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 24,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "The Voltage at 30° = 50.00 Volts\n",
+ "The Voltage at 45° = 70.71 Volts\n",
+ "The Voltage at 90° = 100.00 Volts\n",
+ "The Voltage at 270° = -100.00 Volts\n"
+ ]
+ }
+ ],
+ "source": [
+ "from numpy import sin, pi\n",
+ "# A sine wave of voltage varies from zero to a maximum of 100 V. How much is the voltage at the instant of 30° of the cycle? 45°? 90°? 270°?\n",
+ "\n",
+ "# Given data\n",
+ "\n",
+ "Vm = 100# # Vm=100 Volts\n",
+ "t1 = 30# # Theta 1=30°.\n",
+ "t2 = 45# # Theta 2=45°.\n",
+ "t3 = 90# # Theta 3=90°.\n",
+ "t4 = 270# # Theta 4=270°.\n",
+ "\n",
+ "v1 = Vm*sin(t1*pi/180)\n",
+ "print 'The Voltage at 30° = %0.2f Volts'%v1\n",
+ "\n",
+ "v2 = Vm*sin(t2*pi/180)\n",
+ "print 'The Voltage at 45° = %0.2f Volts'%v2\n",
+ "\n",
+ "v3 = Vm*sin(t3*pi/180)\n",
+ "print 'The Voltage at 90° = %0.2f Volts'%v3\n",
+ "\n",
+ "v4 = Vm*sin(t4*pi/180)\n",
+ "print 'The Voltage at 270° = %0.2f Volts'%v4"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example No. 15_2 Page No: 548"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 25,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "The Time period = 1e-03 Seconds\n",
+ "i.e 1/1000 sec\n",
+ "The Frequency = 1000.00 Hertz\n",
+ "OR 1 kHz\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "# An alternating current varies through one complete cycle in 1 ⁄ 1000 s. Calculate the period and frequency.\n",
+ "\n",
+ "# Given data\n",
+ "\n",
+ "tc = 1/1000# # One Complete Cycle=1 ⁄ 1000 sec.\n",
+ "\n",
+ "T = tc#\n",
+ "print 'The Time period = %0.e Seconds'%T\n",
+ "print 'i.e 1/1000 sec'\n",
+ "\n",
+ "f = 1/tc#\n",
+ "print 'The Frequency = %0.2f Hertz'%f\n",
+ "print 'OR 1 kHz'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example No. 15_3 Page No: 549"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 26,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "The Time period = 1e-06 Seconds of 1 MHz freq.\n",
+ "i.e 1*10**-6 sec = 1 usec\n",
+ "The Time period = 5e-07 Seconds of 2 MHz freq.\n",
+ "i.e 0.5*10**-6 sec = 0.5 usec\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Calculate the period for the two frequencies of 1 MHz and 2 MHz.Calculate the period for the two frequencies of 1 MHz and 2 MHz.\n",
+ "\n",
+ "# Given data\n",
+ "\n",
+ "f1 = 1*10**6# # Freq=1 MHz\n",
+ "f2 = 2*10**6# # Freq=2 MHz\n",
+ "\n",
+ "t1 = 1/f1#\n",
+ "print 'The Time period = %0.e Seconds of 1 MHz freq.'%t1\n",
+ "print 'i.e 1*10**-6 sec = 1 usec'\n",
+ "\n",
+ "t2 = 1/f2#\n",
+ "print 'The Time period = %0.e Seconds of 2 MHz freq.'%t2\n",
+ "print 'i.e 0.5*10**-6 sec = 0.5 usec'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example No. 15_4 Page No: 549"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 27,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "The Lamda or Wavelenght = 1.00 cm\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Calculate lamda for a radio wave witf f of 30 GHz.\n",
+ "\n",
+ "# Given data\n",
+ "\n",
+ "c = 3*10**10# # Speed of light=3*10**10 cm/s\n",
+ "f = 30*10**9# # Freq=30 GHz\n",
+ "\n",
+ "l = c/f#\n",
+ "print 'The Lamda or Wavelenght = %0.2f cm'%l"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example No. 15_5 Page No: 550"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 28,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "The Height = 250.00 cm\n",
+ "The Height = 8.20 feet\n"
+ ]
+ }
+ ],
+ "source": [
+ "# The length of a TV antenna is lamda\u0005/2 for radio waves with f of 60 MHz. What is the antenna length in centimeters and feet?\n",
+ "\n",
+ "# Given data\n",
+ "\n",
+ "c = 3*10**10# # Speed of light=3*10**10 cm/s\n",
+ "f = 60*10**6# # Freq=60 MHz\n",
+ "In = 2.54# # 2.54 cm = 1 in\n",
+ "ft = 12# # 12 in = 1 ft\n",
+ "\n",
+ "l1 = c/f#\n",
+ "l = l1/2#\n",
+ "print 'The Height = %0.2f cm'%l\n",
+ "\n",
+ "li = l/In\n",
+ "lf = li/ft#\n",
+ "print 'The Height = %0.2f feet'%lf"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example No. 15_6 Page No: 550"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 29,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "The Frequency = 50000000 Hertz\n",
+ "i.e 50*10**6 Hz OR 50 MHz\n"
+ ]
+ }
+ ],
+ "source": [
+ "# For the 6-m band used in amateur radio, what is the corresponding frequency?\n",
+ "\n",
+ "# Given data\n",
+ "\n",
+ "v = 3*10**10# # Speed of light=3*10**10 cm/s\n",
+ "l = 6*10**2# # lamda=6 meter\n",
+ "\n",
+ "f = v/l\n",
+ "print 'The Frequency = %0.f Hertz'%f\n",
+ "print 'i.e 50*10**6 Hz OR 50 MHz'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example No. 15_7 Page No: 551"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 30,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "The Lamda or Wavelenght = 11.30 ft\n"
+ ]
+ }
+ ],
+ "source": [
+ "# What is the wavelength of the sound waves produced by a loudspeaker at a frequency of 100 Hz?\n",
+ "\n",
+ "# Given data\n",
+ "\n",
+ "c = 1130# # Speed of light=1130 ft/s\n",
+ "f = 100# # Freq=100 Hz\n",
+ "\n",
+ "l = c/f#\n",
+ "print 'The Lamda or Wavelenght = %0.2f ft'%l"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example No. 15_8 Page No: 552"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 31,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "The Lamda or Wavelength = 0.03 ft\n",
+ "The Lamda or Wavelength = 1.00 cm\n"
+ ]
+ }
+ ],
+ "source": [
+ "# For ultrasonic waves at a frequency of 34.44 kHz, calculate the wavelength in feet and in centimeters.\n",
+ "\n",
+ "# Given data\n",
+ "\n",
+ "c = 1130# # Speed of light=1130 ft/s\n",
+ "f = 34.44*10**3# # Freq=100 Hz\n",
+ "In = 2.54# # 2.54 cm = 1 in\n",
+ "ft = 12# # 12 in = 1 ft\n",
+ "\n",
+ "l = c/f#\n",
+ "print 'The Lamda or Wavelength = %0.2f ft'%l\n",
+ "\n",
+ "a = l*ft#\n",
+ "\n",
+ "l1 = a*In#\n",
+ "print 'The Lamda or Wavelength = %0.2f cm'%l1"
+ ]
+ }
+ ],
+ "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
+}