Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
Program a simplified Galton board in python. It is required that:
- The user must select the number of rows n of the board
- The distribution resulting from dropping the beads should be displayed on the screen.
- Display an animation where the number of rows n increases over time.
All resulting distributions must be scaled to the interval [0, 1], so that it is possible to
appreciate the convergence to the normal distribution. Consider n from 1 to 80.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 5 steps with 3 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Write the function that takes three dimensions of a brick: height(a), width(b) and depth(c) and returns true if this brick can fit into a hole with the width (w) and height(h). Examples doesBrickFit(1, 1, 1, 1, 1) → true doesBrickFit(1, 2, 1, 1, 1) → true doesBrickFit(1, 2, 2, 1, 1) false Notes • You can turn the brick with any side towards the hole. • We assume that the brick fits if its sizes equal the ones of the hole (i.e. brick size should be less than or equal to the size of the hole, not strictly less). • You can't put a brick in at a non-orthogonal angle.arrow_forward[Python Language] Using loops of any kind, lists, or is not allowed. Angela loves reading books. She recently started reading an AI generated series called “Harry Trotter”. Angela is collecting books from the series at her nearest bookstore. Since the series is AI generated, the publishers have produced an infinite collection of the books where each book is identified by a unique integer. The bookstore has exactly one copy of each book. Angela wants to buy the books in the range [l,r], where l ≤ r. As an example, the range [−3,3] means that Angela wants to buy the books − 3, − 2, − 1, 0, 1, 2, and 3. Dan also loves the series (or maybe annoying Angela – who knows, really), and he manages to sneak into the bookstore very early to buy all of the books in the range [d,u], where d ≤ u. When Angela later visits, sadly she will not find those books there anymore. For example, if Angela tries to buy books [−2,3] and Dan has bought books [0,2], Angela would only receive books − 2, − 1,…arrow_forwardGiven a vector of real numbers r = (r1, V2, ..., rn). We can standardize the vector using the formulation: V; = "im, where m is the ri-m mean of the vector r, and s is the standard deviation of r. The vector v = (V1, V2, . , Un) will be the scaled vector. ... 9 Write a Python function scale_vec(r) that takes the vector r as input and returns the scaled vector v. Sample inputs and outputs: • Input: np.array([1, 3, 5]), output: [-1.22474487 0. 1.22474487] Input: np.array([3.3, 1.2, -2.7, −0.6]), output: [1.35457092 0.40637128 -1.35457092 -0.40637128] Hint: Use numpy.mean and numpy.std with default parameters. [ ] # Write your function here Let's test your function. [ ] import numpy as np print (scale_vec(np.array ( [1, 3, 5]))) print (scale_vec(np.array([3.3, 1.2, -2.7, -0.6])))arrow_forward
- Please help solve the python problemarrow_forwardUse Python. Q1. Suppose deg is an angle in degrees. Write down the NumPy code that computes the counterclockwise rotation matrix. Don't forget to convert the angles into radians when necessary. def rotate(deg): Q2. Let x be a vector. How do you use rotate(deg) to find a vector y that is normal to x? Namely <x,y> = 0. y = ... Q3. Let x be a vector. How do you find a vector v in the same direction as x but with |v| = 1. v = ... Q4. A hyperplane in 2D is the same as a line. A hyperplane is defined by a normal vector w and a bias scalar b. Write down the expression that defines points on the line that is the hyperplane in 2D defined by (w, b). { x : ... } Q5. Given a vector x, and a hyperplane P defined by (w, b). Describe how to compute the point v that is the projection of x on to the plane P.arrow_forwardThe Problem: You are coding a graphics filter that process each of an image through a filter. Each pixel is defined a triplet of real numbers (R,G,B) each of which is between 0 and 255.The filtering algorithms need to work on real numbers in order to do their job. But examining the program you discover that they only need two digits of accuracy. Any additional digits is just overkill.arrow_forward
- Assignment: Create a surface and contour plot of function z=f(x,y) [-5,5] by [-5,51. Take a pick to plot from any of the choices below. (01) f(x,y) = x*y**3-y*x**3 (02) f(x,y) = (x**2+3*y**2) *exp(-x**2-y**2) (03) f(x, y) = -1/(x**2+y**2) (04) f(x, y) = cos(abs(x)+abs(y)) - Use at least 500 points in each direction to discretize domain and create the grid. - Make the surface plot red and without grid lines. - For contour plot, specify contour levels to go from minimum and maximum Z values on the entire domain and include at least 15 contour levels. - Pick a colormap you like I ## Create data import numpy as np import pyvista as pvarrow_forwardAlice, a friend of Mr. Bernard’s, wants to compose a song. She asks Mr. Bernard for help. Although Mr. Barnard knows nothing about music, he finds that the sequence of notes in a numbered musical notation can be expressed as an FSM with input the alphabet {1, 2, 3, 4, 5, 6, 7} (“do”, “re”, “mi”, “fa”, “so”, “la”, “ti”). Alice wants to compose a song that contains the pattern “15” an even number of times. Please draw an FSM that only accepts a sequence of notes that satisfies the above pattern. Note that you should provide a detailed description of the FSMs in your design to show how it works. Specifically, you should describe the meaning of each state.arrow_forwardYour first task will be to write a simple movement simulator on a snakes and ladders board. For this questionyou can ignore the snakes and ladders and just simply assume you only have to deal with moving. You willneed to simulate rolling the die - this can be done by using the Python random module and the randint method.Your function play_game will take as input the length of the board (an integer), "play" the game by rolling the diemultiple times until the sum of rolls is larger or equal to the length of the board. (note: this is one of the possibleand simplest end rules). The function should return the total number of rolls required to finish the the particulargame that was played. Obviously this number will vary as it depends on the specific random rolls performedduring the movement simulation.arrow_forward
- Use C++ language Can you please give me a code that runs properly this time Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region.For example, for the following board,X X X XX O O XX X O XX O X XAfter capturing all regions, the board becomesX X X XX X X XX X X XX O X XThe algorithm should take an input file, named “input.txt”, and output the resulting board in the console.Sample input.txt6X X X X X OX O X O O XX X O O O XX X X O X XX O X X O OX X X X X XThe first line is a number indicating the size of the board; in the above example, 6 means the board is .Output for in console:X X X X X OX X X X X XX X X X X XX X X X X XX X X X O OX X X X X Xarrow_forwardA typical roulette wheel used in a casino has 38 slots that are numbered 1,2,3,....,36,0,00, respectively. Half of the remaining slots are red and half are black. Also, half of the integers between 1 and 36 inclusive are odd, half are even, and 0 and 00 are defined to be neither odd nor even. A ball is rolled around the wheel and ends up in one of the slots; we assume each slot has equal probability of 1/38, and we are interested in the number of the slot into which the ball falls. (a)Define the Sample space S. (b)Let A = {0,00}. Give the value of P(A). (c) Let B = {14,15,17 18}. Give the value of P(B). (d) Let D = {x:x is odd}. Give the value of P(D).arrow_forwardWrite a triangle (x0, y0, x1, y1, x2, y2) function to draw the triangle with vertices (x0, y0), (x1, y1), and (x2, y2). Use your function to draw some triangles. www..arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
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