Skip to main content
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 ...
Henrik Schumacher's user avatar
19 votes
Accepted

Efficiently Mowing Grass with Mathematica

This is just starting ideas for arbitrary regions. Perhaps you can improve it. Version 1 Define concave region with holes, which can be generalizable to arbitrary complexity: ...
Vitaliy Kaurov's user avatar
8 votes
Accepted

Thermodynamics of the 2D Ising model

The energy can be calculated exactly as written in the formula using Sum and correct indices: ...
Domen's user avatar
  • 26.3k
5 votes
Accepted

Parallelized Monte-Carlo

…You're simply in wrong way. The first thing should do is to write code in Mathematica style. I suggest reading the following as a first step: 10 Tips for Writing Fast Mathematica Code If you insist ...
xzczd's user avatar
  • 66.8k
5 votes
Accepted

Graphing curves formed by a rolling polygon

Here is a simplified starting point. We restrict the path to a line, the x axis. And the shape that is rolled on the path to a (not necessarily regular) convex polygon. We start with an arbitrary ...
Daniel Huber's user avatar
  • 52.6k
5 votes

How to model wooden joints with Mathematica's FEM?

We can use method described in my answer here. First we define mesh with a small space between regions as follows ...
Alex Trounev's user avatar
  • 45.1k
4 votes

How to generate a random snowflake?

For couple of years I was thinking that I should post an answer here using the RandomMandala framework. So, finally (after some experimentation) I got reasonable ...
Anton Antonov's user avatar
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 ...
Nasser's user avatar
  • 145k
3 votes
Accepted

How to simulate a directed acyclic graph?

An idea in order to generalize the steps 3 and 4, considering the definition of the weighted graph given by edges and weights: ...
vindobona's user avatar
  • 4,516
3 votes

Gillespie (stochastic simulation) algorithm

It is not complete answer since paclet we try to use has some typos in it (maybe it needs just version update). At first step we compute data using GillespieSSA ...
Alex Trounev's user avatar
  • 45.1k
3 votes

Regarding the interactive operation of a four-bar linkage mechanism

...
miss's user avatar
  • 804
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. ...
creidhne's user avatar
  • 5,225
3 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 (...
Eric Brown's user avatar
  • 4,426
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 ...
lericr's user avatar
  • 29k
2 votes
Accepted

Troubleshooting NDSolveValue::rdelay Error in a Dengue Epidemic Model with Delay Differential Equations in Mathematica

At the time of posting this question, the NDSolve implementation in the latest version of Mathematica (version 14) did not support delay differential equations with ...
Lennert Saerens's user avatar
2 votes

Python code of plot of Fisher KPP equation

...
azerbajdzan's user avatar
  • 18.8k
2 votes

Python code of plot of Fisher KPP equation

May be this will get you started. Given this system \begin{align*} x'(t) &= F(x,y)\\ y'(t) &= G(x,y) \end{align*} The phase plot is drawn using the command ...
Nasser's user avatar
  • 145k
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....
James Stein's user avatar
1 vote

Plot roots of polynomials

Although the question is not entirely clear, I believe that defining dataND as something like ...
bbgodfrey's user avatar
  • 61.6k
1 vote

Integrating Over a Conditional Time-Dependent Region

Although RegionQ[Rotate[Rectangle[{0, 0}, {l, 2}], 3, {0, 0}]] == True but Rotate still not the right way to represent a proper ...
cvgmt's user avatar
  • 75k
1 vote
Accepted

Value of a function over permutations of two lists

You can do the multiplications more efficiently without needing Sum. ...
flinty's user avatar
  • 25.5k

Only top scored, non community-wiki answers of a minimum length are eligible