blob: 319f795d60730475b5c69a18bc5769c25a61c60d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import math
def linspace(a, b, N):
lns = []
step = (float(b) - float(a)) / float(N - 1)
print step
for i in range(N):
lns.append(a + i*step)
return lns
def sin_func():
x = linspace(0, 5, 11)
sin_list = []
for i in x:
sin_list.append(math.sin(i))
print sin_list
def sinsin_func():
x = linspace(0, 5, 11)
sin_list = []
for i in x:
sin_list.append(math.sin(i) + math.sin(10*i))
print sin_list
sinsin_func()
|