Plot Relative Intensity of Function in Maple

10 replies · 2K views · last reply
Schwarzschild90
Messages
111
Reaction score
1

Homework Statement


Plot the following function in maple (any graphics software):

[itex]I_\theta = I_m (cos (\beta))^2 \left( \frac{sin(\alpha)}{\alpha} \right)^2[/itex]

Homework Equations


Range = -20 degrees to 20 degrees
[itex]\beta = \frac{\pi d}{\lambda} \sin(\theta)[/itex]
[itex]\alpha = \frac{\pi a}{\lambda} \sin(\theta)[/itex]
[itex]d = 0,2[/itex]
[itex]a = 0,1[/itex]
[itex]\lambda = 632,8[/itex]

The Attempt at a Solution


This is the maple code:
plot((cos((Pi*.2)*sin(theta)/(632.8))^2)(sin((Pi*.1)*sin(theta)/(632.8))*(632.8)/((Pi*.1)*sin(theta)))^2, theta = convert(-20*degrees, radians) .. convert(20*degrees, radians), axes = boxed);

And in latex:

[itex]\displaystyle {\it plot} \left( \left( \left( \left( \cos \left( 0.0009929180323\\<br /> \mbox{}\,\sin \left( \theta \right) \right) \right) ^{2} \right) \left( 2014.264960\,{\frac {\sin \left( 0.0004964590161\\<br /> \mbox{}\,\sin \left( \theta \right) \right) }{\sin \left( \theta \right) }} \right) \right) ^{2},\theta={{\it convert} \left( -20\\<br /> \mbox{}\,{\it degrees},{\it radians} \right) \ldots {\it convert} \left( 20\,{\it degrees},{\it radians} \right) }\\<br /> \mbox{},{\it axes}={\it boxed} \right)[/itex]Yields this:

Maple plot of a smooth single-peaked curve over theta from -3pi/32 to 3pi/32, peaking at 1 at theta = 0 and falling to about 0.9999998 at the ends; y-axis tick labels range from 0.99999980 to 1.


It should have a spike at (-17.5 degrees in radians) and at 0 degrees in radians and another at 17.5 degrees in radians. Mine has a single spike at 0 degrees in radians.
 
Last edited:
Schwarzschild90 said:

Homework Statement


Plot the following function in maple (any graphics software):

[itex]I_\theta = I_m (cos (\beta))^2 \left( \frac{sin(\alpha)}{\alpha} \right)^2[/itex]

Homework Equations


Range = -20 degrees to 20 degrees
[itex]\beta = \frac{\pi d}{\lambda} \sin(\theta)[/itex]
[itex]\alpha = \frac{\pi a}{\lambda} \sin(\theta)[/itex]
[itex]d = 0,2[/itex]
[itex]a = 0,1[/itex]
[itex]\lambda = 632,8[/itex]

The Attempt at a Solution


This is the maple code:
plot((cos((Pi*.2)*sin(theta)/(632.8))^2)(sin((Pi*.1)*sin(theta)/(632.8))*(632.8)/((Pi*.1)*sin(theta)))^2, theta = convert(-20*degrees, radians) .. convert(20*degrees, radians), axes = boxed);
Your Maple code is wrong, I believe. Simplifying greatly, ##\cos(\beta) = \cos(\sin(\theta))## (with several factors removed), and similarly for ##\sin(\alpha)##. Your Maple code above appears to be multiplying these functions instead of using function composition.

Also, instead of working with the very long plot expression that you have above, it would be worthwhile to assign some variables above the plot statement. For example, create a variable and assign the value ##\pi/2## to it. And another for the 632.8 constant -- where does this one come from? Is that ##\frac{\pi \lambda}{d}##? It looks like you might have missed the other constant, ##\frac{\pi \lambda}{a}##.

Schwarzschild90 said:
And in latex:

