Tutorial letter 201/0/2025
COMPUTER ALGEBRA
APM2616
Year module
Department of Mathematical Sciences
This tutorial letter contains solutions for assignment 01.
Note: This is an online module. It is therefore, only available on myUnisa.
university
Define tomorrow. of south africa
,Question 1: 15 Marks
Using MuPAD, assign each ai , where i = 1, ... , 20, the value of i 2 using the assign() function.
Solution
for i from 1 to 20 do
_assign(a.i, iˆ2);
end:
a1,a6,a13;
1, 36, 169
Question 2: 20 Marks
Write one line code that generates two lists,
X = [x1, x2, ...., x50] and Y = [y 1, y 2, .., y50] .
Then write another one line code which computes the inner product of X and Y . Do not use a loop.
Solution
// Define list X containing symbolic variables x.1 to x.50
X:=[x.i $i=1..50];
[x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16,
x17, x18, x19, x20, x21, x22, x23, x24, x25, x26, x27, x28, x29, x30,
x31, x32, x33, x34, x35, x36, x37, x38, x39, x40, x41, x42, x43, x44,
x45, x46, x47, x48, x49, x50]
// Define list Y containing symbolic variables y.1 to y.50
Y:=[y.i $i=1..50];
[y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16,
y17, y18, y19, y20, y21, y22, y23, y24, y25, y26, y27, y28, y29, y30,
y31, y32, y33, y34, y35, y36, y37, y38, y39, y40, y41, y42, y43, y44,
y45, y46, y47, y48, y49, y50]
2
, APM2616/201/0/2025
// Compute the inner product of vectors X and Y using the given lists
_plus(op(zip(X,Y,_mult)));
x1 y1 + x2 y2 + x3 y3 + x4 y4 + x5 y5 + x6 y6 + x7 y7 + x8 y8 + x9 y9 +
x10 y10 + x11 y11 + x20 y20 + x12 y12 + x21 y21 + x30 y30 + x13 y13 +
x22 y22 + x31 y31 + x40 y40 + x14 y14 + x23 y23 + x32 y32 + x41 y41 +
x50 y50 + x15 y15 + x24 y24 + x33 y33 + x42 y42 + x16 y16 + x25 y25 +
x34 y34 + x43 y43 + x17 y17 + x26 y26 + x35 y35 + x44 y44 + x18 y18 +
x27 y27 + x36 y36 + x45 y45 + x19 y19 + x28 y28 + x37 y37 + x46 y46 +
x29 y29 + x38 y38 + x47 y47 + x39 y39 + x48 y48 + x49 y49
Question 3: 10 Marks
product(f(k), k=a..b) computes a closed form expression of a finite and infinite product. Use
MuPad to verify the following identity
n
Y (n + 2)!
(k + 2) = .
2!
k=1
Solution
//Define Left Hand Side of the equation
LHS:= product(k + 2, k = 1..n);
gamma(n + 3)
------------
2
// Rewrite the above equation in terms of factorial function
LHS:= rewrite(%,fact);
fact(n + 2)
-----------
2
3
, // Define Right Hand Side and show that RHS = LHS
RHS:= fact(n+2)/fact(2);
fact(n + 2)
-----------
2
// Verify that LHS and RHS are equal (the result should be 0)
LHS-RHS;
0
Question 4: 20 Marks
Determine the values of the following series
∞
X 2k − 3
(k + 1)(k + 2)(k + 3)
k=0
Solution
f := (2*k - 3)/((k + 1)*(k + 2)*(k + 3)):
sum(f, k = 0..infinity);
-1/4
and
n
X k
.
(k − 1)2 (k + 1)2
k=2
Solution
f := k/((k - 1)ˆ2 * (k + 1)ˆ2):
sum(f, k = 2..n);
3 2 4
10 n - 3 n - 8 n + 5 n - 4
-----------------------------
2 3 4
16 n + 32 n + 16 n
Question 5: 15 Marks
Use MuPad to prove that
n−1
X
k a (1 − r n )
ar = ,
1−r
k=0
for all n ∈ N; n ≥ 1.
4