General Physics 102 lab

profilesawyer2016
optics.zip

optics/ABline.class

                synchronized 
                class ABline {
    
                static double 
                eps;
    
                static double 
                PI2;
    int 
                xa;
    int 
                ya;
    int 
                xb;
    int 
                yb;
    double 
                ca;
    double 
                cb;
    double 
                m;
    double 
                b;
    double 
                index;
    double 
                x;
    double 
                y;
    double 
                len;
    double 
                cta;
    double 
                alpha;
    double 
                r12p;
    double 
                r12s;
    boolean 
                total;
    double 
                rc;
    double 
                twoPI;
    void 
                draw(java.awt.Graphics);
    void 
                translate(int, int);
    void 
                setPoints(int, int, int, int);
    double 
                angle(double, double, double, double);
    boolean 
                touch(ray);
    ray 
                reflection(ray);
    ray 
                refraction(ray);
    void ABline(double);
    
                static void 
                <clinit>();
}

            

optics/box.class

                public 
                synchronized 
                class box 
                extends java.applet.Applet {
    double 
                time;
    java.awt.Dimension 
                area;
    java.awt.Image 
                bgImage;
    java.awt.Image 
                fgImage;
    java.awt.Graphics 
                gb;
    java.awt.Graphics 
                g;
    java.awt.Color 
                bgColor;
    String 
                rts;
    String[] 
                STR;
    int 
                xx;
    int 
                yy;
    boolean 
                rightClick;
    int 
                size;
    int 
                size2;
    int 
                size4;
    int 
                dragLight;
    boolean 
                changed;
    int 
                xs;
    int 
                ys;
    java.awt.FontMetrics 
                fm;
    int 
                chy;
    int 
                tx;
    int 
                ty;
    int[] 
                b;
    int 
                xc;
    boolean 
                display;
    java.awt.Point[] 
                light;
    double 
                len;
    double 
                index;
    java.awt.Polygon 
                hp;
    java.awt.Polygon 
                tp;
    double 
                PI6;
    double 
                LEN;
    boolean 
                showC;
    
                public void 
                init();
    String 
                d2String(double);
    
                public boolean 
                mouseDown(java.awt.Event, int, int);
    
                public boolean 
                mouseDrag(java.awt.Event, int, int);
    
                public boolean 
                mouseUp(java.awt.Event, int, int);
    
                public boolean 
                mouseMove(java.awt.Event, int, int);
    void 
                clear(boolean);
    
                public void 
                paint(java.awt.Graphics);
    void 
                drawPointer(java.awt.Point, java.awt.Point);
    
                public void 
                update(java.awt.Graphics);
    void 
                drawRay(double, double, double);
    
                public void box();
}

            

optics/c1.gif

optics/c2.gif

optics/er.gif

optics/esp.gif

optics/eye.gif

optics/eyescan.gif

optics/fiber.class

                public 
                synchronized 
                class fiber 
                extends java.applet.Applet {
    double 
                time;
    java.awt.Dimension 
                area;
    java.awt.Image 
                bgImage;
    java.awt.Image 
                fgImage;
    java.awt.Graphics 
                gb;
    java.awt.Graphics 
                g;
    java.awt.Color 
                bgColor;
    String 
                rts;
    String[] 
                STR;
    java.awt.TextField 
                tf;
    int 
                xs;
    int 
                ys;
    boolean 
                rightClick;
    boolean 
                draghead;
    boolean 
                dragtail;
    java.awt.FontMetrics 
                fm;
    int 
                chy;
    int 
                x1;
    int 
                y1;
    int 
                y2;
    int 
                xx;
    int 
                yy;
    int 
                dd;
    java.awt.Point 
                head;
    java.awt.Point 
                tail;
    double 
                m;
    double 
                b;
    double 
                x;
    double 
                y;
    double 
                sc2;
    double 
                tc2;
    double 
                n;
    java.awt.Polygon 
                hp;
    java.awt.Polygon 
                tp;
    double 
                PI6;
    double 
                LEN;
    double 
                cta;
    
                public void 
                init();
    
                public boolean 
                action(java.awt.Event, Object);
    String 
                d2String(double);
    
                public boolean 
                mouseDown(java.awt.Event, int, int);
    
                public boolean 
                mouseDrag(java.awt.Event, int, int);
    
                public boolean 
                mouseUp(java.awt.Event, int, int);
    void 
                clear();
    
                public void 
                paint(java.awt.Graphics);
    
                public void 
                update(java.awt.Graphics);
    double 
                drawIt(double, double, double);
    void 
                drawPointer(java.awt.Point, java.awt.Point);
    
                public void fiber();
}

            

