--- loncom/homework/lonmaxima.pm	2008/12/10 23:28:04	1.28
+++ loncom/homework/lonmaxima.pm	2010/06/14 11:34:18	1.29
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Interface routines to MAXIMA CAS
 #
-# $Id: lonmaxima.pm,v 1.28 2008/12/10 23:28:04 raeburn Exp $
+# $Id: lonmaxima.pm,v 1.29 2010/06/14 11:34:18 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -117,7 +117,9 @@ sub runscript {
 
 sub maxima_cas_formula_fix {
    my ($expression)=@_;
-   return &Apache::response::implicit_multiplication($expression);
+   $expression=&Apache::response::implicit_multiplication($expression);
+   $expression=~s/([^\w\%])pi/$1\%pi/gs;
+   return $expression;
 }
 
 sub maxima_run {