Question: In python, solve in as few lines as possible ( each can be done in one line ) Problem 2 : Construct a matrix C

In python, solve in as few lines as possible (each can be done in one line)Problem 2: Construct a matrix C with C[i,j]=1x[i]+y[j].
In []: x= np. linspace (1,2,6)
y = np. linspace )
# Write your code below
Problem 3: Each row of x and Y is the coordinates of a 2D-point. Construct the matrix D, such that D[i,j] is the distance between x[i] and
Y[j].
In [3]: x
Y
#
Problem 4. Generate a random matrix of mm, with roughly half of the entries 0, and the remaining entries are integers chosen from 1,2 and 3.
In []:m=5
# Write your code here
Problem 5. Generate a random nn matrix whose entries above the main diagonal are positive, while the entries below the main diagonal are all
negative.
In []: n=5
# Write your code here
Problem 6. Muptiple each row of x whose index is given in I by 2.
In []: A= np. random. rand (4,4)
#print (A)
I=[0,1,1,2]
 In python, solve in as few lines as possible (each can

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!