Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. import pylab
  2. import random
  3. import numpy as np
  4. import math
  5.  
  6. def SetXvals(n):
  7. xSet = np.linspace(-1, 1, n)
  8.  
  9. return xSet
  10.  
  11. def RamdXvals(n):
  12. xRand = np.random.randint(-1, 1, n)
  13.  
  14. return xRand
  15.  
  16. def CalcYvals(xVals):
  17.  
  18. y = ((1-xVals ** 2) ** (1/2) + (abs(xVals) ** (1/2)) * (4/5))
  19. y2 = ((1-xVals ** 2) ** (1/2) + (abs(xVals) ** (1/2)) * (4/5)) * -1
  20.  
  21.  
  22.  
  23. def Plot(xCoords, myTuple, title):
  24.  
  25. fig = pylab.figure()
  26. plot = fig.add_subplot(111)
  27. plot.scatter(xx, yy)
  28.  
  29. plot.set_title("Plot")
  30. plot.set_xlabel("X Axis")
  31. plot.set_ylabel("Y Axis")
  32. fig.show()
  33.  
  34.  
  35. def main():
  36.  
  37. ui = int(input("Enter the number of points you would like to plot: ")))
  38.  
  39. return ui
  40.  
  41. RamdXvals(ui)
  42. SetXvals(ui)
  43.  
  44. CalcYvals(xSet)
  45. CalcYvals(xRand)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement