Posts

Showing posts with the label Cosine Graph

Sine and Cosine Graph using Python

Image
Introduction to Sine/Cosine Graph The sine and cosine graphs are almost identical, except the cosine curve ( y = cos ( x )) starts at amplitude y = 1, when angle x = 0° (whereas the sine curve ( y = sin ( x )) starts at amplitude y = 0). We say the cosine curve is a sine curve which is shifted to the left by 90°. The graph of sine and cosine is like a wave that forever oscillates between -1 and 1, in a shape that repeats itself every 360° (2π) units. Program Implementation In this tutorial, I have used Python 3.5.2 (64-bit) software, and 7 modules: MatPlotLib 2.0.2 , PyParsing 2.2.0 , Python-DateUtil 2.6.1 , PyTZ 2017.2 , SetupTools 36.2.0 , Cycler 0.10.0 , and NumPy-MKL 1.13.1 implemented in Windows 10 Enterprise operating system. The 7 modules are chosen based on the compatibility of Python and OS version and bit. Source Code import numpy as np import matplotlib.pyplot as plt X = np.linspace(-np.pi, np.pi, 256, endpoint = True) C, S = np.cos(X), np.sin(X)...