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
1 answer
Minimum probability in R
I am trying to find the minimum number of people with a sampled birthday in r of 0.9 (90%)
I am trying to do this through sampling and two for loops:
my expected results are around 300 people I think
bus = 2
#start person count at 2
count = 0
#…

pip
- 11
- 1
1
vote
1 answer
Monte carlo area of a circle
is it possible to use Monte carlo to compute the area of circle with a radius bigger than 1?
i tried to make it this way but it only work for a circle of radius 1.
N = 10000
incircle = 0
count = 0
while (count

Rasule
- 19
- 1
- 6
1
vote
4 answers
Having trouble solving simulation
I got a question related to probability theory and I tried to solve it by simulating it in R. However, I ran into a problem as the while loop does not seem to break.
The question is asking: How many people are needed such that there is at least a…

Wei
- 131
- 1
- 8
1
vote
2 answers
Simulating Multple Entries and Exits in a Vehicle Car Park in Java with Multi Threading
I have currently created classes such as CarPark, and Floor to represent the car park. I have used an ArrayList of the Floor class to show multiple levels in the car park.
I want to have multiple entries and exits on different floors, equipped with…

Imperial_J
- 306
- 1
- 7
- 23
1
vote
1 answer
Heat diffusion a ring with a temperature activated flame using deSolve::ode in R
I'm trying to model a ring that is heated at one point if the temperature goes below a certain value. Here's my R code:
library(deSolve)
library(dplyr)
library(ggplot2)
library(tidyr)
local({
heatT <- 100
v <- c(rep(1, 49), heatT, rep(1,…

Bakaburg
- 3,165
- 4
- 32
- 64
1
vote
0 answers
Is there a correction I can apply to negative values within a probability matrix produced by matexpo {ape}?
I'm simulating discrete character data using the function rTraitDisc {ape} in R using a variety of model matrices. I've not encountered any issues with scaling when all state changes are possible. However when I supply an ordered model with 8 or…

SmithOfToms
- 11
- 2
1
vote
1 answer
How to plot a cumulative sum (running total) of a turtles-own variable in Netlogo?
I can plot the sum of worms per animal using the code below (visualized in Figure 1).
plot sum [worm-number] of animals
Figure 1.
I want my graph to be cumulative however like Figure 2 but I don't know how to code this. Previous examples use older…

tonysdatamodels
- 31
- 6
1
vote
1 answer
Initialize vector using the ifelse function in R
I'm trying to run the next algorithm in R:
simulation <- function(n){
f <- function(x){.7*h(x)+.3*g(x)}
x <- vector("numeric", 2)
w <- vector("numeric", 2)
x0 <- c(3,3)
for(i in 0:n){
ifelse(i==0,w<-x0,w<-x) //After this line w=(3,3)…

Sofía Contreras
- 259
- 2
- 7
1
vote
0 answers
How to save multiple arrays as columns in a DataFrame in Python
I'm very new to Python and need help with a for loop. With the following code, I'm able to generate an array with 12 values of predictor, which is what I want. The thing is I'm trying to generate 1000 arrays of 12 values each and I'm not sure how to…

Philippe Rosato
- 11
- 1
1
vote
2 answers
How can I generate missing data structures to run simulations on high dimensional data in R?
In the R program, I will generate a high-dimensional dataset using the following codes and create missing datasets with MAR, MCAR and MNAR mechanisms, with 5%, 25% and 40% missing rates:
generateData<- function(n,p) {
sigma <- diag(p)
sigma <-…

Bugra Varol
- 53
- 5
1
vote
0 answers
Processing angle calculation on rotated object
I am making a little ant colony simulation in Processing (4).
I have an Ant class, with a sense() , a move()and a render() function.
I also have a Food class with only a position PVector.
My sense class loops through all Foods in a given radius, and…

Dr Tipmack
- 26
- 4
1
vote
1 answer
How to read distribution information from AnyLogic database table
I want to read information about distributions of delay times from an Excel file (already imported into an AnyLogic database table). The format is "distribution(parameter1, parameter2,...)", so for example uniform (0, 0) or normal(0, 1). Is there a…

user17334485
- 11
- 2
1
vote
1 answer
Getting NullPointerExection error while creating a text file for an Agent in AnyLogic
I have created an agent and then I put a text file from the Connectivity pallet into that Agent model. As soon as I run the simulation it is displaying NullPointerException error. In the console it says Unknown Source. Although I have created that…

Shahir Abdullah
- 23
- 5
1
vote
1 answer
Unexpected warning in Verilog simulation for port size
I couldn't figure out why the simulator gives the warning and why the circuit does not work properly.
This is the Verilog code:
`timescale 1ns/1ns
module circuitIVEightBitAssign(input [7:0]a,flag,output [7:0]b);
assign #(143) b = flag ? ~a :…

Ali Eftekhari
- 23
- 3
1
vote
1 answer
How to get source/destination IP address of a packet in NS3 when I am using MacTx TraceSource for PointToPointNetDevice?
I am trying to simulate a fattree network in NS3. I have UdpServerHelper and UdpClientHelper to generate traffic between two hosts. Then I call
TraceConnectWithoutContext ("MacTx", MakeCallback (&SinkMethod))
on one of my NetDeviceContainer nodes…

soroush
- 45
- 8