You are on page 1of 2
10. 12. 13. 14, 15. 16. 17. 18. Exercises: Part 1 Create two strings with words “slumdog” and “millionaire”. Print them in separate lines and in one line (using paste). Create a row vector with the elements 1,3,5,7,11, 13, 17 and 19. Generate a columa vector» with 2,...,28, Generate a columa vector ¢ with 1,4,9,16,25,...,64. Find the positions where clements of » and c coincide (use vsich) Create a matrix i. with the first column vector b and the second column vector c. Print the imension and the seventh row of .c. (Create a matria 14. with the first row vector a and the second row vector b. Rename the rows of 4M. rtoa and b and the columns to S, 7, ..., ¥, Z. (Hint.: These are the last 8 letters of the alphabet.) Print the matrix 4. r without the column W. Print elements of 4. larger than 12. ‘Compute the values of the function y: of 05. for an equidistant grid from -3 to 3 with an stepwidth Create a vector d which contains the numbers from 1 to 100 and another vector e which contains 100 elements equal to 7. Create a (10 10) matrix D which contains the numbers 1 to 100 (filled by columns) and another (10 10) matrix © which contains the numbers 1,4, 4...., 7 (filled by rows). Calculate the the sum D+ E, the difference D—E, the (matrix!) product D-E and the product of elements (4; ;-€,)); = Print the diagonal elements of the matrix P= D-E. ‘Compute the difference of the functions yy = 35 +.x'-42° +32 +441 andy =144-(L48-(1+ 4-(1+x-(1+2)))) forsome.x. What is the difference between both methods? Calculate sine and cosine on a grid [0;2x]. calculate sin /cos—tan, what is the difference? Assuming {2,3,5,3,2,5,7,4,2,5} are prices, calculate log retums (by two methods, one using aiff). From vector {1, 1.1.1, 1,2,2,2,2,3,3,3,3,3,3.3.4,4.4.4.4.4,5,5,5,5,5,5,5,5,5,6,6,6.6.6} find the points where values change. 20. Define A= 21. Find the determinant, 22. Fin 23. Replace the upper triangles ia the following matrices 1.00 0.40 =4.30 0.03 0.24 Fraction of positive to negative elements eee 371 Lgl 171 3.90 0.01 I 3 6 the vector sin. 0.01 134 ou 0.02 2.87 aus ean 119. 174 344 1.05 3.57 inverse an multiply by the original (test whether we get the Identity matrix).

You might also like