4. In the class, you learn a bunch of tools. But, in the homework, I need you to be a little bit creative and use all you have learned to solve a seemingly random problem. Let us consider semi-circular paper of radius 2. The area of the whole paper is 2π ≈ 6.28. We want to cut a chord(red line) from this paper such that the area of the leftover paper(shown in blue) is 4.0. Where should I cut the chord (find the value of a where the red line should be such that the area of the blue region is 4.0? Try to get a decent answer. If you are good with geometry you can actually figure this one out analytically, but I want you to do it numerically using what we have learned so far. return sqrt(r**2 - ***2) ▷ 1 def circ_top(x, r=2.): 2 3 4 5 [3] def circ_bot(x, r=2.): return -sqrt(r**2 6 x=np.linspace(0,2,100) ***2) 7 y_top= [circ_top(xx) for xx in x] 8 y_bot = [circ_bot(xx) for xx in x] 9 ax= plt.figure(figsize=(4,4)) 10 plt.gca().set_aspect('equal') #get current axis and set aspect ratio 11 plt.plot(x, y_top, 'k-') 12 plt.plot(x, y_bot, 'k-') 13 plt.axvline (1.1, color='red') 14 plt.fill_between(x,y_top,y_bot, where=x>1.1, alpha=0.3) 2.0 15 10 0.5 0.0 -0.5 -1.0 -1.5 -2.0 1 00 05 10 15 20 Python Python
4. In the class, you learn a bunch of tools. But, in the homework, I need you to be a little bit creative and use all you have learned to solve a seemingly random problem. Let us consider semi-circular paper of radius 2. The area of the whole paper is 2π ≈ 6.28. We want to cut a chord(red line) from this paper such that the area of the leftover paper(shown in blue) is 4.0. Where should I cut the chord (find the value of a where the red line should be such that the area of the blue region is 4.0? Try to get a decent answer. If you are good with geometry you can actually figure this one out analytically, but I want you to do it numerically using what we have learned so far. return sqrt(r**2 - ***2) ▷ 1 def circ_top(x, r=2.): 2 3 4 5 [3] def circ_bot(x, r=2.): return -sqrt(r**2 6 x=np.linspace(0,2,100) ***2) 7 y_top= [circ_top(xx) for xx in x] 8 y_bot = [circ_bot(xx) for xx in x] 9 ax= plt.figure(figsize=(4,4)) 10 plt.gca().set_aspect('equal') #get current axis and set aspect ratio 11 plt.plot(x, y_top, 'k-') 12 plt.plot(x, y_bot, 'k-') 13 plt.axvline (1.1, color='red') 14 plt.fill_between(x,y_top,y_bot, where=x>1.1, alpha=0.3) 2.0 15 10 0.5 0.0 -0.5 -1.0 -1.5 -2.0 1 00 05 10 15 20 Python Python
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
%matplotlib inline
import numpy as np
from matplotlib import pyplot as plt
from math import sin, cos, exp, pi, sqrt
import math
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education