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.
Questions tagged [simulation]
5194 questions
1
vote
2 answers
Monte carlo simulation - what's wrong?
I want to calculate area under the curve using monte carlo simulation of function
. I want to calculate it on interval [-2, 2]
My work so far
# Define function f
f <- function(x) x^2 + 1
# I want to close my function in rectangle (-2, 2) - x axis…

Lucian
- 351
- 2
- 10
1
vote
1 answer
I'm trying to make conway game of life but something happening
edit: i made a huge mistake in the qeustion don't bother trying to help.
I'm trying but when ever run the code, I get a window that I can draw on but when i run (which i set the button to key pad enter) the simulation, it get rid of all the…

pawnadona
- 21
- 3
1
vote
1 answer
How to assign alternative values to a variable relative to another variable in Ox (a bit similar to C++)
I was simulating some data with Ox (syntax similar to C, C++ and Java) and I was stuck in my assignation part. Let's say, I have this function simulating my data, g_mY:
decl g_mX, g_mY;
simuldata(const ct) // ct : number of observations
{ …

Tande
- 31
- 5
1
vote
0 answers
Problem Plot: Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ
Good morning, I have a problem plotting. In the last 10 lines of the syntax I try to create a plot for the bias but I get the following error: "Error in xy.coords (x, y, xlabel, ylabel, log): 'x' and 'y' lengths differ" It seems that there is an…
1
vote
1 answer
Collision Of Balls Code Isn't Working, Balls Sticking Together
So I am trying to create a code that will correctly show the elastic collision of two balls of different masses. The code works if I give the balls equal masses but does not work for different masses. I have tried messing around with a ton of stuff…

Corey D
- 11
- 3
1
vote
1 answer
How to program a complex set of interrelations?
First, I'm sorry about the title, that was the best I could come up with.
What I mean is something like, a program that tells me that when A goes up, B goes down, which makes C go up, which increases the likelihood that D and E will go down, sending…

San Diago
- 1,030
- 1
- 12
- 26
1
vote
0 answers
Openmodelica simulation of large model with OPC client connection crashes
I am using OpenModelica 1.18.0~dev-259-g9ebba11 on Ubuntu 20.04.2 LTS 64bit and have developed a fluid system model that throws errors when simulating with the flags -embeddedServer=opc-ua -rt=0.1. Even though startup of the embedded opc server,…

Briant
- 31
- 4
1
vote
0 answers
number of items to replace is not a multiple of , MonteCarlo Stochastic Process R error
##
set.seed(123)
SimpleEulerApproximation = function(T,x,a,b,delta){
numberofSteps = T/delta;
TimeSteps = rep(numberofSteps,1);
Y = rep(numberofSteps,1)
Y[1] = x;
for (i in 1:numberofSteps){
TimeSteps[i] = 0 + i*delta;
}
for (j in…

Kushal Kharel
- 11
- 2
1
vote
2 answers
Anylogic, how to setup a button so it would restart the simulation
Good day,
Currently, there are 6 edit boxes, which are connected to specific parameters in the model (and the user can edit these boxes in the model runtime) and a button that doesn't do anything. I want to make this button to restart the…

ProjectAvatar
- 55
- 4
1
vote
1 answer
How to get normal probability distribution from a simulation on car agains car?
I want to understand why I am not getting a probability distribution when I use a simulation from a random normal distribution:
library(tidyverse)
df <- mtcars # data
df$sd <- sd(df$mpg) # standard deviation of the sample
set.seed(123)
f <-…

Pastor Soto
- 336
- 2
- 14
1
vote
1 answer
Assign priority to 50% agents in anylogic
I want to assign priority to my agents and then queue them based on that. I have an agent Container which has two parameters carrier (which can be either Truck or Train) & priority (which is to be assigned with some value). 50% of agents where…
1
vote
1 answer
How to determine the optimal capacity for Quadtree subdivision?
I've created a flocking simulation using Boid's algorithm and have integrated a quadtree for optimization. Boids are inserted into the quadtree if the quadtree has not yet met its boid capacity. If the quadtree has met its capacity, it will…

Michael Moreno
- 947
- 1
- 7
- 24
1
vote
1 answer
Log the selected resource in Simmer for R
I'm trying to create a simulation model that describes traffic near the motorway gates.
I have added the resources
motorwayGate <-
simmer("motorwayGate") %>%
add_resource("counterCards", 1) %>%
add_resource("counterCash1", 1) %>%
…

igy234
- 59
- 1
- 7
1
vote
1 answer
Simulate data with correlations to multiple other vectors
I am trying to simulate a vector that is correlated to a few other vectors. I figured out the code for simulating a vector correlated to one other vector, but can't figure out how to simulate it with correlations to multiple other vectors:
Here is…

Cae.rich
- 171
- 7
1
vote
1 answer
How can i make my randomly moving object move in a specific angle in pygame
Full Code
self.VEL = 3
self.RAND = numpy.linspace(-self.VEL, +self.VEL, 100) # calculating value between -2 and 2, a total of 100 values
-----------------------------------------
if self.new_line:
self.deltax = random.choice(self.RAND)
…

salzig1
- 27
- 3