Question: Solve the below problem in Python. Problem 6 : Using a Model that Breaks Newton's Law of Cooling gives the rate of a cooling of

Solve the below problem in Python.
Problem 6: Using a Model that Breaks
Newton's Law of Cooling gives the rate of a cooling of an object proportional to its current
temperature and the ambient temperature. The model described is:
Tmp(t)=(Ti-Ta)e-kt+Ta
where T0 is the object's initial temperature, T8 is the ambient (or background) temperature, t is
time elapsed, the k and experimentally determined constant. Assume k=0.19617. Implement
a function determine t(T,TO,Ta,k) that, when given a final temperature T, determines the time it
takes to reach that temperature. For example, this code
x=0.19617
To=200
Ta=72
T=85
prist(deterainet(T,To,Ta,K))
which has the initial temperature at 200F, ambient temperature at 72F, and final temperature
at 85F produces
which means it will take about 11min. 40sec. to cool. The problem with this model is that we
can't use it directly to ask how long will it take to cool to room temperature:
Ta=(T0-Ta)e-kt+Ta
e-kt=0
We can't take the log of 0. We confirm with Python:
The reason is that this is a limit (convergence):
limte-kt=0
Indeed, if we run our solution weill raise the same error:
How can we solve this problem? We can form the linear regression over, say, the last three
points:
The code uses the last three whole temperatures (we'll need our original function to deter-
mine them). We can then use numpy's polyfit bttps://aunpy.org/doc/stable/reference/
geverated/aunpy.polyfit. html that has how to tind the coetticients y=mx+b as an array
and how to automatically build the function from the coetticients.
x=0.19617
Assignment N29 Convergence, Al (Clustering), Monte Carlo
Delverables Problem 6
Implement the two functions.
Round to two decimal places.
Here is the defining for the problem:
#Problem 6
#INPUT temperature, initial temp, ambient temp, k
#OUTPUT time to reach T from T0 in Ta
def determine_t(T,T0,Ta,k):
pass
#INPUT T0, Ta, k
#OUTPUT using the function above model the three data points
#using numpy polyfit and poly1d
def final_temp(T0,Ta,k):
pass
Thank you for your help!
Solve the below problem in Python. Problem 6 :

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 Accounting Questions!