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 : 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:
where is the object's initial temperature, is the ambient or background temperature, is
time elapsed, the and experimentally determined constant. Assume Implement
a function determine that, when given a final temperature determines the time it
takes to reach that temperature. For example, this code
prist
which has the initial temperature at ambient temperature at and final temperature
at produces
which means it will take about min. 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:
We can't take the log of We confirm with Python:
The reason is that this is a limit convergence:
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 well need our original function to deter
mine them We can then use numpy's polyfit bttps:aunpyorgdocstablereference
geveratedaunpypolyfit. html that has how to tind the coetticients as an array
and how to automatically build the function from the coetticients.
Assignment N Convergence, Al Clustering Monte Carlo
Delverables Problem
Implement the two functions.
Round to two decimal places.
Here is the defining for the problem:
#Problem
#INPUT temperature, initial temp, ambient temp, k
#OUTPUT time to reach T from T in Ta
def determinetTTTak:
pass
#INPUT T Ta k
#OUTPUT using the function above model the three data points
#using numpy polyfit and polyd
def finaltempTTak:
pass
Thank you for your help!
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
