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
1answer
108 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
46 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
62 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
63 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
64 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 ...
6
votes
2answers
206 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
126 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
65 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
158 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
361 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
161 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
82 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
124 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
86 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
49 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
99 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
49 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
123 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
91 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
231 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
528 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
58 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
49 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
19 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
346 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
63 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
88 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
275 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
157 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
111 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
51 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
47 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
50 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
273 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
137 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
267 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
487 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
158 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
349 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
74 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
193 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
367 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
435 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
138 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
480 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 ...

1
2 3 4 5