2009\353\205\204 1\355\225\231\352\270\260 \354\202\260\352\263\265\354\210\230\355\225\231(INE215)4\354\233\22410\354\235\274
\353\252\205\353\240\271\354\226\264 \354\213\244\355\226\211\354\213\234: \353\252\205\353\240\271\354\226\264 \354\236\205\353\240\245\355\233\204 Enter\353\247\214\353\252\205\353\240\271\354\226\264\353\245\274 \354\227\254\353\237\254\354\244\204\354\227\220 \354\227\260\354\235\264\354\226\264\354\204\234 \354\236\205\353\240\245\355\225\230\352\263\240 \354\213\266\354\235\204 \352\262\275\354\232\260 shift + EnterText \354\236\205\353\240\245\354\213\234: Ctrl + Shift + J or K \353\230\220\353\212\224 \354\225\204\354\235\264\354\275\230 T\353\252\205\353\240\271\354\226\264 \354\236\205\353\240\245\354\213\234: Ctrl + J or K \353\230\220\353\212\224 \354\225\204\354\235\264\354\275\230 [>Maple \354\213\244\354\212\265#21. Selection statements(\354\241\260\352\261\264\353\254\270): if, elif, else, end ifa:=1: b:=3:
if a > b then
print("a is larger than b");
elif b > a then
print("b is larger than a");
else
print("a is equal to b");
end if;a := -1:b:=-1:
if a > 0 then
if b > 0 then
print("a is positive and b is positive");
else
print("a is positive and b is negative");
end if;
else
if b > 0 then
print("a is negative and b is positive");
else
print("a is negative and b is negative");
end if;
end if;
2. Repetition statements(\353\260\230\353\263\265\353\254\270): for, whiletotal := 0:
for i from 1 to 10 do
total := total + i;
end do;for i from 1 to 10 by 2 do
i^2;
end do;total := 0:
for i from 10 to 1 by -1 do
total := total + i;
end do;total := 0; i := 1;
while i <= 10 do
total := total + i;
i := i + 1;
end do:
total;for i from 1 to 10 do
if i = 1 or i = 3 then
next
else
print(i)
end if;
end do;for i from 1 to 10 do
if i = 7 then
break
end if;
print(i)
end do;3. Procedure(\355\225\250\354\210\230)- procedure \354\240\225\354\235\230\355\225\230\353\212\224 \354\210\234\354\204\234 name := proc(argument1, argument2, ...) # \355\225\250\354\210\230\354\235\230 \354\240\204\353\213\254\354\235\270\354\236\220(argument) local var1, var2,... # procedure \353\202\264\353\266\200\354\227\220\354\204\234\353\247\214 \354\202\254\354\232\251\353\220\230\353\212\224 \354\247\200\354\227\255\353\263\200\354\210\230(local variable) global var3, var4,...# procedure \353\260\226\354\227\220\354\204\234\353\217\204 \354\202\254\354\232\251\353\220\240 \354\210\230 \354\236\210\353\212\224 \354\240\204\354\227\255\353\263\200\354\210\230(global variable) description " ... (\355\225\250\354\210\230\354\227\220 \353\214\200\355\225\234 \354\204\244\353\252\205)" procedure body(\355\225\250\354\210\230\354\235\230 \354\210\230\355\226\211\353\202\264\354\232\251) end proc:func:=proc() # function name
"Hello World"
end proc:
func();
dist := proc(x,y)
x^2 + y^2;
end proc; # If we use semicolon instead of colone,
# Maple shows the definition of "dist()".dist(3,4);dist(c,d);half := proc(x)
local result;
result := x / 2;
end proc:half(100);fact := proc(n)
description "This function computes n!";
if n = 1 then
1;
else
n * fact(n-1); # recursive call
end if;
end proc:fact(5);