optics/fish.swf

optics/i.gif

optics/ie.gif

optics/image.class

                public 
                synchronized 
                class image 
                extends java.applet.Applet 
                implements Runnable {
    java.awt.Dimension 
                area;
    java.awt.Image 
                bgImage;
    java.awt.Image 
                fgImage;
    java.awt.Graphics 
                gb;
    java.awt.Graphics 
                g;
    java.awt.Color 
                bgColor;
    String 
                rts;
    String[] 
                STR;
    int 
                xx;
    int 
                yy;
    int 
                xs2;
    int 
                ys2;
    boolean 
                running;
    Thread 
                animThread;
    long 
                startTime;
    long 
                lastTime;
    long 
                delay;
    long 
                delta;
    double 
                c;
    int 
                cnt;
    int 
                ns;
    double 
                xt;
    double 
                yt;
    double 
                bt;
    boolean 
                rightClick;
    boolean 
                dragm;
    boolean 
                dragd;
    boolean 
                dragd2;
    boolean 
                down;
    int 
                xs;
    int 
                ys;
    double 
                cta1;
    double 
                cta2;
    double 
                ctaa;
    double 
                dd;
    double 
                PI2;
    double 
                m;
    int 
                ni;
    int 
                nf;
    int 
                n;
    double 
                V;
    double 
                dc2;
    java.awt.FontMetrics 
                fm;
    int 
                chy;
    int 
                xc;
    int 
                yc;
    int 
                size;
    int 
                size2;
    int 
                xm;
    int 
                ym;
    int 
                ym2;
    int 
                Nmax;
    int 
                NR;
    int 
                Nmax1;
    double 
                cta;
    double 
                rm;
    double 
                dc;
    double[] 
                CR;
    double[] 
                X;
    double[] 
                Y;
    double[] 
                VX;
    double[] 
                VY;
    double 
                cst;
    int 
                NI;
    double[] 
                PXA;
    double[] 
                PYA;
    double[] 
                PXB;
    double[] 
                PYB;
    java.awt.Point 
                na;
    java.awt.Point 
                nb;
    
                public void 
                init();
    
                public void 
                reset();
    
                public void 
                start();
    
                public void 
                stop();
    
                public void 
                run();
    void 
                advanced(double);
    
                public boolean 
                mouseDown(java.awt.Event, int, int);
    
                public boolean 
                mouseDrag(java.awt.Event, int, int);
    void 
                setupRay();
    
                public boolean 
                mouseUp(java.awt.Event, int, int);
    void 
                clear();
    
                public void 
                paint(java.awt.Graphics);
    void 
                imgs(double, double, double[], double[], java.awt.Point);
    
                public void 
                update(java.awt.Graphics);
    
                public void image();
}

            

optics/image_e.html

Multiple Reflection from two plane mirrors

Rays of lights are reflected from the mirror, each ray satisfying the law of reflection. It is fun to play with two plane mirrors,  multiple images are formed. Would you like to try it with this java applet?

The inverted moving fish (virtual image) is what the observer (fish on the left) will see underwater.

When the moving fish is away from the observer,     light emitter from the moving fish will be totally reflected at the water-air interface. So the water-air interface acting like a mirror. When the distance is too short for the total internal reflection to occurs,     the virtual image above the water vanished.

