Explain what is the python doing
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Explain what is the python doing
![6. A scientist studying the universe has written the Python code below:
from pylab import *
def rate (z):
A = = 0.6
B = 0.5
C =
9.4
zdash =
return (zdash)
A*exp(-z/C) B*Z
to = 0
ZO = float (input("Please enter initial value: "))
float (input ("Please enter final time: "))
time_end =
number_of_steps
20
time_step =
=
time_end/number_of_steps
z = zeros(int (number_of_steps+1))
t = zeros(int (number_of_steps+1))
z [0]
zo
t [0]
= to
i = 0
print (i,z[i])
while i < number_of_steps:
i = i + 1
t[i]
z [i]
=
t[i-1]+time_step
=
z [i-1]+time_step*rate (z[i-1])
print (i, z[i])
The scientist knows that you have just finished SCIE1000, and so emails it to you to get some
advice. You run it, and enter two numbers. It gives the following output:
Please enter initial value: 0.1
Please enter final time: 10
0 0.1
1 0.3718254266066964
2 0.567233937130043](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F0a74a251-376d-4ec7-abb5-b513b674e39e%2F4580a424-4127-4f2f-af72-b565b4131b47%2Fwn5r2p0s_processed.png&w=3840&q=75)
Transcribed Image Text:6. A scientist studying the universe has written the Python code below:
from pylab import *
def rate (z):
A = = 0.6
B = 0.5
C =
9.4
zdash =
return (zdash)
A*exp(-z/C) B*Z
to = 0
ZO = float (input("Please enter initial value: "))
float (input ("Please enter final time: "))
time_end =
number_of_steps
20
time_step =
=
time_end/number_of_steps
z = zeros(int (number_of_steps+1))
t = zeros(int (number_of_steps+1))
z [0]
zo
t [0]
= to
i = 0
print (i,z[i])
while i < number_of_steps:
i = i + 1
t[i]
z [i]
=
t[i-1]+time_step
=
z [i-1]+time_step*rate (z[i-1])
print (i, z[i])
The scientist knows that you have just finished SCIE1000, and so emails it to you to get some
advice. You run it, and enter two numbers. It gives the following output:
Please enter initial value: 0.1
Please enter final time: 10
0 0.1
1 0.3718254266066964
2 0.567233937130043

Transcribed Image Text:3 0.7078576294083201
4 0.8091316697378195
5 0.8821055956118914
6 0.9347074436372816
7 0.9726346885043051
8 0.9999864581494113
9 1.0197143082402373
10 1.033944716658461
11 1.0442103586631264
12 1.0516162493108738
13 1.0569592427060288
14 1.0608140584976962
15 1.063595250817454
16 1.065601867742315
17 1.067049646798249
18 1.0680942305349759
19 1.0688479096897523
20 1.069391699903605
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 5 steps with 5 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY