{"nbformat_minor": 0, "cells": [{"source": "# Chapter 2 : Maxwell's Equations and Electromagnetic Waves", "cell_type": "markdown", "metadata": {}}, {"source": "## Example 2.8,Page Number 112", "cell_type": "markdown", "metadata": {}}, {"execution_count": 1, "cell_type": "code", "source": "from __future__ import division\nimport numpy as np\nfrom math import pi\n\n#variable delaration\nmu_0 = 4*pi*10**(-7) # permeability in free space\nmu_r1 = 3 # region 1 relative permeability\nmu_r2 = 5 # region 2 relative permeability\nmu_1 = mu_r1*mu_0 # region 1 permeability\nmu_2 = mu_r2*mu_0 # region 2 permeability\n\n#calculations\nH1 = np.array([4,1.5,-3]) # magnetic field in region 1 in A/m\nHt1 = np.array([0,1.5,-3]) # tangential component of magnetic field H1\nHn1 = np.array([4,0,0]) # normal component of magnetic field H1\nHt2 = np.array([0,1.5,-3]) # as tangential componenet of magnetic field H2 = tangential component of magnetic field H1\nHn2 = (mu_1/mu_2)*Hn1 # normal component of magnetic field H2\nH2 = Ht2+Hn2 # magnetic field in region 2 in A/m\nh2 = np.linalg.norm(H2) # magnitude of the magnetic field H2 in A/m\n\n#results\nprint \"magnetic field in region 2 in A/m:\",np.around(H2,2)\nprint \"magnitude of magnetic field in region 2 in A/m:\",round(h2,3) \n", "outputs": [{"output_type": "stream", "name": "stdout", "text": "magnetic field in region 2 in A/m: [ 2.4 1.5 -3. ]\nmagnitude of magnetic field in region 2 in A/m: 4.124\n"}], "metadata": {"collapsed": false, "trusted": true}}, {"source": "## Example 2.9,Page Number 113", "cell_type": "markdown", "metadata": {}}, {"execution_count": 21, "cell_type": "code", "source": "from __future__ import division\nimport numpy as np\n\n#variable Declaration\nepsilon_0 = 8.854*10**(-12) # permittivity in free space\nsigma_1 = 0 #conductivity of medium 1\nsigma_2 = 0 #conductivity of medium 2\nepsilon_r1 = 1 # region 1 relative permittivity\nepsilon_r2 = 2 # region 2 relative permittivity\n\n#calculations\nepsilon_1 = epsilon_r1*epsilon_0 # region 1 permittivity\nepsilon_2 = epsilon_r2*epsilon_0 # region 2 permittivity\nE1 = np.array([1,2,3]) # Electric field in region 1 in V/m\nEt1 = np.array([0,2,3]) # tangential component of electric field E1\nEn1 = np.array([1,0,0]) # normal component of electric field E1\nEt2 = np.array([0,2,3]) # as tangential componenet of electric field E2 = tangential component of electric field E1\nEn2 = (epsilon_1/epsilon_2)*En1 # normal component of electric field E2\nE2 = Et2+En2 # electric field in region 2 in V/m\nDt1 = epsilon_0*Et1 # tangential component of electric flux density D1\nD2 = epsilon_2*E2 # electric flux density in region 2 in C/m**2\n\n\n#Results\nprint \"electric field in region 2 in V/m:\",np.around(E2,2)\nprint \"electric flux density in region 2 in C/m**2:\",D2 \n", "outputs": [{"output_type": "stream", "name": "stdout", "text": "electric field in region 2 in V/m: [ 0.5 2. 3. ]\nelectric flux density in region 2 in C/m**2: [ 8.85400000e-12 3.54160000e-11 5.31240000e-11]\n"}], "metadata": {"collapsed": false, "trusted": true}}, {"source": "## Example 2.12,Page Number 116", "cell_type": "markdown", "metadata": {}}, {"execution_count": 3, "cell_type": "code", "source": "from __future__ import division\nimport numpy as np\nfrom math import pi\n\n#variable Declaration\n\n# H = cos(10**8*t-Beta*z)ay # magnetic field in A/m\n# E = 377*cos(10**8*t-Beta*z)ax # electric field in V/m\nomega = 10**8 # angular frequency in Hz\nv_0 = 3*10**8 # speed of light in m/s\n\n\n#calculations\nf = omega/(2*pi) # frequency in Hz\nlamda = v_0/f # wavelength in m\nBeta = (2*pi)/lamda # phase constant in rad/m\nprint \"eta_0 = E/H = 377*cos(10**8*t-Beta*z)/cos(10**8*t-Beta*z) = > E/H = 377\"\neta_0 = abs(377) # intrinsic impedence in ohm\n\n\n\n#Results\nprint \"intrinsic impedence in ohm:\",eta_0\nprint \"frequency in MHz:\",round(f/(10**6),3)\nprint \"phase constant in rad/m:\",round(Beta,3)\nprint \"wavelength in m:\",round(lamda,3)\n\n", "outputs": [{"output_type": "stream", "name": "stdout", "text": "eta_0 = E/H = 377*cos(10**8*t-Beta*z)/cos(10**8*t-Beta*z) = > E/H = 377\nintrinsic impedence in ohm: 377\nfrequency in MHz: 15.915\nphase constant in rad/m: 0.333\nwavelength in m: 18.85\n"}], "metadata": {"collapsed": false, "trusted": true}}, {"source": "## Example 2.14,Page Number 116", "cell_type": "markdown", "metadata": {}}, {"execution_count": 22, "cell_type": "code", "source": "from __future__ import division\nfrom math import pi\nimport numpy as np\n\n#Variable Declaration\nf = 100 # frequency in MHz\nf = 100*10**6 # frequency in Hz\nv_0=3*10**8 # speed of light in m/s\n\n\n# formula : Gamma = omega(j)*sqrt(mu_0*epsilon_0)=omega(j)/v_0 =(2j*pi*f)/v_0\nGamma =(2j*pi*f)/(v_0) # propagation constant\n\n\n#result\nprint \"propagation constant in m**-1:\",np.around(Gamma,3)\n", "outputs": [{"output_type": "stream", "name": "stdout", "text": "propagation constant in m**-1: 2.094j\n"}], "metadata": {"collapsed": false, "trusted": true}}, {"source": "## Example 2.15,Page Number 116", "cell_type": "markdown", "metadata": {}}, {"execution_count": 5, "cell_type": "code", "source": "from __future__ import division\nfrom math import pi\n\n#Variable Declaration\n\n# H(z,t) = 48*cos(10**8*t+40*z)ay # equation of magnetic field \nA = 48 # amplitude of the magnetic field in A/m\nomega = 10**8 # angular frequency in radians/sec\nBeta = 40 # phase constant in rad/m\n\n#Calculations\nf = omega/(2*pi) # frequency in Hz\nlamda = (2*pi)/Beta # wavelength in m\n\n\n#results\nprint \"amplitude of the magnetic field in A/m:\",A\nprint \"frequency in MHz:\",round(f/10**6,3)\nprint \"phase constant in rad/m:\",round(Beta,3)\nprint \"wavelength in m:\",round(lamda,3)\n", "outputs": [{"output_type": "stream", "name": "stdout", "text": "amplitude of the magnetic field in A/m: 48\nfrequency in MHz: 15.915\nphase constant in rad/m: 40.0\nwavelength in m: 0.157\n"}], "metadata": {"collapsed": false, "trusted": true}}, {"source": "## Example 2.16,Page Number 117", "cell_type": "markdown", "metadata": {}}, {"execution_count": 6, "cell_type": "code", "source": "from __future__ import division\nfrom math import pi,sqrt\n\n#Variable Declaration\n\nH = 2 # ampliutude of magnetic field in A/m\nsigma = 0 # conductivity\nmu_0 = 4*pi*10**-7 # permeability in free space in H/m\nepsilon_0 = 8.854*10**-12 # permittivity in free space in F/m\n\n#calculations\nmu = mu_0 # permeability in F/m\nepsilon = 4*epsilon_0 # permittivity in F/m\nEta_0 = 120*pi # intrinsic impedence in free space in ohm\nE_free = Eta_0*H # electric field in V/m\n\n\n#results\nprint \"magnitude of electric field in V/m in free space:\",round(E_free,3)\nEta = sqrt(mu/epsilon) # intrinsic impedence in ohm\nE = Eta*H # magnitude of electric field\nprint \"magnitude of electric field in V/m:\",round(E,3)\n", "outputs": [{"output_type": "stream", "name": "stdout", "text": "magnitude of electric field in V/m in free space: 753.982\nmagnitude of electric field in V/m: 376.734\n"}], "metadata": {"collapsed": false, "trusted": true}}, {"source": "## Example 2.17,Page Number 117", "cell_type": "markdown", "metadata": {}}, {"execution_count": 23, "cell_type": "code", "source": "from __future__ import division\nfrom math import pi,sqrt\nimport numpy as np\n\n\n#variable Declaration\n\nsigma = 0 # conductivity in mho/m\nf = 0.3 # frequency in GHz\nf = 0.3*10**9 # frequency in Hz\nomega = 2*pi*f # angular frequency in rad/sec\n # formula : Gamma = sqrt(1j*omega*mu*(sigma+1j*omega*epsilon)) = 1j*omega*sqrt(mu*epsilon)\nepsilon_0 = 8.854*10**-12 # permittivity in free space in F/m\nepsilon = 9*epsilon_0 # permittivity in F/m\nmu_0 = 4*pi*10**-7 # permeability in free space in H/m\nmu = mu_0 # permeability in H/m\nGamma = 1j*omega*sqrt(mu*epsilon) # propagation constant im m**-1\n\n\n#results\n\nprint \"propagation constant im m**-1:\",np.around(Gamma,3)\n # formula : eta = sqrt((1j*omega*mu)/(sigma+omega*epsilon)) = sqrt(mu/epsilon)\neta = sqrt(mu_0/(9*epsilon_0)) # intrinsic impedence in ohm\nprint \"intrinsic impedence in ohm:\",round(eta,3)\n\n\n\n# note : answer in the book is wrong.\n\n\n\n", "outputs": [{"output_type": "stream", "name": "stdout", "text": "propagation constant im m**-1: 18.862j\nintrinsic impedence in ohm: 125.578\n"}], "metadata": {"collapsed": false, "trusted": true}}, {"source": "## Example 2.18,Page Number 118", "cell_type": "markdown", "metadata": {}}, {"execution_count": 8, "cell_type": "code", "source": "from __future__ import division\nfrom math import sqrt,pi\n\n#variable declaration\n\nlamda = 0.25 # wavelength in m\nv = 1.5*10**10 # velocity of propagation of wave in cm/sec\nv = 1.5*10**8 # velocity of propagation of wave in m/sec\nepsilon_0 = 8.854*10**-12 # permittivity in free space in F/m\nmu_0 = 4*pi*10**-7 # permeability in free space in H/m\nmu = mu_0 # permeability in H/m\nv_0 = 3*10**8 # speed of light in m/s\nf = v/lamda # frequency in Hz\n # formula : v = 1/(mu*epsilon) = 1/(mu_0*epsilon_0*epsilon_r) = v_0/sqrt(epsilon_r)\nepsilon_r = (v_0/v)**2 # relative permittivity\n\n\n#results\nprint \"frequecy in MHz:\",round(f/10**6,3)\nprint \"relative permittivity:\",epsilon_r\n\n\n # note : answer in the book is wrong.\n", "outputs": [{"output_type": "stream", "name": "stdout", "text": "frequecy in MHz: 600.0\nrelative permittivity: 4.0\n"}], "metadata": {"collapsed": false, "trusted": true}}, {"source": "## Example 2.19,Page Number 118", "cell_type": "markdown", "metadata": {}}, {"execution_count": 9, "cell_type": "code", "source": "from __future__ import division\nfrom math import sqrt,pi\n\n#variable declaration and calculations\n\n#E = 5*sin(10**8*t+4*x)az # equation of electric field \n\nA = 5 # amplitude of the electric field\nomega = 10**8 # angular frequency in radians/sec\nf = omega/(2*pi) # frequency in Hz\nBeta = 4 # phase constant in rad/m\nv_0 = 3*10**8 # speed of light in m/s\nlamda = v_0/f # wavelength in m\n\n\n#results\nprint \"frequency in MHz:\",round(f/10**6,3)\nprint \"phase constant in rad/m:\",round(Beta,3)\nprint \"wavelength in m:\",round(lamda,3)\n", "outputs": [{"output_type": "stream", "name": "stdout", "text": "frequency in MHz: 15.915\nphase constant in rad/m: 4.0\nwavelength in m: 18.85\n"}], "metadata": {"collapsed": false, "trusted": true}}, {"source": "## Example 2.20,Page Number 119", "cell_type": "markdown", "metadata": {}}, {"execution_count": 10, "cell_type": "code", "source": "from __future__ import division\nfrom math import pi\n\nsigma = 10**-2 # conductivity of earth in mho/m\nepsilon_r = 10 # relative permittivity\nmu_r = 2 # relative permeability\nepsilon_0 = (1/(36*pi))*10**-9 # permittivity in free space\nepsilon = epsilon_r*epsilon_0 # permittivity\nf1 = 50 # frequency in Hz\nomega1 = 2*pi*f1 # angular frequency in rad/sec\nprint \"When frequency = 50Hz:\"\nk1 = sigma/(omega1*epsilon)\nprint \"K1 is equal to\",k1\nprint \"since k1>>1 hence it behaves like a good conductor:\"\nf2 = 1 # frequency in kHz\nf2 = 1*10**3 # frequency in Hz\nomega2 = 2*pi*f2 # angular frequency in rad/sec\nprint \"When frequency = 1kHz:\"\nk2 = sigma/(omega2*epsilon)\nprint \"K2 is equal to\",k2\nprint \"since k2>>1 hence it behaves like a good conductor:\"\nf3 = 1 # frequency in MHz\nf3 = 1*10**6 # frequency in Hz\nomega3 = 2*pi*f3 # angular frequency in rad/sec\nprint \"When frequency = 1MHz:\"\nk3 = sigma/(omega3*epsilon)\nprint \"K3 is equal to\",k3\nprint \"since k3 = 18 hence it behaves like a moderate conductor:\"\nf4 = 100 # frequency in MHz\nf4 = 100*10**6 # frequency in Hz\nomega4 = 2*pi*f4 # angular frequency in rad/sec\nprint \"When frequency = 100MHz:\"\nk4 = sigma/(omega4*epsilon)\nprint \"K4 is equal to\",k4\nprint \"since k4 = 0.18 hence it behaves like a quasi-dielectric:\"\nf5 = 10 # frequency in GHz\nf5 = 10*10**9 # frequency in Hz\nomega5 = 2*pi*f5 # angular frequency in rad/sec\nprint \"When frequency = 10GHz:\"\nk5 = sigma/(omega5*epsilon)\nprint \"K5 is equal to\",k5\nprint \"since k5<<1 hence it behaves like a good dielectric:\"\n", "outputs": [{"output_type": "stream", "name": "stdout", "text": "When frequency = 50Hz:\nK1 is equal to 360000.0\nsince k1>>1 hence it behaves like a good conductor:\nWhen frequency = 1kHz:\nK2 is equal to 18000.0\nsince k2>>1 hence it behaves like a good conductor:\nWhen frequency = 1MHz:\nK3 is equal to 18.0\nsince k3 = 18 hence it behaves like a moderate conductor:\nWhen frequency = 100MHz:\nK4 is equal to 0.18\nsince k4 = 0.18 hence it behaves like a quasi-dielectric:\nWhen frequency = 10GHz:\nK5 is equal to 0.0018\nsince k5<<1 hence it behaves like a good dielectric:\n"}], "metadata": {"collapsed": false, "trusted": true}}, {"source": "## Example 2.21,Page Number 120", "cell_type": "markdown", "metadata": {}}, {"execution_count": 11, "cell_type": "code", "source": "from __future__ import division\nfrom math import sqrt,pi\nimport cmath\nimport numpy as np\n\n#variable declaration\nf = 60 # frequency in Hz\nomega = 2*pi*f # angular frequency in rad/sec\nsigma = 5.8*10**7 # conductivity in mho/m\nepsilon_0 = 8.854*10**-12 # permittivity in free space in F/m\nmu_0 = 4*pi*10**-7 # permeability in free space in H/m\nepsilon_r = 1 # relative permittivity\nmu_r = 1 # relative permeability\n\n\n#calculations\nepsilon = epsilon_r*epsilon_0 # permittivity\nmu = mu_0*mu_r # permeability\nk = sigma/(omega*epsilon) # ratio\nprint \"ratio k is equal to\",k\nprint \"since k>>1 therefore it is very good conductor:\"\nalpha = sqrt(omega*mu*sigma/2) # attenuation constant in m**-1\nBeta = sqrt(omega*mu*sigma/2) # phase constant in m**-1\nGamma = alpha+(1j*Beta) # propagation constant in m**-1\nlamda = (2*pi)/Beta # wavelength\neta = cmath.sqrt(((1j*omega*mu)/sigma)) # intrinsic impedence in ohm\nv = lamda*f # phase velocity of wave in m/s\n\n\n#result\nprint \"attenuation constant in m**-1:\",round(alpha,2)\nprint \"phase constant in m**-1:\",round(Beta,2)\nprint \"propagation constant in m**-1:\",np.around(Gamma,2)\nprint \"intrinsic impedence in ohm:\",np.around(eta,10)\nprint \"wavelength in cm:\",round(lamda*100,2)\nprint \"phase velocity of wave in m/s:\",round(v,3)\n", "outputs": [{"output_type": "stream", "name": "stdout", "text": "ratio k is equal to 1.73763020468e+16\nsince k>>1 therefore it is very good conductor:\nattenuation constant in m**-1: 117.21\nphase constant in m**-1: 117.21\npropagation constant in m**-1: (117.21+117.21j)\nintrinsic impedence in ohm: (2.0209e-06+2.0209e-06j)\nwavelength in cm: 5.36\nphase velocity of wave in m/s: 3.216\n"}], "metadata": {"collapsed": false, "trusted": true}}, {"source": "## Example 2.22,Page Number 120", "cell_type": "markdown", "metadata": {}}, {"execution_count": 12, "cell_type": "code", "source": "from __future__ import division\nfrom math import sqrt,pi\n\n\n#variable Declaration\n\nf1 = 60 # frequency in Hz\nomega1 = 2*pi*f1 # angular frequency in Hz\nf2 = 100 # frequency in MHz\nf2 = 100*10**6 # frequency in Hz\nomega2 = 2*pi*f2 # angular frequency in Hz\nsigma = 5.8*10**7 # conductivity in mho/m\nepsilon_0 = 8.854*10**-12 # permittivity in free space in F/m\nmu_0 = 4*pi*10**-7 # permeability in free space in H/m\nepsilon_r = 1 # relative permittivity\nmu_r = 1 # relative permeability\nepsilon = epsilon_r*epsilon_0 # permittivity\nmu = mu_0*mu_r # permeability\n\nprint \"At f = 60Hz\"\nk1 = (sigma)/(omega1*epsilon) # ratio\nprint \"ratio k is equal to\",k1\nprint \"since k>>1 therefore it is very good conductor at f = 60Hz:\"\ndelta1 = (sqrt(2/(omega1*mu*sigma))) # depth of penetration in m\nprint \"depth of penetration delta1 in m:\",delta1\n\nprint \"At f = 100Hz\"\nk2 = sigma/(omega2*epsilon) # ratio\nprint \"ratio k is equal to\",k2\nprint \"since k2>>1 therefore it is very good conductor at f = 100Hz:\"\ndelta2 = (sqrt(2/(omega2*mu*sigma))) # depth of penetration in m\nprint \"depth of penetration delta2 in m:\",delta2\n", "outputs": [{"output_type": "stream", "name": "stdout", "text": "At f = 60Hz\nratio k is equal to 1.73763020468e+16\nsince k>>1 therefore it is very good conductor at f = 60Hz:\ndepth of penetration delta1 in m: 0.00853160047351\nAt f = 100Hz\nratio k is equal to 10425781228.1\nsince k2>>1 therefore it is very good conductor at f = 100Hz:\ndepth of penetration delta2 in m: 6.60854931008e-06\n"}], "metadata": {"collapsed": false, "trusted": true}}, {"source": "## Example 2.23,Page Number 121", "cell_type": "markdown", "metadata": {}}, {"execution_count": 13, "cell_type": "code", "source": "from __future__ import division\nfrom math import sqrt,pi\n\n\n#variable Declaration\n\nIc = 10 # conduction current in ampere\nepsilon_r = 1 # relative permittivity\nepsilon_0 = 8.854*10**-12 # permittivity in free space\nepsilon = epsilon_r*epsilon_0 # permittivity\nsigma = 5.8*10**7 # conductivity in mho/m\n\nprint \"when f = 1MHz\"\nf = 1 # frequency in MHz\nf = 1*10**6 # frequency in Hz\nId = (2*pi*f*epsilon*Ic)/sigma # printlacement current\nprint \"displacement current when f = 1MHz in A:\",Id\nprint \"when f = 100MHz\"\nf = 100 # frequency in MHz\nf = 100*10**6 # frequency in Hz\nId = (2*pi*f*epsilon*Ic)/sigma # printlacement current\nprint \"displacement current when f = 100MHz in A:\",Id\n", "outputs": [{"output_type": "stream", "name": "stdout", "text": "when f = 1MHz\ndisplacement current when f = 1MHz in A: 9.59160736375e-12\nwhen f = 100MHz\ndisplacement current when f = 100MHz in A: 9.59160736375e-10\n"}], "metadata": {"collapsed": false, "trusted": true}}, {"source": "## Example 2.25,Page Number 122", "cell_type": "markdown", "metadata": {}}, {"execution_count": 14, "cell_type": "code", "source": "from __future__ import division\nfrom math import sqrt,pi,sin,cos,radians,log\n\n#variable declaration\nEm = 20 # minimum signal level required for vessel under sea water in microV/m\nEm = 20*10**-6 # minimum signal level required for vessel under sea water in V/m\nE = 100 # electric intensity of wave in V/m\nv = 3*10**8 # speed of light in m/s\nf = 4 # frequency in MHz\nf = 4*10**6 # frequency in Hz\nomega = 2*pi*f # angular frequency in Hz\nsigma = 4 # conductivity of sea water in mho/m\nepsilon_r = 81 # relative permittivity\nepsilon_0 = 8.854*10**-12 # permittivity in free space\nepsilon = epsilon_r*epsilon_0 # permittivity\nmu_r = 1 # relative permeability\nmu_0 = 4*pi*10**(-7) # permeability in free space\nmu = mu_r*mu_0 # permeability\nk = (sigma)/(omega*epsilon) #ratio\nprint \"ratio k is equal to:\"\nprint \"ratio:\",round(k,3)\nprint \"K is >>1 so sea water is a good conductor\"\neta_1 = 377 # intrinsic impedance in free space in ohm\nalpha_1 = 0 # attenuation constant in free space in m**-1\n\n\n#calculations\nbeta_1 = omega/v # phase constant in m**-1\nmageta_2 = sqrt((omega*mu)/sigma) # magnitude of eta_2(intrinsic impedance of sea water in ohm) \nargeta_2 = 45 # argument of eta_2 in degrees\neta_2 = mageta_2*cos(radians(argeta_2))+(1j*mageta_2*sin(radians(argeta_2))) #intrinsic impedance in complex form (r*cos(theta)+1j*r*sin(theta))\nTC = 2*eta_2/(eta_1+eta_2) # transmission cofficient\nEt = abs(TC)*E # transmitted electric field in V/m\nalpha_2 = sqrt((omega*mu*sigma)/2) # attenuation constant for sea water in m**-1\n# formula: Et*exp(-alpha_2*d) = Em\nd = -(1/alpha_2)*(log(Em/Et)) # depth in the sea that can be reached by the aeroplane in m\n\n\n#result\nprint \"depth in the sea that can be reached by the aeroplane in m:\",round(d,5)\n\n\n# note 1: the value of alpha_2 in book is 7.905 but it is \"7.94\" exactly calculated by python.\n#note 2 : The correct answer of the Depth(d) is \"1.41095\" the answer in the book is wrong.\n", "outputs": [{"output_type": "stream", "name": "stdout", "text": "ratio k is equal to:\nratio: 221.92\nK is >>1 so sea water is a good conductor\ndepth in the sea that can be reached by the aeroplane in m: 1.41095\n"}], "metadata": {"collapsed": false, "trusted": true}}, {"source": "## Example 2.27,Page Number 124", "cell_type": "markdown", "metadata": {}}, {"execution_count": 15, "cell_type": "code", "source": "from __future__ import division\nfrom math import sqrt\n\n#variable declaration\n\neta_0=377 # intrinsic impedance in free space in ohm\nprint \"E=sin(omega*t-beta*z)ax+2*sin(omega*t-beta*z+75)ay # electric field in V/m\"\nEx=1 # magnitude of Ex\nEy=2 # magnitude of Ey\n\n#calculations\nE=sqrt(Ex**2+Ey**2) # resultant magnitude\nPav=((1/2)*E**2)/(eta_0) # power per unit area conveyed by the wave in free space\n\n#results\nprint \"power per unit area conveyed by the wave in free space in mW/m**2:\",round(Pav*1000,3)\n", "outputs": [{"output_type": "stream", "name": "stdout", "text": "E=sin(omega*t-beta*z)ax+2*sin(omega*t-beta*z+75)ay # electric field in V/m\npower per unit area conveyed by the wave in free space in mW/m**2: 6.631\n"}], "metadata": {"collapsed": false, "trusted": true}}, {"source": "## Example 2.28,Page Number 125", "cell_type": "markdown", "metadata": {}}, {"execution_count": 16, "cell_type": "code", "source": "from __future__ import division\nfrom math import sqrt,pi\n\n#variable declaration\n\nepsilon_0 = 8.854*10**-12 # permittivity in free space in F/m\nmu_0 = 4*pi*10**-7 # permeability in free space in H/m\nepsilon_r = 4 # relative permittivity\nmu_r = 1 # relative permeability\nepsilon = epsilon_r*epsilon_0 # permittivity\nmu = mu_0*mu_r # permeability\nH = 5 # magnitude of magnetic field in mA/m\nH = 5*10**-3 # magnitude of magnetic field in A/m\n\n#calculations\neta = sqrt(mu/epsilon) # intrinsic impedence in ohm\nE = H*sqrt(mu/epsilon) # magnitude of electric field\nP_av = E**2/(2*eta) # average power\nW_E = epsilon*E**2 # maximum energy density of the wave\n\n\n#results\nprint \"Average power in micro*w/m**2:\",round(P_av*10**6,2)\nprint \"maximum energy density of the wave in PJ/m*3:\",round(W_E*10**12,3)\n\n\n#note: P_av is = 2353.75 in book but it is 2354.58 correctly calculated by python.\n", "outputs": [{"output_type": "stream", "name": "stdout", "text": "Average power in micro*w/m**2: 2354.59\nmaximum energy density of the wave in PJ/m*3: 31.416\n"}], "metadata": {"collapsed": false, "trusted": true}}, {"source": "## Example 2.29,Page Number 125", "cell_type": "markdown", "metadata": {}}, {"execution_count": 17, "cell_type": "code", "source": "from __future__ import division\nfrom math import sqrt,pi\n\n#variable declaration\n\nepsilon_0 = 8.854*10**-12 # permittivity in free space in F/m\nmu_0 = 4*pi*10**-7 # permeability in free space in H/m\nepsilon_r = 1 # relative permittivity\nmu_r = 1 # relative permeability\nepsilon = epsilon_r*epsilon_0 # permittivity\nmu = mu_0*mu_r # permeability\nE = 100*sqrt(pi) # magnitude of electric field in V/m\n\n\n#calculations\nW_E = (1/2)*epsilon*E**2 # electric energy density of the wave\nW_H = W_E # as the energy density is equal to that of magnetic field for a pla`ne travelling wave\nW_T = W_E+W_H # total energy density\n\n#results\nprint \"electric energy density of the wave in nJ/m**3:\",round(W_E*10**9,3)\nprint \"magnetic energy density of wave in nJ/m**3:\",round(W_H*10**9,3)\nprint \"Total energy density in nJ/m**3:\",round(W_T*10**9,3)\n", "outputs": [{"output_type": "stream", "name": "stdout", "text": "electric energy density of the wave in nJ/m**3: 139.078\nmagnetic energy density of wave in nJ/m**3: 139.078\nTotal energy density in nJ/m**3: 278.157\n"}], "metadata": {"collapsed": false, "trusted": true}}, {"source": "## Example 2.30,Page Number 126", "cell_type": "markdown", "metadata": {}}, {"execution_count": 18, "cell_type": "code", "source": "from __future__ import division\nfrom math import sqrt,pi\n\n#variable Declaration\n\nsigma = 5 # conductivity of sea water in mho/m\nf1 = 25 # frequency in kHz\nf1 = 25*10**3 # frequency in Hz\nomega1 = 2*pi*f1 # angular frequency in Hz\nf2 = 25 # frequency in MHz\nf2 = 25*10**6 # frequency in Hz\nomega2 = 2*pi*f2 # angular frequency in Hz\nepsilon_r = 81 # relative permittivity\nepsilon_0 = 8.854*10**(-12) # permittivity in free space\nepsilon = epsilon_r*epsilon_0 # permittivity\nmu_r = 1 # relative permeability\nmu_0 = 4*pi*10**(-7) # permeability in free space\nmu = mu_r*mu_0 # permeability\n\n#calculations and results\n\nprint \"when frequency = 25kHz\"\nalpha_1 = omega1*sqrt((mu*epsilon)/2*(sqrt(1+(sigma**2/(omega1**2*epsilon**2)))-1)) # attenuation constant when f = 25kHz\n# formula: exp(-alpha*x) = 0.1\nx1 = 2.3/alpha_1 # transmitted distance in m\nprint \"transmitted distance in m:\",round(x1,3)\nprint \"when frequency = 25MHz\"\nalpha_2 = omega2*sqrt((mu*epsilon)/2*(sqrt(1+(sigma**2/(omega2**2*epsilon**2)))-1)) # attenuation constant when f = 25MHz\nx2 = 2.3/alpha_2 # transmitted distance in m\nprint \"transmitted distance in m:\",round(x2,3)\n\n\n# note: the values of epsilon_r = 81 and of mu_r = 1 for sea water which are not given in the book.\n", "outputs": [{"output_type": "stream", "name": "stdout", "text": "when frequency = 25kHz\ntransmitted distance in m: 3.274\nwhen frequency = 25MHz\ntransmitted distance in m: 0.105\n"}], "metadata": {"collapsed": false, "trusted": true}}, {"source": "## Example 2.31,Page Number 126", "cell_type": "markdown", "metadata": {}}, {"execution_count": 19, "cell_type": "code", "source": "from __future__ import division\nfrom math import sqrt,pi,radians,asin,cos,sin,degrees\n\n#variable Declaration\n\nE_i = 1 # magnitude of incident electric field in mV/m\nE_i = 1*10**-3 # magnitude of incident electric field in V/m\nepsilon_0 = 8.854*10**-12 # permittivity in free space in F/m\nmu_0 = 4*pi*10**-7 # permeability in free space in H/m\ntheta_i = 15 # incident angle in degrees\nepsilon_r1 = 8.5 # relative permittivity of medium 1\nmu_r1 = 1 # relative permeability of medium 1\nepsilon1 = epsilon_r1*epsilon_0 # permittivity\nmu1 = mu_0*mu_r1 # permeability\neta1 = sqrt(mu1/epsilon1) # intrinsic impedence of medium 1 in ohm\nepsilon2 = epsilon_0 # permittivity of medium 2\nmu2 = mu_0 # permeability of medium 2\neta2 = sqrt(mu2/epsilon2) # intrinsic impedence of medium 2 in ohm\n\n#calculations and result\n\n# formula : sin(theta_i)/sin(theta_t) = sqrt(epsilon2/epsilon1)\ntheta_t = asin(sin(radians(theta_i)))/(sqrt(epsilon2/epsilon1)) # transmitted angle in degrees\nE_r = (E_i*(((eta2*cos(radians(theta_i))))-(eta1*cos(radians((theta_i))))))/((eta2*cos(radians(theta_i)))+(eta1*cos(radians(theta_i)))) # reflection cofficient of electric field\nprint \"reflection cofficient of electric field in mV/m:\",round(E_r*1000,3)\nH_i = E_i/eta1 # incident cofficient of magnetic field\nprint \"incident cofficient of magnetic field in micro*A/m:\",round(H_i*10**6,3)\nH_r = E_r/eta1 # reflection cofficient of electric field\nprint \"reflection cofficient of magnetic field in micro*A/m:\",round(H_r*10**6,3)\n\n\n#note : minute difference in decimel in the value of H_i and H_r.\n\n", "outputs": [{"output_type": "stream", "name": "stdout", "text": "reflection cofficient of electric field in mV/m: 0.489\nincident cofficient of magnetic field in micro*A/m: 7.739\nreflection cofficient of magnetic field in micro*A/m: 3.786\n"}], "metadata": {"collapsed": false, "trusted": true}}, {"source": "## Example 2.32,Page Number 127", "cell_type": "markdown", "metadata": {}}, {"execution_count": 20, "cell_type": "code", "source": "from __future__ import division\nfrom math import pi,sqrt\n\n#variable declaration\n\nsigma = 5.8*10**7 # conductivity in mho/m\nf = 2 # frequency in MHz\nf = 2*10**6 # frequency in Hz\nomega = 2*pi*f # angular frequency in rad/sec\nE = 2 # magnitude of electric field in mV/m\nE = 2*10**-3 # magnitude of electric field in V/m\nepsilon_0 = 8.854*10**-12 # permittivity in free space in F/m\nmu_0 = 4*pi*10**-7 # permeability in free space in H/m\nepsilon_r = 1 # relative permittivity\nmu_r = 1 # relative permeability\nepsilon = epsilon_r*epsilon_0 # permittivity\nmu = mu_0*mu_r # permeability\n\n# calculations\neta = sqrt(mu*omega/sigma) # intrinsic impedence in ohm\nP_av = (1/2)*E**2/eta # average power density anbsorbed by copper\n\n#result\nprint \"average power density anbsorbed by copper in mW/m**2:\",round(P_av*1000,2)\n", "outputs": [{"output_type": "stream", "name": "stdout", "text": "average power density anbsorbed by copper in mW/m**2: 3.83\n"}], "metadata": {"collapsed": false, "trusted": true}}], "nbformat": 4, "metadata": {"kernelspec": {"display_name": "Python 2", "name": "python2", "language": "python"}, "language_info": {"mimetype": "text/x-python", "nbconvert_exporter": "python", "version": "2.7.8", "name": "python", "file_extension": ".py", "pygments_lexer": "ipython2", "codemirror_mode": {"version": 2, "name": "ipython"}}}}