diff --git a/contrib/MathEval/node.cpp b/contrib/MathEval/node.cpp
index 420dfb671756e0b80e1728990c17dc204b4f4369..2698e2c29229c7989e6c025a14056ea763b2377a 100644
--- a/contrib/MathEval/node.cpp
+++ b/contrib/MathEval/node.cpp
@@ -403,6 +403,12 @@ node_derivative(Node * node, char *name, SymbolTable * symbol_table)
      */
     else if (!strcmp(node->data.function.record->name, "Log"))
       return node_create('b', '/', node_derivative(node->data.function.child, name, symbol_table), node_copy(node->data.function.child));
+    /*
+     * Apply rule of base 10 logarithmic function derivative.
+     */
+    else if (!strcmp(node->data.function.record->name, "Log10"))
+      return node_create('b', '/', node_derivative(node->data.function.child, name, symbol_table), 
+			 node_create('b', '*', node_create('c', log(10.)), node_copy(node->data.function.child)));
     /*
      * Apply rule of square root function derivative.
      */
diff --git a/contrib/MathEval/scanner.l b/contrib/MathEval/scanner.l
index 0b92fa78c8a4ecc725888b7557ea0da72547d324..759dad1fe2cf93e900dd2d20979fee920e913e47 100644
--- a/contrib/MathEval/scanner.l
+++ b/contrib/MathEval/scanner.l
@@ -46,7 +46,7 @@ static int input_from_string (char *buffer, int max_size);
 whitespace [\ \t]+
 digit [0-9]
 number ({digit}+|{digit}+"."{digit}*|{digit}*"."{digit}+)([Ee][-+]?{digit}+)?
-function "Exp"|"Log"|"Sqrt"|"Sin"|"Cos"|"Tan"|"Ctan"|"Asin"|"Acos"|"Atan"|"Actan"|"Sinh"|"Cosh"|"Tanh"|"Ctanh"|"Asinh"|"Acosh"|"Atanh"|"Actanh"|"Fabs"|"Rand"
+function "Exp"|"Log"|"Sqrt"|"Sin"|"Cos"|"Tan"|"Ctan"|"Asin"|"Acos"|"Atan"|"Actan"|"Sinh"|"Cosh"|"Tanh"|"Ctanh"|"Asinh"|"Acosh"|"Atanh"|"Actanh"|"Fabs"|"Rand"|"Log10"
 identifier [a-zA-Z\_][a-zA-Z0-9\_]*
 
 %%
diff --git a/contrib/MathEval/scanner.yy.cpp b/contrib/MathEval/scanner.yy.cpp
index f23bb52aa5d943790726a6d0a6c2c819515865e3..c819cd362aef7c92721d5aa17ab8f26f7e0d8036 100644
--- a/contrib/MathEval/scanner.yy.cpp
+++ b/contrib/MathEval/scanner.yy.cpp
@@ -20,7 +20,7 @@
 /* A lexical scanner generated by flex */
 
 /* Scanner skeleton version:
- * $Header: /cvsroot/gmsh/contrib/MathEval/scanner.yy.cpp,v 1.1 2005-09-21 17:29:37 geuzaine Exp $
+ * $Header: /cvsroot/gmsh/contrib/MathEval/scanner.yy.cpp,v 1.2 2007-05-05 11:19:40 geuzaine Exp $
  */
 
 #define FLEX_SCANNER
@@ -303,15 +303,15 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
 
 #define YY_NUM_RULES 13
 #define YY_END_OF_BUFFER 14
-static yyconst short int yy_accept[65] =
+static yyconst short int yy_accept[67] =
     {   0,
         0,    0,   14,   13,    1,   12,   10,   11,    7,    5,
         6,   13,    8,    2,    4,    4,    4,    4,    4,    4,
         4,    4,    4,    9,    1,    2,    2,    2,    0,    4,
         4,    4,    4,    4,    4,    4,    4,    4,    4,    4,
         4,    4,    2,    0,    2,    4,    4,    4,    4,    3,
-        4,    3,    4,    4,    3,    4,    3,    3,    4,    3,
-        3,    3,    3,    0
+        4,    3,    4,    3,    4,    3,    4,    3,    3,    4,
+        3,    3,    3,    4,    3,    0
     } ;
 
 static yyconst int yy_ec[256] =
