![]() ![]() Now can you see the problem? The value of sin always stays between -1 and 1. Maybe you think it looks a bit like a line? What do you think the problem is? Here is a hint…go back and take a look at the values for the sine function as they were calculated and printed in the earlier example. You probably think that the program has errors since it does not draw the picture we expect. Since most of us are used to stating the size of an angle in “degrees”, the math module provides a function, radians that will convert from degrees to radians for us. In “radians” (you may remember this from trigonometry class). ![]() To help you understand the sine function, consider the following Python program.Īs you can see, the sin function from the math library takes a single parameter. Note that the x axis is given in degrees.įor this lab, we will use the math library to generate the values that The sine function, sometimes called the sine wave, is a smooth, repetitive oscillation that occurs often in many fields including mathematics, physics, and engineering. In this exercise, we will use our turtle to plot a simple math function, the sine wave. Have you ever used a graphing calculator? You can enter an equation, push a few buttons, and the calculator will draw a line. Support Runestone Academy Today Plotting a sine Wave ¶
0 Comments
Leave a Reply. |