Maple - symbolic math do loops

Status
Not open for further replies.

Safacto

Beta member
Messages
1
Hi,

Does anyone here use Maple? I can't find a specific forum for it anywhere on google, so this is my best bet.

I'm having trouble getting 'if' statements to work when nested in a 'for' loop. eg:

for i from 1 to 50 do
if(i=1) then h=i;
else h=i+4;
end if;
end do;

Basically, I need it to do something different for the first instance of the loop. At the moment I have coded the first instance separately and have a normal 'for' loop for 2 to 50.

Any ideas why it doesn't work?

Thanks,
Richard.
 
Have you tried enclosing the commands to be executed in the loop with the curly brackets, {}. Also check the maple help file as it provides very complete documentation for all functions
 
Status
Not open for further replies.
Back
Top Bottom