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.

5194 questions
9
votes
10 answers

All things equal what is the fastest way to output data to disk in C++?

I am running simulation code that is largely bound by CPU speed. I am not interested in pushing data in/out to a user interface, simply saving it to disk as it is computed. What would be the fastest solution that would reduce overhead? iostreams?…
mindless.panda
  • 4,014
  • 4
  • 35
  • 57
9
votes
7 answers

Simulation of molecular dynamics in Python

I am searching for a python package that I can use to simulate molecular dynamics in non-equilibrium situations. I need a setup that can handle a fairly large number of molecules in a primarily kinetic theory manner, and that can handle having solid…
Elliot
  • 5,211
  • 10
  • 42
  • 70
9
votes
2 answers

Algorithm for partially filling a polygonal mesh

Overview: I have a simple plastic sandbox represented by a 3D polygonal mesh. I need to be able to determine the water level after pouring a specific amount of water into the sandbox. The water is distributed evenly from above when poured No fluid…
Chau
  • 5,540
  • 9
  • 65
  • 95
9
votes
2 answers

How to use multicores in OCaml to do Monte Carlo simulations?

OCaml process can use just one core and in order to use multiple cores I have to run several processes. Are there any OCaml frameworks to use to parallelize Monte Carlo simulations?
Alfa07
  • 3,314
  • 3
  • 26
  • 39
9
votes
3 answers

What is a good pattern for storing implementations of an interface and retrieving specific implementations?

I am writing a simulator that has several interfaces which all simulated objects implement. The Entity interface has methods that all objects must have, such as ID retrieval and advancing the time step for the object's state. Collidable extends…
derefed
  • 679
  • 5
  • 17
8
votes
2 answers

Editing/Updating Graphs in Haskell

I'm using a Data.Graph Graph to model a simulation in Haskell. The simulation is limited to a 2D grid which my graph models. A node at each point on the grid below will contain a Maybe Molecule type so there could be a molecule present or just…
mikeyP
  • 237
  • 1
  • 2
  • 8
8
votes
0 answers

How to simulate a bluetooth mouse programmatically

we have seen bluetooth/wireless mouses/keyboards which can do the same as wired counterparts. i have an idea of writing an app to simulate the same functionality using a bluetooth device such as a mobile phone because there should be a way that…
Keshan
  • 14,251
  • 10
  • 48
  • 72
8
votes
6 answers

Reversing Lists Splices Python Optimization (USACO February 2020 Bronze Question 3 "Swapity Swap")

I am trying to solve a problem that involves reversing list splices, and I am having trouble with the time limit for a test case,, which is 4 seconds. The question: Farmer John's N cows (1≤N≤100) are standing in a line. The ith cow from the left has…
CoderTang
  • 460
  • 5
  • 14
8
votes
2 answers

create random points inside a shape in r

I'm trying to simulate some data for a project, and basically I need to draw an irregular oval-ish shape, then make a bunch of random points inside that shape, and I'm at a total loss for how to do this. For now, I've made a spline shape, then…
Jake L
  • 987
  • 9
  • 21
8
votes
9 answers

Run my application in a simulated low memory, slow CPU environment

I want to stress-test my application this way, because it seems to be failing in some very old client machines. At first I read a bit about QEmu and thought about hardware emulation, but it seems a long shot. I asked at superuser, but didn't get…
dario_ramos
  • 7,118
  • 9
  • 61
  • 108
8
votes
4 answers

How should I program a simulation of physics?

I am trying to create a Java package that can be used to write simulation programs. My goal is to create 'objects' like springs or solid objects like cubes and spheres. They will have mass, velocity, gravity etc. and they can interact with each…
Mahendra Chouhan
  • 91
  • 1
  • 1
  • 2
8
votes
2 answers

Using Blender for physics simulations

I've been looking at different ways of creating a certain physics simulation. What I am trying to do is to 3D model the motion of a body under the effects of various forces over time. I was originally looking at coding something in c++ using a…
Anon
  • 5,103
  • 11
  • 45
  • 58
8
votes
3 answers

CONNECT BY or hierarchical queries in RDBMS other than Oracle

Oracle ships with a very handy feature. You can create hierarchical queries (recursive behaviour) using the following clause: CONNECT BY [NOCYCLE] {condition [AND condition...]} [START WITH condition] As documented…
Lukas Eder
  • 211,314
  • 129
  • 689
  • 1,509
8
votes
4 answers

Flocking boids behaviour problem

Yesterday I came across Craig Reynolds' Boids, and subsequently figured that I'd give implementing a simple 2D version in Java a go. I've put together a fairly basic setup based closely on Conrad Parker's notes. However, I'm getting some rather…
Iskar Jarak
  • 5,136
  • 4
  • 38
  • 60
8
votes
3 answers

Efficiently compute n-body gravitation in python

I am trying to compute the accelerations due to gravity for an n-body problem in 3-space (I'm using symplectic Euler). I have position and velocity vectors for each time step, and am using the below (working) code to calculate accelerations and…