0% found this document useful (0 votes)
48 views

Ai Lab 9

This document contains the notes from Lab #09 for a student named Fariha Saeed. It includes examples and exercises on working with 1D, 2D and 3D arrays in Python, such as converting lists to arrays, creating matrices, performing transpose operations, and multiplying matrices. The lab covers basic NumPy array functions like shape, size, dtype and creating diagonal arrays.

Uploaded by

Muhammad Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views

Ai Lab 9

This document contains the notes from Lab #09 for a student named Fariha Saeed. It includes examples and exercises on working with 1D, 2D and 3D arrays in Python, such as converting lists to arrays, creating matrices, performing transpose operations, and multiplying matrices. The lab covers basic NumPy array functions like shape, size, dtype and creating diagonal arrays.

Uploaded by

Muhammad Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

NAME: FARIHA SAEED SECTION: B ROLL NO: CE-20F-094

LAB # 09
EXAMPLES
Example: 1 (The N-dimensional arrays)

Example: 2 (Two-dimensional arrays)

(Array 1d, 2d, 3d)

CE415L
NAME: FARIHA SAEED SECTION: B ROLL NO: CE-20F-094

Example: 3 (Basic Functions)

CE415L
NAME: FARIHA SAEED SECTION: B ROLL NO: CE-20F-094

Basic Functions:

Basic Functions:

Basic Functions:

CE415L
NAME: FARIHA SAEED SECTION: B ROLL NO: CE-20F-094

Basic Functions:

Example: 4 (Array iteration)

CE415L
NAME: FARIHA SAEED SECTION: B ROLL NO: CE-20F-094

EXERCISE
Task: 1 Write a Python program to convert a list of numeric value into a one-
dimensional NumPy array.

Task: 2 Create a 3x3 matrix with values ranging from 2 to 10

Task: 3 Create a null vector of size 15 and update fifth value to 12 and ninth value to 17.

CE415L
NAME: FARIHA SAEED SECTION: B ROLL NO: CE-20F-094

Task: 4 Take 2D and 3D array and perform transpose function.


2D:

3D:

CE415L
NAME: FARIHA SAEED SECTION: B ROLL NO: CE-20F-094

Task: 5 Write a Python program to find the real and imaginary parts of an array of
complex numbers.

CE415L
NAME: FARIHA SAEED SECTION: B ROLL NO: CE-20F-094

Task: 6 Multiply a 5x3 matrix by a 3x2 matrix create a real matrix product using dot ( ).

CE415L
NAME: FARIHA SAEED SECTION: B ROLL NO: CE-20F-094

Task: 7 Create array by 2x3 and perform following function:


 Number of dimension(ndim)
 Total number of element/size in an array
 What type of array stores in memory(dtype)

Task: 8 Write a Python program to create a 3-D array with ones on the diagonal and
zeros elsewhere

CE415L

You might also like