Question: Create three lists ( A , B , and C ) with random values in Python such that each list contains five real values. Calculate

Create three lists (A, B, and C) with random values in Python such that each list contains five real values. Calculate the distances between the lists using the formulas below.
d(A,B)=i=15(Ai-Bi)22
d(A,B)=(Ai-Bi)T(Ai-Bi)2
cosine(A,B)=A*B|A||B|
Here, ()T is transpose. (.) denotes dot product and || presents the magnitude of the vector. You MUST implement these equations from scratch without using any Python library or routines.
Randomly generate two matrices (P and Q) with four rows and five columns. You can use numpy arrays in Python. Write a program that obtains L(2,1)-norm of a matrix. First, take the L2 norm of each row of a matrix as below.
Prnorm(i)=jncolPij22
This is actually sum of squared values in each row. Then, obtain the L1 norm of the L2 norm values Prnorm as below.
P2,1=inrow|Prnorm(i)|
Here, nrow and ncol represent the numbers of rows and columns, respectively.
 Create three lists (A, B, and C) with random values in

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!