His most considerable book (though possibly less well known than his lucid work on solid geometry), appeared about this time. It is entitled Collection of Examples of the Processes of the Differential and Integral Calculus, and was thoughtful and original. At first his plan had been to edit a second edition of a work with a similar title, which twenty-five years before had come from the pens of Herschel, Peacocke, and Babbage, but as he considered this, he discovered what immense strides had been made in the general aspect of mathematics. The mathematical theories of heat, light, electricity, and magnetism were all new, and they required a fresh treatment. Thus he undertook the book which brought him so much honour.

Gregory had an absolute passion for mathematics. ‘All these things seem to me,’ he said once, while turning over the pages of Fourier’s great work on heat, ‘to be a kind of mathematical paradise,’ and the enjoyment comes out all through his book.

He contested unsuccessfully with Professor Kelland the Chair of Mathematics in the University of Edinburgh, and in 1841 was offered the corresponding chair in Toronto, which, however, he declined; and it was well that he did so, for in the following year he had the first attack of the illness which was to end fatally for him. In the spring he left Cambridge never to return again.

Up to the last he had taken part in his college work, and in spite of severe suffering had gone through the irksome labour of examinations. Months of all but constant pain followed, brightened only by short intervals of ease. Whenever these occurred he turned to his old studies for refreshment, and only a little while before his death he began a paper on the analogy between differential equations and those in finite differences.

As the weeks passed, the watchful eyes of his sister could see the gradual failing of his strength, and at five o’clock on the morning of February 23rd, 1844, he passed away in his sleep. He died at Canaan Lodge.

His sister, Miss Georgina Gregory, made a collection of the poems written by her brothers. Some of Mr Duncan Gregory’s verses would have made delightful children’s poetry. One time when they had gone to the English lakes together for change of air, they, as is not an entirely unknown experience in that part of the world, had to spend most of their time in the inn, and as a last resource fell to writing doggerel.

‘The fields are one extensive bog,

The roads are just as bad;

I wish I were a little frog,

Then rain would make me glad.