source:
trunk/anuga_work/development/2010-projects/anuga_1d/base/util.py
Last change on this file was 7884, checked in by steve, 13 years ago | |
---|---|
File size: 264 bytes |
Rev | Line | |
---|---|---|
[7884] | 1 | """ |
2 | This module contains various auxiliary function used by pyvolution. | |
3 | """ | |
4 | ||
5 | ||
6 | import numpy | |
7 | ||
8 | def mean(x): | |
9 | return numpy.sum(x)/len(x) | |
10 | ||
11 | ||
12 | def gradient(x0, x1, q0, q1): | |
13 | ||
14 | if q1-q0 != 0: | |
15 | a = (q1-q0)/(x1-x0) | |
16 | else: | |
17 | a = 0 | |
18 | ||
19 | return a | |
20 | ||
21 |
Note: See TracBrowser
for help on using the repository browser.