# Modification and Optimization of Cycloidal Gear Tooth Profile Based on Machining Error Compensation
## 3 Monte Carlo Simulation
### The Sampling Formula of Each Machining Error Item  
(1) The grinding wheel radius error, the distance error from the grinding wheel center to the spindle center, the eccentricity error of the machine tool spindle, the transmission ratio error of the machine tool, and other errors obey the normal distribution, and its probability density function [32] is shown in Formula (8). Even if the variance \(\sigma\) in Formula (8) is small, large negative values for the error are still possible (albeit with low probability), thus, assuming a Gaussian distribution, is at best, a convenient approximation.  
\[f(x)=\frac{1}{\sqrt{2\pi\sigma}}e^{-\frac{1}{2}(\frac{x-x}{\sigma})^{2}},(- \infty<x<+\infty) \tag{8}\]  
where \(\mu\) and \(\sigma\) are the mean and standard deviation in a normal distribution (mm), respectively.  
The sampling of normal distribution X, obtained by transformed sampling [33], is shown in Formula (9), where \(R_{1},R_{2}\) are uniform distributions ranging from 0 to 1. The 3\(\sigma\) principle is suitable for the data processing of samples with a sufficiently large number of normal or approximately normal distributions. An interval is determined according to a certain probability, and it is considered that any error exceeding this interval is not a random error, but a gross error, and the data containing this error should be eliminated. When the confidence level is 99.7%, according to the 3\(\sigma\) principle, the value of the distribution parameter is shown in Formula (10), where \(T=T_{1}-T_{2}\), \(T^{\prime}=T_{1}+T_{2}\), where \(T_{1}\) and \(T_{2}\) are the values within the error range, respectively.  
\[X=\mu+\sigma(-2\ln R_{1})^{1/2}\sin(2\pi R_{2}) \tag{9}\]  
\[\mu=\frac{1}{2}T^{\prime},\sigma=\frac{1}{6}T \tag{10}\]  
(2) Since the eccentric error is composed of two independent random variables of magnitude and direction [34], the eccentricity error of the installation of the cycloidal gear blank obeys the Rayleigh distribution, and its distribution and probability density functions are shown in Formulas (11) and (12), respectively:  
\[F(X)=1-e^{-\frac{1}{2}(\frac{X}{\sigma})^{2}},(X>0) \tag{11}\]  
\[f(X)=\frac{X}{\eta^{2}}e^{-\frac{X^{2}}{2\eta^{2}}},(X>0) \tag{12}\]  
The sampling formula obtained by the direct sampling method is:  
\[R=1-e^{-\frac{1}{2}(\frac{X}{\eta})^{2}} \tag{13}\]  
where \(R\) represents a uniform distribution ranging from 0 to 1. According to the probability distribution relationship, since \(R\) and \(1-R\) have the same probability distribution, the sampling formula of X, which obeys the Rayleigh distribution, can be obtained from Formula (14). When the confidence level is 99.7%, the distribution parameter values can be obtained from (15).  
\[X=\eta(-2\ln R)^{1/2} \tag{14}\]  
\[\eta=\frac{T}{2\sqrt{-2\ln(1-0.997)}}=\frac{T}{6.8} \tag{15}\]  
(3) Due to the rotary motion, the phase angles of the cycloidal gear and each runout amount obey the uniform distribution within 0 to 2\(\pi\), with the following probability density formula:  
\[f(\theta)=\frac{1}{2\pi^{\prime}},(0\leq\theta\leq 2\pi) \tag{16}\]The sampling formula of the uniform distribution \(\theta\) obtained by the direct sampling method is shown in Formula (17), where R is a uniform distribution from 0 to 1,  
\[\theta=2\pi R \tag{17}\]