{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 22 : Reflection anda refraction of light"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 22.2 Page No: 739"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Angle = 19.20 degree\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import sin, pi, degrees, asin\n",
    "n1=1\n",
    "n2=1.52\n",
    "x=sin(pi/180*30)\n",
    "theta_2=degrees(asin((n1*x)/n2))\n",
    "print \"Angle = %0.2f degree\"%theta_2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 22.3 Page No: 739"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Solution a\n",
      "Velocity = 2.06e+08 m/s\n",
      "Solution b\n",
      "Wavelength in Fused quartz = 403.98 nm\n"
     ]
    }
   ],
   "source": [
    "print \"Solution a\"\n",
    "c=3*10**8# Constant in m/s\n",
    "n=1.458\n",
    "v=c/n\n",
    "print \"Velocity = %0.2e m/s\"%v\n",
    "print \"Solution b\"\n",
    "lambda_o=589#in nm\n",
    "lambda_n=lambda_o/n\n",
    "print \"Wavelength in Fused quartz = %0.2f nm\"%lambda_n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 22.5 Page No: 741"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Angle = 16.24 degree\n",
      "Angle = 25.69 degree\n"
     ]
    }
   ],
   "source": [
    "from math import atan, degrees, asin\n",
    "x=699#in micrometer(w-a)\n",
    "t=1200 #in micrometer\n",
    "b=x/2\n",
    "theta_2=degrees(atan(b/t))\n",
    "print \"Angle = %0.2f degree\"%theta_2\n",
    "y=sin(pi/180*theta_2)\n",
    "n1=1\n",
    "n2=1.55\n",
    "theta_1=degrees(asin((n2*y)/n1))\n",
    "print \"Angle = %0.2f degree\"%theta_1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 22.6 Page No: 744"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Angle(theta_c) = 48.75 degree\n"
     ]
    }
   ],
   "source": [
    "from math import asin, degrees\n",
    "n1=1.33\n",
    "n2=1\n",
    "x=degrees(asin(n2/n1))\n",
    "\n",
    "print \"Angle(theta_c) = %0.2f degree\"%x"
   ]
  }
 ],
 "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
}
