Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Table of Ray through lens' topicStudent Support Forum > General > Archives > "Table of Ray through lens"

< Previous CommentHelp | Reply To Comment | Reply To Topic
Author Comment/Response
Bill Simpson
02/28/13 2:20pm

In Response To 'Re: Table of Ray through lens'
---------
That is much more helpful. Thank you.

First. Optional.

In[2]:= \[Theta]2 = ArcSin[(n1(x-xo+(y-(f/.t->xo))(ff/.t->xo)))/(n2(y-(f/.t->xo)+(-x+xo)(ff/.t->xo))\[Sqrt]((((x-xo)^2+y^2-2y(f/.t->xo)+(f/.t->xo)^2)(1+(ff/.t->xo)^2))/(y-(f/.t->xo)+(-x+ xo)(ff/.t->xo))^2))]

and

In[3]:= \[Theta]2 = ArcSin[(n1(x-xo+(y-f))ff))/ (n2(y-f+(-x+xo)ff)\[Sqrt]((((x-xo)^2+y^2-2y f+f^2)(1+ff)^2))/(y-f)+(-x+xo)ff)^2))]/.t->xo

appear to produce exactly the same result, if I haven't made any errors in trying to turn this back into ordinary text. In other words, /.t->x0 at the end of a whole expression should translate every t it finds inside the expression. Try this with caution, but it might help make your expressions smaller and easier to understand if it works.

Next. Your wanting equally spaced lines.

In your Plot Prolog replace this

Line[{{x,y}, {xo,(f/.t->xo)}}],Line[{{xo,(f/.t->xo)}, {xu,(g/.t->xu)}, {xe,ye}}]

with this:

Sequence@@Table[Line[{{x,y}, {xo,(f/.t->xo)},{xu,(g/.t ->xu)}, {xe, ye}}],{xo,-4,4,1/2}]

That should create a list of all the bent lines that you want to have, then strip off the outer {} and place that in your Prolog. I'm getting all the lines above the first surface, but the rest are causing me trouble.

Ah, and xo can no longer be a Manipulate variable, the value for xo will be stepped in that Table[].

When I run this I'm getting some errors about zeros in denominators and infinities.

I try inserting this immediately before your Plot[].

Print[Table[{Line[{{x,y}, {xo,(f/.t->xo)}, {xu,(g/.t->xu)}, {xe,ye}}]}, {xo, -4, 4,1/2}]];

and the first part of the Print I see is

{{Line[{{0, 3},
{-4, 0},
{{-8., -1.70827},
{4.47214- 5.2915 I, -1.27954}},
{{10.0509+ 1.79353 I, -10.2496 - 37.0125 I}, {1.76058- 12.0179 I, -30.0379 + 10.9928 I}}}]},

So the first two points on the line look good, but the third and fourth point I'm guessing are what looks like multiple solutions from your Solve, some are complex, and it is blowing up.

Maybe I'm misusing your code somehow. Maybe my initial values for the manipulate variables, which I didn't touch or change,

x = 0; y = 3; n1 = 1; n2 = 1.6;

are inappropriate.

I think we are close but I'm running out of ideas. See if you can spot and fix a problem and get it working.

Please test all this carefully and try to make sure I have not made any mistakes in this. Hopefully there is not some

URL: ,

Subject (listing for 'Table of Ray through lens')
Author Date Posted
Table of Ray through lens Nickel 02/25/13 1:28pm
Re: Table of Ray through lens Bill Simpson 02/27/13 11:40am
Re: Table of Ray through lens Nickel 02/28/13 11:50am
Re: Re: Table of Ray through lens Bill Simpson 02/28/13 2:20pm
< Previous CommentHelp | Reply To Comment | Reply To Topic