T04-GraphsSine.mws

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(%);

sin(3/7*Pi) = .9749279123

>    n := 12;
array( [seq( [ 2*i*Pi/n, evalf(sin(2*i*Pi/n)) ],   i = 1..n ) ]);

n := 12

matrix([[1/6*Pi, .5000000000], [1/3*Pi, .8660254040], [1/2*Pi, 1.], [2/3*Pi, .8660254040], [5/6*Pi, .5000000000], [Pi, 0.], [7/6*Pi, -.5000000000], [4/3*Pi, -.8660254040], [3/2*Pi, -1.], [5/3*Pi, -.866...


This is the basic shape of the sine graph

>    f := x-> sin(x);
SolidPlot( f, 0, 2*Pi);

f := sin

[Maple Plot]

>   

 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) ] );

[Maple Plot]


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);

f := proc (x) options operator, arrow; 3*sin(x) end proc

>    SinePlot( f );

[Maple Plot]

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) ]);

[Maple Plot]


If the constant is negative, the stretching factor is the same, but the sine is flipped upside down.

>    f := x -> -.4*sin(x);

f := proc (x) options operator, arrow; -.4*sin(x) end proc

>    SinePlot( f );

[Maple Plot]

 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);

[Maple Plot]


The fundamental "piece" that repeats has length of
2*Pi . The frequency is 1/(2*Pi)  - that is, the sin(x) function completes 1 cycle every "time" interval of 2*Pi  - or, another way to think of it is that the function completes 1/(2*Pi)  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`;

[Maple Plot]

`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
2*Pi/2 = Pi , and the frequency is 1 over that, or 1/Pi .

>    f := x -> sin(2*x);
SinePlot( f );

f := proc (x) options operator, arrow; sin(2*x) end proc

[Maple Plot]

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 );

f := proc (x) options operator, arrow; sin(1/2*x) end proc

[Maple Plot]


If the constant is negative, the stretching factor is the same, but the sine is flipped upside down.

>    f := x -> -.4*sin(x);

f := proc (x) options operator, arrow; -.4*sin(x) end proc

>    SinePlot( f );

[Maple Plot]


 

 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 := proc (x) options operator, arrow; 10*sin(2*x) end proc

[Maple Plot]

>    f := x -> (1/10)*sin(2*x);
SinePlot(f);

f := proc (x) options operator, arrow; 1/10*sin(2*x) end proc

[Maple Plot]

>    f := x -> 3*sin((1/2)*x);
SinePlot(f);

f := proc (x) options operator, arrow; 3*sin(1/2*x) end proc

[Maple Plot]


 

 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);

[Maple Plot]

>    f := x -> sin(x - Pi/3) + 4 ;
SinePlot(f);

f := proc (x) options operator, arrow; sin(x-1/3*Pi)+4 end proc

[Maple Plot]

>    f := x -> sin(x -  Pi/2) - 2 ;
SinePlot(f);

f := proc (x) options operator, arrow; sin(x-1/2*Pi)-2 end proc

[Maple Plot]


 

 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 );

f := proc (x) options operator, arrow; 3*sin(2*x-1/3*Pi)+1 end proc

[Maple Plot]


Another exmaple

>    f := x -> 10*sin( (1/2)*x + Pi) + 5;
SinePlot( f );

f := proc (x) options operator, arrow; 10*sin(1/2*x+Pi)+5 end proc

[Maple Plot]

 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 := proc (x) options operator, arrow; abs(sin(x)) end proc

[Maple Plot]

>    f := x -> sin(x)^2;
display(SolidPlotCol( x->sin(x), 0, 2*Pi, blue),
        plot(f(x), x = 0..2*Pi,thickness = 3));

f := proc (x) options operator, arrow; sin(x)^2 end proc

[Maple Plot]

>    f := x -> sin(x)^3;
display(SolidPlotCol( x->sin(x), 0, 2*Pi, blue),
        plot(f(x), x = 0..2*Pi,thickness = 3));

f := proc (x) options operator, arrow; sin(x)^3 end proc

[Maple Plot]


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);

[Maple Plot]

>    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)]);

[Maple Plot]

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));

[Maple Plot]

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:

1/3*sin(3*x)

1/3*sin(3*x)+1/5*sin(5*x)

1/3*sin(3*x)+1/5*sin(5*x)+1/7*sin(7*x)

1/3*sin(3*x)+1/5*sin(5*x)+1/7*sin(7*x)+1/9*sin(9*x)

1/3*sin(3*x)+1/5*sin(5*x)+1/7*sin(7*x)+1/9*sin(9*x)+1/11*sin(11*x)

1/3*sin(3*x)+1/5*sin(5*x)+1/7*sin(7*x)+1/9*sin(9*x)+1/11*sin(11*x)+1/13*sin(13*x)

1/3*sin(3*x)+1/5*sin(5*x)+1/7*sin(7*x)+1/9*sin(9*x)+1/11*sin(11*x)+1/13*sin(13*x)+1/15*sin(15*x)

1/3*sin(3*x)+1/5*sin(5*x)+1/7*sin(7*x)+1/9*sin(9*x)+1/11*sin(11*x)+1/13*sin(13*x)+1/15*sin(15*x)+1/17*sin(17*x)

>    display( [plot( {sum( sin((2*j+1)*x)/(2*j+1), j= 1..k) $ k = 1..8},
                    x = 0..2*Pi, color=black)]);

[Maple Plot]

How about
  
sin(x), 2*sin(1/2*x)^2, 3*sin(1/3*x)^3, 4*sin(1/4*x)^4, 5*sin(1/5*x)^5, 6*sin(1/6*x)^6, 7*sin(1/7*x)^7, 8*sin(1/8*x)^8, 9*sin(1/9*x)^9, 10*sin(1/10*x)^10, 11*sin(1/11*x)^11, 12*sin(1/12*x)^12
sin(x), 2*sin(1/2*x)^2, 3*sin(1/3*x)^3, 4*sin(1/4*x)^4, 5*sin(1/5*x)^5, 6*sin(1/6*x)^6, 7*sin(1/7*x)^7, 8*sin(1/8*x)^8, 9*sin(1/9*x)^9, 10*sin(1/10*x)^10, 11*sin(1/11*x)^11, 12*sin(1/12*x)^12

>    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)]);

[Maple Plot]

Or
 
1/2*sin(1/2*x)^2, 1/3*sin(1/3*x)^3, 1/4*sin(1/4*x)^4, 1/5*sin(1/5*x)^5, 1/6*sin(1/6*x)^6, 1/7*sin(1/7*x)^7, 1/8*sin(1/8*x)^8, 1/9*sin(1/9*x)^9, 1/10*sin(1/10*x)^10, 1/11*sin(1/11*x)^11, 1/12*sin(1/12*x...
1/2*sin(1/2*x)^2, 1/3*sin(1/3*x)^3, 1/4*sin(1/4*x)^4, 1/5*sin(1/5*x)^5, 1/6*sin(1/6*x)^6, 1/7*sin(1/7*x)^7, 1/8*sin(1/8*x)^8, 1/9*sin(1/9*x)^9, 1/10*sin(1/10*x)^10, 1/11*sin(1/11*x)^11, 1/12*sin(1/12*x...

>    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)]);

[Maple Plot]

>    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] );

[Maple Plot]

>   

>   

>   

 
       © 2002 Waterloo Maple Inc