SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 304 Weeks Ago, 4 Days Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 26 Mar 2018 My Price 10.00

Note the change from the code we worked on in class.

The computer language must be done in python, the problem is at the bottom of the page. The algorithms given need on the assignment need to be manipulated to work for dot multiplication of a matrix.

 

Introduction to Programming Matrix Multiplication The following program will add two “square arrays.” Note the change from the code we worked on in class. # add 2 square matrices def add(a,b): lena=len(a) x=[lena*[0] for i in range(lena)] for i in range(lena): for j in range(lena): x[i][j]=a[i][j]+b[i][j] return x x=[[1,1],[1,1]] y=[[1,1],[3,4]] c=add(x,y) print(c) Write a function mult(a,b) that will “multiply” the two square matrices a and b as we discussed in class. If we write c=mult(a,b) then c[i][j] will be the dot product of row i of matrix a with column j of matrix b. Recall that if we have 2 lists a and b of the same size, then we can define dot as follows: z=[1,2,3] v=[4,5,6] def dot(a,b): lena=len(a) g=0 for i in range(lena): g=g+a[i]*b[i] return g print(dot(z,v)) Problem 1. Ask your user for an integer n. 2. Create two nXn matrices (two dimensional lists) filled with random integers. Call one A and the other B. 3. Print A and B. 4. Multiply (by using the matrix multiplication algorithm) A and B to get matrix C. 5. Print matrix C. 6. Go back to step 1 and repeat until the user enters “done”. Test out your function on matrices of various sizes. The values in the matrices should be generated by using randint(). I would suggest using small random numbers so that it will be easier for you to check. 
 

Attachments:

Answers

(5)
Status NEW Posted 26 Mar 2018 09:03 AM My Price 10.00

  ----------- He-----------llo----------- Si-----------r/M-----------ada-----------m -----------  ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be-----------

Not Rated(0)