High School Modules > Trigonometry by Gregory A. Moore
The Sine Graph
An exploration of the many variations of the sine graph.
[Directions : Execute the Code Resource section first. Although there will be no output immediately, these definitions are used later in this worksheet.]
0. Code
| > | restart; with(plots): |
Warning, the name changecoords has been redefined
| > | SolidPlot := proc(f,a,b) local c; c := COLOR(RGB, .6, .8, .5); plot( f(x), x = a..b, filled = true, color=c, style=patchnogrid); end: |
| > | SolidPlotRCol := proc(f,a,b) local c; c := COLOR(RGB, 5*evalf(rand()/10^13,2), 5*evalf(rand()/10^13,2), 5*evalf(rand()/10^13,2) ); plot( f(x), x = a..b, filled = true, color=c, style=patchnogrid); end: |
| > | SolidPlotCol := proc(f,a,b, COL) local box,i,n,x1,x2,xmid,delta,y1,y2,A,B, m,M,slope, concav, col: plot( f(x), x = a..b, filled = true, color=COL, style=patchnogrid, numpoints=1000); end: |
| > | SinePlot := proc(f) local A, B,G,start, endpt, freq, period, lift, amp : lift := ( maximize(f(x), x = 0..10) + minimize(f(x), x = 0..10) )/2 ; G := f(x) - lift; start := solve(G = 0, x); if (nops(G) = 2) then freq := subs( x = 1, op(1, op(1, op(2,G)))); period := 2*Pi/freq; amp := evalf(subs(x = start + period/4, G)); else amp := 1; freq := subs( x= 1, op(1,G)); period := 2*Pi/freq; fi; endpt := start + period; plots[display]( SolidPlot( x->sin(x), 0, 2*Pi), plot( f(x), x = start..endpt, color = blue, thickness = 2), plot( [[start,lift],[endpt,lift]], color = red, thickness = 1, linestyle = 2), plot( 0, x = 0..2*Pi) ); end: |
1. The Basic Sine Graph
For each value of x, there is a value of sin(x). In other words, y = sin(x) is a function of x, and can be plotted.
| > | sin( 3*Pi/7): % = evalf(%); |
| > | n := 12; array( [seq( [ 2*i*Pi/n, evalf(sin(2*i*Pi/n)) ], i = 1..n ) ]); |
This is the basic shape of the sine graph
| > | f := x-> sin(x); SolidPlot( f, 0, 2*Pi); |
| > |
2. Altering the Amplitude
The amplitude of the sine function is the height of its hill (and depth of its valley). For sin(x), the amplitude is 1.
| > | display( [ plot(sin(x), x = 0..2*Pi, filled = true, color = COLOR(RGB, .9, .8, .5) ), plot(sin(x), x = 0..2*Pi, thickness = 2, color = maroon), plot( [[Pi/2,0],[Pi/2,1]], color = blue, linestyle = 2, thickness = 3), plottools[arrow]( [Pi/2,0],[Pi/2,1], .1, .2, .1, color = red), plot( [[3*Pi/2,0],[3*Pi/2,-1]], color=red, linestyle=2,thickness=3), plottools[arrow]( [3*Pi/2,0],[3*Pi/2,-1], .1, .2, .1, color = red) ] ); |
A constant in front of the sin(x) function alters the amplitude. In fact, the amplitude is the absolute value of this number.
| > | f := x -> 3*sin(x); |
| > | SinePlot( f ); |
Below are plots of sine functions with amplitudes ranging from 1/16 to 1, that is, the graphs of 1/16sin(x), 1/8sin(x), 3/16sin(x),1/4sin(x),5/16sin(x),3/8sin(x),7/16sin(x),1/2sin(x),9/16sin(x), 5/8sin(x), 11/16sin(x), 3/4sin(x), 13/16sin(x), 7/8sin(x), 15/16sin(x), sin(x).
| > | display( [ seq( SolidPlotCol( x-> (k/16)*sin(x),0,2*Pi, COLOR(RGB, 1 - k/20, .5 - k/32, 0 )),k = 1..16) ]); |
If the constant is negative, the stretching factor is the same, but the sine is flipped upside down.
| > | f := x -> -.4*sin(x); |
| > | SinePlot( f ); |
3. Altering the Period & Frequency
The sine graph is periodic - it repeats. Each section that repeats is called a "period".
| > | plot( sin(x), x=0..10*Pi, color = blue); |
The fundamental "piece" that repeats has length of
. The frequency is
- that is, the sin(x) function completes 1 cycle every "time" interval of
- or, another way to think of it is that the function completes
of a period every one unit of time.
| > | display( plot(sin(x), x = -2*Pi..6*Pi, color = blue), plot(sin(x), x = -0..2*Pi, color = red, thickness = 4), plot( [[0,-1],[2*Pi,-1],[2*Pi,1],[0,1]], color = red, linestyle = 2) ); `Fundamental Period`; |
If there is a constant times x inside of the sin(x) function, the period and frequency change. For example, sin(2x) will complete its cycles twice as fast as sin(x) - each one taking half as long. So the period of sin(2x) is
, and the frequency is 1 over that, or
.
| > | f := x -> sin(2*x); SinePlot( f ); |
If the constant is less than one, the graph has a smaller frequency and a longer period.
| > | f := x -> sin((1/2)*x); SinePlot( f ); |
If the constant is negative, the stretching factor is the same, but the sine is flipped upside down.
| > | f := x -> -.4*sin(x); |
| > | SinePlot( f ); |
4. Amplitude & Period Changes
The changes to period and amplitude can both operate independently on a single sine function. The period is a property of the x coordiate, and the amplitude is a property of the y coordinate, so neither has any impact on the other.
| > | f := x -> 10*sin(2*x); SinePlot(f); |
| > | f := x -> (1/10)*sin(2*x); SinePlot(f); |
| > | f := x -> 3*sin((1/2)*x); SinePlot(f); |
5. Shifting & Lifting
In algebra we learn that y = f(x) and (y-b) = f(x-a), or y = f(x-a) + b, have the same graphs except the latter is shifted a units right, and b units up. The same concept applies to all other functions, including the sine function.
| > | plot( {x^2, (x-3)^2 + 4} , x = -3..6, y = 0..9); |
| > | f := x -> sin(x - Pi/3) + 4 ; SinePlot(f); |
| > | f := x -> sin(x - Pi/2) - 2 ; SinePlot(f); |
6. Shifting/Lifting/Amplitude/Period
Here are some examples where all four transformation take place in the same function.
| > | f := x -> 3*sin( 2*x - Pi/3) + 1; SinePlot( f ); |
Another exmaple
| > | f := x -> 10*sin( (1/2)*x + Pi) + 5; SinePlot( f ); |
7. Composite Functions of Sine
| > | with(plots): |
| > | f := x -> abs(sin(x)); display(SolidPlotCol( x->sin(x), 0, 2*Pi, blue), plot( f(x), x = 0..2*Pi, thickness = 3) ); |
| > | f := x -> sin(x)^2; display(SolidPlotCol( x->sin(x), 0, 2*Pi, blue), plot(f(x), x = 0..2*Pi,thickness = 3)); |
| > | f := x -> sin(x)^3; display(SolidPlotCol( x->sin(x), 0, 2*Pi, blue), plot(f(x), x = 0..2*Pi,thickness = 3)); |
We can look at families of similar sine functions.
| > | restart; with(plots): SolidPlotCol := proc(f,a,b, COL) local box,i,n,x1,x2,xmid,delta,y1,y2,A,B, m,M,slope, concav, col: n:= 60; delta := (b-a)/n; x2 := a; col := COL; for i from 1 to n do x1 := evalf(x2); y1 := evalf( f(x1)); x2 := evalf(a + i*delta); y2 := evalf( f(x2)); B[i]:=polygonplot([[x1,0],[x1,y1],[x2,y2],[x2,0]], color=col, style=patchnogrid); od: display({ seq( B[i],i=1..n ) } ); end: |
Warning, the name changecoords has been redefined
| > | plot( { sin(x)^k $ k = 1..10}, x = 0..2*Pi, color = aquamarine); |
| > | display( [ seq( SolidPlotCol( x-> sin(x)^(16-k),0,2*Pi, COLOR(RGB, .4 + k/24, .5 + k/24, .2 + k/24)), k = 1..12), plot( [sin(x)^(16-k) $ k = 1..12], x = 0..2*Pi, color =gray, axes = none)]); |
Below are plots of the following 10 functions superimposed.
| > | display( plot( sin(x), x = 0..2*Pi, thickness=3), seq( SolidPlotCol( x-> k*sin(k*x),0,2*Pi, COLOR(RGB, .2 + k/15, .2 + k/15, .75)), k = 1..10)); |
Below is a superimposition of the plots of the following 8 functions.
| > | for i from 1 to 8 do print(sum( sin((2*j+1)*x)/(2*j+1), j= 1..i)); end do: |
| > | display( [plot( {sum( sin((2*j+1)*x)/(2*j+1), j= 1..k) $ k = 1..8}, x = 0..2*Pi, color=black)]); |
How about
| > | display( [ seq( SolidPlotCol( x-> k*(sin(x/k)^k),0,12*Pi, COLOR(RGB, .2 + k/25, .5 + k/60, .1 + k/25)), k = 1..12), plot( [k*(sin(x/k)^k) $ k = 1..12], x = 0..12*Pi, color =blue, thickness=2)]); |
Or
| > | display( [ seq( SolidPlotCol( x-> (1/k)*(sin(x/k)^k),0,6*Pi, COLOR(RGB, .2+k/25, .6 + k/60, .3 + k/25)), k = 2..12), plot( [(1/k)*(sin(x/k)^k) $ k = 2..12], x = 0..6*Pi, color =blue, thickness=2)]); |
| > | restart: col := j -> COLOR(RGB,.5-j/20,.6-j/20,.7-j/20): plot( [x/(2+sin(j*x/2)) $ j = 1..10], x = 0..5*Pi, color = [ col(j)$ j = 1..10] ); |
| > |
| > |
| > |
© 2002 Waterloo Maple Inc