Questions tagged [simulation]

Simulation is the imitation of some real thing, state of affairs, or process. The act of simulating something generally entails representing certain key characteristics or behaviours of a selected physical or abstract system.

Filter by
Sorted by
Tagged with
0 votes
1 answer
41 views

Temperature of a Lennard-Jones system

Are the formulas used in getTemperature() and setTemperature() correct? ...
user366312's user avatar
1 vote
2 answers
138 views

Minimalistic implementation of Leapfrog integration algorithm (2)

Please review this C++ listing of an implementation of Leapfrog integration. This C++ listing is rewritten according to this review. ...
user366312's user avatar
1 vote
1 answer
44 views

Counting number of time frames in a simulation trajectory file

I have written a function in c++, which accepts an "ifstream" object (file) to read from and a string to match a header token in the file. This way I am counting how many times a token ...
Syed Shuja Zaidi P19PH007's user avatar
1 vote
1 answer
61 views

Flowers in the Window: An Exercise in Using Classes and Objects in Rust

The Problem As part of my doomed efforts to learn Rust, I decided to get to grips with how the language handles classes and objects. But, instead of taking on some well-known exercise, I thought it ...
Tom Hosker's user avatar
1 vote
1 answer
61 views

Molecular Simulation: PBC using the Ewald Summation technique

The following is a Rust implementation of polymer simulation where the PBC(periodic boundary condition) has been implemented using the Ewald Summation technique. Can you review the code? Is the PBC ...
user366312's user avatar
6 votes
2 answers
796 views

Molecular simulation: Minimum Image Convention

Can you review the following code to check to see if the Minimum Image Convention is properly implemented? ...
user366312's user avatar
0 votes
0 answers
84 views

Simulation: Find a waiting queue order that minimizes the total waiting time - Java

Intro Suppose we are given a queue of waiting times \$\langle t_1, \ldots, t_n\rangle\$. The first "person" \$(t_1)\$ leaves the queue immediately. The persons \$(t_i), i > 1\$ all have ...
coderodde's user avatar
  • 27k
0 votes
1 answer
122 views

Python Logic Gate Circuit Simulator [closed]

I have recently become interested in simulating logic circuits because of a electronics class at school. I have created a functioning simulator for logic gate circuits in Python. My implementation ...
turt1edman's user avatar
6 votes
2 answers
150 views

Means square displacement (MSD)

I have written a code to calculate the MSD of some molecules. The code averages over multiple time origins (sliding time window) and over all the molecules. I have also made it do one extra thing: do ...
mjksho's user avatar
  • 61
2 votes
1 answer
116 views

Simulation of a real capacitor to calculate its capacitance

The goal is to simulate a real flat plate capacitor in 2D. The potential of the armature is fixed to +V and -V, on the edges of the simulation cell the potential is zero. Between the plates of the ...
Pietro Scapolo's user avatar
2 votes
1 answer
63 views

Smoothed Particle Hydrodynamics in Rust

So I'm simultaneously learning both Rust and Smoothed Particle Hydrodynamics. I've been using this video from AMD as a reference and the provided smoothing kernels. At this stage, I've not optimised ...
ScottishTapWater's user avatar
0 votes
0 answers
63 views

Bruteforce proof of an arithmetic expansion scheme expression in array lists (Java)

Given a list of, say, integers, one way to implement such a list is to rely on an array under the hood. When we are adding elements to the array list, we might need to make the internal array larger. ...
coderodde's user avatar
  • 27k
1 vote
1 answer
186 views

Simulating a toilet seat usage in Java - follow-up

(See the previous iteration.) This time, I removed the stuff I don't need in my demo runner. Also, I consolidated some code that seemed DRY to me. Simulation rules When a female arrives, she ensures ...
coderodde's user avatar
  • 27k
2 votes
2 answers
121 views

Simulating a toilet seat usage in Java

(See also the next iteration.) I have this small simulation program simulating a toilet seat. The toilet seat may be in two positions: up or down. If a male arrives to the toilet to urinate, and ...
coderodde's user avatar
  • 27k
3 votes
1 answer
63 views

I made a webpage that simulates sharks eating fish in the torrid world of Wa-tor

I've been self-studying HTML/CSS/JS. I read about Wa-tor. It's a population dynamics simulation which simulates fish and sharks breeding and predating. This seemed cool so I decided to implement it....
Jeff's user avatar
  • 33
4 votes
2 answers
676 views

Traffic simulation GUI: an exercise in concurrent programming using threads

