Skip to main content

Questions tagged [simulation]

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

Filter by
Sorted by
Tagged with
153 votes
8 answers
35k views

How to generate a random snowflake?

'Tis the season... And it's about time I posed my first question on Mathematica Stack Exchange. So, here's an holiday quest for you Graphics (and P-Chem?) gurus. What is your best code for generating ...
Peltio's user avatar
  • 5,536
51 votes
1 answer
1k views

Random polyhedra walk

I would like to recreate ssch's random polyhedra random walk, which he posted in the chat. For convenience here it is again: This is my best attempt so far: You can download the notebook with the ...
C. E.'s user avatar
  • 71k
42 votes
7 answers
3k views

Nice formatting for the results of a dice game simulation

One of my Mathematica interests is in problems related to the formatting of output. Getting nice formatting from Mathematica is often frustrating, but occasionally Mathematica will delight me by ...
m_goldberg's user avatar
  • 108k
42 votes
6 answers
7k views

2D random walk within a bounded area

I want to simulate a random walk in two dimensions within a bounded area, such as a square or a circle. I am thinking of using an If statement to define a boundary. ...
MOON's user avatar
  • 3,876
41 votes
3 answers
4k views

Computational Bayesian analysis in Mathematica: Any plans to develop MCMC?

Does anyone know if there are any plans to develop an MCMC capability in Mathematica? My reasoning for asking is that as it stands, I can't seem to find any 'out-of-the-box' functions/capabilities ...
ben18785's user avatar
  • 3,167
35 votes
3 answers
10k views

Animation of double pendulum

Sadly, I am a completely newbie. I am studying Physics and in our theoretical physics class we got the task to solve the double pendulum using Mathematica. We just got the program, but no introduction ...
Thison's user avatar
  • 351
32 votes
2 answers
11k views

Creating a simulation of our Solar System

As the title says, my objective is to create a simulation of the motion of the planets in our Solar System using Mathematica. All the theoretical background regarding the equations of motion of ...
Vaggelis_Z's user avatar
  • 8,810
32 votes
1 answer
4k 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 ...
István Zachar's user avatar
32 votes
1 answer
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 ...
M.R.'s user avatar
  • 31.7k
30 votes
1 answer
981 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 ...
tsuresuregusa's user avatar
29 votes
2 answers
3k views

Animating wave motion in water

Further to this question I found on MSE, I tried to replicate from here this is as far as I got: ...
martin's user avatar
  • 8,830
28 votes
3 answers
3k views

How to simulate the true reflective movement of a particle bouncing around in an ellipse?

Please help me to simulate the movement of a particle inside a region with elliptical walls such that particle is reflected from the walls and continues to move. A friend was able write code to ...
Spizhen's user avatar
  • 283
28 votes
2 answers
2k views

Simulating molecular dynamics efficiently

The following website offers a very nice molecular dynamics simulation: http://physics.weber.edu/schroeder/md/. It is pretty neat and quite a few physical phenomena can be described from that small ...
anderstood's user avatar
  • 14.4k
24 votes
3 answers
1k views

Modeling the spread of an infection in networked computers

I would like to show the iterative stages of infection for problem 2 in this link. In case the link dies, I have copied the text for the problem below: One hundred computers are connected in a ...
martin's user avatar
  • 8,830
22 votes
1 answer
2k 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....
tsuresuregusa's user avatar
21 votes
2 answers
1k views

Partial Differential Equation in Parallel

is there any native way to implement multi-core parallel solving of PDE in Wolfram Mathematica? WM 10 now supports Finite Elements Method, but it is actually useless without parallelization. Usually ...
user18790's user avatar
  • 311
20 votes
4 answers
7k views

Finding the volume of a sphere using the Monte Carlo algorithm

I used the following code to find the volume of the sphere $x^2+y^2+z^2 \leq 1$ in the first octant: ...
johny's user avatar
  • 355
20 votes
3 answers
2k views

How can I simulate this toggle mechanism?

