0% found this document useful (0 votes)
24 views8 pages

Maa Test01

The document outlines a test for the first half of the semester for students in the Department of Radioelectronics at the Czech Technical University. It includes various tasks related to vectors, matrices, Taylor series approximation, and the approximation of the Ludolph number π. Each task specifies operations to be performed, such as creating vectors and matrices, calculating determinants, and plotting graphs.

Uploaded by

Aarush Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views8 pages

Maa Test01

The document outlines a test for the first half of the semester for students in the Department of Radioelectronics at the Czech Technical University. It includes various tasks related to vectors, matrices, Taylor series approximation, and the approximation of the Ludolph number π. Each task specifies operations to be performed, such as creating vectors and matrices, calculating determinants, and plotting graphs.

Uploaded by

Aarush Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

MAA - Test for the first half of the semster

Václav Vencovský

Department of Radioelectronics, Faculty of Electrical Engineering, Czech Technical


University in Prague, Czech Republic

April 24, 2025 1/8


Task 1 – Vectors (1 point)
Create a vector (enumeration):
v1 = 4 8 1 3.4 0 -5 22
Create a vector (FROM, STEP, TO)
v2 = -20 -10 0 10 20
v3 = 60 80 100 120
Create a vector (FROM, TO, NUMBER)
v4 = 1 2 3 4 5 6 7
Create a vector by concatenating two vectors v3 and v4
v5 = v3 v4
Create a vector by transposing a vector v6 = 3-4j 2+8j 1+9j

April 24, 2025 2/8


Task 2 – Matrices (1 point)
Create a matrix m1 with 100 rows and 100 columns, which contains
normally (0 mean, standard deviation 1) distributed random numbers

Calculate a determinant of the matrix m1

Has the matrix linearly independent rows and columns?

Save the matrix into a mat file (binary file with suffix .mat, those who
work in Python can use binary file format in Python or use the function
savemat from module scipy.io)

April 24, 2025 3/8


Task 3 – Matrices (2 points)
Write a script which loads the matrix saved in the previous step

Draw a graph showing the values taken from the diagonal of the matrix
as a function of the values in the first column of the matrix, i.e. the y
axis will show the values in the diagonal and the x-axis will show the
values in the first column of the matrix.

Multiply the matrix with a matrix which has the same size, the values of
1 in diagonal and zeros everywhere else. Make an element-wise
multiplication and matrix multiplication.

April 24, 2025 4/8


Task 4 – Vectors (2 points)
Make an array of all integer multiples of 42 higher than 0 and smaller
than 10000.
Display the array into the command window.
Use the values in the created array to create an array of complex
numbers with magnitude equal to the values of the array created in the
previous step and angle equal to π/2.
Make a new array which will have transposed dimensions (relative to
the complex array) and the values will be complex conjugate values of
the previous array.
Save this array into a text file.

April 24, 2025 5/8


Task 5 – Taylor series approximation (3 points)
Approximate the function sin(x) by a Taylor series
x − x 3 /3! + x 5 /5! − x 7 /7! + x 9 /9! ... (see
https://en.wikipedia.org/wiki/Taylor_series)

Interval: x = -2*pi:0.01:2*pi

How many terms of the Taylor series we need to approximate sin(x) in


the given interval such that the largest error is less than 1e-3?

Draw a graph with two subplots. The firts one on top showing sin(x)
and your approximation and the second one in the bottom showing the
difference (error)

April 24, 2025 6/8


Task 6 – Matrix multiplication (3 points)
Calculate N
P
j=1 (M(i, j)X (j)), where M(i, j) is a matrix NxN with
Gaussian random numbers with a mean equal to 20 and a variance
equal to 10 and X is a vector with uniformly distributed random
numbers with values 0 to 1, and N is the length of the vector X .

Implement the solution using matrix multiplication.

April 24, 2025 7/8


Task 7 – Ludolph number (3 points)
Approximate Ludolph number π with Mahadava-Leibnitz series
(−1)k
π=4 ∞
P
k =0 2k +1 .

How many terms of the series do we need to approximate with


precision up to two decimal points (to get 3.14)

April 24, 2025 8/8

You might also like