Professional Documents
Culture Documents
Experiment: 2.1
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
# 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: