I needed to write a random number generator in C which will generate random numbers from Normal Distribution (Gaussian Distribution). Without this component I couldn’t proceed to finish writing a C code for Heuristic Kalman Algorithm by Lyonnet and Toscano for some experiments. I selected the Marsaglia and Bray method also known as the Polar method to generate Normal random variables. Here is how it is done. Continue reading “Generating random numbers from Normal distribution in C”
An integer n is given, the task is to find the number of trailing zeros in n! .
A brief introduction to the Simpson’s 1/3rd rule and a uniform interval Composite Simpson’s 1/3rd Rule implementation.
Continue reading “Simpson’s 1/3rd Rule”
A brief introduction to the Trapezoidal rule and a uniform interval Composite Trapezoidal Rule implementation.
Continue reading “Trapezoidal Rule”
A floating point number is given. the task is to evaluate the value of its square root. We will discuss how to find the square root of a real number in this post, and also present a C Language code which does this job. The value of the root will be evaluated with the Hero’s method.
Continue reading “Hero’s Method : Evaluating square root of a real number”
In this post we will see how to find nth roots of a positive real number. We will use the Newton-Raphson method to deduce an iterative formula, and see its convergence.
The task is to find the real qth root of a real number. Let there be a non-negative real number C, of which the real qth root is to be found. Let the square root of C be x. We represent this with .
So we are now to find the roots of the qth order function