Encerrado

Project 4 using Python

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)''

Habilidades: Python

Ver mais: where can i get python, small project in python, python look for file, python find, purpose of use case, models 2d, list get python, find python, find call center process, can 0 be a probability, call center positions, at least probabilities, 2d models, todo list, small python project, simple python project, python project , print models, convert 2d to, python read, convert python text file, project input output, python convert file, convert text file python, probability matrix

Acerca do Empregador:
( 1 comentário ) Fortville, United States

ID do Projeto: #5142787

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

fejs

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.

$20 USD em 1 dia
(7 Comentários)
3.1
Venky117

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

$25 USD em 1 dia
(5 Comentários)
2.7
sousivw

A proposal has not yet been provided

$20 USD in 2 dias
(1 Comentário)
1.0
mimoban

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

$25 USD in 3 dias
(0 Comentários)
0.0
szymszteinsl

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

$100 USD in 3 dias
(0 Comentários)
0.0
benonisilva

A proposal has not yet been provided

$15 USD in 3 dias
(0 Comentários)
0.0
georgemurga

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.

$15 USD in 2 dias
(0 Comentários)
0.0