Difference between revisions of "PhET-Simulations-for-Physics/C2/Geometric-Optics/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
'''Title of the script''': Linear Discriminant Analysis in R
+
'''Title of the script''': Geometric Optics
  
'''Author''': YATE ASSEKE RONALD OLIVERA  and Debatosh Charkraborty
+
'''Author: Shraddha Kodavade and Madhuri Ganapathi'''
  
'''Keywords''': R, RStudio, machine learning, supervised, unsupervised, dimensionality reduction, LDA, video tutorial.
+
'''Keywords: Phet simulation, Geometric Optics, lenses, mirrors, rays, optical axis, focal length, object, image, real, virtual, '''radius of curvature, refractive index, diameter, video tutorial.
  
{| border=1
+
 
|-  
+
{|border=1
 +
|-
 
|| '''Visual Cue'''
 
|| '''Visual Cue'''
 
|| '''Narration'''
 
|| '''Narration'''
|-  
+
|-
|| '''Show slide'''
+
|| '''Slide Number 1'''
  
'''Opening Slide'''
+
'''Title Slide'''
 +
|| Welcome to this Spoken Tutorial on '''Geometric Optics'''.
 
|-
 
|-
 +
|| '''Slide Number 2'''
  
|| '''Show slide'''
+
'''Learning Objectives'''
 +
|| In this tutorial, we will learn about:
  
'''Opening Slide'''
+
Image formed by a lens and a mirror.
||
+
# Limitations of LDA
+
# LDA on a subset of Raisin dataset
+
# Visualization of the '''LDA''' separator and its corresponding confusion matrix.
+
  
 +
Distance between the lens or mirror and the image.
  
|-  
+
Size and nature of the image formed.
|| '''Show slide'''
+
|-
 +
|| '''Slide Number 3'''
  
'''System Specifications'''
+
'''System Requirements'''
 
|| This tutorial is recorded using,
 
|| This tutorial is recorded using,
* '''Windows 11 '''
 
* '''R '''version''' 4.3.0'''
 
* '''RStudio''' version '''2023.06.1'''
 
  
It is recommended to install '''R''' version '''4.2.0''' or higher.
+
Ubuntu Linux OS version 22.04
|-
+
|| '''Show slide.'''
+
  
'''Prerequisites '''
+
Firefox Web Browser version 126.0.1
 +
|-
 +
|| '''Slide Number 4'''
  
'''https://spoken-tutorial.org'''
+
'''Pre-requisites'''
|| To follow this tutorial, the learner should know:
+
  
* Basics of '''R''' programming.  
+
[https://spoken-tutorial.org/ https://spoken-tutorial.org]
* Basics of '''Machine Learning '''using '''R'''.  
+
|| To follow this tutorial the learner should be familiar with topics in basic physics.
  
If not, please access the relevant tutorials on '''R '''on this website.
+
Please use the link below to access the tutorials on PhET Simulations.
|-  
+
|-
|| '''Show slide.'''
+
|| '''Slide Number 5'''
  
'''Linear Discriminant Analysis'''
+
Link for Phet Simulations https://phet.colorado.edu/en/simulations/geometric-optics
|| Linear Discriminant Analysis is a statistical method.
+
|| Please use the given link to download the PhET simulation.
* It is used for classification.  
+
|-
* It constructs a data driven line that best separates different classes.
+
* It is based on maximization of likelihood function to classify two or more classes.
+
 
+
 
+
|-  
+
|| '''Show slide.'''
+
 
+
'''Applications of LDA'''
+
 
||  
 
||  
* LDA technique is used in several applications like
+
|| Let us begin.
 +
|-
 +
|| '''Slide Number 6'''
  
** Fraud Detection
+
'''Geometric Optics'''
** Bio-Imaging classification
+
|| '''Geometric Optics ''' is a branch of optics.
** Classify patient disease state
+
  
|-
+
It shows propagation of light in the form of rays, which pass through a medium.  
|| Only Narration
+
|-
|| Let us now understand the assumptions of LDA.
+
|| '''Slide Number 7'''
|-  
+
|| '''Show Slide '''
+
  
'''Assumptions for LDA'''
+
'''PhET Simulations'''
|| '''Multivariate Normality: '''
+
|| In this tutorial, we will use '''Geometric Optics PhET Simulation'''.
 +
|-
 +
|| Show the '''Downloads''' folder.
 +
|| I have already downloaded '''Geometric Optics simulation '''to my '''Downloads''' folder.
 +
|-
 +
|| Double on '''geometric-optics_en.html ''' file.
 +
|| Let us open the simulation.
 +
|-
 +
|| '''Cursor''' on the '''interface'''.
  
* All data entries are continuous, Gaussian, with equal covariance matrix for all the classes.
+
Point to the screens.
* Mean vectors for each class are different.
+
* Data records are independent and identically distributed among each class.
+
  
|-
+
Point to the Lens screen.
|| '''Show Slide '''
+
|| This is the interface of '''Geometric Optics simulation'''.
  
'''Limitations of LDA'''
+
It has '''Lens''' and '''Mirror''' screens.
|| Now we will see the limitations of LDA.
+
  
* Departure from Gaussianity may increase misclassification probability in LDA.
+
Let us explore the '''Lens '''screen.
* '''LDA''' may perform poorly if data has unequal class covariance matrix.
+
|-
 +
|| Point to the lens.
 +
|| This screen has a spherical convex lens, an object and its image.
 +
|-
 +
|| Point to the distance.
 +
|| The distance from the object to the lens is the object distance.  
  
|-  
+
The distance from the lens to the image is the image distance.
|| '''Show Slide'''
+
|-
 +
|| Point to the bottom of the interface.
  
'''Implementation Of LDA'''
+
Point to the Parameters.
|| Now let us implement '''LDA''' on the '''raisin dataset '''with two chosen variables'''.'''
+
  
More information on '''raisin''' data is available in the '''Additional Reading material''' on this tutorial page.
+
Check the '''Labels''' checkbox.
|-
+
|| At the bottom we have a box with various optic parameters.
|| '''Show slide '''
+
  
'''Download Files'''  
+
Let us check the '''Labels''' check box to see the labels of all the items.
|| We will use a script file '''LDA.R'''
+
|-
 +
|| Point to the axis
 +
|| The purple dashed line is '''Optical Axis'''.
  
Please download this file from the''' Code files''' link of this tutorial.
+
It is an imaginary line perpendicular to the face of the lens.
 +
|-
 +
|| Point to the pencil.
 +
|| A pencil is used as the default object in this simulation.
 +
|-
 +
|| Point to the object drop down list on the top left.
  
Make a copy and then use it for practicing.
+
Click the drop down to show the objects.
|-
+
|| On the top left side, an object drop down list is provided.
|| [Computer screen]
+
  
Point to '''LDA.R''' and the folder '''LDA.'''
+
Let us click on it to see the objects.  
  
Point to the''' MLProject folder '''on the '''Desktop.'''
+
Users can choose different objects and explore.
 +
|-
 +
|| Point to the pencil.
 +
|| I will retain, pencil as the object.
 +
|-
 +
|| Point to the Rays option at the bottom of the screen.  
  
 +
Marginal option chosen by default.
  
Point to the''' LDA folder.'''
+
Click on all the radio buttons.
|| I have downloaded and moved these files to the '''LDA '''folder.
+
|| Intensity of light can be changed using the '''Rays ''' option at the bottom.
  
 +
'''Marginal''' option is chosen by default.
  
This folder is in the '''MLProject''' folder on my '''Desktop'''.
+
We have '''Principal''', '''Many''' and '''None''' as the options.  
  
 +
I will select the''' Marginal''' option.
 +
|-
 +
|| Point to the rays.
  
I have also set the '''LDA''' folder as my working''' directory'''.
+
Point to focus
|-
+
|| Point to the script file '''LDA.R.'''
+
|| In this tutorial, we will create a '''LDA''' classifier model on the '''raisin''' dataset.
+
  
 +
Point to the focal length.
  
Let us switch to '''RStudio'''.
+
Point to the curvature of the lens.
|-
+
|| Open '''LDA.R '''in '''RStudio'''
+
  
 +
Point to the focal length.
 +
|| As the rays pass through the lens, they bend slightly towards the axis.
  
Point to''' LDA.R''' in '''RStudio'''.
+
This is due to refraction of the lens.  
|| Open the script '''LDA.R''' in '''RStudio'''.
+
  
For this, click on the script '''LDA.R.'''
+
For more information please refer to the '''Additional Reading material'''.
  
Script '''LDA.R''' opens in '''RStudio'''.
+
Due to the curvature of the lens, rays from infinity bend and converge to a point.  
|-
+
|| Highlight the '''Readxl package.'''
+
  
Highlight the command '''library(MASS) '''
+
This point is known as focus.
  
Highlight the command '''library(ggplot2)'''
+
The distance from centre of lens to the focus is the focal length.
 +
|-
 +
|| Point to the top and bottom rays.
  
Highlight the command '''library(caret)'''
+
Point to the centre ray.
 +
|| The rays at the top and bottom bend at larger angles than the one at the centre.
 +
|-
 +
|| Point to the converged point.
 +
|| This is an example of a converging lens.
  
Highlight the command '''library(caret)'''
+
It produces real images beyond the focus.
 
+
|-
Highlight all the commands.
+
|| Point to the top ray.
 
+
'''<nowiki>#install.packages(“package_name”)</nowiki>'''
+
|| '''Readxl package''' is used to load the '''Excel''' file.
+
 
+
 
+
The''' MASS package''' contains the '''lda()''' function that we will use for our analysis.
+
 
+
 
+
The '''ggplot2 package''' is used to plot the results of our analysis.
+
 
+
 
+
The '''caret package''' contains the
+
 
+
'''confusionMatrix''' function.
+
 
+
 
+
It is used as a measure for the performance of the classifier.
+
 
+
 
+
Please note that in order to import these libraries, we need to install them.
+
 
+
 
+
Please ensure that everything is installed correctly.
+
 
+
 
+
You can use the command '''install.packages(“package_name”)''' to install the required packages.
+
 
+
 
+
As I have already installed these packages, I will directly import them.
+
 
+
|-  
+
|| [RStudio]
+
 
+
'''library(readxl)'''
+
 
+
'''library(MASS)'''
+
 
+
'''library(ggplot2)'''
+
 
+
'''library(caret)'''
+
 
+
'''library(lattice)'''
+
 
+
 
+
 
+
|| Select and run these commands to import the requisite packages.
+
 
+
|-
+
|| Highlight the command''' '''
+
 
+
'''data <- read_xlsx("Raisin.xlsx")'''
+
 
+
 
+
Highlight the command''' data<-data[c("minorAL","ecc","class")]'''
+
 
+
 
+
Highlight the commands.
+
 
+
'''data <- read_xlsx("Raisin.xlsx")'''
+
 
+
 
+
'''data<-data[c("minorAL","ecc","class")]'''
+
 
+
|| We will read the excel file and choose 3 columns, two features ('''minorAL, ecc)''' and one target ('''class''') variable.
+
 
+
Run these commands to import the '''raisin''' dataset.
+
 
+
|-
+
|| Drag boundary to see the '''Environment '''tab clearly.
+
 
+
Point to the data variable in the Environment tab.
+
 
+
Click the data to load the dataset.
+
 
+
|| Drag boundary to see the Environment tab clearly.
+
 
+
In the Environment tab under '''Data '''heading, you will see a '''data '''variable.
+
 
+
Click the data''' variable''' to load the dataset in the '''Source''' window.
+
|-
+
|| Drag boundary to see the Source window clearly.
+
|| Drag boundary to see the '''Source '''window clearly.
+
  
 +
Point to the bottom ray.
 +
|| A real inverted image is formed when light rays are directed to a fixed point.
 
|-
 
|-
||[RStudio]
+
|| Point to the focal lengths.
  
Type these commands in the source window.
+
Drag the scale and measure the focal length,
 
+
|| This lens has same focal length on both the sides.  
'''data$class <- factor(data$class)'''
+
 
+
|| In the '''Source''' window type this command.
+
  
 +
Let us measure the distance using the scale.
 
|-
 
|-
||Highlight the below commands.
+
|| Measure the focal length - 80 cm.
  
'''data$class <- factor(data$class)'''
+
Measure the distance from the centre of the lens to the image - 160 cm.
 +
|| The distance between the focus and the lens is 80 cm.
  
Select the commands and click the Run button.
+
The distance from the centre of the lens to the image is 160 cm.  
  
||Here we are converting the variable '''data$class''' to a factor.
+
A real, inverted image, which is same size as the object, is formed at 2F1.
  
It ensures that the categorical data is properly encoded.
+
Let us put the scale back to its place.
 
+
Select the command and run it. them.
+
 
|-
 
|-
||Only Narration.
+
|| Drag the Radius of curvature slider to minimum.
|| Now we split our dataset into training and testing data.
+
|| Let’s drag the '''Radius of Curvature''' slider towards minimum.
 
|-
 
|-
||[RStudio]
+
|| Point to the radius of curvature and the focal length.
  
Type the command in the source window.
+
Point to the image.
  
'''set.seed(1) '''
+
Drag the Radius of curvature slider to maximum.
  
'''index_split=sample(1:nrow(data),size=0.7*nrow(data),replace=FALSE)'''
+
Point to the image.
||In the '''Source''' window type these commands.
+
|| As the radius of curvature decreases, the focal length decreases.  
  
|-
+
Observe the size of the image.
||Highlight the command
+
  
'''set.seed(1)'''
+
It becomes smaller.
  
Highlight the command '''sample(1:nrow(data),size=0.7*nrow(data),replace=FALSE)'''
+
As the radius of curvature increases, image moves away from the lens.
  
Highlight the command '''replace=FALSE'''
+
Observe that the image is magnified and blurred.
 +
|-
 +
|| Drag the diameter slider.
  
Select the commands and click the Run button.
+
(Drag the slider to right and bring it back to 80)
||First we set a seed for reproducible results.
+
|| Let’s drag the diameter slider to see the effects.  
  
 +
As the diameter increases the image becomes brighter.
 +
|-
 +
|| Point to the Index of Refraction check box.
  
We will create a vector of indices using '''sample() '''function.
+
Drag the slider of the Index of Refraction.
 +
|| Drag the '''Index of Refraction''' slider.
  
 +
Observe how change in refractive index, bends light to different angles.
 +
|-
 +
|| Click on the reset button.
 +
|| Click on the '''Reset''' button to reset the simulation.
  
This will be 70% for training and 30% for testing.
+
Check the labels check box.
 
+
 
+
The training data is chosen using simple random sampling without replacement.
+
 
+
Select the commands and run them.
+
 
|-
 
|-
|| The vector is shown in the''' Environment '''tab.
+
|| '''Slide Number 8:'''
|-
+
||Point to train-test split.
+
|| We use the indices that we previously generated to obtain our train-test split.
+
|-
+
|| [RStudio]
+
  
Type the command
+
'''Table 1'''
  
'''train_data <- data [index_split, ]'''
 
 
'''test_data <- data[-c(index_split), ]'''
 
|| In the '''Source '''window type these commands.
 
|-
 
|| Highlight the command
 
 
'''train_data <- data[index_split, ]'''
 
 
Highlight the command
 
 
'''test_data <- data[-c(index_split), ]'''
 
|| This creates training data, consisting of 630 unique rows.
 
  
 +
<u>'''Table 1: Image formation by a convex lens'''</u>
  
This creates testing data, consisting of 270 unique rows.
+
{|border=1
 
|-  
 
|-  
|| Select the commands and click the Run button.
+
|| Object Position
 
+
|| Image Position
 
+
|| Image Size
Point to the sets in the Environment Tab
+
|| Nature
|| Select the commands and run them.
+
 
+
 
+
The data sets are shown in the Environment tab.
+
 
+
 
+
Click on '''test_data '''and '''train_data '''to load them in the Source window.
+
 
+
 
|-  
 
|-  
|| Only Narration.
+
|| At 2F1
|| Let us train our '''LDA''' model.
+
|| At 2F2
 +
|| Same size as object
 +
|| Real,inverted
 
|-  
 
|-  
|| [RStudio]
+
|| Beyond 2F1
 
+
|| Between F2 and 2F2
'''LDA_model <- lda(class~.,data=train_data)'''
+
|| Diminished
 
+
|| Real,inverted
'''LDA_model'''
+
|| In the '''Source '''window, type these commands.
+
 
+
 
|-  
 
|-  
|| Highlight the command
+
|| Between F1 and 2F1
 
+
|| Beyond 2F2
'''LDA_model <- lda(class~.,data=train_data)'''
+
|| Magnified
 
+
|| Real,inverted
'''LDA_model'''
+
 
+
 
+
Highlight the command '''LDA_model'''
+
 
+
 
+
Click on Save and Run buttons.
+
 
+
Point to the output in the '''console '''window.
+
|| We pass two parameters to the '''lda()''' function.
+
# formula
+
# data on which the model should train.
+
 
+
Select the comands and run them.
+
 
+
The output is shown in the '''console''' window.
+
 
|-  
 
|-  
|| Drag boundary to see the '''console''' window.
+
|| At F1
|| Drag boundary to see the '''console '''window clearly.
+
|| Infinity
 
+
|| Highly magnified
 +
|| Real,inverted
 
|-  
 
|-  
|| Highlight '''output''' in the '''console.'''
+
|| Between F1 and O
|| Our '''model''' provides us with a lot of information.
+
|| On the same side as object
 
+
|| Magnified
Let us go through them one at a time.
+
|| Virtual, erect
 
|-  
 
|-  
|| Highlight the command '''Prior probabilities of groups. '''
+
|| Infinity
 +
|| F2
 +
|| Point Sized
 +
|| Real,inverted
 +
|-
 +
|}
  
Highlight the command''' Group means.'''
+
Concave lens forms virtual and erect image on the same side of the lens between F1 and O.  
  
Highlight the command '''Coefficients of linear discriminants '''
+
It is always diminished.
  
|| These explain the distribution of classes in the training dataset.
+
|| This table shows the Image formation by a convex lens.
 +
|-
 +
|| Show the table here and point to different cases.
  
 +
Point to case 1 in the table.
 +
|| Here are 6 instances of placing an object.
  
These display the mean values of each '''predictor '''variable for each '''species'''.
+
We have already discussed case 1.
 +
|-
 +
|| Case 2: Beyond 2F.
  
 +
Point to case 2 in the table.
  
These display the '''linear combination of predictor''' variables.  
+
Switch to the simulation.
  
 +
Drag the lens beyond 2F.
  
The given linear combinations form the decision rule of the '''LDA''' model.
+
(drag the object - so that distance between lens and image is around 180 cm)
 +
|| Case 2: Let us discuss the case of placing the object beyond 2F1.
  
|-
+
Let’s measure the distance between the object and lens.  
|| Drag boundary to see the Source window.
+
|| Drag boundary to see the '''Source '''window clearly.
+
  
|-
+
It is 160 cm.
||
+
|| Let us use this model to make predictions on the testing data.
+
|-
+
|| [RStudio]
+
  
'''predicted_values <- predict(LDA_model, test_data)'''
+
Let us move the object beyond this measured distance that is beyond 2F.
  
|| In the '''Source '''window type this command and run it.  
+
The object distance is 180 cm.
  
Let us check what '''predicted_values''' contain.
+
Let us measure the distance between the lens and the image.  
  
|-
 
|| Click the '''predicted_values '''data in the Environment tab.
 
  
 +
It is 150 cm.
  
Point to the table.
+
This distance is less than 2F but more than F.
|| Click the '''predicted_values '''data in the Environment tab.
+
  
The '''predicted_values '''table is loaded in the '''Source''' window.
+
Hence we can say that the image is formed between F and 2F.
  
|-
+
A real, inverted and diminished image is formed.
|| [RStudio]
+
  
'''head(predicted_values$class)'''
+
Let us put the scale back to its place.
 +
|-
 +
|| '''Slide Number 9'''
  
'''head(predicted_values$posterior)'''
+
'''Assignment'''
  
'''head(predicted_values$x)'''
+
Show table on the slide.
|| In the '''Source''' window type these commands and run them.
+
|| As an assignment,
  
 +
Place the object in other positions and
  
The output is seen in the''' console''' window.
+
Check the image formed by the convex lens.
|-
+
|| Highlight the command output of '''head(predicted_values$class) '''in the '''console.'''
+
  
 +
Use the table for your reference.
  
Highlight the command output of '''head(predicted_values$posterior)''' in the '''console.'''
+
Follow the steps as shown in case 2.
 +
|-
 +
|| Click on concave lens option
 +
|| Let us click on the concave lens button at the top.
 +
|-
 +
|| Point to the concave lens.
 +
|| A concave lens is a diverging lens.
  
 +
It generates a virtual and erect image.
  
Highlight the command output of '''head(predicted_values$x) '''in '''console'''
+
The point where the rays seem to diverge is extended backwards.
|| It contains the type of species that the model has predicted for each observation.
+
|-
 +
|| Point to the rays.
 +
|| As the rays pass through the lens, they bend slightly outwards from the axis.  
  
 +
This is due to refraction of the lens. So the rays diverge.
 +
|-
 +
|| Point to the focus.
  
It contains the '''posterior probability''' of the observation belonging to each class.
+
(Drag as far as possible but let it be in the screen)
 +
|| The focus is at the same side of the object.  
  
This contains the linear discriminants for each observation.
+
Let us place the object beyond F1.  
  
|-  
+
A diminished, virtual and erect image is formed between focus and lens.
|| Only Narration.
+
|-
|| Now we will measure the performance of our model using the '''Confusion Matrix'''.
+
|| Drag the object close to the lens.
|-
+
|| Now let us drag the object close to the concave lens.
|| [RStudio]
+
  
'''confusion <-table(test_data$class,predicted_values$class)'''
+
Observe that the size of the image increases.
 +
|-
 +
|| Click on the Mirror.
 +
|| Now let us explore the''' Mirror''' screen.
 +
|-
 +
|| Point to the 3 types of mirror.
 +
|| This screen has 3 types of mirrors.
  
 +
By default a concave mirror is selected.
 +
|-
 +
|| Click on the labels check box.
 +
|| Click on the labels checkbox to see the labels of all the items..
 +
|-
 +
|| Point to the front side.
  
'''fourfoldplot(confusion, color = c("red", "green"), conf.level = 0, margin=1)'''
+
Point to the back side.
 +
|| For the concave mirror, front or left side is the reflecting surface.  
  
 +
Hence, the object is placed on this side.
  
Click on '''Save '''and''' Run''' buttons.
+
Right side is the non-reflecting surface.
|| In the '''Source '''window type these commands.
+
|-
 +
|| Point to the distance.
 +
|| The distance between the object and mirror is always positive.  
 +
|-
 +
|| Point to the image on the front side.
  
 +
Drag the object and point to the image on the back side.
  
Save and run the commands.
+
Point to the image formed.
|-
+
|| If the image is on the front side, the distance is positive.
|| Highlight the command '''confusion <- table(test_data$class, predicted_values$class)'''
+
  
Highlight the command
+
This is a real and inverted image.
  
'''fourfoldplot(confusion, color = c("red", green"), conf.level = 0, margin=1)'''
+
Let us drag the object close to the mirror and see the image.  
  
|| This table creates a confusion matrix.
+
A virtual and enlarged image is formed on the right side of the object.
 +
|-
 +
|| '''Slide Number 10:'''
  
 +
Image formation by a Concave mirror.
  
The '''fourfoldplot()''' function generates a visual plot of the confusion matrix,
 
  
 +
<u>'''Table 2 : Image formation by a concave mirror'''</u>
  
The output is seen in the '''plot''' window.
+
{|border=1
 
|-  
 
|-  
|| Highlight the plot in '''plot window '''
+
|| Object Position
|| Drag boundary to see the plot window clearly.
+
|| Image Position
 
+
|| Image Size
Given the specific seed (set.seed=1), LDA has misclassified 33 out of 270 observations.
+
|| Nature
 
+
This number may change for different sets of training data.
+
 
+
 
|-  
 
|-  
|| Only Narration.
+
|| At 2F1
|| Let us visualize how well our model separates different classes.
+
|| At 2F2
 +
|| Same size as object
 +
|| Real,inverted
 
|-  
 
|-  
|| [RStudio]
+
|| Between F1 and O
 
+
|| Behind the mirror
[RStudio]
+
|| Magnified
 
+
|| Virtual, erect
'''X <- seq(min(train_data$minorAL), max(train_data$minorAL), length.out = 100)'''
+
 
+
 
+
'''Y <- seq(min(train_data$ecc), max(train_data$ecc), length.out = 100)'''
+
 
+
 
+
'''min_max <- expand.grid(minorAL = X, ecc = Y)'''
+
 
+
 
+
'''min_max$predicted_class <- predict(LDA_model, newdata = min_max)$class'''
+
 
+
 
+
'''grid <- expand.grid(minorAL = X, ecc = Y)'''
+
 
+
'''grid$class <- predict(LDA_model, newdata = grid)$class'''
+
 
+
 
+
'''grid$classnum <- as.numeric(grid$class)'''
+
 
+
 
+
Click on Save and Run buttons.
+
 
+
|| In the '''Source''' window, type these commands.
+
 
+
 
+
This block of code operates as a setup for visual plotting.
+
 
+
 
+
It consists of square grid coordinates in the range of training data and their predicted linear discriminants.
+
 
+
 
+
The ''' seq ''' function generates a sequence of evenly spaced values within a range of smallest and largest values of 'minorAL' and 'ecc' variables from the training data.
+
 
+
 
+
The''' 'grid' '''variable contains the generated data including the prediction of the LDA_model on it.
+
 
+
 
+
The '''as.numeric''' function encodes the predicted classes labels into numeric values.
+
 
+
 
+
Select the commands and run them.
+
 
+
 
|-  
 
|-  
|| Point to the Environment tab.
+
|| Beyond 2F1
|| Drag boundary to see the details in the Environment tab.
+
|| Between F2 and 2F2
 
+
|| Diminished
 
+
|| Real,inverted
These variables contain the data for the visualization of the linear discriminants.
+
 
+
Click the '''grid''' '''data''' in the Environment tab.
+
 
+
The '''grid data''' table is loaded in the '''Source''' window.
+
 
+
 
|-  
 
|-  
|| [RStudio]
+
|| Between F1 and 2F1
 
+
|| Beyond 2F2
 
+
|| Magnified
'''ggplot() +'''
+
|| Real,inverted
 
+
'''geom_point(data = train_data, aes(x = minorAL, y = ecc, color = class), size = 3) +'''
+
 
+
'''geom_point(data = min_max, aes(x = minorAL, y = ecc, color = predicted_class), size = 1, alpha = 0.3) +'''
+
 
+
'''theme_minimal()'''
+
 
+
 
+
'''ggplot() +'''
+
 
+
'''geom_raster(data=grid, aes(x=minorAL, y=ecc, fill = class),alpha=0.3) +'''
+
 
+
'''geom_point(data = train_data, aes(x = minorAL, y = ecc, color = class), size = 2) +'''
+
 
+
'''geom_contour(data= grid, aes(x=minorAL, y=ecc, z = classnum), colour="black", linewidth = 1.2) +'''
+
 
+
'''scale_fill_manual(values = c("#ffff46", "#FF46e9")) +'''
+
 
+
'''scale_color_manual(values = c("red", "blue")) +'''
+
 
+
'''labs(title = "LDA Decision Boundary") +'''
+
 
+
'''theme_minimal()'''
+
 
+
|| In the '''Source''' window, type these commands.
+
 
+
 
|-  
 
|-  
|| Highlight the command
+
|| At F1
 +
|| Infinity
 +
|| Highly magnified
 +
|| Real,inverted
 +
|-
 +
|| Infinity
 +
|| At the focus F2
 +
|| Point Sized
 +
|| Real,inverted
 +
|-
 +
|}
  
'''ggplot() +'''
+
|| This is the table for the Image formation by a concave mirror.
 +
|-
 +
|| Only Narration.
  
'''geom_point(data = train_data, aes(x = minorAL, y = ecc, color = class), size = 3) +'''
+
Case 1:
 +
|| Now, let us discuss an instance of placing an object at 2F1.
  
'''geom_point(data = min_max, aes(x = minorAL, y = ecc, color = predicted_class), size = 1, alpha = 0.3) +theme_minimal()'''
+
Let us reset the simulation.  
  
 +
And check the labels check box.
 +
|-
 +
|| Drag the scale.
 +
|| Drag the scale to measure the distance.
  
'''ggplot() +'''
+
The distance between the focal point and the mirror is 90 cm.
  
'''geom_raster(data=grid, aes(x=minorAL, y=ecc, fill = class),alpha=0.3) +'''
+
Let us measure the distance from the centre of the mirror to 2F1.  
  
'''geom_point(data = train_data, aes(x = minorAL, y = ecc, color = class), size = 2) +'''
+
It is 180 cm.
  
'''geom_contour(data= grid, aes(x=minorAL, y=ecc, z = classnum), colour="black", linewidth = 1.2) +'''
+
Let us place the object at this point.
  
'''scale_fill_manual(values = c("#ffff46", "#FF46e9")) +'''
+
A real inverted image, same size as the object, is formed below the object.
  
'''scale_color_manual(values = c("red", "blue")) +'''
+
Let us put the scale back to its place.
 +
|-
 +
|| '''Slide Number 11'''
  
'''labs(title = "LDA Decision Boundary") +'''
+
'''Assignment'''
  
'''theme_minimal()'''
+
Show table on the slide.
 +
|| As an assignment,
  
 +
Place the object in other positions and
  
Select the commands and run them.
+
check the image formed by the concave mirror.
  
|| This command creates the decision boundary plot
+
Use the table for your reference.
  
 +
Follow the steps as shown in case 1.
 +
|-
 +
|| Click on the convex mirror button.
  
It plots the '''grid''' points with colors indicating the predicted classes.  
+
Drag the object back and forth and show a virtual image.
 +
|| Now let us click the convex mirror button.
  
'''geom_raster '''creates a colour map indicating the predicted classes of the grid points
+
For this mirror left side is the front side.
  
'''geom_contour '''creates the decision boundary of the LDA.
+
The object is placed on this side.  
  
The '''scale_color_manual''' function assigns specific colors to the classes and so does '''scale_fill_manual''' function.
+
Right side is the back side.
  
 +
A convex mirror always forms a virtual image.
 +
|-
 +
|| Drag the object back and forth to see the image.
  
The overall plot provides a visual representation of the decision boundary and the distribution of training data points of the '''model'''.
+
Point to the image.
 +
|| Let’s drag the object back and forth to see where the image is formed.
  
 +
It is formed on the back side of the mirror.
  
Select and run these commands.
+
Observe that the image formed is always a virtual image
 
+
|-
 
+
|| Drag the object and show the size of the image.
Drag boundaries to see the plot window clearly.
+
|| The image formed is always smaller in size than the object.
|-  
+
|-
|| Point the output in the '''Plots '''window
+
|| We can see that our model has separated most of the data points clearly.
+
|-  
+
 
|| Only Narration
 
|| Only Narration
|| With this we come to end of this tutorial.
+
|| With this we come to the end of this tutorial.
  
Let us summarize.
+
Let us summarise.
|-  
+
|-
|| '''Show Slide'''
+
|| '''Slide Number 12'''
  
 
'''Summary'''
 
'''Summary'''
|| In this tutorial we have learnt:
+
|| In this '''tutorial''', we have learnt about,
 
+
* Image formed by a lens and a mirror.
* Linear Discriminant Analysis ('''LDA''') and its implementation.&nbsp;
+
* The distance between the lens or mirror and the image
* Assumptions of LDA
+
* Size and nature of the image.
* Limitations of LDA
+
|-
* LDA on a subset of Raisin dataset
+
|| '''Slide Number 13'''
* Visualization of the '''LDA''' separator and its corresponding confusion matrix
+
 
+
 
+
|-
+
||
+
|| Now we will suggest an assignment for this Spoken Tutorial.
+
|-  
+
|| '''Show Slide'''
+
  
 
'''Assignment'''
 
'''Assignment'''
||  
+
|| As an '''assignment''',
* Perform LDA on inbuilt '''PlantGrowthdataset'''
+
* Evaluate the model using a confusion matrix and visualize the results
+
  
|-  
+
Explore the Flat mirror option on your own.
|| '''Show slide'''
+
|-
 +
|| '''Slide Number 14'''
  
 
'''About the Spoken Tutorial Project'''
 
'''About the Spoken Tutorial Project'''
|| The video at the following link summarizes the Spoken Tutorial project.  
+
|| The video at the following link summarises the Spoken Tutorial project.
  
 
Please download and watch it.
 
Please download and watch it.
|-  
+
|-
|| '''Show slide'''
+
|| '''Slide Number 15'''
  
'''Spoken Tutorial Workshops'''
+
'''Spoken Tutorial workshops'''
|| We conduct workshops using Spoken Tutorials and give certificates.
+
|| The '''Spoken Tutorial Project '''team:
  
 +
conducts workshops and gives certificates
  
Please contact us.
+
For more details, please write to us.
|-  
+
|-
|| '''Show Slide'''
+
|| '''Slide Number 16'''
 
+
'''Spoken Tutorial Forum to answer questions.'''
+
 
+
Do you have questions in THIS Spoken Tutorial?
+
 
+
Choose the minute and second where you have the question.Explain your question briefly.
+
 
+
Someone from the FOSSEE team will answer them.
+
  
Please visit this site.
+
'''Forum for specific questions:'''
 
|| Please post your timed queries in this forum.
 
|| Please post your timed queries in this forum.
|-  
+
|-
|| '''Show Slide'''
+
|| '''Slide Number 17'''
  
'''Forum to answer questions'''
+
'''Acknowledgement'''
|| Do you have any general/technical questions?
+
|| The Spoken Tutorial project was established by the Ministry of Education, Govt. of India.
 
+
|-
Please visit the forum given in the link.
+
|| Thank you
|-
+
|| This tutorial is contributed by FOSSEE and Spoken Tutorial Project, IIT Bombay.
|| '''Show Slide'''
+
 
+
'''Textbook Companion'''
+
|| The FOSSEE team coordinates the coding of solved examples of popular books and case study projects.
+
 
+
We give certificates to those who do this.
+
 
+
For more details, please visit these sites.
+
|-
+
|| '''Show Slide'''
+
 
+
'''Acknowledgment'''
+
|| The '''Spoken Tutorial''' project was established by the Ministry of Education Govt of India.
+
|-  
+
|| '''Show Slide'''
+
 
+
'''Thank You'''
+
|| This tutorial is contributed by Yate Asseke Ronald and Debatosh Chakraborthy from IIT Bombay.
+
  
 
Thank you for joining.
 
Thank you for joining.
 
|-
 
|-
 
|}
 
|}

Latest revision as of 18:03, 13 January 2025

Title of the script: Geometric Optics

Author: Shraddha Kodavade and Madhuri Ganapathi

Keywords: Phet simulation, Geometric Optics, lenses, mirrors, rays, optical axis, focal length, object, image, real, virtual, radius of curvature, refractive index, diameter, video tutorial.


Visual Cue Narration
Slide Number 1

Title Slide

Welcome to this Spoken Tutorial on Geometric Optics.
Slide Number 2

Learning Objectives

In this tutorial, we will learn about:

Image formed by a lens and a mirror.

Distance between the lens or mirror and the image.

Size and nature of the image formed.

Slide Number 3

System Requirements

This tutorial is recorded using,

Ubuntu Linux OS version 22.04

Firefox Web Browser version 126.0.1

Slide Number 4

Pre-requisites

https://spoken-tutorial.org

To follow this tutorial the learner should be familiar with topics in basic physics.

Please use the link below to access the tutorials on PhET Simulations.

Slide Number 5

Link for Phet Simulations https://phet.colorado.edu/en/simulations/geometric-optics

Please use the given link to download the PhET simulation.
Let us begin.
Slide Number 6

Geometric Optics

Geometric Optics is a branch of optics.

It shows propagation of light in the form of rays, which pass through a medium.

Slide Number 7

PhET Simulations

In this tutorial, we will use Geometric Optics PhET Simulation.
Show the Downloads folder. I have already downloaded Geometric Optics simulation to my Downloads folder.
Double on geometric-optics_en.html file. Let us open the simulation.
Cursor on the interface.

Point to the screens.

Point to the Lens screen.

This is the interface of Geometric Optics simulation.

It has Lens and Mirror screens.

Let us explore the Lens screen.

Point to the lens. This screen has a spherical convex lens, an object and its image.
Point to the distance. The distance from the object to the lens is the object distance.

The distance from the lens to the image is the image distance.

Point to the bottom of the interface.

Point to the Parameters.

Check the Labels checkbox.

At the bottom we have a box with various optic parameters.

Let us check the Labels check box to see the labels of all the items.

Point to the axis The purple dashed line is Optical Axis.

It is an imaginary line perpendicular to the face of the lens.

Point to the pencil. A pencil is used as the default object in this simulation.
Point to the object drop down list on the top left.

Click the drop down to show the objects.

On the top left side, an object drop down list is provided.

Let us click on it to see the objects.

Users can choose different objects and explore.

Point to the pencil. I will retain, pencil as the object.
Point to the Rays option at the bottom of the screen.

Marginal option chosen by default.

Click on all the radio buttons.

Intensity of light can be changed using the Rays option at the bottom.

Marginal option is chosen by default.

We have Principal, Many and None as the options.

I will select the Marginal option.

Point to the rays.

Point to focus

Point to the focal length.

Point to the curvature of the lens.

Point to the focal length.

As the rays pass through the lens, they bend slightly towards the axis.

This is due to refraction of the lens.

For more information please refer to the Additional Reading material.

Due to the curvature of the lens, rays from infinity bend and converge to a point.

This point is known as focus.

The distance from centre of lens to the focus is the focal length.

Point to the top and bottom rays.

Point to the centre ray.

The rays at the top and bottom bend at larger angles than the one at the centre.
Point to the converged point. This is an example of a converging lens.

It produces real images beyond the focus.

Point to the top ray.

Point to the bottom ray.

A real inverted image is formed when light rays are directed to a fixed point.
Point to the focal lengths.

Drag the scale and measure the focal length,

This lens has same focal length on both the sides.

Let us measure the distance using the scale.

Measure the focal length - 80 cm.

Measure the distance from the centre of the lens to the image - 160 cm.

The distance between the focus and the lens is 80 cm.

The distance from the centre of the lens to the image is 160 cm.

A real, inverted image, which is same size as the object, is formed at 2F1.

Let us put the scale back to its place.

Drag the Radius of curvature slider to minimum. Let’s drag the Radius of Curvature slider towards minimum.
Point to the radius of curvature and the focal length.

Point to the image.

Drag the Radius of curvature slider to maximum.

Point to the image.

As the radius of curvature decreases, the focal length decreases.

Observe the size of the image.

It becomes smaller.

As the radius of curvature increases, image moves away from the lens.

Observe that the image is magnified and blurred.

Drag the diameter slider.

(Drag the slider to right and bring it back to 80)

Let’s drag the diameter slider to see the effects.

As the diameter increases the image becomes brighter.

Point to the Index of Refraction check box.

Drag the slider of the Index of Refraction.

Drag the Index of Refraction slider.

Observe how change in refractive index, bends light to different angles.

Click on the reset button. Click on the Reset button to reset the simulation.

Check the labels check box.

Slide Number 8:

Table 1


Table 1: Image formation by a convex lens

Object Position Image Position Image Size Nature
At 2F1 At 2F2 Same size as object Real,inverted
Beyond 2F1 Between F2 and 2F2 Diminished Real,inverted
Between F1 and 2F1 Beyond 2F2 Magnified Real,inverted
At F1 Infinity Highly magnified Real,inverted
Between F1 and O On the same side as object Magnified Virtual, erect
Infinity F2 Point Sized Real,inverted

Concave lens forms virtual and erect image on the same side of the lens between F1 and O.

It is always diminished.

This table shows the Image formation by a convex lens.
Show the table here and point to different cases.

Point to case 1 in the table.

Here are 6 instances of placing an object.

We have already discussed case 1.

Case 2: Beyond 2F.

Point to case 2 in the table.

Switch to the simulation.

Drag the lens beyond 2F.

(drag the object - so that distance between lens and image is around 180 cm)

Case 2: Let us discuss the case of placing the object beyond 2F1.

Let’s measure the distance between the object and lens.

It is 160 cm.

Let us move the object beyond this measured distance that is beyond 2F.

The object distance is 180 cm.

Let us measure the distance between the lens and the image.


It is 150 cm.

This distance is less than 2F but more than F.

Hence we can say that the image is formed between F and 2F.

A real, inverted and diminished image is formed.

Let us put the scale back to its place.

Slide Number 9

Assignment

Show table on the slide.

As an assignment,

Place the object in other positions and

Check the image formed by the convex lens.

Use the table for your reference.

Follow the steps as shown in case 2.

Click on concave lens option Let us click on the concave lens button at the top.
Point to the concave lens. A concave lens is a diverging lens.

It generates a virtual and erect image.

The point where the rays seem to diverge is extended backwards.

Point to the rays. As the rays pass through the lens, they bend slightly outwards from the axis.

This is due to refraction of the lens. So the rays diverge.

Point to the focus.

(Drag as far as possible but let it be in the screen)

The focus is at the same side of the object.

Let us place the object beyond F1.

A diminished, virtual and erect image is formed between focus and lens.

Drag the object close to the lens. Now let us drag the object close to the concave lens.

Observe that the size of the image increases.

Click on the Mirror. Now let us explore the Mirror screen.
Point to the 3 types of mirror. This screen has 3 types of mirrors.

By default a concave mirror is selected.

Click on the labels check box. Click on the labels checkbox to see the labels of all the items..
Point to the front side.

Point to the back side.

For the concave mirror, front or left side is the reflecting surface.

Hence, the object is placed on this side.

Right side is the non-reflecting surface.

Point to the distance. The distance between the object and mirror is always positive.
Point to the image on the front side.

Drag the object and point to the image on the back side.

Point to the image formed.

If the image is on the front side, the distance is positive.

This is a real and inverted image.

Let us drag the object close to the mirror and see the image.

A virtual and enlarged image is formed on the right side of the object.

Slide Number 10:

Image formation by a Concave mirror.


Table 2 : Image formation by a concave mirror

Object Position Image Position Image Size Nature
At 2F1 At 2F2 Same size as object Real,inverted
Between F1 and O Behind the mirror Magnified Virtual, erect
Beyond 2F1 Between F2 and 2F2 Diminished Real,inverted
Between F1 and 2F1 Beyond 2F2 Magnified Real,inverted
At F1 Infinity Highly magnified Real,inverted
Infinity At the focus F2 Point Sized Real,inverted
This is the table for the Image formation by a concave mirror.
Only Narration.

Case 1:

Now, let us discuss an instance of placing an object at 2F1.

Let us reset the simulation.

And check the labels check box.

Drag the scale. Drag the scale to measure the distance.

The distance between the focal point and the mirror is 90 cm.

Let us measure the distance from the centre of the mirror to 2F1.

It is 180 cm.

Let us place the object at this point.

A real inverted image, same size as the object, is formed below the object.

Let us put the scale back to its place.

Slide Number 11

Assignment

Show table on the slide.

As an assignment,

Place the object in other positions and

check the image formed by the concave mirror.

Use the table for your reference.

Follow the steps as shown in case 1.

Click on the convex mirror button.

Drag the object back and forth and show a virtual image.

Now let us click the convex mirror button.

For this mirror left side is the front side.

The object is placed on this side.

Right side is the back side.

A convex mirror always forms a virtual image.

Drag the object back and forth to see the image.

Point to the image.

Let’s drag the object back and forth to see where the image is formed.

It is formed on the back side of the mirror.

Observe that the image formed is always a virtual image

Drag the object and show the size of the image. The image formed is always smaller in size than the object.
Only Narration With this we come to the end of this tutorial.

Let us summarise.

Slide Number 12

Summary

In this tutorial, we have learnt about,
  • Image formed by a lens and a mirror.
  • The distance between the lens or mirror and the image
  • Size and nature of the image.
Slide Number 13

Assignment

As an assignment,

Explore the Flat mirror option on your own.

Slide Number 14

About the Spoken Tutorial Project

The video at the following link summarises the Spoken Tutorial project.

Please download and watch it.

Slide Number 15

Spoken Tutorial workshops

The Spoken Tutorial Project team:

conducts workshops and gives certificates

For more details, please write to us.

Slide Number 16

Forum for specific questions:

Please post your timed queries in this forum.
Slide Number 17

Acknowledgement

The Spoken Tutorial project was established by the Ministry of Education, Govt. of India.
Thank you This tutorial is contributed by FOSSEE and Spoken Tutorial Project, IIT Bombay.

Thank you for joining.

Contributors and Content Editors

Madhurig