Question: Problem with "if" and the ";" (mapple 14)

November 29 2012 ben93 5
Maple 14
1

Hello,

 

First of all I'm French so excuse my English.

I have some questions about Maple 14 on MacOSX,

1- I want to use the "proc()" fuction with an "if" fuction in the "proc()" but it's not workink, I tested many display with the "print" command to evaluate where is the problem and now I can say that the problem is in the "if" fuction. Here his my worksheet :

> suite := proc (n) local u, k, i; u := n; k := 0; for i from 0 to 10 do print(irem(u, 2), evalb(irem(u, 2) = 0)); if evalb(irem*(u, 2) = 0) then u := (1/2)*u; print("on divise par 2") else u := 3*u+1; print("*3+1") end if; print(u); k := k+1 end do; return k end proc;
print(`output redirected...`); # input placeholder
proc(n) ... end;
> suite(2);

print(`output redirected...`); # input placeholder
0, true
"*3+1"
7
1, false
"*3+1"
22
0, true
"*3+1"
67
1, false
"*3+1"
202
0, true
"*3+1"
607
1, false
"*3+1"
1822
0, true
"*3+1"
5467
1, false
"*3+1"
16402
0, true
"*3+1"
49207
1, false
"*3+1"
147622
0, true
"*3+1"
442867
11
 
Have you got any idea ?
2- At school I use to work on Maple 7.5 or 9.5 (I don't really remember) on Windows, but at home I work on Maple 14 on MacOSX, and I want to know what are the differents between the two versions and why the ";" is useless in Maple 14.
3- I've heard that I can use the old interface/classic worksheet but I don't know how to do.
 
Thanks for helping.
Have a nice day.
Ben 
Please Wait...