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

EXPERIMENT NO python

The document presents a series of experiments using NumPy for basic mathematical operations including addition, subtraction, multiplication, division, power, remainder, and absolute values. Each operation is demonstrated with example code snippets that define input arrays and print the resulting output. The operations are structured in a sequential manner, labeled from Q1 to Q8.

Uploaded by

prayasambawade
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)
4 views

EXPERIMENT NO python

The document presents a series of experiments using NumPy for basic mathematical operations including addition, subtraction, multiplication, division, power, remainder, and absolute values. Each operation is demonstrated with example code snippets that define input arrays and print the resulting output. The operations are structured in a sequential manner, labeled from Q1 to Q8.

Uploaded by

prayasambawade
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/ 3

EXPERIMENT NO

Q1 Addition Q3 Multiply

INPUT ;- INPUT ;-

import numpy as np import numpy as np

arr1 = np.array([10, 11, 12, 13, 14, 15]) arr1 = np.array([10, 11, 12, 13, 14, 15])

arr2 = np.array([20, 21, 22, 23, 24, 25]) arr2 = np.array([20, 21, 22, 23, 24, 25])

newarr = np.add(arr1, arr2) newarr = np.multiply(arr1, arr2)

print(newarr) print(newarr)

OUTPUT ;- OUTPUT ;-

Q2 Subtraction Q4 Division

INPUT ;- INPUT ;-

import numpy as np import numpy as np

arr1 = np.array([10, 11, 12, 13, 14, 15]) arr1 = np.array([120, 20, 30, 40, 50, 60])

arr2 = np.array([20, 21, 22, 23, 24, 25]) arr2 = np.array([6, 5, 10, 8, 2, 3])

newarr = np.subtract(arr1, arr2) newarr = np.divide(arr1, arr2)

print(newarr) print(newarr)

OUTPUT ;- OUTPUT ;-
import numpy as np

Q5 Power arr1 = np.array([10, 20, 30, 40, 50, 60])

arr2 = np.array([3, 7, 9, 8, 2, 33])

INPUT ;- newarr = np.divmod(arr1, arr2)

import numpy as np print(newarr)

arr1 = np.array([10, 6, 3, 4, 7, 6]) OUTPUT;-

arr2 = np.array([3, 5, 6, 8, 2, 6])

newarr = np.power(arr1, arr2)

print(newarr) Q8 Absolute Values

OUTPUT ;- INPUT ;-

import numpy as np

Q6 Remainder arr = np.array([-1, -2, 1, 2, 3, -4])

newarr = np.absolute(arr)

INPUT ;- print(newarr)

import numpy as np

arr1 = np.array([10, 20, 30, 40, 50, 60]) OUTPUT ;-

arr2 = np.array([3, 7, 9, 8, 2, 33])

newarr = np.mod(arr1, arr2)

print(newarr)

OUTPUT ;-

Q7 Quotient and Mod

INPUT ;-

You might also like