What inverse sine Function
It is reciprocal of sine wave .sine inverse of the same ratio will give the measure of the angle. y= sin -1(x) <=> sin y = x. Here, the sine function is equal to the opposite side divided by the hypotenuse, and Each range value (-1 to 1) is within the limited domain (-π/2, π/2)
θ = Sin-1 (Opposite side to θ/Hypotenuse)
The inverse sinewave graph and degree value table are shown below:
degree | convert to radians | inverse sine |
---|---|---|
0 | 0 | 0 |
30 | π/6 | 1/2 |
45 | π/4 | √2/2 |
60 | π/3 | √3/2 |
90 | π/2 | 1 |
Example 2: Generating Inverse of the sine wave
Python3
import math import turtle win = turtle.Screen() win.bgcolor( "white" ) # coordinate setting win.setworldcoordinates( - 90 , - 1 , 90 , 1 ) t = turtle.Turtle() # Draw a Horizontal line t.goto( - 90 , 0 ) t.goto( 90 , 0 ) t.penup() t.goto( 0 , 0 ) t.pendown() # Draw a vertical line t.goto( 0 , 1 ) t.goto( 0 , - 1 ) t.penup() t.goto( - 90 , - 1 ) t.pendown() t.pencolor( "blue" ) t.pensize( 4 ) # Generate wave form for x in range ( - 90 , 90 ): y = math.sin(math.radians(x)) t.goto(x, y) |
Output:
Draw a Sine wave using Turtle in Python
In this article, we will draw a sinewave using a turtle in Python.
Turtle is one of the modules in python, it is a graphic that refers to controlling a graphical entity in a graphics window with x, and y coordinates. It is a toolkit that provides a simple and enjoyable way to draw pictures and shapes on the windows screen. By using turtles we can design any form, graphics. If you want to write code using turtle, you need to import the turtle.m