NumPy which is also called numerical python ., Study Guides, Projects, Research of Programming Languages

NumPy which is also called numerical python .

Typology: Study Guides, Projects, Research

2023/2024

Uploaded on 06/05/2024

mahnoor-bari
mahnoor-bari 🇵🇰

3 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
_________________________________________________________________________
Introduction to IT Lab Page 1 Experiment # 10
DEPARTMENT OF AVIONICS ENGINEERING
SUBJECT : Introduction to Information Technology
Lab
SUBJECT CODE : 108444
LAB NO : 10
TITLE :NumPy
SUBMITTED TO : Ms. Anila Ali Ahmed
SEMESTER : 1st
SECTION : A
Marks Obtained
Group Member
1
Group Member
2
Group Member
3
NAME
REGISTRATION #
LAB REPORT
PERFORMANCE
TOTAL MARKS
DEADLINE: 1600hrs, 30th December 2022
DATE OF SUBMISSION:
pf3
pf4

Partial preview of the text

Download NumPy which is also called numerical python . and more Study Guides, Projects, Research Programming Languages in PDF only on Docsity!

DEPARTMENT OF AVIONICS ENGINEERING

SUBJECT : Introduction to Information Technology

Lab

SUBJECT CODE : 108444

LAB NO : 10

TITLE :^ NumPy

SUBMITTED TO : Ms. Anila Ali Ahmed

SEMESTER : 1

st

SECTION : A

Marks Obtained

Group Member

Group Member

Group Member

NAME

REGISTRATION

LAB REPORT

PERFORMANCE

TOTAL MARKS

DEADLINE: 1600hrs, 30th^ December 2022

DATE OF SUBMISSION:

Task # 1: Explain the following functions in 1-2 lines along with examples

ans = np.sum(array) ans = np.sqrt(array) ans = np.square(array) ans = np.add(array A, arrayB) ans = array.T ans = np.max(A) //works for 1D, 2D ans = np.min(A) //works for 1D, 2D ans = np.ceil(array) ans = np.floor(array) ans = np.round(array) ans = array.reshape(r,c) ans = np.ones(n) ans = np.zeros(m)

Task # 2: Create a vector of length 20, where each component has the value 1. Then replace

odd index values with 0. ( use numpy.ones() )

Task # 3: Create a 10x10 random matrix. ( use numpy.random.rand(r,c) )

(a) Print the element in the first row, and the first column. (b) Set the element in last row, and the last column to -1 and then print the matrix. (c) Print the elements in the second row. (d) Print the elements in the third column. (e) Replace all the elements in the second row with 0 and then print the matrix.

Task # 4: Evaluate the following:

a) R1 = np.random.random(10, 10) (you may use (2,2) initially) b) R2 = R1 < 0.5 (Print value of R2 and Justify the logic behind it) c) R1[R2] (Print R1[R2] and Justify the logic behind it) d) R1[R2] = -1 (Print R1 and Justify the logic behind it)

Task # 5: Create two matrices, A and B, of random numbers, with the 5x5 shape.

a. Add matrices element wise, using np.add(..) It also works with + b. Add 6 to all the elements of the matrix A. c. Double all the elements of the matrix B.

d. Try np.sum() and understand its functionality in comparison with the function

np.add().

 Tax Collected at Day 2is 10;