# \#monte-carlo

**URL:** https://discourse.julialang.org/tag/monte-carlo/411.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Uncertainty propagation using MonteCarloMeasurements gives weird results](https://discourse.julialang.org/t/uncertainty-propagation-using-montecarlomeasurements-gives-weird-results/124745)

<div class="topic-metadata">

**Author:** [@Iddingsite](https://discourse.julialang.org/u/Iddingsite)\
**Replies:** 8\
**Last updated:** [January 14, 2025, 6:39pm UTC](https://discourse.julialang.org/t/uncertainty-propagation-using-montecarlomeasurements-gives-weird-results/124745 "2025-01-14T18:39:47Z")

</div>

Hi! I am not familiar with MonteCarloMeasurements.jl, so I am probably doing something dumb, but I thought that it would be the good tool for what I want to do and I am getting some weird results. I am trying to calcul…

---

## [Why does the plot of EnsembleProblem differ from the original ODEProblem?](https://discourse.julialang.org/t/why-does-the-plot-of-ensembleproblem-differ-from-the-original-odeproblem/118415)

<div class="topic-metadata">

**Author:** [@homocomputeris](https://discourse.julialang.org/u/homocomputeris)\
**Replies:** 2\
**Last updated:** [August 29, 2024, 5:59pm UTC](https://discourse.julialang.org/t/why-does-the-plot-of-ensembleproblem-differ-from-the-original-odeproblem/118415 "2024-08-29T17:59:44Z")

</div>

I assume that if I don’t change the problem in EnsembleProblem, the EnsembleSummary should produce the same plot as the original ODEProblem solution. Simple example: module test using Plots, StatsPlots using LinearAlg…

---

## [Efficient simulation with different path lengths](https://discourse.julialang.org/t/efficient-simulation-with-different-path-lengths/116321)

<div class="topic-metadata">

**Author:** [@JADekker](https://discourse.julialang.org/u/JADekker)\
**Replies:** 5\
**Last updated:** [June 28, 2024, 2:32pm UTC](https://discourse.julialang.org/t/efficient-simulation-with-different-path-lengths/116321 "2024-06-28T14:32:25Z")

</div>

Hi, I’ve enjoyed using Julia on my first research project quite a lot, and I’m now thinking of how to set up my code for my second research project. The computational bottleneck in this project lies in performing many co…

---

## [Vectorization of multivariate normal PDF](https://discourse.julialang.org/t/vectorization-of-multivariate-normal-pdf/116248)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 1\
**Last updated:** [June 26, 2024, 7:57am UTC](https://discourse.julialang.org/t/vectorization-of-multivariate-normal-pdf/116248 "2024-06-26T07:57:54Z")

</div>

I would like to compute the PDF of a multivariate normal distribution of given parameters for a number of input points. (eg MvNorm for several vectors at once) This is for a particle filter, many such computations going …

---

## [How to evaluate multivariate log normal distribution at arbitrary point?](https://discourse.julialang.org/t/how-to-evaluate-multivariate-log-normal-distribution-at-arbitrary-point/112608)

<div class="topic-metadata">

**Author:** [@structural](https://discourse.julialang.org/u/structural)\
**Replies:** 2\
**Last updated:** [April 7, 2024, 9:46am UTC](https://discourse.julialang.org/t/how-to-evaluate-multivariate-log-normal-distribution-at-arbitrary-point/112608 "2024-04-07T09:46:47Z")

</div>

Suppose I have the following distribution over two variables dist = MvLogNormal(mean\_a\_b, cov\_a\_b) Suppose h is an array of dimension 1000\\times 2. For each row of array h, the first entry represents the rank of the …

---

## [Error in dblquad integration with Unitful and MonteCarloMeasurements](https://discourse.julialang.org/t/error-in-dblquad-integration-with-unitful-and-montecarlomeasurements/110420)

<div class="topic-metadata">

**Author:** [@GSavvidis](https://discourse.julialang.org/u/GSavvidis)\
**Replies:** 5\
**Last updated:** [February 22, 2024, 7:00pm UTC](https://discourse.julialang.org/t/error-in-dblquad-integration-with-unitful-and-montecarlomeasurements/110420 "2024-02-22T19:00:05Z")

</div>

Hello everyone, This is my first post so apologies in advance for any mistakes in the question format. I have been trying to calculate an integral of two variables using dblquad. The function to be integrated contains …

---

## [Issue with the Metropolis adjusted Langevin sampler from AdvancedMH.jl](https://discourse.julialang.org/t/issue-with-the-metropolis-adjusted-langevin-sampler-from-advancedmh-jl/110155)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 1\
**Last updated:** [February 13, 2024, 10:13pm UTC](https://discourse.julialang.org/t/issue-with-the-metropolis-adjusted-langevin-sampler-from-advancedmh-jl/110155 "2024-02-13T22:13:39Z")

</div>

I am trying to use a Metropolis adjusted Langevin sampler, from AdvancedMH.MALA. I did a simple test to see if things are working correctly, which is to sample from a multivariate normal distribution. Here is the code: i…

---

## [Clean way to use mean value with distributions](https://discourse.julialang.org/t/clean-way-to-use-mean-value-with-distributions/108580)

<div class="topic-metadata">

**Author:** [@lenz](https://discourse.julialang.org/u/lenz)\
**Replies:** 0\
**Last updated:** [January 9, 2024, 6:03pm UTC](https://discourse.julialang.org/t/clean-way-to-use-mean-value-with-distributions/108580 "2024-01-09T18:03:30Z")

</div>

I have a model that is called with a strut with all the arguments (with units) needed. I would like to use this model to do uncertainty analysis by setting some of these values to a distribution. I would like to be able…

---

## [Monte Carlo ray tracing flow chart algorithm pseudocode: A @goto-implementation and a recursion based implementation, any ideas for a more modern implementation?](https://discourse.julialang.org/t/monte-carlo-ray-tracing-flow-chart-algorithm-pseudocode-a-goto-implementation-and-a-recursion-based-implementation-any-ideas-for-a-more-modern-implementation/108089)

<div class="topic-metadata">

**Author:** [@NikoBiele](https://discourse.julialang.org/u/NikoBiele)\
**Replies:** 3\
**Last updated:** [December 29, 2023, 11:59pm UTC](https://discourse.julialang.org/t/monte-carlo-ray-tracing-flow-chart-algorithm-pseudocode-a-goto-implementation-and-a-recursion-based-implementation-any-ideas-for-a-more-modern-implementation/108089 "2023-12-29T23:59:58Z")

</div>

Hi Julia-people :slight\_smile: I am working with heat transfer, more specifically simulating thermal radiation heat transfer in participating media through Monte Carlo ray tracing. I am currently working with a 2D algor…

---

## [Parallelize double nested loop using Dagger for Montecarlo](https://discourse.julialang.org/t/parallelize-double-nested-loop-using-dagger-for-montecarlo/107493)

<div class="topic-metadata">

**Author:** [@matinator](https://discourse.julialang.org/u/matinator)\
**Replies:** 5\
**Last updated:** [December 14, 2023, 9:59am UTC](https://discourse.julialang.org/t/parallelize-double-nested-loop-using-dagger-for-montecarlo/107493 "2023-12-14T09:59:34Z")

</div>

Hello everyone, I am trying to parallelize this montecarlo function that I have created for measuring an option price using the BlackScholes model and I would like to improve its performance by parallelizing the double …

---

## [How to preallocate for a parallel monte carlo simulation?](https://discourse.julialang.org/t/how-to-preallocate-for-a-parallel-monte-carlo-simulation/107104)

<div class="topic-metadata">

**Author:** [@Taneli\_Tolppanen](https://discourse.julialang.org/u/Taneli_Tolppanen)\
**Replies:** 5\
**Last updated:** [December 8, 2023, 8:08am UTC](https://discourse.julialang.org/t/how-to-preallocate-for-a-parallel-monte-carlo-simulation/107104 "2023-12-08T08:08:22Z")

</div>

I am trying to run a series of monte carlo simulations. My simulation gives as an output a matrix. I would like to preallocate this matrix for each of the simulations, and also preallocate some work vectors since I am ru…

---

## [MonteCarloMeasurements.jl - Object with Particles Passed to Function with Comparison Operator](https://discourse.julialang.org/t/montecarlomeasurements-jl-object-with-particles-passed-to-function-with-comparison-operator/105843)

<div class="topic-metadata">

**Author:** [@matthew3245](https://discourse.julialang.org/u/matthew3245)\
**Replies:** 5\
**Last updated:** [November 6, 2023, 12:56pm UTC](https://discourse.julialang.org/t/montecarlomeasurements-jl-object-with-particles-passed-to-function-with-comparison-operator/105843 "2023-11-06T12:56:06Z")

</div>

I’m trying to pass an object that contains particles to a function that uses comparison operators. Consider the following simple example: using MonteCarloMeasurements mutable struct Foo{T} p::T end function add\_on…

---

## [Status of ABC-SMC samplers in Julia](https://discourse.julialang.org/t/status-of-abc-smc-samplers-in-julia/88348)

<div class="topic-metadata">

**Author:** [@fipelle](https://discourse.julialang.org/u/fipelle)\
**Replies:** 10\
**Last updated:** [October 6, 2023, 4:36pm UTC](https://discourse.julialang.org/t/status-of-abc-smc-samplers-in-julia/88348 "2023-10-06T16:36:51Z")

</div>

Hi, I was wondering what is the current status of ABC samplers in Julia. I have seen that GpABC.jl has a few options, but I was wondering if there are alternative packages with a special focus on SMC. I do not have some…

---

## [Plotting only certain trajectories of ensemble solution](https://discourse.julialang.org/t/plotting-only-certain-trajectories-of-ensemble-solution/93288)

<div class="topic-metadata">

**Author:** [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Replies:** 1\
**Last updated:** [January 20, 2023, 11:56pm UTC](https://discourse.julialang.org/t/plotting-only-certain-trajectories-of-ensemble-solution/93288 "2023-01-20T23:56:48Z")

</div>

If I soleve an ensemble problem: using DifferentialEquations using Plots prob = ODEProblem((u,p,t)-\>1.01u,0.5,(0.0,1.0)) function prob\_func(prob,i,repeat) remake(prob,u0=rand()\*prob.u0) end ensemble\_prob = Ensemble…

---

## [Saving RNG state/reproducibility in large scale Monte Carlo simulations](https://discourse.julialang.org/t/saving-rng-state-reproducibility-in-large-scale-monte-carlo-simulations/89408)

<div class="topic-metadata">

**Author:** [@lweber](https://discourse.julialang.org/u/lweber)\
**Replies:** 17\
**Last updated:** [October 29, 2022, 11:08am UTC](https://discourse.julialang.org/t/saving-rng-state-reproducibility-in-large-scale-monte-carlo-simulations/89408 "2022-10-29T11:08:56Z")

</div>

Hi everyone, (I know this question has been asked in different ways a bunch of times, but for me, I still could not find a good solution) I am currently porting my large scale Quantum Monte Carlo framework to Julia but…

---

## [How to change the line width of mean curve when plotting with Plots.jl and MonteCarloMeasurements.jl](https://discourse.julialang.org/t/how-to-change-the-line-width-of-mean-curve-when-plotting-with-plots-jl-and-montecarlomeasurements-jl/86046)

<div class="topic-metadata">

**Author:** [@Firstname\_Lastname](https://discourse.julialang.org/u/Firstname_Lastname)\
**Replies:** 2\
**Last updated:** [August 25, 2022, 11:37pm UTC](https://discourse.julialang.org/t/how-to-change-the-line-width-of-mean-curve-when-plotting-with-plots-jl-and-montecarlomeasurements-jl/86046 "2022-08-25T23:37:11Z")

</div>

Using plot command in MonteCarloMeasurements.jl package, I have a plot of mean function and a shaded area showing the (0.025,0.0975) quantiles. How can I change the width (or line style) of the mean curve? I tried alrea…

---

## [Julia package dealing with propagation of uncertainty](https://discourse.julialang.org/t/julia-package-dealing-with-propagation-of-uncertainty/84472)

<div class="topic-metadata">

**Author:** [@Firstname\_Lastname](https://discourse.julialang.org/u/Firstname_Lastname)\
**Replies:** 3\
**Last updated:** [July 23, 2022, 11:39pm UTC](https://discourse.julialang.org/t/julia-package-dealing-with-propagation-of-uncertainty/84472 "2022-07-23T23:39:40Z")

</div>

In a static problem, there is uncertainty in some input, like I = a \\pm b. The output \[a function of spatial variables, i.e. f(x,y)\] is uncertain due to uncertain input. For each input sample, randomly generated, the fun…

---

## [\[ANN\] ZigZagBoomerang.jl](https://discourse.julialang.org/t/ann-zigzagboomerang-jl/57287)

<div class="topic-metadata">

**Author:** [@mschauer](https://discourse.julialang.org/u/mschauer)\
**Replies:** 37\
**Last updated:** [June 3, 2022, 6:53pm UTC](https://discourse.julialang.org/t/ann-zigzagboomerang-jl/57287 "2022-06-03T18:53:41Z")

</div>

Dear all! We would like to announce our package together with our new paper “Sticky PDMP samplers for sparse and local inference problems” (Arxiv link) ZigZagBoomerang.jl Sleek implementations of the ZigZag, Boomerang …

---

## [AdaptiveMCMC](https://discourse.julialang.org/t/adaptivemcmc/81399)

<div class="topic-metadata">

**Author:** [@marouane1994](https://discourse.julialang.org/u/marouane1994)\
**Replies:** 9\
**Last updated:** [May 30, 2022, 5:20pm UTC](https://discourse.julialang.org/t/adaptivemcmc/81399 "2022-05-30T17:20:17Z")

</div>

I wrote a Metropolis-Hastings code manually for a problem that samples arrays from a custom distribution that can be found here https://github.com/marouanehanhasse/QComm/blob/main/distributions.jl, before i was using Kla…

---

## [Improving metropolis-hastings code](https://discourse.julialang.org/t/improving-metropolis-hastings-code/67412)

<div class="topic-metadata">

**Author:** [@marouane](https://discourse.julialang.org/u/marouane)\
**Replies:** 21\
**Last updated:** [September 6, 2021, 3:22am UTC](https://discourse.julialang.org/t/improving-metropolis-hastings-code/67412 "2021-09-06T03:22:16Z")

</div>

Recently i’m looking for different ways to make the metropolis-hastings algorithm better specially when it comes to rate of the accepted values and the performance, specially if i’m writing this code manually without any…

---

## [Bayesian logistic regression with Turing.jl](https://discourse.julialang.org/t/bayesian-logistic-regression-with-turing-jl/60105)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 29\
**Last updated:** [May 18, 2021, 4:55pm UTC](https://discourse.julialang.org/t/bayesian-logistic-regression-with-turing-jl/60105 "2021-05-18T16:55:27Z")

</div>

Hi everyone, first-time user of Turing.jl here. It is really nice, thanks! :star: I am trying to implement a simple Bayesian logistic regression model, but I keep getting this warning from AdvancedHMC.jl: ┌ Warning: Th…

---

## [MCMC for a customized distribution](https://discourse.julialang.org/t/mcmc-for-a-customized-distribution/54444)

<div class="topic-metadata">

**Author:** [@marouane](https://discourse.julialang.org/u/marouane)\
**Replies:** 3\
**Last updated:** [February 2, 2021, 10:03am UTC](https://discourse.julialang.org/t/mcmc-for-a-customized-distribution/54444 "2021-02-02T10:03:42Z")

</div>

Is there any good package for discret sampling and supports a customized distribution?

---

## [How to use EnsembleDistributed() in DifferentialEquations.jl](https://discourse.julialang.org/t/how-to-use-ensembledistributed-in-differentialequations-jl/51642)

<div class="topic-metadata">

**Author:** [@jmmm](https://discourse.julialang.org/u/jmmm)\
**Replies:** 2\
**Last updated:** [December 11, 2020, 10:07am UTC](https://discourse.julialang.org/t/how-to-use-ensembledistributed-in-differentialequations-jl/51642 "2020-12-11T10:07:48Z")

</div>

I was following a tutorial in Stochastic Differential Equations · DifferentialEquations.jl (sciml.ai) and tried to modify it to use EnsembleDistributed() to speed up MC simulations. This is from the tutorial: using Dif…

---

## [Advice for improving Monte-Carlo code](https://discourse.julialang.org/t/advice-for-improving-monte-carlo-code/49782)

<div class="topic-metadata">

**Author:** [@s0916314](https://discourse.julialang.org/u/s0916314)\
**Replies:** 23\
**Last updated:** [November 11, 2020, 9:17pm UTC](https://discourse.julialang.org/t/advice-for-improving-monte-carlo-code/49782 "2020-11-11T21:17:43Z")

</div>

I’m a relative beginner with Julia and was hoping someone may be able to give me some constructive feedback on a small script I’ve written. I’m mainly looking for performance tips and ways to make my code clearer or less…

---

## [DifferentialEquations and Parameter Estimation with Indicator Variables](https://discourse.julialang.org/t/differentialequations-and-parameter-estimation-with-indicator-variables/42633)

<div class="topic-metadata">

**Author:** [@Alfie](https://discourse.julialang.org/u/Alfie)\
**Replies:** 4\
**Last updated:** [July 8, 2020, 8:40am UTC](https://discourse.julialang.org/t/differentialequations-and-parameter-estimation-with-indicator-variables/42633 "2020-07-08T08:40:54Z")

</div>

Hi I am new to Julia, sorry for this basic question, I am doing some parameter fitting, and would like to use a binary indicator variable (0/1) to differentiate groups from my data. I have the following code: f…

---

## [Bayesian inference in the presence of intractable integral](https://discourse.julialang.org/t/bayesian-inference-in-the-presence-of-intractable-integral/40061)

<div class="topic-metadata">

**Author:** [@francesco.alemanno](https://discourse.julialang.org/u/francesco.alemanno)\
**Replies:** 13\
**Last updated:** [May 25, 2020, 2:43pm UTC](https://discourse.julialang.org/t/bayesian-inference-in-the-presence-of-intractable-integral/40061 "2020-05-25T14:43:53Z")

</div>

Hi guys, recently i’ve learned about the powerful packages for bayesian inference in julia i would like some tips on how to attack this problem, given this probabiliy distribution over the angles \\theta: P(\\vec \\theta…

---

## [\[ANN\] MonteCarloMeasurements.jl](https://discourse.julialang.org/t/ann-montecarlomeasurements-jl/23021)

<div class="topic-metadata">

**Author:** [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Replies:** 34\
**Last updated:** [January 22, 2020, 8:05am UTC](https://discourse.julialang.org/t/ann-montecarlomeasurements-jl/23021 "2020-01-22T08:05:44Z")

</div>

As a spinoff from a homework we gave in our julia course at our department, I created a small package to do nonlinear uncertainty propagation, MonteCarloMeasurements.jl. This package provides two types Particles \<: Real …
