Message Boards Message Boards

Reducing code size for intensity profile of Newton rings?

Posted 2 years ago

Hi all, I am new to this community & Mathematica. I want to generate Newtons Rings simulation with user interface, I found one similar & exact what I want, but lengthy code & reputations. Pls see url.

I feel happy if one suggest & give idea in reducing expressions.

Waiting for reply.

"Intensity Profiles for Newton's Rings"

 http://demonstrations.wolfram.com/IntensityProfilesForNewtonsRings/
 Wolfram Demonstrations Project
 Published: September 22, 2016

POSTED BY: Nataraj G
Posted 2 years ago

Here is the syntax ...any one can suggest idea in limiting with any other commands

Manipulate[Switch[a,

  1, DensityPlot[(Cos[((Pi*2*((x^2 + y^2)/(2 R))/lambda) + 
        Pi/2)])^2, {x, -0.2, 0.2}, {y, -0.2, 0.2}, PlotPoints -> 70, 
   FrameTicksStyle -> Directive[Black, 10], ImageSize -> 400,
   FrameLabel -> {Style["distance, cm", Black, 14], 
     Style["distance, cm", Black, 14]}],

  2, DensityPlot[(Cos[((Pi*2*((x^2 + y^2)/(2 R))/
          lambda))])^2, {x, -0.2, 0.2}, {y, -0.2, 0.2}, 
   PlotPoints -> 70, FrameTicksStyle -> Directive[Black, 10], 
   ImageSize -> 400,
   FrameLabel -> {Style["distance, cm", Black, 14], 
     Style["distance, cm", Black, 14]}],

  3, Plot[(Cos[((Pi*2*(r^2/(2 R))/lambda) + Pi/2)])^2, {r, 0.001, 
    0.2}, Frame -> True, FrameTicksStyle -> Directive[Black, 10], 
   ImageSize -> 400,
   FrameLabel -> {Style["radius, cm", Black, 14], 
     Style["intensity, a.u.", Black, 14]}, Axes -> True, 
   PlotStyle -> Darker[Yellow], AspectRatio -> 1],

  4, Plot[(Cos[((Pi*2*(r^2/(2 R))/lambda))])^2, {r, 0.001, 0.2}, 
   Frame -> True, FrameTicksStyle -> Directive[Black, 10], 
   ImageSize -> 400,
   FrameLabel -> {Style["radius, cm", Black, 14], 
     Style["intensity, a.u.", Black, 14]}, Axes -> True, 
   PlotStyle -> Darker[Pink], AspectRatio -> 1],

  5, Show[
   DensityPlot[(Cos[((Pi*2*(r^2/(2 R))/lambda) + Pi/2)])^2, {r, 0.001,
      0.2}, {y, 0.001, 1}, PlotPoints -> 100, Frame -> True, 
    FrameTicksStyle -> Directive[Black, 10], ImageSize -> 400,
    FrameLabel -> {Style["radius, cm", Black, 14], 
      Style["intensity, a.u.", Black, 14]}, Axes -> True], 
   Plot[(Cos[((Pi*2*(r^2/(2 R))/lambda) + Pi/2)])^2, {r, 0.001, 0.2}, 
    Frame -> True,
    FrameLabel -> {"radius, cm", "intensity, a.u.", 
      "Newton's rings (reflected)"}, Axes -> True, 
    PlotStyle -> {Darker[Blue], Dashed}], AspectRatio -> 1],

  6, Show[
   DensityPlot[(Cos[((Pi*2*(r^2/(2 R))/lambda))])^2, {r, 0.001, 
     0.2}, {y, 0.001, 1}, PlotPoints -> 100, Frame -> True, 
    FrameTicksStyle -> Directive[Black, 10], ImageSize -> 400,
    FrameLabel -> {Style["radius, cm", Black, 14], 
      Style["intensity, a.u.", Black, 14]}, Axes -> True], 
   Plot[(Cos[((Pi*2*(r^2/(2 R))/lambda))])^2, {r, 0.001, 0.2}, 
    Frame -> True, ImageSize -> 400,
    FrameLabel -> {"radius, cm", "intensity, a.u.", 
      "Newton's rings(transmitted)"}, Axes -> True, 
    PlotStyle -> {Darker[Purple], Dashed}], AspectRatio -> 1]
  ],
 Column[{
   Control@{{R, 60, 
      Row[{"radius of curvature of lens ", Style["R", Italic], 
        ", cm"}]}, 20, 150, 10, Appearance -> "Labeled"}, 
   Control@{{lambda, 5*10^-5 // N, "wavelength \[Lambda], cm"}, 
     4*10^-5 // N, 8*10^-5 // N, 1*10^-5 // N, 
     Appearance -> "Labeled"},
   Control@{{a, 1, "plots"}, {
      1 -> "simulation of Newton's rings (reflected)", 
      2 -> "simulation of Newton's rings (transmitted)", 
      3 -> "line intensity profile of Newton's rings (reflected)", 
      4 -> "line intensity profile of Newton's rings (transmitted)", 
      5 -> "Newton's rings (reflected) intensity profile: combined \
plot", 6 -> 
       "Newton's rings (transmitted) intensity profile: combined plot"
      }, ControlType -> PopupMenu}
   }, Alignment -> Left]
 ]
POSTED BY: Nataraj G
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract