Part C: Function, for and plotting We did a project in the lecture on calculating the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Part C: Function, for and plotting We did a project in the lecture on calculating the free fall speeds and plotting them on a graph. This part is similar to the project. An engineer has derived a relationship between the force applied to a material and the extension in length that the force would cause. The relationship between force fand extension is given by: if 0 f 10 if 10 < f < 20 e = { 5.5 f f - 10f + 55 You are asked to plot a graph showing the relationship between force and extension. You are asked to complete the following tasks: Task 1 Write a Python function which returns the value of e for a given input f. Do not use literals (e.g. 5.5, 10) in the expressions for e in the function. Instead you should define constants and use them. Note that the relationship between e and f depends on whether f is bigger than 10 or not, this means you need a certain Python construction in your function. If you can't think of that, have a look at Part A of Lab03. Task 2 The aim of this task is to specify a list of values which are the values of force f that you will be using for plotting. These values are to be stored in a Python list called force_list. We impose these requirements on force_list: The first entry for force_list is 0. The entries in force_list are all integral multiples of a parameter called step_size. The last entry must be less than or equal to 20, which is the upper limit for the force. The difference between the last entry in force_list and 20 must be strictly less than step_size. This is so that we make full use of the range of f. Based on these requirements, the force_list for a number of different sizes are: If step_size=0.4, then force_list should be [0, 0.4, 0.8, 1.2,...,19.6, 20] which contains 51 values If step_size = 0.5, then force_list should be [0, 0.5, 1.0, 1.5,,19.5, 20] which contains 41 values If step_size = 0.7, then force_list should be [0, 0.7, 1.4, 2.1, 17.5,18.2,18.9,19.6] which contains 29 values If step_size =0.9, then force_list should be [0, 0.9, 1.8, 2.7, 18.0,18.9,19.8] which contains 23 values We want to make the program flexible so that it can automatically generate force_list from a given value of step_size. This flexibility will allow us to try out different values of step size. You may think this is complicated but we want to say that it is doable and we will give you some hints in one moment. We want to use this exercise to show you that with a bit of thinking, you can make your programs flexible. Hints: Step size 0.4 0.5 0.7 0.9 Since the entries in force_list are all integral multiples of step_size, you can use step_size and range() to generate force_list. An important consideration is how many entries you need in the sequence generated by range(). The number of entries that you need can be calculated by a formula which depends on 20 (which is the upper limit) and the step_size. You need to come out with the formula and you can check whether your formula is correct by using the examples above. There are two ways you can do that. You can make a mathematical argument to derive the formula. You can use the table below, observe the pattern and derive the formula. In particular, you want to find a relation between the number of entries in force_list and the value of 20 divided by step size, i.e. columns 3 and 4 in the table below. You may find that you need to fiddle the formula a few times to get it right. There is nothing wrong with that, it is part of learning. You may find the functions math.floor() and math.ceil() from the math library useful If you used //instead of the math functions you might have noticed some odd behavior with the last value in force_list. Check out this link to learn why if you are curious. We will discuss this later in the course. Last value in force list 20 (= 50*0.4) 20 (=40*0.5) 19.6 (=280.7) 19.8 (=22*0.9) The value of 20 divided by step size 50.0 40.0 28.57 22.22 Task 3 Use force_list (which you create in Task 2) and the function that your write in Task 1 to compute the extensions corresponding to those force values in the force_list. Use the two lists to plot extension versus force. Number of entries in force list 51 29 23 Part C: Function, for and plotting We did a project in the lecture on calculating the free fall speeds and plotting them on a graph. This part is similar to the project. An engineer has derived a relationship between the force applied to a material and the extension in length that the force would cause. The relationship between force fand extension is given by: if 0 f 10 if 10 < f < 20 e = { 5.5 f f - 10f + 55 You are asked to plot a graph showing the relationship between force and extension. You are asked to complete the following tasks: Task 1 Write a Python function which returns the value of e for a given input f. Do not use literals (e.g. 5.5, 10) in the expressions for e in the function. Instead you should define constants and use them. Note that the relationship between e and f depends on whether f is bigger than 10 or not, this means you need a certain Python construction in your function. If you can't think of that, have a look at Part A of Lab03. Task 2 The aim of this task is to specify a list of values which are the values of force f that you will be using for plotting. These values are to be stored in a Python list called force_list. We impose these requirements on force_list: The first entry for force_list is 0. The entries in force_list are all integral multiples of a parameter called step_size. The last entry must be less than or equal to 20, which is the upper limit for the force. The difference between the last entry in force_list and 20 must be strictly less than step_size. This is so that we make full use of the range of f. Based on these requirements, the force_list for a number of different sizes are: If step_size=0.4, then force_list should be [0, 0.4, 0.8, 1.2,...,19.6, 20] which contains 51 values If step_size = 0.5, then force_list should be [0, 0.5, 1.0, 1.5,,19.5, 20] which contains 41 values If step_size = 0.7, then force_list should be [0, 0.7, 1.4, 2.1, 17.5,18.2,18.9,19.6] which contains 29 values If step_size =0.9, then force_list should be [0, 0.9, 1.8, 2.7, 18.0,18.9,19.8] which contains 23 values We want to make the program flexible so that it can automatically generate force_list from a given value of step_size. This flexibility will allow us to try out different values of step size. You may think this is complicated but we want to say that it is doable and we will give you some hints in one moment. We want to use this exercise to show you that with a bit of thinking, you can make your programs flexible. Hints: Step size 0.4 0.5 0.7 0.9 Since the entries in force_list are all integral multiples of step_size, you can use step_size and range() to generate force_list. An important consideration is how many entries you need in the sequence generated by range(). The number of entries that you need can be calculated by a formula which depends on 20 (which is the upper limit) and the step_size. You need to come out with the formula and you can check whether your formula is correct by using the examples above. There are two ways you can do that. You can make a mathematical argument to derive the formula. You can use the table below, observe the pattern and derive the formula. In particular, you want to find a relation between the number of entries in force_list and the value of 20 divided by step size, i.e. columns 3 and 4 in the table below. You may find that you need to fiddle the formula a few times to get it right. There is nothing wrong with that, it is part of learning. You may find the functions math.floor() and math.ceil() from the math library useful If you used //instead of the math functions you might have noticed some odd behavior with the last value in force_list. Check out this link to learn why if you are curious. We will discuss this later in the course. Last value in force list 20 (= 50*0.4) 20 (=40*0.5) 19.6 (=280.7) 19.8 (=22*0.9) The value of 20 divided by step size 50.0 40.0 28.57 22.22 Task 3 Use force_list (which you create in Task 2) and the function that your write in Task 1 to compute the extensions corresponding to those force values in the force_list. Use the two lists to plot extension versus force. Number of entries in force list 51 29 23
Expert Answer:
Related Book For
Smith and Roberson Business Law
ISBN: 978-0538473637
15th Edition
Authors: Richard A. Mann, Barry S. Roberts
Posted Date:
Students also viewed these programming questions
-
Sirlin Co., a CCPC that is not associated with any other corporation, had taxable income in the current year of $700,000, consisting of ABI of $600,000 and AII of $100,000. Sirlin also received total...
-
You have been employed to create program to assist the manager of a coffee shop. You decide to make a prototype application in Java to show what you can do, and to be able to ask the manager what...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
In Exercises simplify the ratio of factorials. (n + 1)! n!
-
If a process exits and there are still threads of that process running, will they continue to run? LEWI96-42
-
Use the Laws of Continuity and Theorems 2 and 3 to show that the function is continuous. 7. f(x) = x + sin x 9. f(x) = 3x + sin x 11. f(x) = 1 / x2 + 1
-
A sleeve-bearing machine is running up to speed, and as it passes through a known critical frequency, vibration at the critical frequency starts to occur, and even though the machine continues to...
-
What is the rationale for accounting for nonexpendable endowment funds on a full, rather than a modied, accrual basis? Why is it important that depreciation be charged on long-term assets held as...
-
What are 2-3 strategies that enhance ethics, labor relations, and work conditions?
-
Lasky Manufacturing has two divisions: Carolinas and Northeast. Lasky has a cost of capital of 7.5 percent. Selected financial information (in thousands of dollars) for the first year of business...
-
According to ISA 500 Audit Evidence, the auditor should obtain sufficient appropriate audit evidence to be able to draw reasonable conclusions on which to base the audit opinion. ISA 500 provides...
-
Select an organization that has implemented a lean manufacturing model and find information related to the organizations manufacturing practices. Provide a brief summary about the lean manufacturing...
-
Explain at least two ways in which ethnocentrism, stereotyping, prejudice, and discrimination act as barriers to effective intercultural communication.
-
Braverman Company has two manufacturing departments-Finishing and Fabrication. The predetermined overhead rates in Finishing and Fabrication are $18.00 per direct labor-hour and 110% of direct...
-
what ways do theories of social control and deviance management inform governmental policies and legal frameworks ?
-
How do historical precedents and case studies of successful or failed social movements provide insights into the strategies and conditions that facilitate meaningful and lasting social change ?
-
Reduce the matrix to reduced row-echelon form. A = -1 -3 -2 2 -3 -1 - 2 1 2 -8 -5 3
-
Explain briefly what is meant by electronic data interchange (EDI). How does EDI affect a companys audit trail?
-
Several years ago, Pierce purchased a tract of land on which stood an old, vacant house. Recently, Pierce employed Fried, a carpenter, to repair and remodel the house. While Fried was tearing out a...
-
Northwest Airlines leased space in the terminal building at the Portland Airport from the Port of Portland. Crosetti entered into a contract with the Port to furnish janitorial services for the...
-
Morris, a salesperson for Acme, Inc., a manufacturer of household appliances, receives a commission on all sales made and no further compensation. He drives his own automobile, pays his own expenses,...
-
To what amount will the following investments accumulate? a. $6,000 invested for 12 years at 12 percent compounded annually b. $7,500 invested for 8 years at 8 percent compounded annually c. $6,400...
-
What is the present value of the following future amounts? a. $805 to be received 10 years from now discounted back to the present at 10 percent b. $376 to be received 5 years from now discounted...
-
At what annual rate would the following have to be invested? a. \($820\) to grow to \($1,988.12\) in 13 years b. \($320\) to grow to \($423.10\) in 6 years c. \($57\) to grow to \($290.30\) in 18...
Study smarter with the SolutionInn App