source: trunk/anuga_work/development/2010-projects/anuga_1d/base/util.py @ 7884

Last change on this file since 7884 was 7884, checked in by steve, 12 years ago

Moving 2010 project

File size: 264 bytes
Line 
1"""
2This module contains various auxiliary function used by pyvolution.
3"""
4
5
6import numpy
7
8def mean(x):
9    return numpy.sum(x)/len(x)
10
11
12def 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.