Something is Brewing: 1. Random Walk: Weather is extremely good and Ali start randomly walking from...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Something is Brewing: 1. Random Walk: Weather is extremely good and Ali start randomly walking from U.E.T. central library (0,0). At each time step, Ali walks one meter in a random direction, either north, east, south, or west, with probability 25%. How far will Ali be from central library after n time steps? This process is known as a two-dimensional random walk. Write a program Random Walk.java that takes the total time steps n and simulates the motion of a random walk for n steps. Print the location at each step (including the starting point), treating the starting point as the origin (0, 0). Finally, print the final Euclidean distance from the origin. finish (x, y) origin (0, 0) squared distance (x² + y²) 10 Note: how can we relate random walks to real life? Random walks and the mathematics that govern them are found everywhere in nature. When gas particles bounce around in a room, changing direction every time they collide with another particle, it is random walk mathematics that determines how long it will take them to travel from one location to another. Therefore, this task is going to be a beginning of a more interesting stuff we can do. 2. Controlled Walk: Instead of walking randomly, Ali now walks on your directions. You direct him in which direction to move. There are always few hurdles (walls, dustbin, another person) in actual environment, and you cannot keep of walking anywhere. Therfore, this time, if there is some hurdle present at the dictated location, Ali should not move to that location. Write a program where you dictate the direction by press of keys: [arrow-up, arrow-down, arrow-left, arrow- right] The position of hurdles is already stored(hardcoded) in program. 3/3 ::: Something is Brewing: 1. Random Walk: Weather is extremely good and Ali start randomly walking from U.E.T. central library (0,0). At each time step, Ali walks one meter in a random direction, either north, east, south, or west, with probability 25%. How far will Ali be from central library after n time steps? This process is known as a two-dimensional random walk. Write a program Random Walk.java that takes the total time steps n and simulates the motion of a random walk for n steps. Print the location at each step (including the starting point), treating the starting point as the origin (0, 0). Finally, print the final Euclidean distance from the origin. finish (x, y) origin (0, 0) squared distance (x² + y²) 10 Note: how can we relate random walks to real life? Random walks and the mathematics that govern them are found everywhere in nature. When gas particles bounce around in a room, changing direction every time they collide with another particle, it is random walk mathematics that determines how long it will take them to travel from one location to another. Therefore, this task is going to be a beginning of a more interesting stuff we can do. 2. Controlled Walk: Instead of walking randomly, Ali now walks on your directions. You direct him in which direction to move. There are always few hurdles (walls, dustbin, another person) in actual environment, and you cannot keep of walking anywhere. Therfore, this time, if there is some hurdle present at the dictated location, Ali should not move to that location. Write a program where you dictate the direction by press of keys: [arrow-up, arrow-down, arrow-left, arrow- right] The position of hurdles is already stored(hardcoded) in program. 3/3 :::
Expert Answer:
Answer rating: 100% (QA)
Solution Step1 Below is a Java program RandomWalkjava that simulates a 2D random walk and calculates ... View the full answer
Related Book For
Linear Algebra And Its Applications
ISBN: 9781292351216
6th Global Edition
Authors: David Lay, Steven Lay, Judi McDonald
Posted Date:
Students also viewed these programming questions
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
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...
-
A strip of metal is originally 1.5 m long. It is stretched in three steps: first to a length of 1.75 m, then to 2.0 m, and finally to 3.0 m. Show that the total true strain is the sum of the true...
-
If consumers had an MPC of 0.90, by how much would aggregate demand have eventually increased with Obama's first year spending stimulus assuming the stimulus was entirely government spending (News...
-
A shipping crate that weighs 450 kg is placed on a loading ramp that makes an angle of 30 with the horizontal. Find the magnitude of the components of the crates weight perpendicular to and parallel...
-
What do you know about the mathematical value of a project's internal rate of return under each of the following conditions? a. The present worth of the project is greater than 0 . b. The present...
-
Comprehensive variance analysis Kitchen Whiz manufactures premium food processors. The following is some manufacturing overhead data for Kitchen Whiz for the year ended December 31, 2010: Budgeted...
-
A certain substance has a mass per mole of 53 g/mol. When 312 J is added as heat to a 26.0 g sample, the sample's temperature rises from 21.0C to 45.0C. What are the (a) specific heat and (b) molar...
-
The City of Castletons General Fund had the following post-closing trial balance at June 30, 2022, the end of its fiscal year: Debits Credits Cash $ 265,120 Sales Taxes Receivable 11,000 Taxes...
-
Best Buy's Geek Squad tech support and installation services are additional customer service features valued by many customers. How would you characterize Best Buy's competitive strategy? Should it...
-
You deposit $10,000 in an account that earns 5.5% compounded continuously and your friend deposits $10,000 in an account that earns 5.5% annually. a. How much more will you have in the account in 10...
-
During 2023, Olivier Corp., which uses the allowance method of accounting for expected credit losses, recorded loss on impairment of accounts receivable of $25,000. As well, the corporation wrote off...
-
For a certain run, the following data is obtained: Mass of cart = 600 g, hanging mass = 35 g, distance travelled by the cart = 59 cm, initial speed of the cart = 0.33 m/s, Final speed of the cart =...
-
Write the pytorch code to implement the overall architecture of the decoder part of a transformer from input to output. I basically need you to explain the overall code in the bigram model class.
-
Write a report explaining the importance of computational thinking in everyday life. explain with examples the following decomposition, pattern recognition, algorithm and abstraction.
-
A three-phase Y-A system has a source voltage Van = Vp40 = 12040V with load impedance ZA = 2 - j3 0. Calculate the line voltage VL and the line current IL %3D %3D
-
An item of depreciable machinery was acquired on 1 July 2009 for $120,000 by cash It is expected to have a useful life of 10 years and zero salvage value On 1 July 2012, it was decided to revalue the...
-
Mark each statement True or False (T/F). Justify each answer. (T/F) Each elementary matrix is invertible.
-
Determine the dimensions of Nul A, Col A, and Row A for the matrices. A = 0 0 4 7 0 0 0
-
A 2 200 data matrix D contains the coordinates of 200 points. Compute the number of multiplications required to transform these points using two arbitrary 2 x 2 ma- trices A and B. Consider the two...
-
How can speakers use anxiety to their advantage?
-
What are common psychological, physical, and behavioral reactions associated with speech anxiety?
-
Describe strategies for making people the focus of your presentations.
Study smarter with the SolutionInn App