[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Hi Experts I am trying to draw a sine curve in Python , well first I had a script that i could draw a function curve in this way : xMax = 25.0 points = [] for i in range(100): x = (float(i)/99)*xMax y = math.sqrt(x) points.append([x,y]) s.Spline(points=points) first i have questions that : what does the line x = (float(i)/99)*xMax do ? why do we multiply it by and then when I wanted to draw a sine curve I found this one : import math for angle in range(????): y = math.sin(math.radians(angle)) print(y) first , here instead of ???? can we put 2*pi ? second i wanted to try this method instead: xMax = pi Lamda = 200 points = [] for i in range(Lamda): x = (float(i)/99)*xMax y = math.sin(x) points.append([x,y]) it actually works much better and creates an actual sine curve but the lengths are not really what i want , also if i want to draw a straight line I use this command : xMax = 1 Lamda = 200 points = [] for i in range(Lamda): x = (float(i)/99) y = xMax points.append([x,y]) but then the problem will be that I can not control the length of this line and the sine curve , that should be equal

- Prev by Date:
**Python 3 is killing Python** - Next by Date:
**Drawing Sinus curve in Python** - Previous by thread:
**Suds and Python3** - Next by thread:
**Drawing Sinus curve in Python** - Index(es):