@@ -320,16 +320,16 @@ static yyconst int yy_ec[256] =
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    2,    1,    1,    1,    1,    1,    1,    1,    4,
-        5,    6,    7,    1,    8,    9,   10,   11,   11,   11,
-       11,   11,   11,   11,   11,   11,   11,    1,    1,    1,
-        1,    1,    1,    1,   12,   13,   14,   13,   15,   16,
-       13,   13,   13,   13,   13,   17,   13,   13,   13,   13,
-       13,   18,   19,   20,   13,   13,   13,   13,   13,   13,
-        1,    1,    1,   21,   13,    1,   22,   23,   24,   25,
-
-       26,   13,   27,   28,   29,   13,   13,   13,   13,   30,
-       31,   32,   33,   34,   35,   36,   13,   13,   13,   37,
-       13,   13,    1,    1,    1,    1,    1,    1,    1,    1,
+        5,    6,    7,    1,    8,    9,   10,   11,   12,   13,
+       13,   13,   13,   13,   13,   13,   13,    1,    1,    1,
+        1,    1,    1,    1,   14,   15,   16,   15,   17,   18,
+       15,   15,   15,   15,   15,   19,   15,   15,   15,   15,
+       15,   20,   21,   22,   15,   15,   15,   15,   15,   15,
+        1,    1,    1,   23,   15,    1,   24,   25,   26,   27,
+
+       28,   15,   29,   30,   31,   15,   15,   15,   15,   32,
+       33,   34,   35,   36,   37,   38,   15,   15,   15,   39,
+       15,   15,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
@@ -346,74 +346,78 @@ static yyconst int yy_ec[256] =
         1,    1,    1,    1,    1
     } ;
 
-static yyconst int yy_meta[38] =
+static yyconst int yy_meta[40] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
-        1,    2,    2,    2,    2,    2,    2,    2,    2,    2,
-        2,    2,    2,    2,    2,    2,    2
+        2,    2,    1,    2,    2,    2,    2,    2,    2,    2,
+        2,    2,    2,    2,    2,    2,    2,    2,    2
     } ;
 
-static yyconst short int yy_base[66] =
+static yyconst short int yy_base[68] =
     {   0,
-        0,    0,  106,  107,  103,  107,  107,  107,  107,  107,
-      107,   93,  107,   29,   15,    0,   10,   66,   80,   70,
-       78,   14,   77,  107,   96,   34,   37,   47,   46,    0,
-       28,   68,   74,   60,   72,   61,   69,   64,   60,   59,
-       54,   57,   50,   75,   74,   49,   61,   52,   51,   52,
-       49,    0,   43,   52,   47,   38,   44,   43,   40,   41,
-       40,   39,   38,  107,   40
+        0,    0,  122,  123,  119,  123,  123,  123,  123,  123,
+      123,   29,  123,   34,   18,    0,   15,   81,   95,   85,
+       93,   19,   92,  123,  113,   46,   53,    0,   60,    0,
+       42,   83,   89,   75,   87,   76,   84,   79,   75,   74,
+       69,   72,   65,   72,   75,   66,   78,   69,   68,   69,
+       66,    0,   60,   84,   68,   64,   54,   61,   60,   57,
+       49,   39,   31,   49,   22,  123,   47
     } ;
 
-static yyconst short int yy_def[66] =
+static yyconst short int yy_def[68] =
     {   0,
-       64,    1,   64,   64,   64,   64,   64,   64,   64,   64,
-       64,   64,   64,   64,   65,   65,   65,   65,   65,   65,
-       65,   65,   65,   64,   64,   64,   64,   64,   64,   65,
-       65,   65,   65,   65,   65,   65,   65,   65,   65,   65,
-       65,   65,   64,   64,   64,   65,   65,   65,   65,   65,
-       65,   65,   65,   65,   65,   65,   65,   65,   65,   65,
-       65,   65,   65,    0,   64
+       66,    1,   66,   66,   66,   66,   66,   66,   66,   66,
+       66,   66,   66,   66,   67,   67,   67,   67,   67,   67,
+       67,   67,   67,   66,   66,   66,   66,   14,   66,   67,
+       67,   67,   67,   67,   67,   67,   67,   67,   67,   67,
+       67,   67,   66,   66,   66,   67,   67,   67,   67,   67,
+       67,   67,   67,   67,   67,   67,   67,   67,   67,   67,
+       67,   67,   67,   67,   67,    0,   66
     } ;
 
