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
4
votes
1answer
109 views

Trouble iterating my forest fire simulation

I'm having some trouble iterating my simulation of a forest fire. I'm new to Mathematica, so apologies for poor coding. I'm sure there are far neater and more efficient ways of doing this, but I would ...
0
votes
1answer
62 views

Numerical simulation

I want to generate a numerical simulation in table for an equational output. I have used following code. But somehow I can't get any output. I am very novice to Mathematica. Can anyone please ...
6
votes
0answers
98 views

How can we improve transonic flow visualization?

With this code we can make 2D FEM simulation of transonic flow around airfoil NACA 0012 at Mach number of 0.925. It takes about 5 minutes on the XENIA-15 laptop of 32 GB memory with processor Intel ...
6
votes
2answers
359 views

Cumulative plot of a function

I'm working on a SIR model (differential equations): eqS = s'[t] == -b s[t] i[t]; eqI = i'[t] == b s[t] i[t] - k i[t]; eqR = r'[t] == k i[t]; I get a solution of ...
4
votes
3answers
156 views

Empirical mean excess plot of (μ, e(μ))

Say I generated n random variates from the standard cauchy distribution. I want to construct the empirical mean excess plot of (μ, e(μ)) , where e(μ)={Σ(xi-μ) *I {xi>=μ}}/Nμ . Nμ is the number of ...
1
vote
0answers
80 views

“If” not working when solving piecewise differential equation

This is a part 2 to my previous question: Solving Piecewise Differential Equation I am embarking on a physics project and this is the simulation that I would like to do. More information is included ...
2
votes
1answer
108 views

Solving Piecewise Differential Equation

I am trying to simulate something using differential equations. However, the equations are piecewise. Here is my code: ...
0
votes
1answer
75 views

Find the Hill Estimator of “alpha”

I am trying to get the Hill estimator of "alpha" and the Hill-plot graph from a standard Cauchy distribution. So, how to get it? Thanks! Hill estimator can be outlined as follows. Generate ...
2
votes
1answer
47 views

Shaky Point[] objects in simple animation

I'm making a simple animation of wave motion. Each point is supposed to be moving exactly along a circle, and for some reason the purple & orange points seem to shake as they rotate about their ...
1
vote
2answers
97 views

Translating MATLAB code into WL code [closed]

I want to solve the following problem by simulation. There is a bus with 100 labelled seats (labelled from 1 to 100). There are 100 persons standing in a queue. Persons are also labelled from 1 to ...
0
votes
1answer
40 views

Simulation of a recursive stochastic process

