Brownian motion is a physical phenomenon

Assignment Help C/C++ Programming
Reference no: EM13161728

Brownian motion is a physical phenomenon which can be observed, for instance, when a small particle is immersed in a liquid. One method for describing this motion (in one -dimension) involves modelling the particles as "jumping" once per microsecond a random distance. The Brownian model predicts how far the particle moves after waiting a certain amount of time. Because the model is based onrandom numbers , we are interested in the average distance the particle moves. Write a program that will simulate Brownian motion by doing ALL of the following: 1) Ask the user how many trials to run. 2) Run the requested number of trials. For each trial you will si mulate the Brownian motion of one particle over 10 microseconds (10 jumps). The particle should jump up to 1 nanometer to the left or right with each jump . 3) Calculate the average absolute value of the distance that the particle has moved. 4) Print the average absolute value of the distance to the screen. Hints: 1) You will need rand() from to generate random numbers to simulate the jum ping. Note that rand() generates random integers, but for Brownian motion the jumps must be floating point values. 2) The code is easiest if you consider negative numbers as movement to the left and positive numbers as movement to the right. Then you can simulate a jump by generating a random number between- 1 and 1. The position of the particle is simply the sum of all the jumps. 3) You can use abs() from to take the absolute value of the final distance. Do not take the absolute value of each jump or you will lose the left/right information. 4 ) You will probably need two loops. One to loop thr ough each trial, and one to loop through each of the 10 jumps. 5 ) Because we are taking the absolute value of the final distance, the average displacement of the particles after 10 jumps should not be 0. 6 ) Because the code is based on a random number generator, you should get a slightly different answer each time you run the code. 

Reference no: EM13161728

Questions Cloud

In psuedocode, design an application : In psuedocode, design an application that has an array of at least 20 integers. It should call a module that uses the sequential search algorithm to locate one of the values
Least number of comparisons needed : What is the least number of comparisons needed to sort an array of 6 numbers, in the worst case, using any sorting algorithm that sorts with binary comparisons? Explain
20 integers saved in a file called "data.txt" : There are 20 integers saved in a file called "data.txt" (just a random txt file with some numbers) All integers are in the range from 1 to 10
All the new strings generated : Explain why, if on some round, all the new strings generated for any syntactic category are longer than s, and s has not already been generated for L(), then s cannot ever be put in L(). Hint: Use Exercise 11.3.5.
Brownian motion is a physical phenomenon : Brownian motion is a physical phenomenon which can be observed, for instance, when a small particle is immersed in a liquid.
Write a program code to compute and build a table of reynold : Write a program code to compute and build a table of Reynolds numbers at flow velocities varying from 100 to 1000 ft/sec (at increments of 100)
Method called printpowersof2 that accepts a maximum number : Write a method called printPowersOf2 that accepts a maximum number as an argument and prints each power of 2 from 20 (1) up to that maximum power, inclusive. For example, consider the following calls: printPowersOf2(3); printPowersOf2(10)
Create a class named gamer that has a field for name : Create a class named Gamer that has a field for name(string) and a field for points(int).
Federal government regulates labels : The federal government regulates labels, warranties, and consumer products. Without government regulation, what abuses are likely to occur?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Calculate the component voltages

Calculate the component voltages for the following series resonant RLC circuit

  Create a template class

Create a template class, SVector, that implements a constructor

  Program to declare array alpha of components of type int

Write C++ statements to do the following: Declare an array alpha of 15 components of the type int. Output the value of the tenth component of the array alpha.

  Maze program

Maze program. In this assignment you will represent a maze with a binary tree. . The starting point is node N and the ending point is node Z.

  Using opengl to create a cube

Write a program in C/C++ using OpenGL to create (without using built in function) a cube by implementing translation algorithm by translating along 1. X-axis, 2.Y-axis and 3. X and Y plane

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Native method with deadlock detection and recovery

The naïve method with deadlock avoidance and the naïve method with deadlock detection and recovery - what will you measure and compare in order to determine the winner or which is better

  Assign passed value to function to return value

Assign passed value to this member and another function to return value. Your main should read the integer from an input data file, and write the output to the output data file.

  Multiple choice question on c programming

Create a function to print "88 is a great port number" function name is yourName_PrintFunction no input no return type print "88 is a great port number"

  A palindrome is a number

A palindrome is a number or text phrase that reads the same backward as forward. For example, each of the following five-digit integers is a palindrome: 12321, 55555, 34543 and 11611. Write a program that reads in a five-digit integer and determines ..

  Insert the missing code in the c program

You are to insert the missing code in the C program given for combinational equivalence checking. This program will interface with the CUDD package and will parse netlist files in ISCAS85 circuit format. Next, BDDs will be created for each circuit an..

  Write a loop that fills a vector

Write a loop that fills a vector V with ten  different  random numbers between 1 and 100. output must actually display the random numbers to get credit.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd