Onder andere op wetenschapsforum heb ik enkele tijd geleden een methode laten zien hoe men Pi kan berekenen van de decimalen van Pi zelf (indien Pi een normaal getal is) Pi Decimalen Pi.
Op een ander forum heb ik een jaar geleden mijn gedachten gegeven over een cirkel opgebouwd met muntstukken gestart door TwoTwo. Hier is link: Math Forums.
Op MSE (itex stacks exchange) dezelfde vraag als hieronder. Echter al enige tegen votes gekregen. Dus ik weet niet of ervaren/prof wiskundigen geïnteresseerd zijn: MSE.
Hieronder mijn bevingen (Engels):
Method:
With a normal distribution \(\small \pi\) can be calculated with help of the PDF (probability density function). See: Calculate pi from digits of pi (MSE).
$$f(x)={\frac {1}{\sigma {\sqrt {2\pi }}}}e^{-{\frac {1}{2}}\left({\frac {x-\bar{x}}{\sigma }}\right)^{2}}$$
The density at the mean value: \(\small \bar{x}\) is equal to the front end of the PDF. This density at the mean can be approximated by a discrete distribution. Where \(\small n\) is the number of counted/observed values at the mean \(\small \bar{x}\), \(\small N\) is the sample size and \(\small \Delta x\) is the distance between two discrete intervals.
$$f(\bar{x})=\frac {1}{\sigma {\sqrt {2\pi }}} \approx \frac{n}{\Delta x N}$$
So if normal distributed \(\small \pi\) CLT (central limit theorm) can be estimated by statistics with:
$$\boxed{\pi \approx \frac{1}{2} \cdot \left( \frac{\Delta x N}{ n \sigma} \right)^{2}} \tag{1}$$
In this example I sampled any digit from \(\small [0,1,2,3,4,5,6,7,8,9]\) where \(\small s\) is the number of samples “with replacement”. The standard deviation of the mean can be calculated where: \(\small a=0\), \(\small b=9\) and \(\small s\) sample size. The standard deviation from a discrete uniform distribution I calculated with (and divided by number of samples \(\small s\)):
$$\sigma=\sqrt{\frac{(b-a+1)^{2}-1}{12s}}$$
The distance between discrete intervals can be calculated with (found empirical):
$$\Delta x=\frac{1}{s}$$
From counted observations \(\small n\) at the mean value \(\small \bar{x}=4.5\) and formula \(\small (1)\) the value for \(\small \pi\) can be estimated. However also Eulers number can then be estimated by counting the observations \(\small n_{\sigma}\) at the position of standard deviation \(\small \sigma\) and requiring the estimated value for \(\small \pi\):
$$\boxed{e \approx \frac{1}{2\pi} \cdot \left( \frac{\Delta x N}{ n_{\sigma} \sigma} \right)^{2}} \tag{2}$$
In another study regarding discrete circles created with Coin Circles (MF) I encountered a probability density function with the mean value involving \(\small \log(2)\) and \(\small \pi\), the standard deviation involved Catalan's constant \(\small G\). When sampling \(\small \varepsilon \in [0,\frac{1}{2}]\) over a uniform continuous distribution (random) variable \(\small \alpha\) is found by:
$$ \alpha(\varepsilon) =2 \cdot \arctan \left( \frac{1}{2\varepsilon} \right)$$
$$\frac{d \varepsilon}{d \alpha}=-\frac{1}{4} \csc^2 \left( \frac{\alpha}{2} \right)$$
The cumulative probability density function of $\alpha$ was found/defined as:
$$F(\alpha) =\int_{\pi/2}^{\pi} \frac{1}{2} \csc^{2} \left( \frac{\alpha}{2} \right) d \alpha$$
The mean value was calculated with:\(\small \bar{\alpha}=\int_{\pi/2}^{\pi} \alpha \cdot f(\alpha) \ d \alpha\) .
$$\overline{\alpha}=\log(2)+\frac{\pi}{2}$$
So when I sample a continues uniform distribution \(\small \varepsilon\) and determine \(\small \alpha(\varepsilon)\), \(\small \log(2)\) can be calculated with help of the estimated value for \(\small \pi\) and the mean value \(\small \bar{\alpha}\) with:
$$\boxed{ \log(2) \ \approx\ \overline{\alpha}-\frac{\pi}{2} } \tag{3}$$
The variance of \(\small \alpha(\epsilon)\) was calculated with: \(\small Var(\alpha)=\int_{\pi/2}^{\pi} (\alpha-\bar{\alpha})^2 \cdot f(\alpha) \ d \alpha \):
$$Var(\alpha)=-4G - \frac{\log^{2}(4) }{4}+\pi \cdot \log(4)$$
With \(\small G\), Catalan's constant. With the found value for \(\small \log(2)\) and \(\small \pi\) the value for \(\small G\) can be estimated with:
$$\boxed{G\approx \frac{-log^{2}(2) + \pi \cdot \ 2\log(2) -Var(\alpha) }{4} } \tag{4}$$
With the code below: \(\small \pi\) and \(\small e\) have been calculated by sampling from digits: \(\small [0,1,2,3,4,5,6,7,8,9]\). Then \(\small \log(2)\) and \(\small G\) have been determined with the calculated \(\small \pi\) and sampling from a continuous uniform distribution between: \(\small \varepsilon \in [0,\frac{1}{2}]\).
With: \(\small s=800\) samples, \(\small N=20000\) trials/size and \(\small R=10000\) repeats. The following values were found: This calculation already took an hour, I did not have the patience for another marathon of 18 hours like I did for Pi from Pi . For easier to read code I did not include all CI (confidence intervals) in sample code below. Those in plots are based upon CI of \(\small \pi\).
Question:
Is there a reason why: \(\small \pi\) and \(\small \log(2)\) are related to mean values and: \(\small e\) and \(\small G\) are related to the standard deviation?
Any other information related to method is very welcome also advice in better itex formulation. This is a very open question but hoped for more insight on the itex involved. Crackpot ideas/observations:
- \(\small \pi\) is determined without apparent circle definition.
- \(\small e\) is determined as "width" normal distribution and \(\small \pi\).
- \(\small \log(2)\) can be calculated from coin circles error angle and \(\small \pi\).
- Catalan's constant \(\small G\) is determined by width of the error angle distribution of coin circle, \(\small \log(2)\) and \(\small \pi\).
Code: Selecteer alles
import numpy as np
import pandas as pd
#Samples, trials (pick trials >1000 to avoid zero counts) and repeats
s=500
N=1000
R=1000
#Set counting arrays to zero
mean_count=[]
std_count=[]
#stdev, sampled stdev and dx uniform distribution [0,1,2,3,4,5,6,7,8,9]
array=[0,1,2,3,4,5,6,7,8,9]
mean=np.mean(array)
var=((array[-1]-array[0]+1)**2-1)/12
stdev=np.sqrt(var)
stdevt=stdev/np.sqrt(s)
dx=1/s
for p in range(R):
#Create Array random numbers uniform discrete
random=np.random.choice(array,[N,s])
#Determine mean no of samples
m=np.mean(random,axis=1)
#Create dataframe and count number of observation per interval
df=pd.DataFrame({'m' : m})
dfg=df.groupby(['m'])['m'].agg(['count']).reset_index()
#Count observation at mean: 4.5
out=dfg[(dfg['m'] < mean +dx/2) & (dfg['m'] > mean-dx/2)]
nc=out['count'].to_numpy()
n=np.sum(nc)
mean_count.append(n)
#Count observation at standard deviations
out=dfg[(dfg['m'] < (mean+stdevt+dx/2)) & (dfg['m'] > (mean+stdevt-dx/2)) & (dfg['m'] > (mean-stdevt-dx/2)) & (dfg['m'] > (mean-stdevt-dx/2)) ]
nc=out['count'].to_numpy()
n=np.sum(nc)
std_count.append(n)
#Statistical pi (by counted observation mean)
mean=np.mean(mean_count)
pi=0.5*(dx*N/(stdevt*mean))**2
print('pi: ' + str(np.round(pi,4)) + " (mean)")
#Error in pi 95% CI
stdev=np.std(mean_count)
stdevm=stdev/np.sqrt(R)
pimin=0.5*(dx*N/(stdevt*(mean+2*stdevm)))**2
pimax=0.5*(dx*N/(stdevt*(mean-2*stdevm)))**2
print(str(np.round(pimin,4)) + "<pi<" + str(np.round(pimax,4)) + " (95%)")
#Statistical Eulers number (by counted observation stdev)
mean=np.mean(std_count)
e=0.5/pi*(dx*N/(stdevt*mean))**2
print('e: ' + str(np.round(e,4)) + " (mean)")
#Statistical log(2) (by mean ya, calc: pi)
epsilon=0.5*np.random.random_sample((N,))
alpha=2*np.arctan(1/(2*epsilon))
log2=np.mean(alpha)-pi/2
print('log(2): ' + str(np.round(log2,4)) + " (mean)")
#Statistical Catalan constant (by stdev ya, calc: pi and log(2))
nvar=np.var(alpha)
G=(-nvar-(log2)**2+pi*2*log2)/4
print("Catalan's Constant G: " + str(np.round(G,4)) + " (mean)")