I've been introduced to Mathematica very recently. Basically, I haven't actually "solved" anything in my Mathematica lifetime, but I've done some simulations. With my fractional knowledge, I tried ...
Waffle's Crazy Peanut's user avatar
20 votes
2 answers
2k views

Simulation of diffusion in a grid

I want to simulate a diffusive process in a 2D grid, for a central initial value of 1 to the adjacent cells initially at 0. At each time step, the value of the +1 level adjacent cells are increased ...
Valacar's user avatar
  • 970
20 votes
1 answer
704 views

Simulating Theatre puzzle

I have been trying to simulate the process of the theatre puzzle from the Joy of X (Strogatz). The puzzle, and some relevant material are here. My simplistic coding for this process follows: ...
ubpdqn's user avatar
  • 63k
19 votes
1 answer
2k views

Efficiently Mowing Grass with Mathematica

Recently, I was mowing my yard and was thinking about how to use the least amount of time/fuel and how to simulate. Mowing a yard that is shaped as a convex polygon is not difficult, you can just make ...
Teg Louis's user avatar
  • 114
18 votes
2 answers
2k views

Bouncy Bubbles animation

I want to make a bouncing bubbles animation, looking like this. Here is a start: ...
matrix42's user avatar
  • 7,180
18 votes
1 answer
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 ...
LCarvalho's user avatar
  • 9,263
17 votes
1 answer
1k views

Simulating discrete time stochastic dynamic systems

What is the canonical way of simulating discrete time stochastic dynamical systems in Mathematica using the new functionality of Random processes? To take a concrete example, lets consider the ...
Aditya's user avatar
  • 315
17 votes
1 answer
995 views

Simulating Stochastic Processes the MMA way

This question is really a specific problem and a methodological one concerning MMA best practices. I want to simulate a system of stochastic processes. If this were a geometric Brownian motion or ...
Luap Nalehw's user avatar
16 votes
4 answers
5k views

How to do System Dynamics simulations / diagrams in Mathematica?

System Dynamics is an approach to understanding the behaviour of complex systems over time. It deals with internal feedback loops and time delays that affect the behaviour of the entire system. What ...
Luxspes's user avatar
  • 930
16 votes
3 answers
1k views

Simulate a simple spinner

I'm teaching some simple ideas in probability to students in grade 7. The "spinner" below works, but I'm wondering how I could make it just a bit more realistic by having it actually "spin" around a ...
Tom De Vries's user avatar
  • 3,780
15 votes
2 answers
868 views

Fast Simulations with Compile

this post relates to another post that I didn't follow up propely. If I wanted to simulate a system of stochastic proesses like the following, and loop over this run many many times would writing the ...
Luap Nalehw's user avatar
15 votes
1 answer
390 views

Gravitation simulation and interaction of N (1000) massive objects

Is there an implementaion of the Barnes-Hut algorithm running with Mathematica? Thanks a lot
Rémy Galli's user avatar
14 votes
2 answers
757 views

Multiple reflections of a laser beam in a triangle

I want to make a animation that multiple reflections of a laser beam in a triangle looked like, I have tried following, but it's not a good way, I'm looking for a better way(Nested solution). ...
matrix42's user avatar
  • 7,180
14 votes
1 answer
2k views

Is there a free version of the Springer book "Mathematical Statistics with Mathematica"?

Is there a free version of the Springer book: $$\text{Mathematical Statistics with Mathematica}$$ by Rose and Smith ... available on the internet?
13 votes
4 answers
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. ...
yode's user avatar
  • 27k
13 votes
2 answers
1k views

How to implement lane-change rules for Nagel Schreckenberg model

I am trying to extend the Nagel-Schreckenberg model for traffic flow to include two lanes of traffic. I have a function that generates information about a random initial road configuration. A road ...
jlrawden's user avatar
  • 131
13 votes
2 answers
920 views

Efficient GeometricBrownianMotionProcess Monte Carlo simulation

Following the answers in this post, I'm trying to implement something similar. If the GBM stays inside the corridor [L, U] between predefined times it should return ...
user6174's user avatar
  • 151
12 votes
2 answers
9k views

Making mathematical animations with Mathematica

