CPCS 212
Applied maths for computing I
Assignment (1)
Matlab
For these 6 matrices:
A = [3 5 2; 1 2 5; 5 9 10],
B = [3 -2; 4 -3; 7 -1],
C = [3, 2 -1; 2 1 3; -3 -2 1],
D = [1 2 5; 4 -3 6]',
E= [1 -2; 4 -1];
F= magic(3)
Which of the following pairs can be added? Find the sums of 3 first pairs
Which pairs can be subtracted? Get the differences of, then repeat in the opposite order.
Which pairs can be multiplied? Find the products
Which of these has a trace? Compute the traces?
2) U = [3, 4, 7], V = [1, -2, 4, -3], W = [7, -3, 0, -4]' and Z = [2; 5; 4; 6]'
Using necessary commands, investigate the products of following cases U*(V+W), [U;V], V*[W- Z]', W*Z', U.*V, [W Z], U'*V
Explain the concatenation matrix with the examples and check following matrices M1 = [U; V], M2 = [U V], M3 = [W’; V]
Using help, identify the command “vertcat” and create a random matrix (size: 5, 5) with integers and find A = [magic(4) B] where B = [5 9 11 2]'.
Find A(B)
If c = [3 7; 5 9], find A(c)
If d = diag([t], -2) and t=1:2:6; find d.
Explain the output T = vertcat(A, d)
Tabulate the functions a = 2sin(3x), b = 3cos(2x) and c = 2exp(sin(x)) for x = 0:t:2pi.
Using any interval t, plot all functions separately
Plot all functions in single graph
Create a sparse 6 ´4 matrix S having only 3 non-zero values:
S2,1 = 8, S4,4 = 5andS3,4 = 11
Develop Matlab code for following operations with any 2X2
inv
left division
Regarding the 3D graph, following lines can be used in the Matlab editor window. [x, y] = meshgrid(-pi:pi/10:pi,-pi:pi/10:pi);
z = sin(x).*sin(y); surf(x,y,z)
Plot the 3D graph with all necessary
find the size of z
find diagonal elements of z
find z(12)
k = find (z > 35)
find the A = 25*z
find ceil(A) and floor(A)
We expect you to show the following points as course learning outcomes:
A |
An ability to apply knowledge of computing and mathematics appropriate to the discipline. |
I |
An ability to use current techniques, skills, and tools necessary for computing practice. |
J |
An ability to apply mathematical foundations, algorithmic principles, and computer science theory in the modeling and design of computer-based systems in a way that demonstrates comprehension of the tradeoffs involved in design choices. |
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of