-static yyconst short int yy_nxt[145] =
+static yyconst short int yy_nxt[163] =
     {   0,
         4,    5,    6,    7,    8,    9,   10,   11,   12,   13,
-       14,   15,   16,   17,   18,   19,   20,   21,   22,   23,
-       24,   16,   16,   16,   16,   16,   16,   16,   16,   16,
-       16,   16,   16,   16,   16,   16,   16,   27,   31,   28,
-       34,   30,   40,   29,   26,   35,   41,   43,   29,   32,
-       33,   29,   44,   44,   29,   27,   45,   28,   46,   29,
-       43,   29,   29,   47,   29,   52,   52,   52,   52,   63,
-       52,   52,   29,   52,   52,   29,   52,   52,   62,   52,
-       61,   60,   59,   58,   45,   45,   57,   56,   55,   54,
-       52,   53,   52,   51,   50,   49,   48,   25,   42,   39,
-
-       38,   37,   36,   26,   25,   64,    3,   64,   64,   64,
-       64,   64,   64,   64,   64,   64,   64,   64,   64,   64,
-       64,   64,   64,   64,   64,   64,   64,   64,   64,   64,
-       64,   64,   64,   64,   64,   64,   64,   64,   64,   64,
-       64,   64,   64,   64
+       14,   14,   14,   15,   16,   17,   18,   19,   20,   21,
+       22,   23,   24,   16,   16,   16,   16,   16,   16,   16,
+       16,   16,   16,   16,   16,   16,   16,   16,   16,   26,
+       26,   26,   27,   31,   28,   28,   28,   34,   30,   40,
+       29,   52,   35,   41,   32,   33,   26,   26,   26,   52,
+       52,   29,   29,   43,   43,   43,   44,   44,   52,   29,
+       45,   45,   45,   29,   46,   43,   43,   43,   52,   47,
+       29,   29,   45,   45,   45,   45,   45,   45,   65,   52,
+       52,   52,   29,   52,   52,   64,   52,   63,   52,   62,
+
+       61,   60,   59,   58,   57,   56,   55,   54,   53,   52,
+       51,   50,   49,   48,   25,   42,   39,   38,   37,   36,
+       25,   66,    3,   66,   66,   66,   66,   66,   66,   66,
+       66,   66,   66,   66,   66,   66,   66,   66,   66,   66,
+       66,   66,   66,   66,   66,   66,   66,   66,   66,   66,
+       66,   66,   66,   66,   66,   66,   66,   66,   66,   66,
+       66,   66
     } ;
 
-static yyconst short int yy_chk[145] =
+static yyconst short int yy_chk[163] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,   14,   15,   14,
-       17,   65,   22,   14,   26,   17,   22,   27,   26,   15,
-       15,   27,   29,   29,   14,   28,   29,   28,   31,   26,
-       43,   28,   27,   31,   43,   63,   62,   61,   60,   59,
-       58,   57,   28,   56,   55,   43,   54,   53,   51,   50,
-       49,   48,   47,   46,   45,   44,   42,   41,   40,   39,
-       38,   37,   36,   35,   34,   33,   32,   25,   23,   21,
-
-       20,   19,   18,   12,    5,    3,   64,   64,   64,   64,
-       64,   64,   64,   64,   64,   64,   64,   64,   64,   64,
-       64,   64,   64,   64,   64,   64,   64,   64,   64,   64,
-       64,   64,   64,   64,   64,   64,   64,   64,   64,   64,
-       64,   64,   64,   64
+        1,    1,    1,    1,    1,    1,    1,    1,    1,   12,
+       12,   12,   14,   15,   14,   14,   14,   17,   67,   22,
+       14,   65,   17,   22,   15,   15,   26,   26,   26,   64,
+       63,   14,   26,   27,   27,   27,   29,   29,   62,   27,
+       29,   29,   29,   26,   31,   43,   43,   43,   61,   31,
+       27,   43,   44,   44,   44,   45,   45,   45,   60,   59,
+       58,   57,   43,   56,   55,   54,   53,   51,   50,   49,
+
+       48,   47,   46,   42,   41,   40,   39,   38,   37,   36,
+       35,   34,   33,   32,   25,   23,   21,   20,   19,   18,
+        5,    3,   66,   66,   66,   66,   66,   66,   66,   66,
+       66,   66,   66,   66,   66,   66,   66,   66,   66,   66,
+       66,   66,   66,   66,   66,   66,   66,   66,   66,   66,
+       66,   66,   66,   66,   66,   66,   66,   66,   66,   66,
+       66,   66
     } ;
 
 static yy_state_type yy_last_accepting_state;
