Maple1231W8T5 - Programming in Maple

Thursday, 13 September 2018

7:37 PM

Untitled picture.png Machine generated alternative text:
The series 
73 +91 + + + C, 
where t is the n th term, is an arithmetic series. Suppose that the values of n and t have already been entered to a Maple worksheet. 
Select all the single-line Maple Codes below which output the sum of this series. 
tor i from 73 toe by 18 do s:=s+i end do: s, 
s:=73: for i trom 2 ton do + 73 + end do: s; 
tor i trom 73 tot by 18 do s:=s+i end do: s, 
73: for from 2 to n do 73 + i*18 end do: s; 
O: tor i trom O to n-l do s:=s+ 73 + i*18 end do: s; 
tor i from C to 73 by -18 do s:=s+i end do: s; 

Untitled picture.png Machine generated alternative text:
The Maple code below defines a procedure f that takes a single argument n and returns 
n 
if n > 70; 
• n if 50 < n2<70; 
n 
if n < 50. 
Select the correct items from the drop down menus to complete the Maple code. 
f 
proc (n) 
if nA2 > 70 then 
ret urn n" 
elif nA2 > 50 then 
return 
return 
end if 
end proc; 

Untitled picture.png Machine generated alternative text:
(a) 
The skeleton "for loop" below is used to evaluate the sum 
16 
for k from 3 to 50 
Select the correct item from each drop down box so that the output from the loop contains exactly 48 lines and displays the sum for each integer value of k 
from 3 to 50. 
for 
k 
O from 3 
O to 50 
O do 
evalf(add(sin(k/n), n=16..29) 
end do; 
(b) 
The terms of a sequence an are generated by the recurrence relation 
an +1 = an 5 an _ 1 + an _ 2 forn 3, 4, 5, 
Using your Maple worksheet, write a for loop to find the value of ago given that 
al 2, a2 = 2 and — 
-1 
Copy (Ctrl-C) the correct value of ago from your Maple worksheet and paste (Crtl-V) it in th answer box. 
-2404257210258014267540184092638
Untitled picture.png Machine generated alternative text:
(a) 
The skeleton "for loop" below is used to evaluate the sum 
16 
for k from 3 to 50 
Select the correct item from each drop down box so that the output from the loop contains exactly 48 lines and displays the sum for each integer value of k 
from 3 to 50. 
for 
k 
O from 3 
O to 50 
O do 
evalf(add(sin(k/n), n=16..29) 
end do; 
(b) 
The terms of a sequence an are generated by the recurrence relation 
an +1 = an 5 an _ 1 + an _ 2 forn 3, 4, 5, 
Using your Maple worksheet, write a for loop to find the value of ago given that 
al 2, a2 = 2 and — 
-1 
Copy (Ctrl-C) the correct value of ago from your Maple worksheet and paste (Crtl-V) it in th answer box. 
-2404257210258014267540184092638 

Untitled picture.png Machine generated alternative text:
Find x 184 given that 
= 2.25 
.25 
1 
3 
and enter your answer correct to 10 significant figures in the box below. 
To check that your calculations are correct, you should be able to calculate that x 81 is approximately 3.375103. 
[Note that you should do your calculations correct to 10 significant figures. Use Digits : =le;] 
x 184 
2.791108815 

Untitled picture.png Machine generated alternative text:
A simple iteration procedure with ao 
0 and 
sin 
2 
an 
2 
is being used to find an approximate solution to the equation 
sin 
Select the correct expressions from the drop down menus to define a procedure which takes a positive integer m and uses a for loop to 
calculate am. The procedure should return am if lam — am 1 1 < 10 and —1 otherwise. All calculations are done using 30 
significant figures. 
Digits 
f proc(m) 
local a, i; 
o; 
for i from 1 
a[i] := 
Untitled picture.png Machine generated alternative text:
restart : 
proc (x) 
local i; 
a[l] 
2; 
a[2] 
2; 
for i from 4 toxdo 
end do; 
a[x]; 
end proc: 
f(90) 
-2404257210258014267540184092638
Untitled picture.png Machine generated alternative text:
A simple iteration procedure with ao 
0 and 
sin 
2 
an 
2 
is being used to find an approximate solution to the equation 
sin 
Select the correct expressions from the drop down menus to define a procedure which takes a positive integer m and uses a for loop to 
calculate am. The procedure should return am if lam — am 1 1 < 10 and —1 otherwise. All calculations are done using 30 
significant figures. 
Digits 
f proc(m) 
local a, i; 
o; 
for i from 1 
a[i] := 

Untitled picture.png Machine generated alternative text:
end do; 
if abs (a Cm] —a Cm—I]) < IOA (—6) then 
end if 
end proc; 
Use this procedure to calculate f (4) and f (10) and enter your answers in the box below as decimal approximations correct to 30 
significant figures. To prevent typing errors, you can copy and paste your answers from your Maple worksheet. 
The value of f (4) is -1
Untitled picture.png Machine generated alternative text:
end do; 
if abs (a Cm] —a Cm—I]) < IOA (—6) then 
end if 
end proc; 
Use this procedure to calculate f (4) and f (10) and enter your answers in the box below as decimal approximations correct to 30 
significant figures. To prevent typing errors, you can copy and paste your answers from your Maple worksheet. 
The value of f (4) is -1

 

Created with Microsoft OneNote 2016.