I would like to simulate and plot multiple paths of the following stochastic difference equation, for any initial condition $\pi_{0} \in (0,1)$: $\pi_{t+1} = \gamma \pi_{t}$ with probability $1/3 \pi_{...
1
vote
1answer
62 views

How to do importance sampling to estimate variance?

For a random variable X with density $q(x)=e^{(1/3)∗|x|^3}$, I can estimate its variance by numerical integration method. Then, how can I do importance sampling using a standard normal proposal (...
1
vote
1answer
75 views

Geometry3D objects as functions of parameters

I want to make a simulation of a rigid body with mathematica, but I want to use a Geometry3D object instead of a Graphics3D primitive. Mainly I don't know how to rotate the 3D model, I know how to do ...
5
votes
2answers
228 views

Accelerate the speed of selection in Random

Tossing 4 points on a circle at a time, and calculate the chance of all 4 points on the upper part of the circle. This is very simple by math: $$\left( \frac{1}{2} \right)^4 = 0.0625$$ But I want do ...
10
votes
1answer
484 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 ...
0
votes
0answers
56 views

Equal point charges on the sphere

I have coded a simulation where $n$ equal charges are randomly placed on the surface of the conducting sphere. I added a damping term proportional to velocity so that the charges arrange in a stable ...
1
vote
0answers
39 views

Explicit time dependent force in NBodySimulation

I'm looking for a way to use [NBodySimulation](https://reference.wolfram.com/language/ref/NBodySimulation.html) to simulate the application of a force stemming from ...
2
votes
0answers
39 views

How can I efficiently save multidimensional data that is retrievable by key?

I am doing some simulations in Mathematica, where I calculate a spectrum intensity(frequency) for a variation of parameters in my samples. So in the following image, for example, I vary the charge ...
0
votes
1answer
17 views

Calculation time differs between segmented loops and one whole loop

I stumbled on a strange issue while simulating a large number of random values, $10^8$ to be precise. I generated the numbers at first by the following code: ...
2
votes
3answers
203 views

Compute volume of ellipsoid using Monte Carlo methods

I have following code in Mathematica: https://pastebin.com/zRB9vEx8 and I need to compute volume of ellipsoid with given parameters: $$\frac{x^2}{9} + \frac{y^2}{4} + \frac{z^2}{4} = 1$$ Can anyone ...
2
votes
0answers
52 views

How to make following feynman path integral simulation [closed]

I want to do the simulation of Feynman path integral which is given in here. How should I proceed?
0
votes
0answers
86 views

Is it possible to create the following simulation in mathematica?

Consider a set of discrete "states" $|1\rangle,|2\rangle,|3\rangle,\dots,|N_{\text{max}}\rangle$). Next, assume that there are 1000 "particles" occupying the state 1 at the initial moment of "time". ...
1
vote
2answers
213 views

Dice Rolling Simulation [closed]

I'm simulating a sequence of dice rolls by choosing a random integer between 1 and 6. I need to use FoldList to generate a function that returns a list which describes how the cumulative total varies ...
0
votes
0answers
28 views

Simulation of a compound renewal process with copula dependency

I'm new to Mathematica and this is brief about my project that I would like to seek advice from this group about my coding. My project is to perform 100 simulations with 1000 iteration each based on ...
3
votes
2answers
155 views

Plotting tens of thousands of functions together on the same axes

I'm trying to plot a large number of functions together on the same axes. Each of these functions is the result from one iteration of a Monte Carlo simulation. Essentially, I'm varying parameters of a ...
8
votes
2answers
2k views

How can I show that a sphere is rolling in a simulation?

I recently wrote code to simulate a table tennis ball rolling on the ground. v0 = 10; w0 = 8; R = 4; mu = 0.2; g = 9.8; δ = (2 (v0 + w0 R))/(5 mu g); This gives ...
0
votes
1answer
109 views

Simulating a poker win rate over time

Poker players start with a fixed bankroll (bankroll) and play with a win-rate winRate (say measured in dollars per hour) and ...
0
votes
0answers
48 views

Simulating a function with no closed form solution

So I am trying to simulate a function in 3d. Suppose our function looks like this: f=k*r*a I am interested in simulating the numerical values of k when r is ...
1
vote
0answers
46 views

Is it possible to speed up SDE simulation?

Is it possible to speed up SDE simulation in Mathematica? I am simulating a large number of Heston processes that look like the following (note this code is only a slight modification of the ...
1
vote
0answers
48 views

Simulating a bicycle going around a circle

I want to simulate a bicycle moving around a circle. Instead of graphs and calculations, I want to almost see an actual simulation of this happening. How could I do this? I tried looking up ...
2
votes
1answer
251 views

Monte Carlo Simulation of a Double Well Potential (Edited)

I am looking for a possible way to simulate the temperature effect on a collection of atoms sitting within a double well potential, say something like ...
1
vote
1answer
134 views

Numerical simulation for density of strings in a ball

I am trying to numerically reproduce the Mathematica result for the density of strings in a sphere as explained here. The program is to generate random, uniformly distributed pair points on a unit ...
2
votes
0answers
231 views

Noise covariance matrix

I am trying to find the noise covariance matrix of a random vector $\mathbf{x}$ with itself. The elements of this vector represent image pixels and are treated as random variables i.e, $\mathbf{x}=\{...
28
votes
2answers
2k 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: ...
5
votes
1answer
402 views

Trying to compute the heat capacity for the 2D-Ising model

I'm trying compute the heat capacity $C_v$ out of my simulation for the 2D-Ising model which is given by $C_v = \frac{\langle E^2 \rangle - \langle E \rangle^2}{T^2N^2}$ ($E$: Energy, $T$: ...
3
votes
2answers
151 views

Initial values of position (x) and speed (v) of a particle visualizing using Mathematica

$$\vec{F}(\vec{r})=-m\omega^2\begin{pmatrix}x\\4y\end{pmatrix}$$ I have the force $F$ shown above. How could I specify the initial values of position ($x$) and speed ($v$) in Mathematica using the <...
1
vote
1answer
330 views

Solving Differential Equation System for HIV Treatment Model

I was working on a project about optimal strategies for HIV treatment, models used from [Butler, Kirschner, and Lenhart] 1997. This model explains the spread of HIV viruses in the human body, where ...
1
vote
1answer
71 views

Manual control plots differ from StateResponse and OutputResponse

So In my quest to try to learn some control theory inspired by the following link, I have been modeling an inverse pendulum regulated with a flywheel. The system model is pretty ok I think, and when ...
3
votes
0answers
103 views

Inhomogeneous Compound Poisson process

I need to use a compound Poisson process with time-varying jump intensity. Mathematica has the function of compound Poisson process as well as inhomogeneous Poisson process, but no combination of ...
5
votes
3answers
190 views

Improving the run time of random walk simulation

One of our professors told us that during his thesis he used Mathematica in simulating it since it is about networks, I don't know how he did it but all I know is he said it took about two weeks to ...
8
votes
2answers
349 views

How to simulate a random walk to randomly generated particle to another particle fixed at the center of a grid?

I am new in Mathematica, it is my first program. Many codes of diffusion-limited aggregation are available but, they are too difficult to understand. I basically want to create a simulation of the ...
5
votes
1answer
430 views

Random walk in one dimension — meeting of two particles

I'm new to Mathematica and still teaching all by myself, hope you bear with me. I have the code: ...
1
vote
1answer
126 views

How to plot lines using consecutive points from an array using ParametricPlot3D or so?

I was trying to simulate Gravitational Orbits using Newtonian Gravitation. I did not use NDSolve[] but instead used finite differences; coded myself. The code for ...
3
votes
1answer
421 views

How to directly input calculated Geodesic differential equation into *NDSolve*

I am trying to find the trajectory of a test particle around a relativistic object. Initially, I was trying the Kerr metric as spacetime but the final simulations clearly were not correct as I saw the ...
7
votes
1answer
154 views

Efficiency in calculation on graphs: Compile?

Basic Question I have a looping calculation that I need to perform on some large lists a very large number of times, and as I have written the functions the computational speed is prohibitively slow. ...
5
votes
1answer
72 views

Random normalised variable generation

I want to generate 8 random variables (in reality to form 4 complex numbers) such that the sum of the 8 variables squared is equal to unity. The aim of generating such numbers is to perform a quantum ...
0
votes
1answer
37 views

How to (efficiently) generate and catch some data-set that has similar correlation?

...
1
vote
1answer
78 views

Infinite potential, prevent value to go beyond zero, initial value problem

How do you make a wall potential in Mathematica. Meaning : I want my potential to have a wall at 0 : $ U(x)=\left\{ \begin{split} & x>0 : U(x) = f(x)\\ &x=0: U(x)=U_0 \\ & x<0: U(x)=...
2
votes
1answer
230 views

Including periodic boundary conditions when drawing box of particles

This is essentially a follow-up question to this older post. Given a configuration of tubes (or for simplicity cylinders), we draw them in a box using Graphics3D, ...
2
votes
0answers
112 views

NDSolve can solve two systems of equations separately but not simultaneously

I want to solve a system of coupled equations. After facing problems solving the coupled system, I reduced it to both of the systems uncoupled. Even uncoupled, the equations will not solve ...

1
2 3 4 5