You can click and drag the observer left/right to change its location. More information will be shown when you drag the observer (fish).

Why does a fish appear to be closer to the surface of water than it really is?

The following java applet let you find out the answer,     and learn the physics of refraction, and total internal reflection.

[removed] [removed]

Usage:

A scanning eye represent the observer. You can click on it and drag it to any position you like. The whole screen will be clear when you drag the scanning eye.

You can draw any pattern you like, and the java program will draw the virtual image of it.  ( If the virtual can be formed due to refraction or total internal reflection)

When you draw in the water region,      the region where the total internal reflection is possible, will be shown.

If you click the right mouse button, it will show you many light rays emitted.     (including refraction rays and total internal reflection rays)

Right click the mouse button twice is another way to clear the screen.

to java applet This is an image
You can draw any thing within the animation region, for example: the object shown in the above image.

Light emitted from the object is refracted at the water and air interface. The observer trace back those refracted light to find the image of the object.

The image appear closer to the water surface and its shape is different from the object.

How to determine the location of the image (yellow dot) ?

The world viewed under water is different from what we view it above the water surface.

Drag the observer (eye) under the water and find out more interesting phenomena.

Your suggestions are highly appreciated! Please click [email protected]
Author¡G
                Fu-Kwun Hwang, 
                Dept. of physics, 
                National Taiwan Normal University
            
Last modified :  More physics related java applets  

optics/point.class

                synchronized 
                class point {
    
                static java.awt.Graphics 
                gb;
    
                static java.awt.Rectangle 
                r;
    
                static double 
                n;
    
                static int 
                cnt;
    double 
                x;
    double 
                y;
    double 
                vx;
    double 
                vy;
    double 
                v;
    double 
                c;
    int 
                status;
    void 
                set(double, double, double, double);
    
                static void 
                init(java.awt.Graphics, java.awt.Rectangle, double);
    point 
                advanced(double);
    void point(double, double, double, double);
}

            

optics/prism.class

                public 
                class prism 
                extends java.applet.Applet {
    double 
                time;
    java.awt.Dimension 
                area;
    java.awt.Image 
                bgImage;
    java.awt.Image 
                fgImage;
    java.awt.Graphics 
                gb;
    java.awt.Graphics 
                g;
    java.awt.Color 
                bgColor;
    int 
                xx;
    int 
                yy;
    boolean 
                rightClick;
    boolean 
                movep;
    boolean 
                dragt;
    boolean 
                dragh;
    boolean 
                dragp;
    int 
                xs;
    int 
                ys;
    boolean 
                check;
    double[] 
                C;
    double 
                PI2;
    java.awt.FontMetrics 
                fm;
    prisms 
                p;
    int 
                chy;
    int 
                xa;
    java.awt.Rectangle 
                box;
    java.awt.Point 
                head;
    java.awt.Point 
                tail;
    int 
                N;
    int 
                n;
    int 
                N2;
    double 
                V;
    ray 
                light;
    double 
                I;
    int 
                size;
    int 
                size2;
    double 
                dist;
    double 
                angle;
    java.awt.Polygon 
                hp;
    java.awt.Polygon 
                tp;
    double 
                PI6;
    double 
                cta;
    double 
                ctaa;
    double 
                c2a;
    double 
                LEN;
    double 
                maxI;
    int 
                maxCnt;
    int 
                Cnt;
    ABline 
                AB;
    
                public void 
                init();
    
                public void 
                reset();
    String 
                d2String(double);
    
                public boolean 
                mouseDown(java.awt.Event, int, int);
    
                public boolean 
                mouseDrag(java.awt.Event, int, int);
    
                public boolean 
                mouseUp(java.awt.Event, int, int);
    
                public void 
                changeIndex(double);
    void 
                clear();
    
                public void 
                paint(java.awt.Graphics);
    
                public void 
                update(java.awt.Graphics);
    void 
                drawPointer(java.awt.Point, java.awt.Point);
    ray 
                drawRay(ray);
    void 
                drawTo(ray);
    ABline 
                getTouch(ray);
    
                public void prism();
}

            

optics/prisms.class

                class prisms {
    int 
                N;
    int 
                N1;
    java.awt.Polygon 
                P;
    int 
                xc;
    int 
                yc;
    double[] 
                L;
    double[] 
                C;
    double 
                PI2;
    ABline[] 
                AB;
    java.awt.Rectangle 
                r;
    int 
                size;
    int 
                size2;
    double 
                ax;
    double 
                ay;
    double 
                bx;
    double 
                by;
    double 
                ac;
    double 
                dv;
    double 
                c2a;
    int 
                dragID;
    void prisms(int, int, double, double);
    void 
                setXY();
    void 
                setLine(int);
    void 
                drawPrism(java.awt.Graphics, java.awt.Color);
    void 
                drawAngles(java.awt.Graphics, int, int);
    double 
                angleAB(int, int, int);
    void 
                fillPrism(java.awt.Graphics, java.awt.Color);
    void 
                translate(int, int);
    boolean 
                checkDrag(int, int);
    void 
                drag(int, int);
}

            

optics/prism_e.html

Prism: Reflection and refraction

This java applet let you play with a light source and a prism, to study the physics of light. There are reflection and refraction occurs at the interface between two media. (Total internal reflection might also occurs) [removed] [removed] [removed] refractive indices: air (n1)= prism(n2)= Do not forget to hit ENTER key

Usage:
Click the red region to change the light direction. Click other region of light source can move the light pen to differ location( even inside the prism).

Click one of the corner of the prism to change the shape of prism. Click inside the prism to change its location.

When tracing of the light will terminated when the ray intensity is less than  than 0.4%. The relative intensity for each ray is shown at the boundary. Intensity of red and green are used to represent two different polarization. The yellow light (sum of red light and green light) represent equal intensity of two polarization waves.

At Brewster's angle, only one of the polarized light is refracted, and other one is totally reflected. The index of refraction for the prism is 1.5

Things to watch:
1. Total internal reflection 2. Change in light intensity 3. There might be small bugs, did you find out?
Light will travel with different speed at different media, which cause the reflection and refraction.

For reflection: the angle of incidence is equal to angle of reflection. For refraction: the Snell's law govern the angle

index of refraction for media 1:  angle of incidence  index of refraction for media 2:  angle of refraction 
Part of the energy is reflected and the rest propagate into new media. The ratio depend on incident angle and index of refraction ( refracted angle ) EM (transverse) wave can have  two polarization (perpendicular to each other and ) The intensity  is proportional to  The intensity of electric field changed when reflection/refraction occurs,

where  So the intensity for the reflected light  is proportional to

Since the energy is conserved, so we can find out the  intensity of refraction light.

For normal incident, both  and  equal to zero. The coefficient are the same =  For light emit from air (n=1.) into glass (n=1.5) The electric field scale to  = (1.5-1)/(1.5+1)=0.2 So the intensity of the reflection scale to 0.22=0.04 ( 4% of incident light) So 96% light will enter the glass and only  4% of light were reflected.

This java applet use above equations to calculate the relative intensity of each ray.

to java applet Your suggestions are highly appreciated! Please click [email protected]
Author:
                Fu-Kwun Hwang, 
                Dept. of physics, 
                National Taiwan Normal University
            
Last modified :  More physics related java applets

optics/r12p.gif

optics/r12s.gif

optics/ray.class

                synchronized 
                class ray {
    double 
                x;
    double 
                y;
    double 
                cta;
    double 
                r;
    double 
                p;
    boolean 
                fromAir;
    double 
                eps;
    java.awt.Color 
                color(float);
    void 
                setAngle(int, int, int, int);
    void 
                setXY(int, int);
    double 
                intensity();
    void ray(int, int);
    void ray();
    void ray(double, double, double, double, double, boolean);
}

            