I recently stumbled upon the Cycloid and was working on finding its length and such when I found this animation on Wikipedia. Strikingly pretty and small in size too (66KB) So on searching how he ...
The-Ever-Kid's user avatar
  • 1,129
12 votes
4 answers
3k views

3D Random Walk with Periodic Boundary Conditions

I am working on a 3D random walk with periodic boundary conditions and have written a program that will do this for me, but it is extremely slow. Does anyone have any suggestions on how I could speed ...
Kane's user avatar
  • 481
12 votes
1 answer
715 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....
henry's user avatar
  • 2,510
12 votes
2 answers
2k views

How to improve the accuracy of this Monte Carlo simulation

A friend of mine went on an interview and he was asked to calculate the angle between the hour hand and minute hand of an analog clock when the time was 3:15. Arguably, this is a trivial problem that ...
stathisk's user avatar
  • 3,074
12 votes
1 answer
499 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 ...
Wjx's user avatar
  • 9,640
11 votes
7 answers
5k views

How to model rolling a pair of dice 100 times (Monte Carlo)

Like the title says, I'm having trouble trying to write out a function that will find the probability of finding the sum of a pair of dice 100 times to find the probability of each sum of 2,3,4,5...up ...
xCanaan's user avatar
  • 311
11 votes
2 answers
1k views

Two bouncing balls in 1 dimension, issues with two different methods?

I'm trying to simulate 2 balls with the same mass and diameter bouncing one on top of another under gravity, see the illustration below (not ideal, but this is the best result I've got so far, the ...
Yuriy S's user avatar
  • 675
11 votes
0 answers
2k views

Resources on Mathematica and strong AI (a.k.a. AGI) [closed]

David Deutsch (physicist / quantum computing theorist) wrote an article for Aeon Magazine last year: On Artificial Intelligence that got me thinking. The article assesses and critiques the ...
Jagra's user avatar
  • 14.5k
10 votes
2 answers
5k views

How to set up a simple Monte Carlo simulation?

there is a 1% chance that there will be a scattering event, if there is a scattering event the direction of scattering will be determined by a random sample of the custom[a_] function and if there is ...
AW1991's user avatar
  • 153
10 votes
3 answers
1k views

Simulate random data with correlation

I would like to simulate some random data e.g. between 0 and 1, but with a given correlation. In other words some data where the correlation between two datasets is e.g. a constant or within a give ...
holistic's user avatar
  • 3,005
10 votes
3 answers
1k views

Creating random configurations of spherocylinders or cylinders

About the setting: We have a 3D simulation box with side $l$ and our catesian coordinate system is set with its origin at the centre of the box. We have a number $N$ of spherocylinders of aspect ...
user avatar
10 votes
2 answers
592 views

Impact Crater Simulation

I have been trying to model crater formation on a given planetary surface - $500\,\textrm{km}^2$. The locations of impacts are random, however, if an impact is within $30\,\textrm{km}$ of another, the ...
Benjamin L's user avatar
10 votes
5 answers
1k views

Simple Birth Death Process

I am trying to implement simple birth death process. Why my code does not work? Any suggestion. Thanks. Cross posted http://community.wolfram.com/groups/-/m/t/1205656 ...
OkkesDulgerci's user avatar
10 votes
1 answer
768 views

Writing compiled functions as fast as Python's Numba

I want to write some code to simulate a damped oscillator that is just as fast as code written using Numba's @njit decorator. I've written the mathematica code and ...
Diffycue's user avatar
  • 1,844
10 votes
2 answers
317 views

Evolution of a trait in an asexual population (performance tuning)

I just coded a simple simulation module that looks at the evolution of a continuous trait in a haploid asexually reproducing population under density dependent competition in discrete time (i.e. non-...
Tom Wenseleers's user avatar
10 votes
2 answers
900 views

Fluorescence Correlation Spectroscopy Simulation

I am simulating Fluorescence Correlation Spectroscopy which basically involves tracking the random motion of particles in a box with periodic boundary conditions and then calculating their intensity ...
Kane's user avatar
  • 481

1
2 3 4 5 6