Plot Relative Intensity of Function in Maple

Click For Summary

Homework Help Overview

The discussion centers around plotting a function related to intensity in a physics context, specifically involving parameters from wave optics. The function is defined as I_\theta = I_m (cos (\beta))^2 (sin(\alpha)/\alpha)^2, with variables defined for angles and constants relevant to the problem.

Discussion Character

  • Exploratory, Assumption checking, Problem interpretation

Approaches and Questions Raised

  • Participants share their attempts at coding the function in Maple, with some questioning the correctness of the original code and suggesting simplifications. There are discussions about the meaning of parameters like I_m and the expected behavior of the function, particularly regarding the presence of spikes in the plot.

Discussion Status

Several participants have provided feedback on the code and the expected output. Some have expressed confusion about the results, while others have clarified the nature of the function and its behavior. There is an ongoing exploration of the assumptions behind the expected spikes in the plot, with some participants indicating that the original expectations may not align with the actual behavior of the function.

Contextual Notes

Participants are working within the constraints of a homework assignment, which includes specific ranges for the variables and the requirement to use Maple for plotting. There is also mention of potential misunderstandings regarding the physical interpretation of the function and its parameters.

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:

upload_2015-12-14_16-28-55.png


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:
Physics news on Phys.org
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
upload_2015-12-14_17-54-30.png

upload_2015-12-14_17-54-43.png


I can't see where the error is
 

Attachments

  • upload_2015-12-14_17-54-25.png
    upload_2015-12-14_17-54-25.png
    500 bytes · Views: 457
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!
 
  • #10
d = 0.2 mm = 200000 nm
a = 0.1 mm = 100000 nm

The plot still isn't right
 
  • #11
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?
 

Similar threads

  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 22 ·
Replies
22
Views
2K
Replies
3
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K