Consider the matrix list x = [[1, 2, 3], [4, 5, 6], [7, 8, 9]].
Write...
Consider the matrix list x = [[1, 2, 3], [4, 5, 6], [7, 8, 9]].
Write a list comprehension to extract the first column of the
matrix [1, 4, 7]. Write another list comprehension to create a
vector of twice the square of the middle column.
2. Write the output matrix “v”
t = [2:4];
k = [1:3];
v = t.*k –...
2. Write the output matrix “v”
t = [2:4];
k = [1:3];
v = t.*k – k.^2
4. Given: D = [1 2 3 4 5 6 7 8 9] (3x3) . Which command will
extract the submatrix [1 2 3 4 5 6] (2x3) ?
a. D[1:2,1:3]
b. D(1,2 ;1,3)
c. [D(1:2),D(1:3)]
d. D(1:2,1:3)
14. What will be the dimension of matrix B?
B=[ones(3) zeros(3) rand(3); 2*eye(9)]
18. Find the value of “C”
A=1:2:10;
B=linspace(1,5,5);
C = length(A)*B(2)+A(5)*B(3);
19....
Solve the system of equations using an inverse matrix
-4x-2y+z= 6
-x-y-2z= -3
2x+3y-z= -4
Choose...
Solve the system of equations using an inverse matrix
-4x-2y+z= 6
-x-y-2z= -3
2x+3y-z= -4
Choose one:
a. (-1, 0, -2)
b. (1, 0, -2)
c. (1, 0, 2)
d. (-1, 0, 2)
Let the population have N=7 units, with {(unit,value)} =
{(A,-1),(B,+1),(C,-2),(D,+3),(E,-4),(F,+5),(G,-6)}. The design is
as follows: first...
Let the population have N=7 units, with {(unit,value)} =
{(A,-1),(B,+1),(C,-2),(D,+3),(E,-4),(F,+5),(G,-6)}. The design is
as follows: first choose A or B at random; if A then choose from
{C,D} at random, if B then choose from {E,F,G} at random. 1) Find
the first-order inclusion probabilities (note that the sample size
n is fixed at 2).
Verify (show numerically for this example) that the
Horvitz-Thompson estimator is unbiased for the population total.
(Hint: find the probability of each sample and the value...
write a script named print_lines.sh that uses head and tail
together to print out a specific...
write a script named print_lines.sh that uses head and tail
together to print out a specific set of lines from a file. The
script should take three arguments: the line number to start at,
the line number to stop at, and the file to use. Here's an example
run:
[user@localhost ~]$ print_lines.sh 7 10
/etc/passwd
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
[user@localhost ~]$
In this example, the script prints line 7 through 10 (inclusive)
of the /etc/passwd file. Your script must do...