[system] / trunk / pg / macros / contextLimitedPolynomial.pl Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

# Diff of /trunk/pg/macros/contextLimitedPolynomial.pl

Revision 4120 Revision 4121
49# 49#
50sub checkPowers { 50sub checkPowers {
51 my \$self = shift; 51 my \$self = shift;
52 my (\$l,\$r) = (\$self->{lop},\$self->{rop}); 52 my (\$l,\$r) = (\$self->{lop},\$self->{rop});
53 my \$single = \$self->{equation}{context}->flag('singlePowers'); 53 my \$single = \$self->{equation}{context}->flag('singlePowers');
54 \$l->{powers} = {1=>1} if \$l->class eq 'Variable';
55 \$r->{powers} = {1=>1} if \$r->class eq 'Variable';
54 \$self->{isPoly} = 1; 56 \$self->{isPoly} = 1;
55 \$self->{powers} = \$l->{powers}? {%{\$l->{powers}}} : {}; 57 \$self->{powers} = \$l->{powers}? {%{\$l->{powers}}} : {};
56 \$r->{powers} = {1=>1} if \$r->class eq 'Variable';
57 return 1 unless \$r->{powers}; 58 return 1 unless \$r->{powers};
58 foreach my \$n (keys(%{\$r->{powers}})) { 59 foreach my \$n (keys(%{\$r->{powers}})) {
59 \$self->Error("Polynomials can have at most one term of each degree") 60 \$self->Error("Polynomials can have at most one term of each degree")
60 if \$self->{powers}{\$n} && \$single; 61 if \$self->{powers}{\$n} && \$single;
61 \$self->{powers}{\$n} = 1; 62 \$self->{powers}{\$n} = 1;

Legend:
 Removed from v.4120 changed lines Added in v.4121