optics/refraction.class

                public 
                synchronized 
                class refraction 
                extends java.applet.Applet 
                implements Runnable {
    int 
                yOffset;
    double 
                time;
    java.awt.Dimension 
                area;
    java.awt.Image 
                bgImage;
    java.awt.Image 
                fgImage;
    java.awt.Graphics 
                gb;
    java.awt.Graphics 
                g;
    java.awt.Color 
                bgColor;
    String 
                rts;
    String[] 
                STR;
    int 
                xx;
    int 
                yy;
    boolean 
                running;
    Thread 
                animThread;
    long 
                startTime;
    long 
                lastTime;
    long 
                delay;
    long 
                delta;
    point 
                p;
    boolean 
                rightClick;
    java.awt.FontMetrics 
                fm;
    int 
                chy;
    int 
                tx;
    int 
                ty;
    int 
                yc;
    int 
                xp;
    int 
                yp;
    int 
                N;
    int 
                ray2cnt;
    double 
                n;
    point[] 
                ray;
    point[] 
                ray2;
    java.awt.Rectangle 
                r;
    double 
                vw;
    int 
                size;
    int 
                size2;
    
                public void 
                init();
    
                public boolean 
                action(java.awt.Event, Object);
    
                public void 
                reset();
    String 
                d2String(double);
    
                public void 
                start();
    
                public void 
                stop();
    
                public void 
                run();
    void 
                advanced(double);
    
                public boolean 
                mouseDown(java.awt.Event, int, int);
    
                public boolean 
                mouseDrag(java.awt.Event, int, int);
    
                public boolean 
                mouseUp(java.awt.Event, int, int);
    void 
                clear();
    
                public void 
                paint(java.awt.Graphics);
    
                public void 
                update(java.awt.Graphics);
    
                public void refraction();
}

            

optics/shadow.class

                public 
                synchronized 
                class shadow 
                extends java.applet.Applet 
                implements Runnable {
    double 
                time;
    java.awt.Dimension 
                area;
    java.awt.Image 
                bgImage;
    java.awt.Image 
                fgImage;
    java.awt.Graphics 
                gb;
    java.awt.Graphics 
                g;
    java.awt.Color 
                bgColor;
    String 
                rts;
    String[] 
                STR;
    int 
                xx;
    int 
                yy;
    boolean 
                running;
    Thread 
                animThread;
    long 
                startTime;
    long 
                lastTime;
    long 
                delay;
    long 
                delta;
    boolean 
                rightClick;
    boolean 
                dragr;
    java.awt.FontMetrics 
                fm;
    int 
                chy;
    int 
                tx;
    int 
                ty;
    int 
                x0;
    int 
                y0;
    int 
                size;
    int 
                size2;
    int 
                xc;
    java.awt.Rectangle 
                r;
    java.awt.Rectangle 
                s;
    double 
                m;
    double 
                b;
    double 
                x1;
    double 
                x2;
    double 
                y1;
    double 
                y2;
    
                public void 
                init();
    
                public boolean 
                action(java.awt.Event, Object);
    
                public void 
                reset();
    String 
                d2String(double);
    
                public void 
                start();
    
                public void 
                stop();
    
                public void 
                run();
    void 
                advanced(double);
    
                public boolean 
                mouseDown(java.awt.Event, int, int);
    
                public boolean 
                mouseDrag(java.awt.Event, int, int);
    
                public boolean 
                mouseUp(java.awt.Event, int, int);
    void 
                clear();
    
                public void 
                paint(java.awt.Graphics);
    
                public void 
                update(java.awt.Graphics);
    
                public void shadow();
}

            

optics/shadow.html

標題

起頭

[removed] [removed] [removed]

使用說明:

物理解說:

to java applet 歡迎批評指教! 電子郵件 : 請按 [email protected] 作者: 國立台灣師範大學 物理系 黃福坤 最後修訂時間: