PDF (letter size)

Few Simulation/Animation programs

Nasser M. Abbasi

sometime in 2014   Compiled on May 26, 2022 at 1:57am

1 Moving circle and cycloid

Oct 10,2009

I saw nice animation of a moving circle and cycloid written by amca01 on the web. It was implemented in sage.

Below is the Mathematica implementation I wrote of the same idea as the above.

2 Random walk 3D

Written in Matlab 7.1

There are 6 probabilities one for each direction (left x, rightx, left y, right y, up and down). Adjust the parameters at the top of the script. See top of script for more information.

Matlab script source code

3 Random walk 2D

Written in Matlab 7.1

There are 3 probabilities that can be assigned at each step: Right step, left step, and no step (same direction). See top of script for more information.

Movie of with 3 equal probabilities for left, right and no step.

Movie with probability of left step and right step being equal and each is 0.5. Hence no effect is taken for making no step during any time.

Matlab script source code

4 Ornstein-Ehrenfest

Mathematica 6.01

This is an animation of the solution to the PDE \(\frac {\partial f}{\partial t}=c \frac {\partial xf}{\partial x}+ D \frac {\partial ^2 f}{\partial x^2}\). The parameters \(c, D\) can be adjusted. Animation of solution is shown.

One version written in Matlab and another in Mathematica 6 (Using Manipulate)

5 Einstein-Weiner

Mathematica 6.01

This is an animation of the solution to the PDE

\(\frac {\partial f}{\partial t}=-\beta \frac {\partial f}{\partial x}+ D \frac {\partial ^2 f}{\partial x^2}\)

In Mathematica. Adjust using the GUI the parameters Beta (drift) and D (diffusion) and simulation time and run it.

6 Bouncing Ball inside a square

Mathematica 6.01

A small animation of a ball bouncing between the walls inside a closed square. Shows how to use Mathematica to do animation. This was done without using Manipulate.

7 Bouncing Ball inside a square with Manipulate

As last simulation but with more options and using Manipulate. Adjust size of ball and step size and see effect of bouncing off the walls.

8 Markov chain transition probability Matrix being raised to Powers

Small computation to show visually the P matrix (probability transition matrix) used in markov chains being raised to higher powers. To show to what value it converges to. Move the slider and see the matrix being raised to that power one step at a time.

9 Markov chain transition probability Matirx

for inventory problem

Shows the P matrix for the inventory problem as number of weeks increases and the current state row vector. Select s and S and number of weeks from the GUI.

10 Using simulink to look at response to a step input

Showing how to use a scope with multiple input signals