As a young man Castillon was irreligious. John Christian Laursen writes :-
He made his way to Switzerland in 1736, apparently fleeing the Inquisition. His mother had admonished him not to dishonour the family name, so he took the name 'Castiglione' (in Italian; 'Castilloneus' in Latin and 'Castillon' in French) after 'Castiglion Fiorentino', the location of the family home.Castillon taught at Vevey, a town on the north shore of Lake Geneva, where he became the director of the humanistic school. He continued to earn money as a translator, and he taught rhetoric, humanities, and mathematics. During this period he published two mathematical papers, written in Latin giving his name as J Castillioneus, in the Philosophical Transactions of the Royal Society of London. In the first of these De curva cardioide, de figura sua sic dicta Ⓣ, dated April 1741, he named and investigated the cardioid curve. The second paper De polynomia Ⓣ, on Newton's polynomial theorem, was read to the Society on 6 May 1742. He edited three volumes of Newton's works which were first published in Lausanne and Geneva in 1744. The first volume contains Newton's mathematical essays, the second volume contains the philosophical treatises which mainly consist of Newton's "Optical Lectures", which were originally delivered in Latin at Cambridge in 1669, 1670, and 1671. The third volume contains Newton's philological works, mainly historical essays, including a chronicle of ancient history. Roger Ward Babson describes these volumes:-
These three volumes [were] collected and edited by Giovanni Francesco Salvemini, called Castillionaeus, who supplied a Preface and life of Newton. They are a fine piece of bookmaking.Up to this time Castillon had been an atheist, but in 1744 he became a Calvinist. His views on religion are, however, somewhat unclear and we will discuss these further below. In 1745 he took up a teaching position in Lausanne and in the same year he married Elisabeth du Frèsne; they had three children but only one son survived his father, namely Maximilian Friedrich Gustav Adolf. Also in 1745 he published the correspondence between Johann Bernoulli and Gottfried Leibniz; then in 1748 he published the Introductio in analysin infinitorum auctore Leonhardo Eulero, the treatise by Euler which he had edited. Between 1749 and 1751 Castillon taught both at Lausanne and also at Bern. During this time he made efforts to obtain a more prestigious position and applied for a professorship in mathematics in Bern and a professorship in theology in Lausanne. He was unsuccessful in both of these applications, but it is interesting to note that having only become a Calvinist in 1744 he was ready for a professorship in theology a few years later. In the summer of 1751 he received offers of positions at St Petersburg and also at Utrecht. This proved a difficult decision for Castillon and he took several months to make up his mind. In December 1751 he went to the University of Utrecht to lecture on mathematics and astronomy. He obtained a doctorate from Utrecht in 1754, being advised by Johannes Horthemels, and Castillon became an ordinary professor of mathematics and philosophy there in 1755. Three years later Castillon became rector of the University. During these years Castillon had received a number of distinctions being made a Fellow of the Royal Society of London and a member of the Göttingen Academy of Sciences, both in 1753. In 1757 Castillon's wife Elisabeth died; he married to Madeleine Ravène two years later.
Jean-Jacques Rousseau, the French philosopher, writer, and political theorist, published Discours sur l'origine de l'inegalité parmi les hommes Ⓣ in 1755. Castillon replied to Rousseau in Réponse Ⓣ, giving his own defence of progress and modern civility. Published in Amsterdam in 1756, Castillon's work was addressed to Maupertuis, as President of the Berlin Academy of Science. Castillon opposed the views of Rousseau and his supporters, favouring the ideas of thinkers of the English Enlightenment. He also translated John Locke's Elements of Natural Philosophy into French with the title Abrégé de physique Ⓣ, publishing this in 1758. He wrote a detailed commentary on Newton's Arithmetica universalis Ⓣ publishing a Latin edition of the work with his commentary in Amsterdam in 1761.
James Boswell, the famous Scottish lawyer, diarist, and author, travelled in Holland in October 1763 and met with Castillon in Utrecht on several occasions. Boswell recounts a number of incidents which give us some insight into Castillon at this time. For example :-
It is said that the Dutch language is a language for horses. Monsieur Castillon said so, after having lived in Utrecht for several years. He was on an Amsterdam barge when he made that comparison, and if there had not been a man there who knew him, I believe that a stout Dutchman would have thrown him into the canal.Boswell and Castillon discussed free will while in Utrecht. These discussions are summarised in :-
At first Castillon maintained that he could "conceive the most perfect prescience without restraining liberty" - the position which Jerusalem had taken but which Boswell now rejected as "absurd." Thereupon, Castillon, giving the subject a more philosophical cast, explained that since God offered man part of His own nature, He has granted man some of this will.In 1763 Frederick the Great, the King of Prussia, invited Castillon to Berlin offering him the position of professor of mathematics at the Artillery School. Also in that year Castillon, on the personal recommendation of Frederick the Great, was elected to the Mathematics Section of the Berlin Academy of Science. Following the death of Maupertuis in 1759, Leonhard Euler had been made head the Academy but also remained as Director of the Mathematics Section until replaced in that role by Lagrange on 6 November 1766. When Boswell was with Castillon in Utrecht in October 1763 it was already known that he would be moving to Berlin in the following year. Boswell paints the following rather unpleasant picture of Castillon :-
Monsieur Castillon, although a very learned man, is a sad example of [someone who cannot eat meat]. His teeth are so bad that for several years he has eaten nothing but hash. Unknown to him are the robust joys of greedily devouring a great piece of beef or mutton. Poor man! He is going to Berlin. I hope with all my heart that that jesting rogue the Marquis d'Argens never sees him eat, for fear that he will turn him to ridicule.In July 1764 Boswell was in Berlin and there met up again with Castillon who took him to a meeting of the Berlin Academy of Science. Irma Lustig describes some of their conversations in Berlin :-
Boswell had studied with Castillon in Utrecht without enthusiasm, but now that both were newcomers to Berlin, they sought each other's company. On one occasion, Castillon acknowledged with remarkable frankness that he considered God a being to be revered but that he disapproved of emotional worship, which he called "the fancy of fanatics." He also declared that only the Gospels were "truly Christian scriptures," that the Epistles might be useful "sometimes," but that "the Christian religion had not added much to morality."Boswell, in his journal on 26 September 1764, records the following conversation with Castillon when visiting the Court of Dessau :-
Where are all my gloomy speculations at Utrecht, when I imagined that I knew all the circumstances that could arrive in human life, and that the result was only insipidity? Castillon gave me no bad answer to this. "You know," said he, "all the circumstances of human life, as you know the ingredients of which a dish may be made; but in neither of the cases can you know what will be the effect of a selection and mixture, till you try.In 1765 Frederick the Great named Castillon 'Royal Astronomer' at the Berlin Observatory. He received further honours from foreign academies, being appointed a member of the Bologna Academy in 1768, the Mannheim Academy in 1777, the Padua Academy in 1784, and the Prague Academy in 1785. Lagrange had been Director of the Mathematics Section of the Berlin Academy of Science from 6 November 1766 to 18 May 1787 when he left Berlin. At this time Castillon was appointed Director of the Mathematics Section, a role he kept until his death. However, in November 1787 he suffered a stroke from which he recovered mentally, but not physically. After his death his only surviving child, his son Maximilian Friedrich Gustav Adolf, wrote an eulogy to his father  which was published by the Berlin Academy of Science.
We have already noted his two mathematical papers in the 1740s. He also studied conic sections, cubic equations and artillery problems. Among his later mathematical publications we note: Mémoire sur la règle de Cardan, et sur les équations cubique, avec quelques remarques sur les équations en général Ⓣ (1783) and two memoirs in 1790 and 1791 entitled Examen philosophique de quelque principes de l'algèbre Ⓣ. He is also known for 'Castillon's problem' which is:-
To inscribe in a given circle a triangle the sides of which pass through three given points.This problem was posed by Gabriel Cramer and solved by Castillon in 1776. Calinger  writes about the style of Castillon's mathematics:-
Throughout his mathematical work there is a preference for synthetic, as opposed to analytic, geometry, which is perhaps a reflection of his preoccupation with Newton's mathematics.Finally let us examine the rather puzzling question about Castillon's religious beliefs. He certainly was an atheist as a young man and later converted to Calvinism. However, his views on Christianity, as quoted above in his conversations with Boswell, show that he did not hold conventional Calvinist beliefs. The situation becomes even more complicated when we examine the religious views he expressed in his publications and the particular works he chose to translate. For example Castillon's 1771 translation of Observations on the System of Nature (1770) by Paul-Henri Dietrich d'Holbach :-
... amply answered the atheism of d'Holbach, in subtle confutation of the brief and wholly political, even inflammatory, answer of Frederick Castillon's work reintroduced the principles of up-to-date Protestant theology from Clarke to Bonnet, his themes running from the existence of God... to the notion of virtue as philanthropy and dedication to the common good, which he identified with Christianity.In 1774 Castillon published his translation of the English translation (yes - it was a translation of a translation) by Charles Blount of Philostratus's Life of Apollonius of Tyane. This was an extremely anti-Christian work and seen as such at the time that Castillon translated it. By 1774 Castillon was working for Frederick the Great who believed in rational argument and was sceptical of religious beliefs. Carlo Antonio Pilati wrote the following in his book Voyages en Différents Pays de l'Europe en 1774, 1775, et 1776 published in 1777:-
This M Castillon is a mathematician who greatly loves theology, against the ordinary custom of mathematicians who are attached only to demonstrations; I think that the king wanted to mortify him for the theological books he has written by ordering him to translate into French the life of Apollonius of Thyane written by Philostratus, of which there is an English translation, at least of the first two books, to which the translator has adjoined notes very likely to clash with all species of theology; the king wanted M Castillon to begin his French translation of that translation without omitting the notes.In  John Laursen argues that Castillon's translation from Latin into French of Cicero's Academica, published in 1779, was again required by Frederick 'intended to mortify the pious'. In  examples are given of how Castillon worked Christian ideas into his translation 'under the guise of providing interpretative guidance and scholarly apparatus'. However, the remarks he made to Boswell suggest he was not really as 'pious' as his published works made him appear. Lustig suggests that he was deliberately being cautious in his published works :-
That would explain Boswell's commiserating with him for having had to hide his philosophical thought while in Utrecht.It is also possible that once he went to Berlin, Castillon was influenced by Leonhard Euler who was a very devout Christian.
Article by: J J O'Connor and E F Robertson