To avoid a code dump I have removed most of the code and left the first few lines of constructors and methods and anything relevant. Full code at the bottom. The purpose of this code is to use threads ...
Corey Hodges's user avatar
11 votes
3 answers
498 views

Membrane protein diffusion in different confinement models

I am a junior Software Engineer, C++ is usually my main jam but I started picking up Python for a research project I am doing in college. I am eager to learn as much Python syntax, tricks, best ...
hexaquark's user avatar
  • 213
2 votes
1 answer
255 views

Simulation of sand particle collision

I am making a module that allows you to create sand and simulate it. I have successfully done this, but it runs very slowly. I need this to be able to simulate at least 1000 particles, at a fps higher ...
susthebus's user avatar
2 votes
1 answer
132 views

plotting Monte Carlo Simulation from excel sheet

I have created the following code: Option Explicit ...
user avatar
2 votes
1 answer
69 views

Estimate an average duration of every game state in a football match given implied goals for home and away teams

What my program does I'm trying to estimate for how many minutes in average a football(soccer) match will be in different game states depending on implied goals of both teams. Problem domain For our ...
Konstantin Kostanzhoglo's user avatar
7 votes
2 answers
589 views

Dice league, putting players against each other

I've got this code: ...
Nils Edström's user avatar
3 votes
0 answers
68 views

Finds a moving target within a given space

https://youtu.be/XEt09iK8IXs?t=1264 Ben Awad did a mock interview with a React developer, and asked this question. There are a set of 100 holes (0-99). A rabbit is located in one of these holes. Every ...
Stephen Williams's user avatar
8 votes
2 answers
171 views

Frozen yogurt shop simulator

I made this project that simulates a frozen yogurt shop, where you can pick your flavor, toppings, and sauces and then pay for it. I'm a beginner at python and this is my first project. I don't even ...
Nadia's user avatar
  • 81
2 votes
1 answer
177 views

Heston model implementation in C++

