# Project 4 using Python

Orçamento $10-30 USD

Part 1

In part 1, you will read the matrix from the file [url removed, login to view] and determine a number of properties. Build up your program in small steps that are thoroughly tested. For instance, in Todo-1, read the matrix from the file and make sure you indeed get a matrix, before counting the zero entries.

TODO 1 - Calculating the density

Read the matrix from the file given to you. Look at the file content to understand how it is structured. For the purpose of debugging, this matrix is small; you can later process larger and more complex matrices. Remember that reading a file content creates a string that you have to convert into a list that encodes the matrix according to the encoding we have discussed. The string to list conversion is done exactly as if you typed the text for a call to the function input(…). Having read in the matrix from file, determine the density of the material as the quotient of void cells and total number of cells. In our example this would be 14/25. You should be able to leverage your work of project 3 here. Print the output as:

Void cells:14 Cells:25 Quotient:0.56

Todo 2 - Leaky material

Imagine water bordering the top edge of the grid. Assume that a void cell can take on water if it is in the top row or else if at least one of the cells adjacent to the north, the south, east or west can take on water. Please note that the neighbors of a cell are at most four, that is the ones laying in the cross having the cell as center. For instance, a void cell at [i,k] takes on water if any one of its (up to) 4 neighbors is filled, at positions [i-1,k],[i+1,k],[i,k-1], and [i,k+1]. Be careful with the boundary and corner cells that have fewer than 4 neighbor!

Determine all cells that can take on water and assign to the corresponding matrix cells the value 0.5. Also determine the number of these cells. Print the number of cells having a value 0f 0.5. In our example 10 cells can take on water:

Computer models, such as the 2D matrix that represents a porous material, are useful because we can use them to perform experiments. In this case, you will run a simple statistical experiment. For random matrices, that is matrices where the “full” and “void” cells are assigned randomly, but in which 0’s and 1’s are assigned with specific probabilities, you have to estimate empirically the probability that the corresponding material is leaky.

Todo 3- Random Matrix

Generate 10-by-10 matrices with random entries of 0 and 1, where zeroes are generated with probability p and ones with probability 1-p. For fixed probability p=0.3 generate 20 such matrices and print, for each matrix so generated, the number v0 of 0 entries, the number w0 of 0.5 entries after water has been filled– determine using the function you wrote for TODO2–, and the sum v0+w0. The printout should look like:

''Matrix number X has v0=4 w0=10 v0+w0= 14''

where X should be substituted by 1, 2, …., 20. Note that the number used above for v0, w0 are fictitious.

Part 2

TODO4 - Northwest Passage

If a grid is leaky, there will be at least one passage through which water flows from top to bottom. In this part you have to find a path for the leaky grids. For a leaky grid, find and print a path from the top row to the bottom row. In our example, one such path would be given by the index pairs:

''(0,3),(0,2),(1,2),(1,1),(2,1),(2,0),(3,0),(4,0)''

## 7 freelancers estão ofertando em média $31 para esse trabalho

Hi Sir. I'm expert in Python programming, and I've finished this project for You. If You award me the project, I can send You code immediately. Best regards, Fejs.

hi... i can do this. Please let me know if you are interested to complete early. I can deliver you on time. thanks

Hey i can easily do this. This is a very easy code. I am good in python and sincere about my work. So please reply if you are interested

Hi! I am professional C/C++/C#/Java programmer. I can do this project with highest quality. Best Regards, Szymszteinsl

Hello, I understand the project and I know how to do it in Python. I will just need a little bit of clarification for the "Todo 3 - Random Matrix" regarding the use of the probability p. Thank you.