0% found this document useful (0 votes)
21 views3 pages

Aiml Exp 2.1

The document describes an experiment implementing basic Python libraries such as Math, NumPy, and SciPy. It includes the aim, tools used, algorithms, program code, output, and learning outcomes. The student imported and used functions from the Math, NumPy, and SciPy libraries to perform operations like square root, sine, array operations, and permutations.

Uploaded by

Riya Riyaz
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)
21 views3 pages

Aiml Exp 2.1

The document describes an experiment implementing basic Python libraries such as Math, NumPy, and SciPy. It includes the aim, tools used, algorithms, program code, output, and learning outcomes. The student imported and used functions from the Math, NumPy, and SciPy libraries to perform operations like square root, sine, array operations, and permutations.

Uploaded by

Riya Riyaz
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
You are on page 1/ 3

DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING

Experiment: 2.1

Student Name: Kumar Aryan UID: 21BCS-3117


Branch: CSE Section/Group: 21BCS_IOT-627-B
Semester: 5th Date: 18/09/2023
Subject Name: AIML Lab Subject Code: 21CSH-316

1. AIM: Implementation of Python basic Libraries such as Math, Numpy and Scipy.

2. Tools/Resource Used:
There is no specific input or apparatus required for this experiment. It can be conducted on any system
with Python installed..

3. Algorithm:
1. import math: a math library for mathematical operations.
2. import numpy: library for numerical computing in Python.
3. import scipy: library for scientific and technical computing in Python.

4. Program Code:
# Math Library
import math
x = 4.5
y = math.sqrt(x) # Square root
z = math.sin(math.pi / 2) # Sine of pi/2
# Print the results
print(f"Square root of {x} is {y}")
print(f"Sine of pi/2 is {z}")

# Numpy library
import numpy as np

# Creating arrays
arr1 = np.array([1, 2, 3, 4, 5])
arr2 = np.arange(0, 10, 2)
result = arr1 + arr2
mean_value = np.mean(arr1)
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

# Print the results


print(f"Result of addition: {result}")
print(f"Mean value of arr1: {mean_value}")

# Scipy Library
import scipy
from scipy.special import perm
#find permutation of 5, 2 using perm (N, k) function
per = perm(5, 2, exact = True)
print(per)

5. Output/Result:
# Math Library

# Numpy Library
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

# Scipy Library

6. Learning Outcomes:

1. Learnt about Math Library in Python.


2. Learnt about Numpy Library in Python.
3. Learnt about Scipy Library in Python.

You might also like