In: Computer Science
Using Python math functions that produce x,y values. The results of these function calls will be used as input to another program of your choice for plotting the results. Plots can be completed using Excel any other online or other graphing tool you have available. Use standard I/O The Math functions and values range of x-values are described below: a. Generate x, sin(x) for x values ranging from -2PI -> 2PI with an increment of PI/64 b. Generate x, cos(x) for x values ranging from -2PI -> 2PI with an increment of PI/64 c. Generate x, sqrt(x) for x values ranging from 0 -> 200 with an increment of 0.5 d. Generate x, log10(x) for x values ranging from 0 -> 200 with an increment of 0.5
import math
x_sinx=[]#list to store x [-2pi,pi]
sinx=[]#list to store sin(x)
a=-2*math.pi
b=2*math.pi
while a<=b:
x_sinx.append(a)
sinx.append(math.sin(a))
a=a+math.pi/64
x_cosx=[]#list to store x [-2pi,pi]
cosx=[]#list to store cos(x)
a=-2*math.pi
b=2*math.pi
while a<=b:
x_cosx.append(a)
cosx.append(math.cos(a))
a=a+math.pi/64
x_sqrt=[]#list to store x [0,200]
sqrtx=[]#list to store sqrt(x)
a=0
b=200
while a<=b:
x_sqrt.append(a)
sqrtx.append(math.sqrt(a))
a=a+.5
x_log10=[]#list to store x [0,200]
log10x=[]#list to store log10(x)
a=0.5#log doesnt exist for 0
b=200
while a<=b:
x_log10.append(a)
log10x.append(math.log(a,10))
a=a+.5