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”

## Number of trailing zeros in factorial of an integer

An integer `n` is given, the task is to find the number of trailing zeros in `n!` .

Continue reading “Number of trailing zeros in factorial of an integer”

## Simpson’s 1/3rd Rule

A brief introduction to the *Simpson’s 1/3 ^{rd}* rule and a uniform interval

*Composite Simpson’s 1/3*Rule implementation.

^{rd}Continue reading “Simpson’s 1/3rd Rule”

## Trapezoidal Rule

A brief introduction to the Trapezoidal rule and a uniform interval Composite Trapezoidal Rule implementation.

Continue reading “Trapezoidal Rule”

## Hero’s Method : Evaluating square root of a real number

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”

## Finding qth real root of a real number

In this post we will see how to find n^{th} 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 q^{th} root of a real number. Let there be a non-negative real number C, of which the real q^{th} root is to be found. Let the square root of C be x. We represent this with .

Now:

So we are now to find the roots of the q^{th} order function

Continue reading “Finding qth real root of a real number”