Sample Assignments on SCILAB
Assignment Statements:
1. Given two sides a= 3.2 and b=4.6 of a triangle and angle theta= 600 between these
two sides. Find the length of the third side and the area of the triangle.
2. Write a SCILAB statement to calculate the sum of the
series: S= 1- x2/2! + x4/4! x6/6! + x8/8! for x= 1.5
Arrays
3. The array A is given below. Extend the 2-D array to 3-D array by including another 2-
D array as second element in the third dimension.
4. Let a matrix A of size (3x4) is defined as, . Reshape the
matrix A into matrix B of the size (6x2).
5. Let a column vector z be given as z = [2; 3; 4; 5].
(i) Form a diagonal matrix A, using the elements of z as he main diagonal elements of A.
(ii) Form the matrix B, using the elements of vector z as elements of upper diagonal of B.
(iii) Form the matrix C, using the elements of vector z as elements of first lower diagonal of C.
Polynomials
6. Integrate the polynomial y = 4x3 + 12x2 + 16x + 1. Take the constant of integration as 3.
7. Find the polynomial of degree 2 to fit the following data:
x 0 1 2 4
y 1 6 20 100
Input-Output statement and files
8. Write a program in SCILAB to illustrate the user of ‘pause’ command.
9. Write a program in SCILAB to illustrate the use of fwrite function for writing binary data of
Plots
10 -
axis and y-axis and provide a suitable title for the plot
11. Plot a bar graph for the data given as x = [1 2 3 4 5 6] and y = [10 15 25 30 27 19]
12. Given x = t2 and y = 4t for -4 < t < 4. Using MATLAB obtain a 3-D plot showing the
matrix in (x, y) space as a factors of time.
Control structures
13. Write a program in SCILAB to find the count of even values in the given n
numbers.
Functions
14. Write a function in SCILAB to calculate the roots of the quadratic equation
ax2 + bx + c = 0, where a, b, c are constants.
Sample Assignments on Python
Data Types, Input- Outputs, Variables
1. Write a program in Python to swap two variables.
2. Write a program in Python to check the input character is an alphabet or not.
Loop
3. Write a program in python to shuffle a deck of card using the module random and
draw 5 cards.
4. Write a program in python to find the factors of a number.
Array and Lists
5. Write a program in python to transpose a given matrix M = [[1, 2], [4, 5], [3, 6]].
6. Write a program in python to print the median of a set of numbers in a file.
Function
6. Write a function in Python to find the resolution of a JPEG image.
7. Write a program in python and use in-built functions to convert a decimal number to
binary, octal and hexadecimal number.
8. Write a program in python to sort words in alphabetical order.
Plot
9. Use Matplotlib to draw histogram to represent average age of population given as Age
[21, 54, 66, 44, 32,42, 54, 62, 93, 45, 32, 70]
10. Create a 3-D plot in Python for the function over the interval - -