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
1
vote
0answers
78 views

How can I solve the 2D diffusion equation over a region that contains mobile sinks?

I am looking for guidance on how to simulate the following system in 2D. I have a region, assumed to be rectangular for simplicity. A substance is diffusing into this region from its boundary. Again ...
0
votes
0answers
53 views

Numerically Solving Fourth Order PDE with Boundary Condition at Infinity

I am trying to numerically simulate (using NDSolve) the following differential equation with the following boundary conditions: $$\partial_x^2\psi +c\partial_x^4\psi - b(a\psi + \psi^4)= \lambda\...
0
votes
2answers
63 views

Antithetic Variates in Monte-Carlo simulations (code taking too long to execute)

I am trying to use the Antithetic Variates method to reduce error in stock price estimates. Essentially, I generate pairs of negatively correlated RV's and use them to simulate stock price. The ...
1
vote
0answers
206 views

Fokker-Planck equation [closed]

Is there any package for simulation of Fokker-Planck equation in Mathematica? Or, in general for stochastic differential equations?
0
votes
1answer
36 views

How can I get the compensated compound Poisson process in Mathematica

Let us consider the following martingale "compensated compound Poisson process" $M_t=\sum_{k=1}^{N_t} Z_k-\lambda t E(Z)$ where $N_t$ is a Poisson process with intensity $\lambda$, $Z_k$ is ...
0
votes
1answer
67 views

Simulating electrons passing through a beam splitter for random number generation

I would like to write a program that would simulate the trajectory of an electron/photon passing through a 50-50% beam splitter and depending on which detector the particle is measured, it would ...
0
votes
1answer
77 views

NDSolve not finding the right solution for a mass hanging of a thread

My NDSolve isn't predicting the right trajectory for one particular case of a problem. System Consider a mass vertically hanging by an almost inelastic thread. The ...
1
vote
1answer
112 views

Too slow using Dsolve

I am referring to the accepted answer to the question: Solving n simultaneous differential equation The issue is that the code is running too slow for even N=5! Is there any way to make it faster? I ...
1
vote
1answer
52 views

Trying to make the animation showing the process of integration using Wolfram Mathematica

I'm pretty new here, I'm trying to make a animation of integration in Wolfram Mathematica, but it's getting me a headache I really don't know how to do this. The point is to ilustrate the process of ...
1
vote
1answer
81 views

Simulate spring wire through fixed points

Suppose we have a wire made of an ideal spring steel. If we bend it and then release any external force it will straighten itself into a perfect line. Suppose also that the wire is attached to some ...
1
vote
2answers
69 views

How to find estimators of unknown parameter of a distribution using method of least square estimation

I had defined pdf of distribution, generate data and specify the least square function.I am not aware of the code for finding estimators and bias of this distribution using method of least square ...
0
votes
2answers
65 views

Building up functions from data sheet

I'm trying to use a list of data points from a csv file to perform multiple calculations and plot the end result. Basically I have 3 columns of data in my csv, I need the second and third to be pulled ...
7
votes
2answers
236 views

How to add an attractive potential (migration term) named component to Mass Transport PDE

Wolfram Mathematica 12.2 now features "Named Partial Differential Equation Terms" For specific physics fields, relevant PDE terms have been packaged as components and augmented with ...
4
votes
1answer
129 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
67 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 ...
8
votes
0answers
162 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
366 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
165 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
85 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
131 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
93 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
59 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
101 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
56 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
146 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
102 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
233 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
551 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
60 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
57 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
41 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
21 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
394 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
66 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
93 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
335 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 ...
3
votes
2answers
175 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
114 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
54 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
53 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
51 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
293 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
141 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
278 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
545 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
163 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 <...
2
votes
1answer
356 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
2 3 4 5