[itex]\displaystyle {\it plot} \left( \left( \left( \left( \cos \left( 0.0009929180323\\<br /> \mbox{}\,\sin \left( \theta \right) \right) \right) ^{2} \right) \left( 2014.264960\,{\frac {\sin \left( 0.0004964590161\\<br /> \mbox{}\,\sin \left( \theta \right) \right) }{\sin \left( \theta \right) }} \right) \right) ^{2},\theta={{\it convert} \left( -20\\<br /> \mbox{}\,{\it degrees},{\it radians} \right) \ldots {\it convert} \left( 20\,{\it degrees},{\it radians} \right) }\\<br /> \mbox{},{\it axes}={\it boxed} \right)[/itex]Yields this:

View attachment 93338

It should have a spike at (-17.5 degrees in radians) and at 0 degrees in radians and another at 17.5 degrees in radians. Mine has a single spike at 0 degrees in radians.
 
  • Like
Likes   Reactions: Schwarzschild90
I cleaned up the code, as you suggested
Maple plot command: plot of ((cos(sin(theta)))^2 * ((sin(sin(theta)))/((Pi*0.1)/632.8 - sin(theta)))^2) with theta from -Pi/2 to Pi/2 and axes = boxed.

Maple plot of a bell-shaped curve over theta from -π/2 to π/2, peaking at 1 at theta = 0 and falling to about 0.1 at both ends, with y-axis ticks 0.1 to 0.9.


I can't see where the error is
 
Attachments
  • Plain text expression sin(theta) typed as Maple input.
    upload_2015-12-14_17-54-25.png
    500 bytes · Views: 481
Schwarzschild90 said:

Homework Statement


Plot the following function in maple (any graphics software):

[itex]I_\theta = I_m (cos (\beta))^2 \left( \frac{sin(\alpha)}{\alpha} \right)^2[/itex]

Homework Equations


Range = -20 degrees to 20 degrees
[itex]\beta = \frac{\pi d}{\lambda} \sin(\theta)[/itex]
[itex]\alpha = \frac{\pi a}{\lambda} \sin(\theta)[/itex]
[itex]d = 0,2[/itex]
[itex]a = 0,1[/itex]
[itex]\lambda = 632,8[/itex]

The Attempt at a Solution


This is the maple code:
plot((cos((Pi*.2)*sin(theta)/(632.8))^2)(sin((Pi*.1)*sin(theta)/(632.8))*(632.8)/((Pi*.1)*sin(theta)))^2, theta = convert(-20*degrees, radians) .. convert(20*degrees, radians), axes = boxed);

And in latex:

[itex]\displaystyle {\it plot} \left( \left( \left( \left( \cos \left( 0.0009929180323\\<br /> \mbox{}\,\sin \left( \theta \right) \right) \right) ^{2} \right) \left( 2014.264960\,{\frac {\sin \left( 0.0004964590161\\<br /> \mbox{}\,\sin \left( \theta \right) \right) }{\sin \left( \theta \right) }} \right) \right) ^{2},\theta={{\it convert} \left( -20\\<br /> \mbox{}\,{\it degrees},{\it radians} \right) \ldots {\it convert} \left( 20\,{\it degrees},{\it radians} \right) }\\<br /> \mbox{},{\it axes}={\it boxed} \right)[/itex]Yields this:

View attachment 93338

It should have a spike at (-17.5 degrees in radians) and at 0 degrees in radians and another at 17.5 degrees in radians. Mine has a single spike at 0 degrees in radians.

I want to test the plot myself, but I do not know what your ##I_m## means. It looks like a notation for a Bessel function of the second kind, but I do not see any Bessel functions in your plotting expressions.
 
I've taken I_m = 1 and since I know only a little about bessel functions, I cannot tell you if this is one.

(I know that Bessel functions can be used to model the waves coming off of a bass)
 
Last edited:
Ray Vickson said:
I want to test the plot myself, but I do not know what your ##I_m## means. It looks like a notation for a Bessel function of the second kind, but I do not see any Bessel functions in your plotting expressions.

