0% found this document useful (0 votes)
1 views2 pages

CSW1 Assignment Chapter 13

Uploaded by

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

CSW1 Assignment Chapter 13

Uploaded by

ushashimandal13
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Assignment-9 Advanced Uses of “numpy” & “matplotlib”

Subject: Computer Science Workshop - 1 (CSE 2141)


Session: Sep 2025 to Jan 2026
Branch: Computer Science and Engineering (CSE)
Section: All
Course Outcome: CO5, CO6
Program Outcomes: PO1, PO2, PO3, and PO5
Learning Levels: Remembering (L1), Understanding (L2), Application (L3), Analysis (L4)

Q no. Questions Learning


Levels
Q1. Create a NumPy array of 10 equally spaced values between 0 and π. L1, L2
Perform the following operations on the array:

1. Compute sine values


2. Compute cosine values
3. Compute square root of each element
4. Display all results with proper formatting

Q2. Write a Python program to: L1, L2

1. Create an array of angles in degrees: [0, 30, 45, 60, 90]


2. Convert the angles into radians using NumPy
3. Compute sin, cos, and tan values of the angles
4. Display the results in tabular format

Q3. Create a NumPy array containing values [1, 2, 4, 8, 16]. L1, L2


Using NumPy functions:

1. Find the natural logarithm


2. Find the base-10 logarithm
3. Find the base-2 logarithm
4. Find the exponential of each element

Q4. Write a Python program to: L2, L3

1. Generate 50 equally spaced values between 0 and 2π using NumPy


2. Compute the sine, cosine, and tangent of each value
3. Plot the sine, cosine, and tangent curve using Matplotlib

Q5. Write a Python program to: L2, L3

1. Generate 100 equally spaced values between −20 and 25 using [Link]().
2. Compute and plot two polynomial functions on the same graph:
3 2
o y1=x −15x +25
2
o y2=2x −10x+5
3. Use different colors or line styles to clearly distinguish the two curves.
4. Add a suitable title, X-axis label, and Y-axis label.
5. Display a legend identifying both polynomial curves.
6. Show the graph using Matplotlib.

Q6. Visualize the sine and cosine functions using NumPy and Matplotlib. L3, L4
Generate the x values from 0 to 2π with an interval of 0.1, and compute the
corresponding sine and cosine values. Plot both curves on the same graph, where the
sine function is displayed in blue with a solid line, and the cosine function is
displayed in red with a dashed line.

Label the x-axis as “X values (radians)” and the y-axis as “Function values”. Add the
title “Sine and Cosine Functions” and include a legend to clearly distinguish between
the two curves.

Q7. Draw the following figure using matplotlib. L2, L3

Q8. Plot two normalized vectors from the origin using Matplotlib. Represent vector v1 in L3, L4
green color and vector v2 in red color. Ensure that both vectors originate from the
origin, and include a legend to identify them clearly.

-END-

You might also like