@@ -472,7 +476,7 @@ extern char *matheval_input_string; /* String representing function.  */
 /* Read next max_size character from string into buffer.  */
 static int input_from_string (char *buffer, int max_size);
 /* Token definitions.  */
-#line 476 "scanner.yy.cpp"
+#line 480 "scanner.yy.cpp"
 
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
@@ -626,7 +630,7 @@ YY_DECL
 #line 52 "scanner.l"
 
 
-#line 630 "scanner.yy.cpp"
+#line 634 "scanner.yy.cpp"
 
 	if ( yy_init )
 		{
@@ -677,13 +681,13 @@ yy_match:
 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 				{
 				yy_current_state = (int) yy_def[yy_current_state];
-				if ( yy_current_state >= 65 )
+				if ( yy_current_state >= 67 )
 					yy_c = yy_meta[(unsigned int) yy_c];
 				}
 			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 			++yy_cp;
 			}
-		while ( yy_base[yy_current_state] != 107 );
+		while ( yy_base[yy_current_state] != 123 );
 
 yy_find_action:
 		yy_act = yy_accept[yy_current_state];
@@ -804,7 +808,7 @@ YY_RULE_SETUP
 #line 108 "scanner.l"
 ECHO;
 	YY_BREAK
-#line 808 "scanner.yy.cpp"
+#line 812 "scanner.yy.cpp"
 case YY_STATE_EOF(INITIAL):
 	yyterminate();
 
@@ -1096,7 +1100,7 @@ static yy_state_type yy_get_previous_state()
 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 			{
 			yy_current_state = (int) yy_def[yy_current_state];
-			if ( yy_current_state >= 65 )
+			if ( yy_current_state >= 67 )
 				yy_c = yy_meta[(unsigned int) yy_c];
 			}
 		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1131,11 +1135,11 @@ yy_state_type yy_current_state;
 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 		{
 		yy_current_state = (int) yy_def[yy_current_state];
-		if ( yy_current_state >= 65 )
+		if ( yy_current_state >= 67 )
 			yy_c = yy_meta[(unsigned int) yy_c];
 		}
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-	yy_is_jam = (yy_current_state == 64);
+	yy_is_jam = (yy_current_state == 66);
 
 	return yy_is_jam ? 0 : yy_current_state;
 	}
diff --git a/contrib/MathEval/symbol_table.cpp b/contrib/MathEval/symbol_table.cpp
index 34e01043a488b72b18bb5399162e5f5aee5a703a..38fe2fb5d72a798c0ab4d72db763e809c8cf0bf9 100644
--- a/contrib/MathEval/symbol_table.cpp
+++ b/contrib/MathEval/symbol_table.cpp
@@ -42,11 +42,12 @@ symbol_table_create(int length)
   SymbolTable    *symbol_table;	/* Pointer to symbol table.  */
   static char    *names[] = {"Exp", "Log", "Sqrt", "Sin", "Cos", "Tan", "Ctan", 
 			     "Asin", "Acos", "Atan", "Actan", "Sinh", "Cosh", "Tanh",
-			     "Ctanh", "Asinh", "Acosh", "Atanh", "Actanh", "Fabs", "Rand" };
+			     "Ctanh", "Asinh", "Acosh", "Atanh", "Actanh", "Fabs", 
+			     "Rand", "Log10" };
   static double   (*functions[]) (double) = { exp, log, sqrt, sin, cos, tan, x_ctan, 
 					      asin, acos, atan, x_actan, sinh, cosh, tanh, 
 					      x_ctanh, x_asinh, x_acosh, x_atanh, x_actanh,
-					      fabs, x_rand};
+					      fabs, x_rand, log10};
   unsigned int i;
   
   /*