Index: anuga_core/source/anuga/utilities/numerical_tools.py
===================================================================
--- anuga_core/source/anuga/utilities/numerical_tools.py	(revision 5560)
+++ anuga_core/source/anuga/utilities/numerical_tools.py	(revision 5561)
@@ -184,4 +184,11 @@
        if keyword relative is False,
        absolute error is returned
+
+       If there is x and y, n=2 and relative=False, this will calc;
+       sqrt(sum_over_x&y((xi - yi)^2))
+
+       Given this value (err), to calc the root mean square deviation, do
+       err/sqrt(n)
+       where n is the number of elements,(len(x))
     """
 
Index: anuga_core/source/anuga/utilities/test_numerical_tools.py
===================================================================
--- anuga_core/source/anuga/utilities/test_numerical_tools.py	(revision 5560)
+++ anuga_core/source/anuga/utilities/test_numerical_tools.py	(revision 5561)
@@ -18,5 +18,4 @@
     def tearDown(self):
         pass
-
 
     def test_angle1(self):
@@ -30,5 +29,5 @@
         assert allclose(angle([-1.0, -1.0])/pi*180, 225.0)
         assert allclose(angle([0.0, -1.0])/pi*180, 270.0)
-        assert allclose(angle([1.0, -1.0])/pi*180, 315.0)		
+        assert allclose(angle([1.0, -1.0])/pi*180, 315.0)
 		
 							  
@@ -61,16 +60,6 @@
 
 
-		
-	
-				
-		
-	
-		
-
-
     def test_anglediff(self):
         assert allclose(anglediff([0.0, 1.], [1.0, 1.0])/pi*180, 45.0)
-
-
 
 	
@@ -85,5 +74,4 @@
         assert B[0] == 1 and B[1] == 2 and B[2] == 3 and B[3] == 4
 
-
         A = [1,2,3.14,4]
         B = ensure_numeric(A)
@@ -92,5 +80,4 @@
         assert B[0] == 1 and B[1] == 2 and B[2] == 3.14 and B[3] == 4
 
-
         A = [1,2,3,4]
         B = ensure_numeric(A, Float)
@@ -99,5 +86,4 @@
         assert B[0] == 1.0 and B[1] == 2.0 and B[2] == 3.0 and B[3] == 4.0
 
-
         A = [1,2,3,4]
         B = ensure_numeric(A, Float)
@@ -105,5 +91,4 @@
         assert B.typecode() == 'd'
         assert B[0] == 1.0 and B[1] == 2.0 and B[2] == 3.0 and B[3] == 4.0
-
 
         A = array([1,2,3,4])
@@ -113,5 +98,4 @@
         assert A == B    
         assert A is B   #Same object
-
 
         A = array([1,2,3,4])
@@ -139,4 +123,5 @@
         assert allclose(B, [104, 101, 108, 108, 111])
 
+
     def test_gradient(self):
         x0 = 0.0; y0 = 0.0; z0 = 0.0
@@ -149,4 +134,5 @@
         assert zy == 0.0
 
+
     def test_gradient_more(self):
         x0 = 2.0/3; y0 = 2.0/3
@@ -182,4 +168,5 @@
         z2_computed = z0 + a*(x2-x0) + b*(y2-y0)
         assert z2_computed == z2
+
         
     def test_gradient2_more(self):
@@ -221,26 +208,20 @@
         a = [1,1,1,1,1,2,1,3,2,3,1,2,3,4,1]
 
-
         #There are four elements greater than or equal to 3
         bins = [3]
         assert allclose(histogram(a, bins), [4])
 
-
         bins = [ min(a) ]
         assert allclose(histogram(a, bins), [len(a)])
 
-
         bins = [ max(a)+0.00001 ]
         assert allclose(histogram(a, bins), [0])        
-
         
         bins = [1,2,3,4]
         assert allclose(histogram(a, bins), [8,3,3,1])
-
 
         bins = [1.1,2,3.1,4]
         #print histogram(a, bins)
         assert allclose(histogram(a, bins), [0,6,0,1])
-
 
         bins = [0,1.5,2,3]
@@ -263,6 +244,5 @@
         a = [-1.7]
         bins = [-1.7]
-        assert allclose(histogram(a, bins), [1])
-        
+        assert allclose(histogram(a, bins), [1])        
         
 
@@ -312,5 +292,4 @@
         q2 = uniform(7.0, 20.0, 4)
 
-
         for i in range(4):
             #Gradient of fitted pwl surface
@@ -326,10 +305,47 @@
             assert abs(b - b_ref) < epsilon
 
-        
-
+     
+    def test_err(self):
+        x = [2,5] # diff at first position = 4, 4^2 = 16
+        y = [6,7] # diff at secnd position = 2, 2^2 = 4
+        # 16 + 4 = 20
+        
+        # If there is x and y, n=2 and relative=False, this will calc;
+        # sqrt(sum_over_x&y((xi - yi)^2))
+        err__1 = err(x,y,2,False)
+        assert err__1 == sqrt(20)
+        #print "err_", err_
+        #rmsd_1 = err__1*sqrt(1./len(x))
+        #print "err__1*sqrt(1./len(x))", err__1*sqrt(1./len(x))
+        #print "sqrt(10)", sqrt(10)
+        
+        x = [2,7,100]
+        y = [5,10,103]
+        err__2 = err(x,y,2,False)
+        assert err__2 == sqrt(27)
+        #rmsd_2 = err__2*sqrt(1./len(x))
+        #print "err__2*sqrt(1./len(x))", err__2*sqrt(1./len(x))
+
+        x = [2,5,2,7,100]
+        y = [6,7,5,10,103]
+        err_3 = err(x,y,2,False)
+        assert err_3 == sqrt(47)
+        
+        #rmsd_3 = err_3*sqrt(1./len(x))
+        #print "err__3*sqrt(1./len(x))", err__3*sqrt(1./len(x))
+        #print "rmsd_3", rmsd_3
+        #print "sqrt(err_1*err__1+err__2*err__2)/sqrt(5)", \
+        # sqrt(err__1*err__1+err__2*err__2)/sqrt(5)
+        #print "(rmsd_1 + rmsd_2)/2.", (rmsd_1 + rmsd_2)/2.
+        #print "sqrt((rmsd_1*rmsd_1 + rmsd_2*rmsd_2))/2.", \
+        #sqrt((rmsd_1*rmsd_1 + rmsd_2*rmsd_2))/2.
+        
+
+                                    
 
 #-------------------------------------------------------------
 if __name__ == "__main__":
     suite = unittest.makeSuite(Test_Numerical_Tools,'test')
+    #suite = unittest.makeSuite(Test_Numerical_Tools,'test_err')
     runner = unittest.TextTestRunner()
     runner.run(suite)
