A book that shows history of mathematics and how ideas were formed? I am looking for a book that shows the history of mathematics, and how did mathematicians came up with some of the greatest mathematical ideas. For instance, the concept of integration and differentiation, how did they came up with it, and other concepts as well. A book that would show me how those ideas were formed. 

Analysis by Its History by Ernst Hairer and Gerhard Wanner is a great book, I have read it and it kept me interested the whole time.
They truly go through the whole history of mathematics, especially integration and differentiation, logarithms, foundations of calculus, computational methods etc.
Here are the links: http://www.springer.com/gp/book/9780387945514 and https://www.amazon.com/Analysis-History-Undergraduate-Texts-Mathematics/dp/0387770313.
