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.

26 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
10
votes
0answers
174 views

Population dynamic simulation on biological information maintenance 2

This question is the follow-up to this previous question. Background Using this simulation I investigate a system in which enzymes proliferate in cells. During the replications of enzymes, ...
4
votes
0answers
144 views

Fast Hardy-Weinberg equilibrium simulation

I was very bored over one of my breaks this year, so I built a Hardy-Weinberg equilibrium simulator for two unrelated alleles of the same gene. Hardy-Weinberg equilibrium is when there is no evolution,...
4
votes
0answers
476 views

Customizable Multi-Agent Predator/Prey Simulation

I am trying to create a highly customizable "battle simulator". The default setup is a predator/prey relationship (no births); however, I am trying to create code such that it's easy to add and ...
4
votes
0answers
2k views

Monte Carlo simulation to price an Option in Python

In what ways can I make this code more efficient? I haven't put in comments and descriptions yet. I need to do that. Ideally, I'd like to make the S, v, r, and K user entered as I did with T. I'm ...
4
votes
0answers
2k views

Satellite orbit simulation in Matlab using Runge Kutta 4

I have a satellite orbit simulation in Matlab (Using Runge Kutta 4). It seems ugly and I don't know how to fix it. fx.m file: function v = fx(t,x,vx) v = vx; ...
4
votes
0answers
553 views

Speed up a monte carlo simulation with nested loop

I would like to know if there is a more efficiency way to speed up below code. It uses a procedure where subsampling is required in the nested loop (which a previous answer helped to make more ...
3
votes
0answers
55 views

Animation of an incremental rotary encoder

While reworking my teaching materials for an exercise of an introductory course on mobile robotics, I recently created a animation/simulation of an incremental rotary encoder, e.g. often used for ...
3
votes
0answers
146 views

Designing a configurable Discrete Event Simulation class

A bit of context: I've had a fair share of programming in Java but want to refine my C++ skills with a college task. I've wanted to focus on C++11 and C++14, as they are recent but not latest, and C++...
3
votes
0answers
689 views

A Java library for simulating logic circuits

I have this Java library for building logic circuits and running binary data through them: AbstractCircuitComponent.java ...
2
votes
0answers
14 views

Simulation of splitting particles (MATLAB - Fortran)

I'm trying to write a code where a charged particle (charge=+20 called dimers), after a certain time, will split into a neutral particle and a smaller charged particle (charge=-10 called monomer). I ...
2
votes
1answer
103 views

Filling up a hand with random cards that are not yet drawn - Monte Carlo

I would like to know if there is a more efficient way to speed up below code. This function is meant to fill in a set of poker hand with the remaining cards using Mersenne Twister for a Monte Carlo ...
2
votes
0answers
55 views

Excel VBA animation runs slowly after editing worksheet

My VBA macro displays an animation based on a row-by-row time step simulation in the worksheet. The user enters the desired inputs and the worksheet calculates the evolution of the simulation in a ...
2
votes
0answers
54 views

Work environment simulator

This code attempts to solve a suggested challenge by myself a while back on meta, transcribed here for simplicity. Allocate resources efficiently on a work environment The company Code42Review ...
2
votes
0answers
518 views

Lotto simulator in Python

I wrote a rather inapt lotto simulator in Python, showing how long it would take to win the jackpot. I ran a similar application implemented in C and it is so much faster. I know you can't compare the ...
2
votes
0answers
483 views

Routing simulation (Distance vector)

I am trying to write simulation for routing algorithm by distance vector. I will explain my class and how it works a bit, and then, introduce three main issues I encouter. Important to mention that ...
2
votes
0answers
112 views

Sorting overlapping shells in dynamical simulation - for loops vs array methods

I didn't know whether it was best to start with the general task I'm trying to solve, or the meat of the programming problem. They're both below but the former is rather long and solving the latter ...
2
votes
0answers
78 views

Simulation of reflected particles

I made a particle simulation in vanilla JavaScript. It can currently handle around 10000 particles (staying 58-60 fps on my machine). For testing, controls are MB1, MB2, R, Z. How can I make this ...
2
votes
0answers
291 views

Comparing three packet routing algorithms via simulation in Java

Inspired by my question Simulating a random packet routing algorithm and printing packet statistics in Java I decided to implement two more packet routing algorithms: one that computes all the ...
2
votes
0answers
384 views

Physical simulation of diffusion-limited aggregates

The following code generates Diffusion Limited Aggregates on a two-dimensional square lattice. Some of the code has been omitted (e.g. support for differing lattice types and dimensions) for code-...
2
votes
0answers
429 views

PHP Lottery Simulator

I have a lottery simulator on my website that simulates you playing the lottery every week until your death and tells you how much you would have won or lost. It can take a custom number of balls and ...
1
vote
0answers
66 views

Blackjack simulator for Probability of a dealer bust for each starting card

I came up with this solution to another exercise out of John Zelle's Programming book. ...
1
vote
0answers
32 views

Moderate return-low risk vs high returns-high risk investments

To quantify Buffet's #1 rule of investing, "Don't lose money", I take the assumption that % returns of an investment follow a Normal distribution. Now a high return high risk investment might follow ...
1
vote
0answers
2k views

Barrier Option Pricing using Python

This is my implementation of pricing an exotic option (in this case an up-and-in barrier option) using the Monte Carlo simulation in Python. I use NumPy where I can. Any ideas to optimize this code? <...
1
vote
0answers
41 views

Spatial parametric scaling in agent-based model

I’m running a simple agent-based disease spread model on a 2D lattice, where disease transmission in a population depends on each individual’s chance of avoiding infection at every time step, which ...
1
vote
0answers
2k views

DP algorithm to find minimum average wait for customer-serving system

Below is the code to find the minimum average waiting time for customers at a store. I want improve the time complexity of the code. As an overview of the logic, I start from ...
1
vote
0answers
201 views

Template container simulating SQL “select” and “where”

I want to simulate, in C++, the fact that in a form with drop down (or combo boxes), you can filter by selecting items and then projecting on a given set of properties for these item. In a SQL-like ...