-2

I keep receiving error,';' unexpected in this piece of maple code. I have looked and looked and just can't seem to find where I'm going wrong. Can anyone spot it?

QSFactorization := proc (n::(And(posint, odd)), mult::nonnegint := 0, { mindeps::posint := 5, c := 1.5 }) 

local mfb, m, x, fb, nfb, r, M, d; 

if isprime(n) then  
return "(n)"  
elif issqr(n) then  
return "(isqrt(n))"*"(isqrt(n))"  
elif n < 1000000 then  
return ifactor(n)  
end if; 

if mult = 0 then  
mfb := MultSelect(n, ':-c' = c)  
else mfb := [mult, FactorBase(mult*n, c)]  
end if;  

m := mfb[1];  
if 1 < m then  
print('Using*multiplier; -1');  
print(m)  

end if;  
x := m*n*print('Using*smoothness*bound; -1'); 

print(ceil(evalf(c*sqrt(exp(sqrt(ln(n)*ln(ln(n))))))));  
fb := Array(mfb[2], datatype = integer[4]);  
nfb := ArrayNumElems(fb);  
print('Size*of*factor*base; -1'); 
print(nfb);  
r := Relations(x, fb, ':-mindeps' = mindeps);  
M := r[3]; print('Smooth*values*found; -1');   
print(nfb+mindeps);  
print('Solving*a*matrix*of*size; -1');   
print(LinearAlgebra:-Dimension(M));    
d := Dependencies(M);   
print('Number*of*linear*dependencies*found; -1');  
print(nops(d));  
print('Factors; -1');  
FindFactors(n, r, d)  
end proc

I'd really appreciate any insight.

savleavas
  • 19
  • 4

1 Answers1

1

You basic problem is that you are using the wrong quotes inside your print statements. This is invalid,

print('Using*multiplier; -1');

You are using single right-quotes (tick), which in Maple is used for unevaluation. In this case the semicolons inside your print statements are syntax errors.

Use either double-quotes or single left-quotes instead. The former delimits a string, and the latter delimits a name. Eg,

print("Using*multiplier; -1");

print(`Using*multiplier; -1`);

If you choose to go with name-quotes then the print command will prettyprint the output in the Maple GUI with the name in an italic font by default, but you won't see the quotes in the output.

If you choose to go with string-quotes then the print command will show the quotes in the output, but will use an upright roman font by default.

Some other comments/answers (since deleted) on your post suggest that you are missing statement terminators (colon or semicolon) for these two statements,

print(m)
FindFactors(n, r, d)

That is not true. Those statements appear right before end if and end proc respectively, and as such statement terminators are optional for them. Personally I dislike coding Maple with such optional terminator instances left out, as it can lead to confusion when you add intermediate lines or pass the code to someone else, etc.

acer
  • 6,671
  • 15
  • 15