Sample Assignments On SCILAB & PYTHON
Sample Assignments On SCILAB & PYTHON
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.
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.
(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.
x 0 1 2 4
y 1 6 20 100
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
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.
5. Write a program in python to transpose a given matrix M = [[1, 2], [4, 5], [3, 6]].
Function
7. Write a program in python and use in-built functions to convert a decimal number to
binary, octal and hexadecimal number.
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 - -