Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Expert can you help me on this problem. Please read all carefully. Please explain and put a description on on every line on the photon

Expert can you help me on this problem. Please read all carefully. Please explain and put a description on on every line on the photon ( pycharm program language)

I just want to better understand the concept and the step for writing this code. please clearly explain what you do. Thank

image text in transcribedimage text in transcribed

We are analyzing data read from a thermocouple that measures the temperature in a chemical reactor (i.e., a round bottom flask or beaker) that is being heated to cause an endothermic (i.e., absorbs heat) reaction. The reaction rate varies with temperature and, due to environmental conditions beyond our control, the temperature of the reactor varies somewhat over time. The functions described below are intended to a.) determine if a value lies between a minimum and maximum, b.) remove "outlier temperatures from sets of data collected during individual experiments, c.) calculate the sample mean and standard deviation of temperature for each experiment, and d.) calculate the maximum, minimum and average reaction rate predicted for each experiment. To Do: You should write four different functions in addition to a function named main() which you can simply copy from the HW1-Stem.py on Canvas. All of your code should be in a single Python file named HW1- SP21.py. You will test your functions using the particular numerical values given in the main () function. When we grade your assignment, we will run your program with those given numerical values, looking for correct answers. Then we will change the numerical values (including changing the SIZES of the arrays) and look for correct answers for those modified values as well. We will only use numerical values and array sizes that make sense. We will not be testing your program to see how it handles bad data. In this assignment, you must use: variables, loops, if statements, your function definitions and function calls. You must include reasonable comments in your code. For now, you may not use any of the powerful functions available in python modules, with one exception: you may import functions from the math module. a) Write a function defined as: def ClampInclusive (val, minval, maxval): val: is a floating point number minval, maxval: are the minimum and maximum values the val can have. return TF: where TF is a boolean (True or False) indication of val is between minval and maxval (inclusive) b) Write a function defined as: def RemoveOutliers (vals, mean, stdev): vals: a list of lists (i.e., 2-D-matrix) containing temperatures read from a thermocouple. Each list is the result of an experiment and may contain outlier data. mean: the average temperature read by the thermocouple over time stdev: the standard deviation of data read by the thermo return trimmed: where trimmed is a list of lists (i.e., 2-D matrix) where each row contains the temperature data considered valid by being within 2*stdev of the mean. c) Write a function defined as: def SampleEstimators (vals): vals: an array (list) containing temperature readings. return stats: stats is a list containing the sample estimators of the mean and standard deviation of the temperature readings d) Write a function defined as: def ReactionRate (T, P, EA NSt Dev=2): is a list containing the average and standard deviation of the temperature for a reaction in C. P: is a reaction rate coefficient in mol/min-1 EA: is the activation energy for the reaction in kJ/mol NSt Dev: is the number of standard deviations from the mean for which we want to calculate the maximum and minimum reaction rates according to the formula: Rate = P.e where R = 8.3145 J/mol.K return RateRange: where RateRange is a list of the minimum, maximum and average reaction rates we can expect from the given distribution of temperature. Use HW1-stem.py as a starting point to test the four functions defined above. When you upload your program, it must include defined main function and call to main(). An additional requirement of this homework is that you understand EVERY LINE of this main program. If you don't understand something, Google it or ASK Dr. Smay or the TA. Correct Output: Homework 1 - SP21: An exercise in data processing, a) Clamp(185, 169.0, 181.0)=True Clamp(165, 169.0, 181.0)=True Clamp(180, 169.0, 181.0)=False b) Experiment 1 had 3 outliers Refined experiment 1 data = [174.9, 175.4, 175.7, 177.8, 178.3, 179, 176.8, 173.8, 175.1, 174.9, 179.2, 177.1, 180.2, 177.2, 173.4, 174.5, 178.3, 176.4, 173.6, 171.4, 174.9, 172.6, 173.8, 175, 175.4, 173.4, 174.3] Experiment 2 had 2 outliers Refined experiment 2 data =[177.1, 174.6, 173.7, 176.3, 174, 175.3, 177, 171.8, 176.4, 174.6, 176.2, 174.4, 175.1, 176.7, 177.2, 178.5, 174.4, 175.5, 178.3, 179.6, 177.2, 172.6, 175, 175.4, 176.3, 175.1, 173.3, 178.6] Experiment 3 had 2 outliers Refined experiment 3 data =[179.3, 174, 169.1, 174.1, 176.8, 174.5, 177.2, 176.4, 174.7, 173, 175, 172.4, 177.6, 175, 174.5, 172.5, 174.8, 179.3, 175.4, 172.4, 170.1, 170, 175.9, 178.9, 178.5, 178.1, 178.8, 174.1] c) Experiment 1 stats: Mean = 175.6, StDev = 2.2 Experiment 2 stats: Mean = 175.7, StDev = 1.9 Experiment 3 stats: Mean = 175.1, StDev = 2.8 Experiment 1 Rates: Min = 4.26, Max = 4.34, Avg = 4.30 Experiment 2 Rates: Min = 4.27, Max = 4.34, Avg = 4.30 Experiment 3 Rates: Min = 4.25, Max = 4.35, Avg = 4.30

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Michael V. Mannino

3rd Edition

0071107010, 978-0071107013

More Books

Students also viewed these Databases questions

Question

65 Internal investigation, monitoring, and surveillance techniques.

Answered: 1 week ago

Question

Discuss the techniques of sales forecasting.

Answered: 1 week ago

Question

Write short notes on Marketing mix.

Answered: 1 week ago