import pandas as pd
import numpy as np
from numpy.linalg import norm
# max norm of a vector
from numpy import inf
#1.Separate the following data into input and output data:
data = ([2,6,8],[4,32,12],[1,5,5])
x=np.split(data,[1])
print(x)
# 2.Split into train and test data. Split the following dataset at the split point of 2 and using all columns`
data1 = ([5, 10, 15],
[20,25,30],
[35,40,45])
x1=np.split(data1,[2])
print(x)
#3.Use the size of the dataset array dimensions in the shape dimension by specifying the parameters:
data2=np.array([[2,4],[6,8],[10,12]])
print(data2.shape)
# 4.Add the following arrays:
a =np.array([[5,8,1],[6,1,2]])
b = np.array([1, 5, 12])
add_array=np.add(a,b)
print(add_array)
# 5.Multiply the following vectors:
a1 = np.array([10, 12, 18])
b1 = np.array([2, 23, 46])
mul_array=np.multiply(a1,b1)
print(mul_array)
#6.Divide the following vectors:
a2 = np.array([3, 8, 9])
b2 = np.array([12, 15, 16])
div_array=np.divide(a2,b2)
print(div_array)
#7.Find the dot product of the following vectors:
a3 = np.array([ 6, 8, 15])
b3 = np.array ([2, 4, 8])
dot_array=np.dot(a3,b3)
print(dot_array)
#8.Calculate the vector L^1 Norm of the following vector:
a4 = np.array ([20, 32, 40])
l1 = norm(a4, 1)
print(l1)
#9.Calculate the vector L^2 Norm of the following vector:
a5 = np.array ([20, 32, 40])
l2 = norm(a5, 2)
print(l2)
# 10.Calculate the vector Max Norm of the following vector:
a6 =np.array ([20, 32, 40])
maxnorm = norm(a6, inf)
print(maxnorm)
Hello Student , I have completed all your answers , only you have to log into Jupyter notebook. To do that simply search Google colab in your browser and click on the first link after that click on the option Welcome to Colaboratory and just click on the file in the left corner and create a new notebook and rest you are having the code . And if you are new to Jupyter notebook, please feel free to ask me I will guide you.
Thankyou.
Get Answers For Free
Most questions answered within 1 hours.