With the parameters you gave, the intensity ##I_{\theta}## is smooth, has no "spikes" (if I understand that to mean a very sharp, pointed peak), and is so close to 1 for ##-20^o < \theta < 20^o## that it will plot as a straight line (unless you restrict the y-axis to values between about 0.999995 to 1.0, as you did in your first post).

You can see this easily. Let ##\beta = u \sin(\theta)## and ##\alpha = v \sin(\theta)##, where ##u = \pi d/ \lambda \doteq 0 .9929180323 \, 10^{-3}## and ##v = \pi a / \lambda \doteq 0.4964590161\, 10^{-3}##. Then, with ##\theta## in radians we have
[tex]I_{\theta} = \cos^2 (u \sin(\theta)) \, \left( \frac{\sin(v \sin(\theta))}{v \sin(\theta)} \right)^2[/tex]
Note that ##I_{\theta}## is an even function of ##\theta##, so to know its behavior on ##\theta \in (-\pi,\pi)## it is sufficient to restrict attention to the positive half ##\theta \in [0, \pi)##. You can find its local minimal on ##-\pi < \theta < \pi## by solving ##(d/d \, \theta) I_{\theta} = 0 ## numerically; the solution is at ##\theta = \theta_m = 1.5707963267948966192##, at which point we have ##I_{\theta} = .99999893185601793245##. In other words, on the interval ##-\pi < \theta < \pi## the function ##I_{\theta}## lies between a minimum of ##0.9999989## (at ##\theta = \pm 1.5707##) and a maximum of ##1.0## at ##\theta = 0##.

You can also see this using an expansion of ##I_{\theta}## around ##\theta = 0##. Its Maclaurin expansion is
[tex]I_{\theta} = 1 + p_2 S^2 + p_4 S^4+ p_6 S^6 + \cdots, \; \text{with } \; S = \sin(\theta)[/tex]
where
[tex]\begin{array}{lcr}<br /> p_2 &=&-0.10680434033590471660 \, 10^{-5} \\<br /> p_4& =&0.40768810279355082790 \, 10^{-12} \\<br /> p_6& =&-0.71916540449698892880 \, 10^{-19}<br /> \end{array}[/tex]
In other words, ##I_{\theta} \doteq 1 - 0.0000011 \, S^2 + 0.00000000000076 \, S^4 - 0.000000000000000000072 \, S^6 + \cdots##, for ##-1 < S = \sin(\theta) < 1##.

The results in your first post are correct, so your supposition about "spikes" is incorrect.
 
Last edited:
I see that, but I am still at a total loss though
 
Schwarzschild90 said:
I see that, but I am still at a total loss though

At a total loss about what? You have a correct plot, so if somebody told you there should be a spike at 17.5 degrees they were telling you something that is NOT TRUE.
 
Schwarzschild90 said:

Homework Statement


Plot the following function in maple (any graphics software):

[itex]I_\theta = I_m (cos (\beta))^2 \left( \frac{sin(\alpha)}{\alpha} \right)^2[/itex]

Homework Equations


Range = -20 degrees to 20 degrees
[itex]\beta = \frac{\pi d}{\lambda} \sin(\theta)[/itex]
[itex]\alpha = \frac{\pi a}{\lambda} \sin(\theta)[/itex]
[itex]d = 0,2[/itex]
[itex]a = 0,1[/itex]
[itex]\lambda = 632,8[/itex]
Include the units of the data.
The formula might be that of double-slit diffraction in terms of the deflection angle theta. 632.8 nm must be the wavelength of the incident light (from a He-Ne laser) 'a' is the slit width and 'b' is the distance between the slits. They are of micrometer size, comparable with the wavelength, cannot be 0.1 and 0.2 nm!
 
d = 0.2 mm = 200000 nm
a = 0.1 mm = 100000 nm

The plot still isn't right
 
Schwarzschild90 said:
d = 0.2 mm = 200000 nm
a = 0.1 mm = 100000 nm

The plot still isn't right
Was not it a=0.01 mm and d=0.02 mm?