# All posts in Mathematics

When interested in buying bonds a term that often comes up is the definition of Yield To Maturity (YTM): Yield to maturity (YTM) is the total return anticipated on a bond if the bond is held until the end of its lifetime. Yield to maturity is considered a long-term bond . . . Read more

The Knuth shuffle algorithm is an algorithm for randomly shuffling the elements of an array arr of size given a function that generates a uniformly distributed random number in time. The algorithm produces an unbiased permutation. That is, every permutation is equally likely. for i in range(n-1,0,-1): j = integer . . . Read more

In this post I will explain a less intuitive approach of implementing a ceil() function in Java, that is faster than known comparison approaches. A few known facts Fact 1 Dividing two integers and in Java will always floor the result: int a, b; int ans = a/b; // is . . . Read more

This is a rather short post. in which I explain how to we can implement a fast pow function to raise a number to the power of . A rather naive approach would be to do the following: int pow(int x, int n){ int result = 1; while (n > . . . Read more