Scottish mathematician and leader of the Free Church of Scotlandl (1780-1847)