Questions tagged [simulation]
Simulation is the imitation of the operation of a real-world process or system over time.
296 questions
0
votes
0
answers
71
views
Construction of RMT Hamiltonian with given potential
It is well known that the Random Matrix Theory (RMT), the potential function for the Gaussian ensembles, is
$V(H) = \frac{1}{2} H^2 \quad \Rightarrow \quad P(H) \propto e^{-\frac{N}{2} \operatorname{...
4
votes
2
answers
440
views
Animation of trajectories from NBodySimulation
NBodySimulation example code gives below animation, but there are no lines depicted.
How should I modify the code to also plot the trajectories of bodies?
...
1
vote
1
answer
198
views
I am trying to replicate results from a simulation from a paper related to sorption mechanism of hydrogel but I can't seem to replicate it
I am trying to replicate results from a simulation in a paper
https://pubs.acs.org/doi/10.1021/acs.nanolett.1c04216?goto=supporting-info#_i9.
My code seems to be fine at first, but the liquid ...
28
votes
4
answers
2k
views
Boids by Simon Woods: can we re-invent further efficient flocking models to forge complexity from simple rules?
It has been 12 years since @simon-woods created this fascinating animation an invented a boids model which is more efficient than typical ones. Code is extremely short an elegant:
...
3
votes
2
answers
466
views
Simulating k-many 'Electrons' with 'Repulsion' on 'Atoms'
Perhaps a better title would be:
"Simulating k-many Moving Points with Distance Contraints on Sphere-like Cages"
because I am not concerned about representing anything physically real. This ...
2
votes
2
answers
187
views
Inclusion of absorbing boundary in continuous stochastic process simulation
While I'm now aware of the great functions Mathematica has for simulating stochastic processes on an unbounded domain, a common problem is a bounded domain with absorbing boundaries. In particular, ...
1
vote
0
answers
126
views
Problem using NestList
I have the following code with an error appearing for the 'simulation' line command regarding the use of NestList. I get a message regarding 'Objects of unequal length' and 'not valid variables' found....
1
vote
1
answer
454
views
Gillespie (stochastic simulation) algorithm
I want to apply the Gillespie algorithm to a set of reactions. First, I run the source code presented here, and then run my model:
...
1
vote
2
answers
217
views
Python code of plot of Fisher KPP equation [closed]
I have the following system: $x'=y$, $y'=-y+x^2-x$ and I tried using Python code to display the phase portrait along with the stable manifold (point(1,0) for the provided system of differential ...
0
votes
0
answers
129
views
Ising Model Simulation Increase Efficiency
I implemented a 2d simulation of Ising Model for zero external magnetic field. Below you can find the function I wrote to calculate the energy (periodic conditions)
...
2
votes
1
answer
221
views
Regarding the interactive operation of a four-bar linkage mechanism
I have a four-bar linkage mechanism, where when the left locator is moved, the right locator moves accordingly, and when the right locator is moved, the left locator moves accordingly. I have ...
1
vote
1
answer
105
views
Troubleshooting NDSolveValue::rdelay Error in a Dengue Epidemic Model with Delay Differential Equations in Mathematica
I am modeling the vector dynamics of a dengue epidemic using a system of delay differential equations (DDEs) in Wolfram Mathematica. My model includes a complex interplay of host-vector interactions, ...
1
vote
0
answers
112
views
How can I set up and simulate an Ornstein–Uhlenbeck process that depends on the proportional deviations from the steady state?
I'm trying to set up a stochastic differential equation and run numerical simulations for the following process:
$$\frac{dV_t}{V_t}=\left[M+\gamma\left(M-\left(\frac{V_t}{V_{t-1}}-1\right)\right)\...
1
vote
1
answer
166
views
How can I simulate merging of droplets pressed between two slides? [closed]
I'd like to study the evolution and merging of multiple droplet outlines, while confined and pressed between two planparallel slides.
Does anyone have an idea how to code an interactive script by MMA ...
0
votes
0
answers
58
views
Simulation of a discrete pdf
I have 3 random variables (b,c,d) that capture a discrete pdf over 4 possible realizations. In every period, they evolve according to the random process described in the code below. I would like to ...
0
votes
1
answer
229
views
Plot roots of polynomials [closed]
I am a newbie with Mathematica.
I would like to simulate/plot the distribution of the roots of both the polynomials and the derivatives of polynomials. In particular, I would like plot the ...
1
vote
1
answer
127
views
Integrating Over a Conditional Time-Dependent Region
I'm experimenting with integrating over regions so I can check some physics simulations. Here's the rundown of what I'm attempting to do.
I have a rectangle that I'm rotating with a parameter:
...
1
vote
1
answer
236
views
Parallelized Monte-Carlo
I'm trying to do a little Monte-Carlo, and the code is working great, but slows down when I try to increase the number of iterations, any suggestions on how I can parallelize this? Every way I've ...
1
vote
2
answers
483
views
Graphing curves formed by a rolling polygon
I am trying to make a Mathematica graphing function that would generalize common phenomena. How would I do this?
From a circle, we can generate a cycloid (if rolling on a line) or a sine wave (if ...
1
vote
1
answer
141
views
Value of a function over permutations of two lists
I want to do the sum (in Ising lattice gauge theory)
...
1
vote
1
answer
114
views
Sum on a lattice where variables can only take two values (Ising lattice gauge theory)
I want to study the Ising Gauge Theory which has the Hamiltonian
\begin{equation}
\mathcal{H} = -J \sum_{n,\mu,\nu} \sigma_3(n,\mu)\sigma_3(n+\mu,\nu)\sigma_3(n+\mu+\nu, -\mu)\sigma_3(n+\nu, -\nu)
\...
3
votes
1
answer
659
views
How to simulate a directed acyclic graph?
My goal is to have a code to identify and estimate the regression models associated with a directed acyclic graph (DAG), which is obtained through the reduction of a given weighted, directed graph <...
25
votes
2
answers
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 ...
3
votes
1
answer
436
views
Thermodynamics of the 2D Ising model
I want to study the thermodynamics of the 2D Nearest Neighbour Ising model (calculate the average energy, susceptibility, etc.). I have the Hamiltonian
$$\mathcal{H} = J\sum_{\langle i j \rangle} s_i ...
0
votes
1
answer
121
views
Exploring Variability: 100 Stochastic Simulations of Cumulative Incidence
We know $R_0=0.75$ and $\gamma=0.4$. So with the following code I calculate $\beta$
...
3
votes
1
answer
600
views
Simulating the Conduction of Heat on a Metal Rod
Consider the one-dimensional heat equation
$$
\frac{\partial u(x,t)}{\partial t}=\alpha\frac{\partial^2 u(x,t)}{\partial x^2}, \quad
(x,t)\in (0,L)\times (0,\infty),
$$
subject to the ...
3
votes
0
answers
161
views
Fast Multipole Methods [closed]
My goal is to model electrostatic containment of point charges (protons). I understand the basic N-body potential calculation is O[N^2}, and a potential of q/|ri-rj| (constant mass and charge, ...
2
votes
1
answer
142
views
Need an equation for modeling Tytler's Cycle
In all cultures over all time there appears, in different languages for different countries, the maxim "Shirtsleeves to shirtsleeves in three generations." This is a function with three ...
15
votes
1
answer
566
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
1
vote
2
answers
192
views
Simulating the card game War with $m$ suits and $n$ values
I am trying to simulate the card game War to find approximations to the stopping time distribution for different types of decks, and study conditional probabilities of winning given a certain deck. (...
1
vote
1
answer
290
views
Colored plot with Wolfram Mathematica
I saw this image thus I guess that it is possible to color some regions in a plot. What kind of command can I use to have a similar plot?
2
votes
1
answer
155
views
Simulating a discrete time stochastic process
I would like to simulate and plot many paths of a discrete random variable $\tau_{t}$ that follows the following process:
with probability $\tau_{t-1}$, $\tau_{t}$ is either $0.6$ with probability $x$...
0
votes
1
answer
142
views
Evaluating an integral of geometric Brownian motion
I am a Mathematica novice. For an operations research application, I am trying to work with the following wealth process in Mathematica,
$$
d W_t = (\rho W_t + P_t) dt\ ,
$$
where $P_t$ is a stream ...
2
votes
1
answer
238
views
How do I simulate an ItoProcess that is not supposed to become negative?
I have a process that is similar to a Cox Ingersoll Ross process. Like a CIR process this process does not become negative. However, when I define the process with ItoProcess and I simulate it with ...
3
votes
2
answers
314
views
FEM Capacitor Not Converging with Parallel Plate Model
I am trying to model a 3D electrostatics finite element model of a capacitor to see if I can accurately model the behavior of a parallel plate capacitor before I alter the geometry of the electrodes ...
0
votes
0
answers
106
views
Non-linear regression simulation
I have a sequence of data:
data = {{20, 291}, {21, 440}, {22, 571}, {23, 830}, {24, 1287}, {25, 1975}, {26, 2744}, {27, 4515}, {28, 5974}, {29, 7711}};
The data is ...
1
vote
0
answers
94
views
Plot the graph with two best response functions, Mathematica
I have another doubt regarding Mathematica. This is probably another question that can be easily answered, but since I'm a beginner it's a while that I'm stuck.
Since I'm using Mathematica online, the ...
0
votes
2
answers
133
views
Table generation with random variates inside. Mathematica [closed]
I'm new on this forum, and I'm also a new user of the software Mathematica. For this reason, I'm sorry if my question will be unclear and / or dumb.
I have to make a numerical simulation with random ...
1
vote
0
answers
62
views
Plotting a parametric function for a given prior distribution of parmaeters
I have a function $f(x, \alpha, \beta)$. The function is piecewise defined and not analytically integrable. I would like to do the following: draw from a distribution on $\alpha$ and $\beta$, compute $...
4
votes
1
answer
305
views
Optimizing Code N-Body Simulation
below is my code for a gravitational n-body problem. I know Mathematica has a n-body simulation function however I am programming this to learn Mathematica more and programming numerical techniques. ...
1
vote
1
answer
185
views
Simulating network evolution based on common neighbors
I am new to studying networks in Mathematica and I would like to model the following network evolution process:
Start with a random graph $g_0$ with $n$ nodes, $n$ even.
At each time $t$, ach node $i$...
0
votes
0
answers
127
views
How to set this DAE "ball sliding along a frictionless slope" system initial conditions?
How to set this DAE system initial conditions? I want to find out the trajectory of a particle sliding along a frictionless slope, but my code can't work. What's wrong? How should I fix it? Thank you ...
1
vote
0
answers
150
views
Real-time interactive simulation
I would like to know how to use mathematica to make a real-time physics simulation that can be interacted with using a cursor.
As an example, consider a classical magnetic dipole in a background field,...
4
votes
1
answer
370
views
How to simulate hysteresis loop for a ferrimagnetic material
I am trying to modify a ferromagnetic hysteresis loop to ferrimagnetic hysteresis loop.
Below is the equation I used for ferromagnetic simulation :
Below is the code for above equation:
...
0
votes
1
answer
309
views
Sticky Collisions (perfectly inelastic)
There is an awesome simulation https://mathematica.stackexchange.com/a/124926/87086 which shows N particles bouncing in a box (with elastic collisions), made by @Feyre https://mathematica....
0
votes
1
answer
126
views
Plot two list for differen first list parameter
I have a series of equations based on which I plot final lists of "xA1","yB1".
I need to change "xA1 = {0.55}" and "yB1 = {0.6}" between [0,1] with interval 0....
0
votes
1
answer
194
views
Simulate geometric brownian motion and use generated data for calculations
I want to generate a geometric brownian motion A with mean $MuA$, variance $SA$ and starting value 0.05. I do the following:
...
6
votes
1
answer
1k
views
Solving 2D Landau-Khalatnikov equation & Poisson equation using finite element approach
I would like to solve Landau-Khalatnikov (LK) equation and Poisson equation using finite element approach to simulate ferroelectric hysteresis loop, electric potential distribution and electric ...
5
votes
2
answers
327
views
Speeding up the Kuramoto model on a random graph
I am solving the Kuramoto model on a random graph $G(n,p)$, plotting the synchrony against the coupling parameter, as follows,
...
9
votes
3
answers
705
views