As shown in Fig. 1, water is discharged from a cylindrical tank through a horizontal pipe....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
As shown in Fig. 1, water is discharged from a cylindrical tank through a horizontal pipe. Figure 1: Figure for problem 3 Once the pipe is opened, the velocity of the water in the pipe versus time can be computed from the equation: (2) where g = 9.81 ms 2, H = initial liquid level in the tank, [m], L =pipe length, [m], t =elapsed time, [s]. The equation above assumes that the liquid level in the tank does not vary significantly during the transition time. V2gH tanh V = V 9H L -t Develop a Python code that: 1. (5 points) plots the function v = f(H) versus H for a given time, [t]. Present curves for t= = 1, 2, 3, 4, and 5 [s] for H = 0 to 4 [m] on the same plot, and L = 50 m. Label the plot and include a legend. 2. For a pipe with length L = 4m determine the H required to achieve v = 5 ms ¹ at t = 2.5 s. a. (5 points) Determine and plot the appropriate function F(H) in a range of H that includes the real root(s) x = H. Make sure you can see them! Label the x-axis as H, for the possible initial liquid levels. b. (5 points) After approximately identifying the root x, graphically, define an inter- val on the H-axis that brackets the root; i.e. give x, and x, such that x, E (X1, Xu). c. (5 points) Use the built-in scipy command brentq to find x, as a root of F(H); look at the documentation how to use it! Use x₂ or x for the bracketing interval. d. (10 points) Use the myBisection function you developed in problem 1 to find the root x of F(H). Use as bracketing interval the x, and xu you defined in question (b). Compute for every iteration the approximate percent relative error. Use as stopping criteria the error tolerance € 1 x 10-6 and a maximum number of 50 iterations. Present your results in a 2D numpy array. What is the root you obtained? e. (10 points) Use the false myFalse Position function you developed in problem 2 to find the root xr of F(H). Use as bracketing interval the x and xu you defined in question (b). Compute for every iteration the approximate percent relative error. Use as stopping criteria the error tolerance € = 1 × 10-6 and a maximum number of 50 iterations. Present your results in a 2D numpy array. What is the root you obtained? f. (5 points) Plot in a common figure (linear scale axes) the approximated root xr vs the number of iterations, for the solutions you obtained with the bisection and the false position methods in questions (d) and (e). g. (5 points) Plot in a common figure (semi-logarithmic on the y-axis, linear on the x-axis) the approximate relative percent error ea vs number of iterations, for the solutions you obtained with the bisection and the false position methods in questions (d) and (e). h. (10 points) Comment on the results and graphs of the previous questions. Which method performs better in this problem? Which method converges fastest to the exact solution? Make suggestions for improvement of the solutions if not satisfactory. As shown in Fig. 1, water is discharged from a cylindrical tank through a horizontal pipe. Figure 1: Figure for problem 3 Once the pipe is opened, the velocity of the water in the pipe versus time can be computed from the equation: (2) where g = 9.81 ms 2, H = initial liquid level in the tank, [m], L =pipe length, [m], t =elapsed time, [s]. The equation above assumes that the liquid level in the tank does not vary significantly during the transition time. V2gH tanh V = V 9H L -t Develop a Python code that: 1. (5 points) plots the function v = f(H) versus H for a given time, [t]. Present curves for t= = 1, 2, 3, 4, and 5 [s] for H = 0 to 4 [m] on the same plot, and L = 50 m. Label the plot and include a legend. 2. For a pipe with length L = 4m determine the H required to achieve v = 5 ms ¹ at t = 2.5 s. a. (5 points) Determine and plot the appropriate function F(H) in a range of H that includes the real root(s) x = H. Make sure you can see them! Label the x-axis as H, for the possible initial liquid levels. b. (5 points) After approximately identifying the root x, graphically, define an inter- val on the H-axis that brackets the root; i.e. give x, and x, such that x, E (X1, Xu). c. (5 points) Use the built-in scipy command brentq to find x, as a root of F(H); look at the documentation how to use it! Use x₂ or x for the bracketing interval. d. (10 points) Use the myBisection function you developed in problem 1 to find the root x of F(H). Use as bracketing interval the x, and xu you defined in question (b). Compute for every iteration the approximate percent relative error. Use as stopping criteria the error tolerance € 1 x 10-6 and a maximum number of 50 iterations. Present your results in a 2D numpy array. What is the root you obtained? e. (10 points) Use the false myFalse Position function you developed in problem 2 to find the root xr of F(H). Use as bracketing interval the x and xu you defined in question (b). Compute for every iteration the approximate percent relative error. Use as stopping criteria the error tolerance € = 1 × 10-6 and a maximum number of 50 iterations. Present your results in a 2D numpy array. What is the root you obtained? f. (5 points) Plot in a common figure (linear scale axes) the approximated root xr vs the number of iterations, for the solutions you obtained with the bisection and the false position methods in questions (d) and (e). g. (5 points) Plot in a common figure (semi-logarithmic on the y-axis, linear on the x-axis) the approximate relative percent error ea vs number of iterations, for the solutions you obtained with the bisection and the false position methods in questions (d) and (e). h. (10 points) Comment on the results and graphs of the previous questions. Which method performs better in this problem? Which method converges fastest to the exact solution? Make suggestions for improvement of the solutions if not satisfactory. As shown in Fig. 1, water is discharged from a cylindrical tank through a horizontal pipe. Figure 1: Figure for problem 3 Once the pipe is opened, the velocity of the water in the pipe versus time can be computed from the equation: (2) where g = 9.81 ms 2, H = initial liquid level in the tank, [m], L =pipe length, [m], t =elapsed time, [s]. The equation above assumes that the liquid level in the tank does not vary significantly during the transition time. V2gH tanh V = V 9H L -t Develop a Python code that: 1. (5 points) plots the function v = f(H) versus H for a given time, [t]. Present curves for t= = 1, 2, 3, 4, and 5 [s] for H = 0 to 4 [m] on the same plot, and L= 50 m. Label the plot and include a legend. 2. For a pipe with length L = 4m determine the H required to achieve v = 5 ms ¹ at t = 2.5 s. a. (5 points) Determine and plot the appropriate function F(H) in a range of H that includes the real root(s) x = H. Make sure you can see them! Label the x-axis as H, for the possible initial liquid levels. b. (5 points) After approximately identifying the root x, graphically, define an inter- val on the H-axis that brackets the root; i.e. give x, and x, such that x, E (x1, xu). c. (5 points) Use the built-in scipy command brentq to find x, as a root of F(H); look at the documentation how to use it! Use x₂ or x for the bracketing interval. d. (10 points) Use the myBisection function you developed in problem 1 to find the root x of F(H). Use as bracketing interval the x, and xu you defined in question (b). Compute for every iteration the approximate percent relative error. Use as stopping criteria the error tolerance € 1 x 10-6 and a maximum number of 50 iterations. Present your results in a 2D numpy array. What is the root you obtained? e. (10 points) Use the false myFalsePosition function you developed in problem 2 to find the root xr of F(H). Use as bracketing interval the x and xu you defined in question (b). Compute for every iteration the approximate percent relative error. Use as stopping criteria the error tolerance € = 1 × 10-6 and a maximum number of 50 iterations. Present your results in a 2D numpy array. What is the root you obtained? f. (5 points) Plot in a common figure (linear scale axes) the approximated root xr vs the number of iterations, for the solutions you obtained with the bisection and the false position methods in questions (d) and (e). g. (5 points) Plot in a common figure (semi-logarithmic on the y-axis, linear on the x-axis) the approximate relative percent error ea vs number of iterations, for the solutions you obtained with the bisection and the false position methods in questions (d) and (e). h. (10 points) Comment on the results and graphs of the previous questions. Which method performs better in this problem? Which method converges fastest to the exact solution? Make suggestions for improvement of the solutions if not satisfactory. As shown in Fig. 1, water is discharged from a cylindrical tank through a horizontal pipe. Figure 1: Figure for problem 3 Once the pipe is opened, the velocity of the water in the pipe versus time can be computed from the equation: (2) where g = 9.81 ms 2, H = initial liquid level in the tank, [m], L =pipe length, [m], t =elapsed time, [s]. The equation above assumes that the liquid level in the tank does not vary significantly during the transition time. V2gH tanh V = V 9H L -t Develop a Python code that: 1. (5 points) plots the function v = f(H) versus H for a given time, [t]. Present curves for t= = 1, 2, 3, 4, and 5 [s] for H = 0 to 4 [m] on the same plot, and L = 50 m. Label the plot and include a legend. 2. For a pipe with length L = 4m determine the H required to achieve v = 5 ms ¹ at t = 2.5 s. a. (5 points) Determine and plot the appropriate function F(H) in a range of H that includes the real root(s) x = H. Make sure you can see them! Label the x-axis as H, for the possible initial liquid levels. b. (5 points) After approximately identifying the root x, graphically, define an inter- val on the H-axis that brackets the root; i.e. give x, and x, such that x, E (X1, Xu). c. (5 points) Use the built-in scipy command brentq to find x, as a root of F(H); look at the documentation how to use it! Use x₂ or x for the bracketing interval. d. (10 points) Use the myBisection function you developed in problem 1 to find the root x of F(H). Use as bracketing interval the x, and xu you defined in question (b). Compute for every iteration the approximate percent relative error. Use as stopping criteria the error tolerance € 1 x 10-6 and a maximum number of 50 iterations. Present your results in a 2D numpy array. What is the root you obtained? e. (10 points) Use the false myFalse Position function you developed in problem 2 to find the root xr of F(H). Use as bracketing interval the x and xu you defined in question (b). Compute for every iteration the approximate percent relative error. Use as stopping criteria the error tolerance € = 1 × 10-6 and a maximum number of 50 iterations. Present your results in a 2D numpy array. What is the root you obtained? f. (5 points) Plot in a common figure (linear scale axes) the approximated root xr vs the number of iterations, for the solutions you obtained with the bisection and the false position methods in questions (d) and (e). g. (5 points) Plot in a common figure (semi-logarithmic on the y-axis, linear on the x-axis) the approximate relative percent error ea vs number of iterations, for the solutions you obtained with the bisection and the false position methods in questions (d) and (e). h. (10 points) Comment on the results and graphs of the previous questions. Which method performs better in this problem? Which method converges fastest to the exact solution? Make suggestions for improvement of the solutions if not satisfactory. As shown in Fig. 1, water is discharged from a cylindrical tank through a horizontal pipe. Figure 1: Figure for problem 3 Once the pipe is opened, the velocity of the water in the pipe versus time can be computed from the equation: (2) where g = 9.81 ms 2, H = initial liquid level in the tank, [m], L =pipe length, [m], t =elapsed time, [s]. The equation above assumes that the liquid level in the tank does not vary significantly during the transition time. V2gH tanh V = V 9H L -t Develop a Python code that: 1. (5 points) plots the function v = f(H) versus H for a given time, [t]. Present curves for t= = 1, 2, 3, 4, and 5 [s] for H = 0 to 4 [m] on the same plot, and L = 50 m. Label the plot and include a legend. 2. For a pipe with length L = 4m determine the H required to achieve v = 5 ms ¹ at t = 2.5 s. a. (5 points) Determine and plot the appropriate function F(H) in a range of H that includes the real root(s) x = H. Make sure you can see them! Label the x-axis as H, for the possible initial liquid levels. b. (5 points) After approximately identifying the root x, graphically, define an inter- val on the H-axis that brackets the root; i.e. give x, and x, such that x, E (X1, Xu). c. (5 points) Use the built-in scipy command brentq to find x, as a root of F(H); look at the documentation how to use it! Use x₂ or x for the bracketing interval. d. (10 points) Use the myBisection function you developed in problem 1 to find the root x of F(H). Use as bracketing interval the x, and xu you defined in question (b). Compute for every iteration the approximate percent relative error. Use as stopping criteria the error tolerance € 1 x 10-6 and a maximum number of 50 iterations. Present your results in a 2D numpy array. What is the root you obtained? e. (10 points) Use the false myFalse Position function you developed in problem 2 to find the root xr of F(H). Use as bracketing interval the x and xu you defined in question (b). Compute for every iteration the approximate percent relative error. Use as stopping criteria the error tolerance € = 1 × 10-6 and a maximum number of 50 iterations. Present your results in a 2D numpy array. What is the root you obtained? f. (5 points) Plot in a common figure (linear scale axes) the approximated root xr vs the number of iterations, for the solutions you obtained with the bisection and the false position methods in questions (d) and (e). g. (5 points) Plot in a common figure (semi-logarithmic on the y-axis, linear on the x-axis) the approximate relative percent error ea vs number of iterations, for the solutions you obtained with the bisection and the false position methods in questions (d) and (e). h. (10 points) Comment on the results and graphs of the previous questions. Which method performs better in this problem? Which method converges fastest to the exact solution? Make suggestions for improvement of the solutions if not satisfactory. As shown in Fig. 1, water is discharged from a cylindrical tank through a horizontal pipe. Figure 1: Figure for problem 3 Once the pipe is opened, the velocity of the water in the pipe versus time can be computed from the equation: (2) where g = 9.81 ms 2, H = initial liquid level in the tank, [m], L =pipe length, [m], t =elapsed time, [s]. The equation above assumes that the liquid level in the tank does not vary significantly during the transition time. V2gH tanh V = V 9H L -t Develop a Python code that: 1. (5 points) plots the function v = f(H) versus H for a given time, [t]. Present curves for t= = 1, 2, 3, 4, and 5 [s] for H = 0 to 4 [m] on the same plot, and L= 50 m. Label the plot and include a legend. 2. For a pipe with length L = 4m determine the H required to achieve v = 5 ms ¹ at t = 2.5 s. a. (5 points) Determine and plot the appropriate function F(H) in a range of H that includes the real root(s) x = H. Make sure you can see them! Label the x-axis as H, for the possible initial liquid levels. b. (5 points) After approximately identifying the root x, graphically, define an inter- val on the H-axis that brackets the root; i.e. give x, and x, such that x, E (x1, xu). c. (5 points) Use the built-in scipy command brentq to find x, as a root of F(H); look at the documentation how to use it! Use x₂ or x for the bracketing interval. d. (10 points) Use the myBisection function you developed in problem 1 to find the root x of F(H). Use as bracketing interval the x, and xu you defined in question (b). Compute for every iteration the approximate percent relative error. Use as stopping criteria the error tolerance € 1 x 10-6 and a maximum number of 50 iterations. Present your results in a 2D numpy array. What is the root you obtained? e. (10 points) Use the false myFalsePosition function you developed in problem 2 to find the root xr of F(H). Use as bracketing interval the x and xu you defined in question (b). Compute for every iteration the approximate percent relative error. Use as stopping criteria the error tolerance € = 1 × 10-6 and a maximum number of 50 iterations. Present your results in a 2D numpy array. What is the root you obtained? f. (5 points) Plot in a common figure (linear scale axes) the approximated root xr vs the number of iterations, for the solutions you obtained with the bisection and the false position methods in questions (d) and (e). g. (5 points) Plot in a common figure (semi-logarithmic on the y-axis, linear on the x-axis) the approximate relative percent error ea vs number of iterations, for the solutions you obtained with the bisection and the false position methods in questions (d) and (e). h. (10 points) Comment on the results and graphs of the previous questions. Which method performs better in this problem? Which method converges fastest to the exact solution? Make suggestions for improvement of the solutions if not satisfactory.
Expert Answer:
Answer rating: 100% (QA)
import numpy as np import matplotlibpyplot as plt from scipyoptimize import brentq Constants g 981 ms2 L 500 Pipe length in meters epsilons 1e6 Error tolerance maxiterations 50 Maximum number of itera... View the full answer
Related Book For
Modern Classical Physics Optics Fluids Plasmas Elasticity Relativity And Statistical Physics
ISBN: 9780691159027
1st Edition
Authors: Kip S. Thorne, Roger D. Blandford
Posted Date:
Students also viewed these programming questions
-
Jan. 6 9 12 15 Hunter invested $280,000 in the clinic by opening a bank account in the name of Hunter Medical Clinic. Hunter Medical Clinic paid cash for land costing $135,000. There are plans to...
-
their B-to-C Web sites and write a report (in at least 400 words) to compare each other and address the pros and cons of each site. AMC Theatres vs. Regal Cinemas YOU MUST IDENTIFY THE DIFFERENCES of...
-
As depicted in Fig. P5.15, the velocity of water, y (m/s), discharged from a cylindrical tank through a long pipe can be computed as where g = 9.81 m/s2, H = initial head (m), L = pipe length (m),...
-
Compute the stone's average velocity over the time interval [0.5, 2.5] and indicate the corresponding secant line on a sketch of the graph of h(t). A stone is tossed vertically into the air from...
-
A narrow beam of thermal neutrons is attenuated = 360 times after passing through a cadmium plate of thickness d = 0.50 ram. Determine the effective cross-section of interaction of these neutrons...
-
The following estimates have been prepared for a project: Fixed costs: $10,800 Depreciation: $7,200 Sales price per unit: $2 Accounting break-even: 60,000 units What must be the variable cost per...
-
What is the definition of ignorable treatment assignment? a. Give an example of a study where the treatment assignment is ignorable. b. Give an example of a study where the treatment assignment is...
-
Liane Hansen has prepared the following list of statements about bonds. 1. Bonds are a form of interest-bearing notes payable. 2. When seeking long-term financing, an advantage of issuing bonds over...
-
Table 2 TIME Kesler's Fund Vogue Fund's S&P 500s (Beta) T-Bills Return % Return % Return % Return % 2015 15 10 2016 -6 -2 11 -5 6 5 2017 17 13 12 7 2018 18 9 11 6 2019 22 11 13 7 1. Solve for the...
-
Determine the magnitude of the resultant force F R = F 1 + F 2 and its orientation , measured counterclockwise from the positive x axis. F = 260 lb 45 F=310 lb 12 5 13 y X
-
(a) If velocity distribution within the laminar boundary layer on a flat plate is 3y 1y3 assumed to determine U 28 283 (i) the boundary layer thickness & in team of Reynolds number, and (ii) the skin...
-
What is the best reason for marking an existing static method private within in an interface? A. It allows the method to be overridden in a subclass. B. It hides the secret implementation details...
-
What is the output of the following application? A. Spoiled! B. Yummy! C. The application completes without printing anything. D. One line of this application fails to compile. E. Two lines of this...
-
Which statement about the following interface is correct? A. The code compiles. B. The method enterAtmosphere() does not compile. C. The method getCircumference() does not compile. D. The method...
-
How many of the classes in the figure can write code that references the sky() method? A. None B. One C. Two D. Three E. Four. com.color Red protected boolean light Blue void sky () com.light Bright...
-
Given the following class declaration, which options correctly declare a local variable containing an instance of the class? A. new Sunset() extends Sky {}; B. new Sky(); C. new Sky() {} D. new Sky()...
-
Tomorrow your firm will issue 30K one-year zero-coupon bonds outstanding priced at $800 per bond. The bonds have a promised cash flow, i.e. face value ,of $900. If the firm does not default, it can...
-
Anne is employed by Bradley Contracting Company. Bradley has a $1.3 million contract to build a small group of outbuildings in a national park. Anne alleges that Bradley Contracting has discriminated...
-
Derive the solution (10.54) to the evolution equations (10.47) for frequency doubling, and verify that it has the claimed properties. d'Az ik dz 2 = (A), d'A dz =ik AzA; K=B, 200703 0cnn3 -dijk fi()...
-
Consider hydrogen gas in statistical equilibrium at a temperature T ec 2 /kB 6 10 9 K. Electrons at the high-energy end of the Boltzmann energy distribution can produce electron-positron pairs by...
-
Use Archimedes law to explain qualitatively the conditions under which a boat floating in still water will be stable to small rolling motions from side to side. You might want to define and introduce...
-
Which ratio measures the ability of a company to collect its receivables? a. Current ratio b. Quick ratio c. Days sales in receivables d. Return on assets
-
In vertical analysis, the base used for comparison on the income statement is a. total expenses. b. total assets. c. net sales. d. gross profit.
-
A statement that lists the assets, liabilities, and stockholders equity of a company in percentages only with no dollar amounts is a a. common-size income statement. b. benchmarking analysis. c....
Study smarter with the SolutionInn App