t distribution with large degrees of freedom is the same as Normal (Gaussian) distribution with mean 0 and standard devitation 1 approximately.
  • normal[x_] := PDF[NormalDistribution[0, 1], x]
  • t[x_, nu_] := PDF[StudentTDistribution[nu]], x]
  • Plot[{normal[x], t[x, 3], t[x, 6], t[x, 20]}, {x, -6, 6},  PlotStyle -> {Black, Gray, Blue, Red}]
사용자 삽입 이미지
  • Five real random numbers x0 from the Gaussian distribution (0,1):
사용자 삽입 이미지

  • Five real random numbers x1 from the Gaussian distribution (mu,sigma) :
사용자 삽입 이미지
  • There is the following relation : x1 = x0*sigma + mu
사용자 삽입 이미지

Therefore, from a real random number from t distribution random number generator with nu, I can get the random magnetic field strength B_t as following:
사용자 삽입 이미지
,where t_random is generated by gsl_ran_tdist function as

random t distribution


In the random_t_distribution function, I used a sort of random number generator in order to get a random seed. The original random number generator, which is based on /dev/random, is shown in Advanced Linux Programming Chapter 6. I modified it as following:

random seed generator function


Secure Programming Cookbook for C and C++ (11.3 Using the Standard Unix Randomness Infrastructure) is also useful reference book on the web.

'old memories > physics' 카테고리의 다른 글

t distribution and GSL random number generator  (0) 2007.07.02
Confidence Interval and Prediction Interval  (0) 2007.06.20
PhD thesis  (1) 2006.11.30
Tolerance  (3) 2006.11.08
posted by citadel