21
votes
Gravitation simulation and interaction of N (1000) massive objects
And I was somewhat lying in wait for this kind of question...
In I have been working on Barnes-Hut-like code for the so-called tangent-point energies in the last couple of years. This is a family of ...
7
votes
Accepted
Thermodynamics of the 2D Ising model
The energy can be calculated exactly as written in the formula using Sum and correct indices:
...
5
votes
Colored plot with Wolfram Mathematica
The option Filling can color the space between plotted lines (see documentation). In your case, where lines do not intersect, it is easier to stack the plots inside ...
4
votes
Accepted
Simulating the Conduction of Heat on a Metal Rod
This is basic animation using Manipulate. This can be solved analytically by Mathematica. Once you obtain the analytical solution then Manipulate is used to replace $f(x),L,k$ by any other values ...
4
votes
Gross-Pitaevskii equation with NDSolve
You can run this with FEM, but it will take a bit of time:
...
3
votes
Accepted
Simulating a discrete time stochastic process
You can make use of RandomChoice and NestList. Since $\tau_{t+1}$ may depend not only on $\tau_t$ but also on $\tau_{t-1}$, I ...
3
votes
Accepted
Need an equation for modeling Tytler's Cycle
The Logistic Equation is used as a model of population growth, but it may be useful for your simulation. This single equation can simulate dad as he ages and tires, and the decline in the third stage.
...
2
votes
Simulating the card game War with $m$ suits and $n$ values
This isn't so much an answer as pedagogy.
The main reason you can't get your commenceWarCardGame to work is because most of the code in that block isn't part of the ...
2
votes
Solving Differential Equation System for HIV Treatment Model
Cesario's answer is almost there, but I'd like to add a couple points of correction/improvement.
The problem formulation has constraints on the control (...
1
vote
Accepted
Simulating the card game War with $m$ suits and $n$ values
Here is a link to some code I wrote to simulate the game.
No guarantees.
FWIW, it shows a tally of lengths of games for various shuffled decks.
Some of these lead to games without ends.
https://www....
1
vote
Evaluating an integral of geometric Brownian motion
You are not replacing P correctly because you are forgeting the "time" argument. Namely, ...
1
vote
FEM Capacitor Not Converging with Parallel Plate Model
When modeling capacitors, there are a few things that need to be considered. First, one must decide whether to model the volume and the dielectric region or just the dielectric.
By using the first ...
1
vote
Accepted
FEM Capacitor Not Converging with Parallel Plate Model
In the parallel plate capacitor one plate has a positive electric charge $+q$, and another plate has a negative electric charge $-q$, therefore the total electric charge is zero. To avoid this zero ...
1
vote
Table generation with random variates inside. Mathematica
I would simply make your table explicit, like this:
...
1
vote
Optimizing Code N-Body Simulation
Here is a simulation to get you going using the gravitation law without changes. I am using a very simple integration scheme, that fails if the bodies come too close. You may improve this if you like.
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
simulation × 274random × 50
differential-equations × 49
physics × 37
plotting × 27
probability-or-statistics × 26
performance-tuning × 19
animation × 17
list-manipulation × 12
programming × 12
finite-element-method × 12
graphics × 11
numerical-integration × 11
modeling × 11
equation-solving × 10
stochastic-calculus × 10
astronomy × 9
graphics3d × 8
manipulate × 8
distributions × 7
numerics × 6
control-systems × 6
functions × 5
code-request × 5
matrix × 4