# Questions tagged [simulation]

Simulation is the imitation of the operation of a real-world process or system over time.

236 questions
Filter by
Sorted by
Tagged with
1answer
251 views

### Need help setting up a numerical simulation and getting output into a table

I would like to set up a simple numerical simulation of a model - but I don't know how to do it in a simple and efficient manner. Here's what I want to do (using a simplified example): I want to ...
1answer
103 views

### Flatten:flpi message generated with RotationTransform with more points

I am doing a very small job of making points rotate or diffuse randomly on a circle. I generate the particles using positions = RandomPoint[Circle[],100] and ...
0answers
161 views

### Circular membrane vibration [duplicate]

I'm having a problem in a mathematica code I made to observe the normal modes of a vibrating circular membrane. This is a function I made When d==2, I show a 2D graph of the normal mode. After the ...
0answers
109 views

### How to avoid unnecessary calculations in a numerical simulation and improve performance? [closed]

Corresponding to the previous question I posted: Discontinuous boundary condition distorts in the numeric solution. ...
1answer
258 views

### Beginner Simulating Gaussian Process with Correlation

I have no little experience with algorithms. I would like to learn how to simulate a real valued Gaussian process with correlation (e.g., exponentially correlated $\Gamma(t)=e^{-\vert t \vert/2}).$ ...
1answer
1k views

### How to make a pendulum simulation draw the bob's trajectory?

This is the code for a simple pendulum simulation ...
1answer
173 views

### Coding a simulation of multi-species population dynamics

I want to code several steps in a recursion equation (in my case, migration, followed by selection, followed by mating, etc in a population). I have seen this done using a lot of copying and pasting ...
1answer
1k views

### Random coin toss; toss 10 coins; repeat 100 times

I want to simulate a coin toss game in which 10 coins are tossed. Afterwards, I want to repeat this simulation 100 times. So far I have: ...
0answers
484 views

### Simulate Geometric Brownian Motion with stochastic drift

I want to simulate a GBM with its drift parameter follows some continuous time Markov chain. For example, \begin{align} dK & =\mu Kdt+\sigma K dW \end{align} where $\mu$ follows continuous-...
2answers
1k views

### Bouncy Bubbles animation

I want to make a bouncing bubbles animation, looking like this. Here is a start: ...
1answer
500 views

### How to tell Mathematica do parallel computation?

I am using NDSolve on a workstation with 6 kernels. To speed up the simulation I have used LaunchKernels[] to load all the ...
1answer
1k views

### Obtaining a 3D animation as a drop in a liquid surface

Someone could get a similar solution like this animation? I believe the solution is useful for demonstrations in class to other users who teach Math. Spreading of a Thin Liquid Drop Under the ...
0answers
116 views

### How to define inclusions in FEM/NDSolve? [closed]

I am trying to simulate the compaction process of hot mix asphalts and want to do this with mathematica's FEM libraries. How can I define inclusions in meshes (i.e aggregate particles in the binder) ...
0answers
106 views

### averaging over large number of random realizations

I want to run following for few hundreds of a random variable set. This calculates: generate normal random variable find gain with squaring calculate performance metric find ...
1answer
1k views

### Do-Command around entire Notebook (by iterating it from another notebook?)

I have a large simulation (1500 lines of code in different sections) and I would like to run the file using different combinations of input parameters without manually changing the parameters. Say my ...
1answer
3k views

### Gillespie Stochastic Simulation Algorithm

The Gillespie SSA is a Monte Carlo stochastic simulation algorithm to find the trajectory of a dynamic system described by a reaction (or interaction) network, e.g. chemical reactions or ecological ...
1answer
428 views

### Solve and design “water flow”

In some strategy game I play, I'll have to change the terrain to make the water flow in some specific way to fulfill my goal. The water flow changes with terrain so if I can change the terrain wisely ...
0answers
87 views

### What code can I use to calculate, integrate, and visualize the electric field for an arbitrary shape? [duplicate]

I'm looking for a Mathematica program/function with which I'd be able to specify two objects in 3D space, each at a different surface potential, and then the program would calculate (using Finite ...
2answers
342 views

### How can I choose a suitable refresh rate to make a good animation of the wagon-wheel effect?

I'm trying to make an animation of a rotating wheel to show the effect of aliasing in sampled systems. Here is my code, where I use Manipulate to adjust ...
1answer
230 views

### Issues with modeling pulses in a very simple system of DAEs

Bug introduced in 10.4.1 or earlier and fixed in 11.0.0 Bug has been confirmed by WRI [Case:3594387]: It does appear that the NDSolve function is not behaving properly in this case and an incident ...
2answers
2k views

### Calculate $\pi$ using Monte Carlo methods

I know that we can have an estimate of $\pi$ using Monte Carlo methods. I know that we make a huge loop and each time we take randomly two numbers in the range [0,1] and calculate the number of ...
3answers
480 views

### Simulation with two random walkers on a lattice with periodic boundaries

I am having some difficulties implementing a Monte Carlo simulation in order to compare the results to analytical calculations. The following code simulates a case with one random walker and a ...
1answer
173 views

### Periodic boundary conditions for two walkers

For some reason I'm getting infinite loops most of the time i run this. Perhaps the periodic boundary conditions are wrong. Seems like the probability of the two positions to be the same is extremely ...
1answer
453 views

### Simulating a “Coin Tossing” Game

i was wondering if i could simulate the following Coin-tossing-game in Mathematica: Two Persons are playing "Coin-tossing" against each other. If one wins, he gives one Dollar to the other. Game ...
1answer
811 views

### How to model wooden joints with mathematica's FEM?

This is a dovetail joint: and I'd like to see the stresses and deformation on the joint.I haven't seen any modeling of disconnected regions with FEM, only connected regions, so I'm curious if you can ...
1answer
535 views

### Beam deformation due to localized force distribution

I would like to simulate the deformation of a beam which is fixed on one end and has some localized forces applied along the top. I have been inspired by this Mathematica example: http://www....
1answer
924 views

### How to add moon to orbit Earth that Orbit Sun

I want to add moon(Blue) that orbiting earth(Red). while Earth is orbiting Sun. this is my code so far that consist of earth, sun and moon. how to write a code so that Moon is orbiting earth instead ...
1answer
2k views

### Interstellar Image Effects

I'd like to know how to create this type of gravitational lensing effect in an image (here are some star fields from the hubble) "I wrote down the equations and I tested them in Mathematica by ...
2answers
956 views

### How to see phase difference of two pendulum

i want to see the simulation of two uncoupled Simple Harmonic Motion (SHM) pendulum with different Lengths and released at different initial displacement angles. in this case adding one more pendulum ...
2answers
753 views

### How to make A simulation of 2-Dimensional Projectiles

Lets say two cannon is fired at different initial position, initial angle and initial speed. let say initial speed,angle and position for projectile 1= ...
1answer
446 views

### Simulating a Wave Pulse

How to construct a code that superimpose n=10 one dimensional sinuisodal waves. each with an angular frequency ...
0answers
464 views

### How to do multi-agent modeling?

There are tons of examples here: http://demonstrations.wolfram.com/topic.html?topic=multi-agent+modeling&limit=20 But I been unable to find a good guide explaining what is the recommended ...
1answer
335 views

### Ball rotating in a Turntable

I made a turntable to make some experiments and make some studies about Coriolis and Euler forces acting in different frames of reference. ...
4answers
3k views

### How to make a Cahn–Hilliard model GIF

The question derived from @Jason B 's answer.I wanna make it but don't how to do.But we can get some rule about the GIF The change of the total pixel is very small. ...
1answer
400 views

### 3D orbits of moons around their respective planets

I have seen a lot of solar system models (both animated and not), but I am trying to replicate the same thing with moons. Either just one planet and its lunar system or the our whole solar system with ...
1answer
1k views

### How best to simulate n-body systems in a functional way?

I want to simulate a N-body system in the most functional way possible. The system I'm modeling are metallic colloidal particles in a solution of peroxide water, as here http://arxiv.org/pdf/1502....
1answer
536 views

### Generate a simulated covariance matrix

I am working on a problem where one of the input variables is the level of covariance between the entries in a particular matrix. To simulate this problem in Mathematica, I will need to feed my code ...
2answers
419 views

### Confining/Periodic boundary conditions implementation for 2D Random Walker

I am new to Mathematica, and am having trouble implementing confining boundary conditions for a random walk simulation confining the walker to a pre-defined region (periodic boundary conditions would ...
1answer
341 views

### Battery charge simulation not clipping properly as it iterates

My code for simulating a batterylevel-state throughout a year in 15min-steps doesn't work. There is a certain list-inputs which simulates the charge state and the batterylevel-state, additionally ...
2answers
781 views

2answers
1k views

### Evaluation problems with NDSolve using the fixed step ExplicitEuler-Method

Motivation I am using Mathematica to implement System Dynamics (SD) models, e.g. differential equation models as applied to management/economic problems following the "methodology" of Jay W. ...
2answers
497 views

### Simulation of LogNormal process for an asset pricing

I'm new to Mathematica programming, so forgive my rather unsophisticated question. I need to simulate 5000 "walks" of a process value (of a stock) that starts from its current value, at ...