# Monte Carlo Simulation algorithm

The algorthim use for updating the voltage of each componant at every time step is $$v(t+\Delta t)=\begin{cases} v(t)e^{-\gamma \Delta t},& n=0\\ v(t)e^{-\gamma \Delta t}+h_{*}& n=1\end{cases}$$ where $n$ denotes the number of impulses arriving at a componant in the interval $(t,t+\Delta t).$ Here $h_{*}=0.03, \gamma=20, \Delta t=10^{-5}.$ I have no idea how to use this algorithm in monte carlo simulation. More precisely , I have no idea about the use of monte carlo simulation. Plz help

It seems to me you would just be randomly selecting $n$ at each time step, given some distribution you should be sampling $n$ from, and using your dynamics function to propagate the voltage from time $t$ to time $t + \Delta t$.

You would then run multiple Monte Carlo simulations from the initial time to the final time where you basically select a random value for $n$ at each time step. Using the final results, you could compute statistical information like the expected value for the voltage at some time $\hat{t}$, the variance of your voltage at time $\hat{t}$, etc.

If you write a code for this and use the values for the constants the way you set them, you might produce the following type of graphic:

• it's also worth considering which distribution $n$ should be drawn from at every time step. a natural choice would be to flip a fair coin - Bernoulli with $p=0.5$, so previous draws are "forgotten". other choices are also possible, depending on the behavior you're modeling. – GoHokies Jun 3 '17 at 9:52
• @GoHokies Good point to mention, I will update my answer! – spektr Jun 3 '17 at 15:09
• @C.Howard in this experiment the distribution is poisson. – jixon Jun 4 '17 at 15:33

If $\Delta t$ is small enough then $n$ can be only 0 or 1. Otherwise you must either reduce $\Delta t$ or change your formula to $v(t+\Delta t) = v(t)e^{-\gamma \Delta t} + n \times h_{*}$ (which by the way also works for $n=0$).

And if $n$ can be only 0 or 1, there is no notion of distribution: only of probability. The probability of $n$ being 1 is $p_0 \times \Delta t$ (to first order, so $\Delta t$ must be small).

Then it is just a matter of drawing a (pseudo)random number between 0 and 1 (equiprobably): if it is smaller than $p_0 \times \Delta t$ then $n:=1$, otherwise $n:=0$. The probability of a random number between 0 and 1 being less than $p_0 \times \Delta t$ is... $p_0 \times \Delta t$, which is exactly the probability you want to set $n$ to 1.

• if $n$ can be only 0 or 1, there is no notion of distribution: only of probability - are you sure that is correct? in fact, your answer does define a particular type of random distribution for $n$. also, what is $p_0$? – GoHokies Jun 4 '17 at 10:06
• My point is that distribution information boils down to a single number: a probability. $p_0$ is the number of events per unit time, i.e. $1/p_0$ is the frequency of events. – Mathieu Bouville Jun 5 '17 at 9:05