How can estimate $\pi$ with differential equation? I know some method for estimation of $\pi$ .We can use Monte Carlo method to estimate $\pi $.We can use series to estimate $\pi $.
And my question is : Is there exist a (1 st order) differential equation or stochastic differential equation that can estimate $\pi $ ? or $\pi $ is a part of the solution, When we are implementing numerical iteration the solution close to $\pi $ ?
I tried some Matlab codes for Monte Carlo method like this below:
clear;  
N=100000; % the experiment event number  
r=1; %the circle radius  
n=0; % sucessful event number   
for i=1:N  
  x=-r+2*r*rand();  
  y=-r+2*r*rand();  
  if ((x^2+y^2)<=r^2)  
    n = n+1;
  end
end
pi_sim=4*n/N 

How can I make a relation between $\pi$   and diff. equations ?
Thanks in advanced for any hint.
$$\textit{Specially, I am looking for Stochastic diff. Eq.}$$
Remark:
For example:If we solve this SDE $dx_t=(\mu-x_t)dt+\alpha dw_t$ we will see $\mathbb{E}[x_t] \to \mu $ so $$dx_t=(\pi-x_t)dt+\alpha dw_t \to (\mathbb{E}[x_t] \to \pi) $$ but this Non-interesting example (I made it by self)

For a first-order solution, you could use:

Proposition 0. If $$f'(x) = \sqrt{1-x^2}, \qquad f(-1)=0$$
then $2f(1) = \pi$.

However, I think a second-order solution is a bit more conceptually satisfying. You could use:

Proposition 1. $$\pi = \min_{\theta > 0} \,\left(\sin\theta \leq 0\right).$$

So just write a program that numerically approximates $\sin$ via the second order DE $$f'' = -f, f(0) = 0, f'(0)=1.$$ The moment $f(x)$ drops below $0$, return $x$ and it will be near to $\pi.$
