core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change
on this file since 8cdb9f1 was
a42fec0,
checked in by HMP1 <helen.park@…>, 10 years ago
|
Speed-up of 3X, compare.py working
|
-
Property mode set to
100644
|
File size:
168 bytes
|
Line | |
---|
1 | impor |
---|
2 | |
---|
3 | |
---|
4 | |
---|
5 | |
---|
6 | import numpy as np |
---|
7 | |
---|
8 | |
---|
9 | x = np.array([0, 1, 2, 3]) |
---|
10 | y = 2*x + 1 |
---|
11 | |
---|
12 | print y |
---|
13 | sum = 0 |
---|
14 | |
---|
15 | for i in xrange(x.size-1): |
---|
16 | sum += (x[i+1]-x[i])*(y[i]+y[i+1])/2 |
---|
17 | |
---|
18 | print sum |
---|
19 | |
---|
Note: See
TracBrowser
for help on using the repository browser.