--- loncom/homework/lonmaxima.pm	2017/03/04 19:43:47	1.31
+++ loncom/homework/lonmaxima.pm	2017/03/06 23:24:57	1.34
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Interface routines to MAXIMA CAS
 #
-# $Id: lonmaxima.pm,v 1.31 2017/03/04 19:43:47 raeburn Exp $
+# $Id: lonmaxima.pm,v 1.34 2017/03/06 23:24:57 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -155,7 +155,9 @@ sub maxima_eval {
 
 sub compareterms {
     my ($socket,$terma,$termb)=@_;
-    $terma =~s/[\.\*\^\/\s]+$//;
+    if ($terma =~ m{[.*^/\s]+(|\(\s*\((|[^)]+))$}) {
+        return 'Error: blacklisted';
+    }
     my $difference=$terma.'-('.$termb.')';
     if (&blacklisted($difference)) { return 'Error: blacklisted'; }
     my $reply=&maximareply($socket,'trigsimp(trigreduce('.$difference.'));');