I have implemented an option pricing algorithm following the Heston model. The simulation involves specifying the number of simulations, then generating a discretized path for each simulation (code ...
MattA's user avatar
  • 23
2 votes
1 answer
268 views

Electronic circuit logic gates simulator

I've seen a lot of C++ simulators implementing logic gates, but absolutely all of them use the wrapped bitwise operations of the programming language itself. I have tried to omit the use of a bitwise ...
LXSoft's user avatar
  • 155
8 votes
1 answer
596 views

Python implementation of a Galton board simulation

I watched a YouTube show the other day in which a variant of a Galton board is used to make a random selection from a range of movies that will be reviewed in that show. In contrast to a standard ...
Schmuddi's user avatar
  • 487
5 votes
4 answers
2k views

Coin flip streaks in Python

Below is the wording from the problem in Automate the Boring Stuff book. The bold text leads me to believe that I should be checking for a streak and not multiple streaks within each experiment of 100 ...
a-rizzo's user avatar
  • 51
3 votes
1 answer
206 views

Percolation threshold simulation using C++

I am studying Algorithms by Princeton University. The first week assignment is to simulate percolation by using Java. https://coursera.cs.princeton.edu/algs4/assignments/percolation/specification.php ...
yip's user avatar
  • 135
10 votes
1 answer
897 views

High performance physics simulation - core class design

Below is some stripped down code from a physics simulation. The classes Vector2, Line and ...
Oliver Schönrock's user avatar
3 votes
1 answer
326 views

Barnes-Hut \$n\$-body simulation (3D) in C++

I have implemented the Barnes-Hut algorithm for \$n\$-body-simulations (in this case "sort-of" 3D-gravity - see below). I'd appreciate any comments for improving my code (especially ...
Paul Aner's user avatar
  • 131
6 votes
1 answer
421 views

Plants vs. Zombies simulator

I am making a pvz simulator. We have a game board with 1 = peashooter and 2 = zombie: ...
Alan Bagel's user avatar
2 votes
1 answer
326 views

Robotic swarm simulation: aggregation

This program simulates the phenomenon of aggregation of a swarm of robots with no cooperation between each other and each robot following a very simple rule: The velocity of this robot has a random ...
Caridorc's user avatar
  • 27.4k
1 vote
1 answer
246 views

Conway's Game of Life in C++ with a Board Struct

I made the game of Life in C++ for a highschool class project. The website we're using doesn't have an autograder for C++, and my programming teacher doesn't really know how to program... so I'd love ...
digital_drako's user avatar
5 votes
1 answer
585 views

Monte-carlo simulation code - simple exercise

I created a quick monte-carlo simulation which seems to do what I want (simple version below). The code basically simulates a Poisson distribution, say this results in a simulation of ...
lmkir99's user avatar
  • 53
4 votes
1 answer
296 views

Path of a particle in a non-uniform B field

I have completed my project which simulates the path of a particle trapped in a device known as a magnetic mirror. I would like your thoughts and improvements on my implementation. Here is the code: <...
Dila's user avatar
  • 215
1 vote
1 answer
88 views

Quickly update, clone, and iterate ball simulation

What the program does: I have made a program that simulates a ball in an area made of triangles and many optimizations because it's for high-performance ball path simulation (technically ball path ...
VirxEC's user avatar
  • 207
5 votes
1 answer
108 views

The python code simulates an environment of a disease and calculates how many people get infected

The python code simulates an environment of an X number of persons with an Y number of places they can go to, puts the persons randomly in the places and calculates how many persons get infected, die ...
R0Best's user avatar
  • 75
1 vote
0 answers
599 views

Solving the Knapsack Problem With a Genetic Algorithm Simulation in Python

I was watching Computerphile's video on using genetic algorithms to solve the Knapsack problem, and I decided to give it a whack. For anyone running the code, the ...
Jose Fernando Lopez Fernandez's user avatar
3 votes
1 answer
86 views

Simulating disease spread in a population

I am trying to build a model that allows me to estimate the spread of disease in the population. The setup is similar to the SIR model, with the difference that this model includes the stochastic ...
KLMK's user avatar
  • 31
6 votes
4 answers
785 views

Monty Hall simulation - OOP

I mainly write code for data analysis so don't think about or use OOP at all on the day job. I thought I'd have a go at a simple Monty Hall simulation in an object-oriented style to figure out how it ...
henryn's user avatar
  • 163
4 votes
2 answers
108 views

Simulate transmission spectrum of extreme ultraviolet laser pulse through laser-dressed finite sample (Python Version)

I am currently participating in research on transient absorption spectroscopy and four wave mixing. In the experimental design, an extreme ultraviolet (XUV) laser pulse and infrared (IR) laser pulse ...
Matt Bowman's user avatar
3 votes
0 answers
34 views

MatLab: Plotting Output Electric Field Spectrum

Goal This code combines two matrices, diagonalizes that matrix, and finds the right and left eigenvectors, right and left eigenvectors are normalized with respect to each other, then it is multiplied ...
Mate's user avatar
  • 31
5 votes
1 answer
49 views

Simulate transmission spectrum of extreme ultraviolet laser pulse through laser-dressed finite sample (MATLAB version)

I am currently participating in research on transient absorption spectroscopy and four wave mixing. In the experimental design, an extreme ultraviolet (XUV) laser pulse and infrared (IR) laser pulse ...
Matt Bowman's user avatar
1 vote
1 answer
1k views

C# Coffee Machine

I saw this post and tried to do my attempt. This is the requirement of task: Design a coffee machine which makes different beverages based on set ingredients. The initialization of the recipes for ...
Learner's user avatar
  • 143
4 votes
1 answer
65 views

Finding number of possible arrangements of books on a shelf with a Monte-Carlo approach

The Problem I am trying to determine numerically how many possible ways a number of books can be arranged on a shelf. Specifically, there are x3 categories "physics", "sci-fi", and ...
teeeeee's user avatar
  • 141
4 votes
1 answer
204 views

Python Genetic Algorithm Implementation

I've made this to pick the LQR parameters for my self balancing robots simulation. So to break down what I have done, Randomly Create Population I create a random population. The population is a list ...
AfiJaabb's user avatar
  • 141
10 votes
1 answer
265 views

From Hummingbirds to Ornithopters: Simulating the Aerodynamics of Flapping Wings

Ptera Software A Flapping Wing Aerodynamics Simulator Written in Python Motivation About a year ago, I became fascinated by how animals fly. As an aerospace engineering student, it surprised me that ...
wingedNorthropi's user avatar
3 votes
1 answer
211 views

Discrete event simulation framework for discrete times in Julia

I would like to receive constructive feedback on my simulation framework (this is for my thesis work). I have no formal background in programming, and I am wondering if there is a more effective and ...
manuka's user avatar
  • 31
2 votes
1 answer
71 views

Improving performance for social network simulation program

I'm an undergraduate student with little to no experience in formal computer science or coding, and I specialise in quantitative social science research. Our professor asked us to fabricate some ...
C. Babbage's user avatar
1 vote
1 answer
45 views

Optimize narrow phase contact detection for phyiscs simulation code

I'm trying to optimize the narrow phase of the contact detection in my code. I'm using OpenMP for multithreading. That is the starting code: ...
David's user avatar
  • 111

1
2 3 4 5
8