{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 4: Geometrical Optics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.2, Page 191"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "#Variable declaration\n",
      "r = 1;  # For convenience assume radius of the circle to be unity, unit\n",
      "alpha = 0.8*r;  # Distance of light source from the centre of the spherical shell, unit\n",
      "\n",
      "#Calculations\n",
      "cos_phi_by_2 = sqrt((alpha+1)/(4*alpha));\n",
      "\n",
      "#Result\n",
      "print \"cos(phi/2) = %d/4\"%(cos_phi_by_2*4)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "cos(phi/2) = 3/4\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.3, Page 193"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "f1 = 5.;  # Focal length of thin convex lens, cm \n",
      "f2 = 3.;  # Focal length of thin convex lens, cm \n",
      "d = 2.;   # Separation between the lenses, cm\n",
      "\n",
      "#Calculations\n",
      "F = (1./f1)+(1./f2)-(d/(f1*f2));  # Equivalent focal length of a combination of the two lenses, cm\n",
      "\n",
      "#Result\n",
      "print \"The equivalent focal length of the combination of lenses = %3.1f cm\"%F\n",
      "#incorrect answers in the textbook"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The equivalent focal length of the combination of lenses = 0.4 cm\n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.4, Page 194"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "P1 = 5;  # Power of first converging lens, diopter\n",
      "P2 = 4;  # Power of second converging lens, diopter\n",
      "d = 0.1;  # Separation distance between two lenses, cm\n",
      "\n",
      "#Calculations\n",
      "P = P1+P2-d*P1*P2;\n",
      "f = 1/P*100;  # The corresponding value of the focal length of the lens combination, cm\n",
      "\n",
      "#Result\n",
      "print \"The focal length of the combination of lenses of given powers = %5.2f cm\"%f\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The focal length of the combination of lenses of given powers = 14.29 cm\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.5, Page 194"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "f1 = 30.;  # Focal length first convex lens, cm \n",
      "f2 = -50.;  # Focal length of second convex lens, cm \n",
      "d = 20.;  # Separation distance between lenses, cm  \n",
      "\n",
      "#Calculations\n",
      "F = f1*f2/(f1+f2-d);  # Equivalent focal length of a combination of the two lenses, cm\n",
      "\n",
      "#Result\n",
      "print \"The equivalent focal length of the combination = %4.1f cm\"%F\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The equivalent focal length of the combination = 37.5 cm\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.7, Page 195"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "f1 = 4.;  # Focal length of thin convex lens, cm \n",
      "f2 = 12.;  # Focal length of thin convex lens, cm \n",
      "d = 8.;  # Separation distance between the lenses, cm\n",
      "\n",
      "#Calculations&Results\n",
      "F = f1*f2/(f1+f2-d);  # Equivalent focal length of the combination, cm\n",
      "L1H1 = d*F/f2;    # Distance of first principal point H1 from first lens, cm\n",
      "print \"The distance of the first principal point H1 from the first lens = %d cm\"%L1H1\n",
      "L2H2 = -d*F/f1;    # Distance of first principal point H2 from second lens, cm\n",
      "print \"The distance of the second principal point H2 from the second lens = %d cm\"%L2H2\n",
      "L1F1 = -F*(1-d/f2);    # Distance of first focal point F1 from first lens, cm\n",
      "print \"The distance of the first focal point F1 from the first lens = %d cm\"%L1F1\n",
      "L2F2 = F*(1-d/f1);    # Distance of second focal point F2 from first lens, cm\n",
      "print \"The distance of the second focal point F2 from the second lens= %d cm\"%L2F2\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The distance of the first principal point H1 from the first lens = 4 cm\n",
        "The distance of the second principal point H2 from the second lens = -12 cm\n",
        "The distance of the first focal point F1 from the first lens = -2 cm\n",
        "The distance of the second focal point F2 from the second lens= -6 cm\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.8, Page 195"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "f1 = 25.;  # Focal length of thin convex lens, cm \n",
      "f2 = -15.;  # Focal length of thin concave lens, cm \n",
      "d = 15.;  # Separation distance between the lenses, cm  \n",
      "\n",
      "#Calculations&Results\n",
      "# We know that, F = f1*f2/f1+f2-d then\n",
      "F = f1*f2/(f1+f2-d);  # The equivalent focal length of the combination\n",
      "L1H1 = d*F/f2;    # The distance of the first principal point H1 from the first lens, cm\n",
      "print \"The distance of the first principal point H1 from the first lens = %d cm\"%L1H1\n",
      "L2H2 = -d*F/f1;    # The distance of the second principal point H2 from the first lens, cm\n",
      "print \"The distance of the second principal point H2 from the second lens = %d cm\"%L2H2\n",
      "L1F1 = -F*(1-d/f2);    # The distance of the first focal point F1 from the first lens, cm\n",
      "print \"The distance of the first focal point H1 from the first lens = %d cm\"%L1F1\n",
      "L2F2 = F*(1-d/f1);    # The distance of the second principal point F2 from the first lens, cm\n",
      "print \"The distance of the second focal point H2 from the second lens= %d cm\"%L2F2\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The distance of the first principal point H1 from the first lens = -75 cm\n",
        "The distance of the second principal point H2 from the second lens = -45 cm\n",
        "The distance of the first focal point H1 from the first lens = -150 cm\n",
        "The distance of the second focal point H2 from the second lens= 30 cm\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.9, Page 196"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from scipy.linalg import solve\n",
      "from numpy import *\n",
      "\n",
      "#Variable declaration\n",
      "w1 = 0.024;  # Magnitude of the print ersive power of first lens\n",
      "w2 = 0.036;  # Magnitude of the print ersive power of second lens\n",
      "\n",
      "#Calculations\n",
      "# Let 1/f1 = x and 1/f2 = y, then\n",
      "# The condition for achromatic combination of two lenses, w1/f1 + w2/f2 = 0 => w1*x + w2*y = 0    --- [i]\n",
      "F = 90.;  # Given focal length, cm\n",
      "# Also F = 1/f1 + 1/f2 => F = x + y    ---- (II)\n",
      "A = array([[w1 ,w2],[ 1, 1]]);      # Square matrix\n",
      "B = array([0,1/F]);    # Column vector\n",
      "X = solve(A,B)\n",
      "f1 = 1/X[0];    # Focal length of convex lens, cm\n",
      "f2 = 1/X[1];    # Focal length of concave lens, cm\n",
      "\n",
      "#Results\n",
      "print \"The focal length of convex lens = %.f cm\"%((f1))\n",
      "print \"The focal length of concave lens = %.f cm\"%((f2))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The focal length of convex lens = 30 cm\n",
        "The focal length of concave lens = -45 cm\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.10, Page 197"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from scipy.linalg import solve\n",
      "from numpy import *\n",
      "\n",
      "\n",
      "#Variable declaration\n",
      "w1 = 0.02;  # Magnitude of the dispersive power of first lens\n",
      "w2 = 0.04;  # Magnitude of the dispersive power of second lens\n",
      "\n",
      "#Calculations\n",
      "# Let 1/f1 = x and 1/f2 = y, then\n",
      "# The condition for achromatic combination of two lenses, w1/f1 + w2/f2 = 0 => w1*x + w2*y = 0    --- (I)\n",
      "F = 20.;  # Given focal length of achromatic doublet, cm\n",
      "# Also F = 1/f1 + 1/f2 => F = x + y    ---- (II)\n",
      "A = [[w1, w2], [1, 1]];      # Square matrix\n",
      "B = [0,1/F];    # Column vector\n",
      "X = solve(A,B);    # Characteristic roots of the simultaneous equations, cm\n",
      "f1 = 1/X[0];    # Focal length of convex lens, cm\n",
      "f2 = 1/X[1];    # Focal length of concave lens, cm\n",
      "\n",
      "#Results\n",
      "print \"The focal length of convex lens = %2d cm\"%(ceil(f1))\n",
      "print \"The focal length of concave lens = %2d cm\"%(ceil(f2))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The focal length of convex lens = 10 cm\n",
        "The focal length of concave lens = -20 cm\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.11, Page 197"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from numpy import *\n",
      "from scipy.linalg import solve\n",
      "#Variable declaration\n",
      "w1 = 0.017;  # Magnitude of the print ersive power of first lens\n",
      "w2 = 0.034;  # Magnitude of the print ersive power of second lens\n",
      "\n",
      "\n",
      "# Let 1/f1 = x and 1/f2 = y, then\n",
      "# The condition for achromatic combination of two lenses, w1/f1 + w2/f2 = 0 => w1*x + w2*y = 0    --- [i]\n",
      "F = 40.;  # Given focal length of achromatic doublet, cm\n",
      "# Also F = 1/f1 + 1/f2 => F = x + y    ---- (II)\n",
      "A = [[w1, w2],[ 1, 1]];      # Square matrix\n",
      "B = [0,1/F];    # Column vector\n",
      "X = solve(A,B);    # Characteristic roots of the simulmath.taneous equations, cm\n",
      "f1 = 1/X[0];    # Focal length of convex lens, cm\n",
      "f2 = 1/X[1];    # Focal length of concave lens, cm\n",
      "# For the convex lens\n",
      "R2 = -25.;    # Radius of curvature of the contact surface, cm \n",
      "mu = 1.5;    # Mean refractive index of crown glass\n",
      "# From the Lens Maker formula, 1/f = (mu - 1)*(1/R1-1/R2), solving for R1\n",
      "f = f1;\n",
      "R1 = 1/(1/(f*(mu-1))+1/R2);    # Radius of curvature of second surface of first lens, cm\n",
      "print \"The radius of curvature of second surface of first lens = %5.2f cm\"%R1\n",
      "# For the concave lens\n",
      "R1 = -25.;    # Radius of curvature of the contact surface, cm \n",
      "mu = 1.7;    # Mean refractive index of flint glass\n",
      "# From the Lens Maker formula, 1/f = (mu - 1)*(1/R1-1/R2), solving for R1\n",
      "f = f2;\n",
      "R2 = 1/(1/R1-1/(f*(mu-1)));    # Radius of curvature of second surface of second lens, cm\n",
      "print \"The radius of curvature of second surface of second lens = %5.2f cm\"%R2\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The radius of curvature of second surface of first lens = 16.67 cm\n",
        "The radius of curvature of second surface of second lens = -233.33 cm\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.12, Page 199"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "# For flint glass\n",
      "mu_C = 1.665;    # Refractive index of flint glass for C line\n",
      "mu_F = 1.700;    # Refractive index of flint glass for F line\n",
      "\n",
      "#Calculations\n",
      "mu_D = (mu_F+mu_C)/2;    # Refractive index of flint glass for D line\n",
      "w2 = (mu_F-mu_C)/(mu_D-1);  # Magnitude of the dispersive power of second lens of flint glass\n",
      "# For crown glass\n",
      "mu_C = 1.510;    # Refractive index of crown glass for C line\n",
      "mu_F = 1.536;    # Refractive index of crown glass for F line\n",
      "mu_D = (mu_F+mu_C)/2;    # Refractive index of flint glass for D line\n",
      "w1 = (mu_F-mu_C)/(mu_D-1);  # Magnitude of the dispersive power of second lens of crown glass\n",
      "f = 50.;    # Focal length of acromatic doublet, cm\n",
      "FD = f*(w2-w1)/w2;    # Focal length of D line of the Fraunhofer spectrum due to convex lens of crown glass\n",
      "FC = FD*(mu_D - 1)/(mu_C - 1);    # Focal length of C component of converging lens, cm\n",
      "\n",
      "#Result\n",
      "print \"The focal length of C component of converging lens = %4.2f cm\"%FC\n",
      "#rounding-off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The focal length of C component of converging lens = 1.57 cm\n"
       ]
      }
     ],
     "prompt_number": 37
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.13, Page 200"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "F = 50.;  # Equivalent focal length of combination of two lenses, cm\n",
      "\n",
      "#Calculations\n",
      "#d = f1+f2/2, condition for no chromatic aberration  (1)\n",
      "#d = f2-f1, condition for minimum spherical aberration  (2)\n",
      "# From (1) and (2), f1 = 3*d/2, f2 = d/2\n",
      "# As 1/F = 1/f1 + 1/f2 - d/(f1*f2), solving for d\n",
      "d = 4./3*50;    # Distance of separation betwen two lenses, cm\n",
      "f1 = 3*d/2,\n",
      "f2 = d/2;\n",
      "\n",
      "#Results\n",
      "print \"f1 = %.f cm\"%(f1)\n",
      "print \"f2 = %5.2f cm\"%(f2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "f1 = 100 cm\n",
        "f2 = 33.33 cm\n"
       ]
      }
     ],
     "prompt_number": 40
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.14, Page 201"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "mu_R = 1.5230;    # Refractive index for red wavelength\n",
      "mu_V = 1.5145;    # Refractive index for violet wavelength\n",
      "R1 = 40.;    # Radius of curvature for red wavelength, cm\n",
      "R2 = -10.;    # Radius of curvature for violet wavelength, cm\n",
      "\n",
      "#Calculations\n",
      "# As 1/f = (mu - 1)*(1/R1 - 1/R2), solving for fV and fR\n",
      "fV = 1./((mu_V-1)*(1/R1-1/R2));    # Focal length for violet wavelength, cm \n",
      "fR = 1./((mu_R-1)*(1/R1-1/R2));    # Focal length for violet wavelength, cm \n",
      "l = fR - fV;    # Longitudinal chromatic aberration, cm\n",
      "\n",
      "#Result\n",
      "print \"The longitudinal chromatic aberration = %5.3f cm\"%(abs(l))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The longitudinal chromatic aberration = 0.253 cm\n"
       ]
      }
     ],
     "prompt_number": 41
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.15, Page 202"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "F = 10;  # Equivalent focal length of a combination of two lenses, cm\n",
      "d = 2;  # Separation distance between two lenses, cm\n",
      "\n",
      "#Calculations\n",
      "# As d = f1-f2, condition for minimum spherical aberration => f1 = d+f2\n",
      "# and F = f1*f2/(f1+f2-d), so solving for f2\n",
      "f2 = 2*F-d;    # Focal length of second lens, cm\n",
      "f1 = d+f2;    # Focal length of first lens, cm\n",
      "\n",
      "#Result\n",
      "print \"f1 = %2d cm, f2 = %2d cm\"%(f1, f2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "f1 = 20 cm, f2 = 18 cm\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.16, Page 202"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "mu = 1.6;  # Refractive index of aplanatic surface\n",
      "R = 3.2;  # Radius of curvature, cm\n",
      "\n",
      "#Calculations&Results\n",
      "R1 = R/mu;  # First radius of the aplanatic surface, cm \n",
      "print \"R1 = %3.1f cm\"%R1\n",
      "R2 = R*mu;  # Second radius of the aplanatic surface, cm \n",
      "print \"R2 = %4.2f cm\"%R2\n",
      "#Since the image of an object at one aplanatic point will be formed by the sphere at the other aplantic point,so the  is\n",
      "m = mu**2;    # The lateral magnification of the image\n",
      "print \"The lateral magnification of the image = %4.2f\"%m\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "R1 = 2.0 cm\n",
        "R2 = 5.12 cm\n",
        "The lateral magnification of the image = 2.56\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.17, Page 203"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "mu = 1.52;  # Refractive index of aplanatic surface\n",
      "R = 30;  # Radius of curvature, cm\n",
      "\n",
      "#Calculations&Results\n",
      "R1 = R/mu;  # First radius of the aplanatic surface, cm \n",
      "print \"R1 = %5.2f cm\"%R1\n",
      "R2 = R*mu;  # Second radius of the aplanatic surface, cm \n",
      "print \"R2 = %4.1f cm\"%R2\n",
      "#Since the image of an object at one aplanatic point will be formed by the sphere at the other aplantic point,so the  is\n",
      "m = mu**2;    # The lateral magnification of the image\n",
      "print \"The lateral magnification of the image = %4.2f\"%m\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "R1 = 19.74 cm\n",
        "R2 = 45.6 cm\n",
        "The lateral magnification of the image = 2.31\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.18, Page 203"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "F = 5;  # Equivalent focal length of Huygens eyepiece, cm\n",
      "\n",
      "#Calculations\n",
      "# as f1 = 3*f, f2 = f and d = 2*f, therefore\n",
      "f = 2./3*F;    # Focal length of base lens, cm\n",
      "f1 = 3*f;    # Focal length of field lens, cm\n",
      "\n",
      "#Result\n",
      "print \"The focal length of the field lens = %2d cm\"%f1\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The focal length of the field lens = 10 cm\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.19, Page 204"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "f = 10;    # Given focal length of each lens, cm\n",
      "f1 = f;    # Focal length of first lens, cm \n",
      "f2 = f;    # Focal length of second lens, cm\n",
      "\n",
      "#Calculations\n",
      "d = 2./3*f;  # Separation distance between two lenses, cm\n",
      "F = f1*f2/(f1+f2-d);    # Equivalent focal length of Ramsden eyepiece, cm\n",
      "\n",
      "#Result\n",
      "print \"The equivalent focal length of the field lenses is = %3.1f cm\"%F\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The equivalent focal length of the field lenses is = 7.5 cm\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.20, Page 204"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "d = 10;  # Distance between the two thin plano convex lenses in the Huygens eyepiece, \n",
      "\n",
      "#Calculations&Results\n",
      "f = d/2;    # Base focal length\n",
      "f1 = 3*f;   # Focal length of the first component lens, cm\n",
      "print \"f1 = %d cm\"%f1\n",
      "f2 = f;     # Focal length of the second component lens, cm\n",
      "print \"f2 = %d cm\"%f2\n",
      "F = 3./2*f;  # Equivalent focal length of the lens, cm\n",
      "print \"F = %3.1f cm\"%F\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "f1 = 15 cm\n",
        "f2 = 5 cm\n",
        "F = 7.5 cm\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.21, Page 204"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "F = 4.2;  # Equivalent focal length of Ramsden eyepiece, cm\n",
      "#F = 3/4*f, Equivalent focal length of Ramsden eyepiece, \n",
      "f = 5.6;  #focal length,in cm\n",
      "\n",
      "#Calculations&Results\n",
      "f1 = f;\n",
      "f2 = f;\n",
      "print \"f1 = %3.1f cm\"%f1\n",
      "print \"f2 = %3.1f cm\"%f2\n",
      "d = 2./3*f;\n",
      "print \"d = %4.2f cm\"%d\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "f1 = 5.6 cm\n",
        "f2 = 5.6 cm\n",
        "d = 3.73 cm\n"
       ]
      }
     ],
     "prompt_number": 29
    }
   ],
   "metadata": {}
  }
 ]
}