The Analyst, subtitled "A DISCOURSE Addressed to an Infidel MATHEMATICIAN. WHEREIN It is examined whether the Object, Principles, and Inferences of the modern Analysis are more distinctly conceived, or more evidently deduced, than Religious Mysteries and Points of Faith", is a book published by George Berkeley in 1734. The "infidel mathematician" is believed to have been Edmond Halley, though others have speculated Sir Isaac Newton was intended. See (Burton 1997, 477).
From his earliest days as a writer, Berkeley had taken up his satirical pen to attack what were then called 'free-thinkers' (secularists, skeptics, agnostics, atheists, etc.--in short, anyone who doubted the truths of received Christian religion or called for a diminution of religion in public life). In 1732, in the latest installment in this effort, Berkeley published his Alciphron, a series of dialogues directed at different types of 'free-thinkers'. One of the archetypes Berkeley addressed was the secular scientist, who discarded Christian mysteries as unnecessary superstitions, and declared his confidence in the certainty of human reason and science. Against his arguments, Berkeley mounted a subtle defense of the validity and usefulness of these elements of the Christian faith.
Alciphron was widely read and caused a bit of a stir. But it was an offhand comment mocking Berkeley's arguments by the 'free-thinking' royal astronomer Sir Edmund Halley that prompted Berkeley to pick up his pen again and try a new tack. The result was The Analyst, conceived as a satire attacking the foundations of mathematics with the same vigor and style as 'free-thinkers' routinely attacked religious truths.
Berkeley sought to take mathematics apart, claimed to uncover numerous gaps in proof, attacked the use of infinitesimals, the diagonal of the unit square, the very existence of numbers, etc. The general point was not so much to mock mathematics or mathematicians, but rather to show that mathematicians, like Christians, relied upon incomprehensible 'mysteries' in the foundations of their reasoning. Moreover, the existence of these 'superstitions' was not fatal to mathematical reasoning, indeed it was an aid. So too with the Christian faithful and their 'mysteries'. Berkeley concluded that the certainty of mathematics is no greater than the certainty of religion.
...the fallacious way of proceeding to a certain Point on the Supposition of an Increment, and then at once shifting your Supposition to that of no Increment . . . Since if this second Supposition had been made before the common Division by o, all had vanished at once, and you must have got nothing by your Supposition. Whereas by this Artifice of first dividing, and then changing your Supposition, you retain 1 and nxn-1. But, notwithstanding all this address to cover it, the fallacy is still the same.
Its most frequently quoted passage:
And what are these Fluxions? The Velocities of evanescent Increments? And what are these same evanescent Increments? They are neither finite Quantities nor Quantities infinitely small, nor yet nothing. May we not call them the ghosts of departed quantities?
Berkeley did not dispute the results of calculus; he acknowledged the results were true. The thrust of his criticism was that Calculus was not more logically rigorous than religion. He instead questioned whether mathematicians "submit to Authority, take things upon Trust" just as followers of religious tenets did. According to Burton, Berkeley introduced an ingenious theory of compensating errors that were meant to explain the correctness of the results of calculus. Berkeley contended that the practitioners of calculus introduced several errors which cancelled, leaving the correct answer. In his own words, "by virtue of a two fold mistake you arrive, though not at science, yet truth."
The idea that Newton was the intended recipient of the discourse is put into doubt by a passage that appears toward the end of the book: "Query 58: Whether it be really an effect of Thinking, that the same Men admire the great author for his Fluxions, and deride him for his Religion?" 
Here Berkeley ridicules those who celebrate Newton (the inventor of "fluxions", roughly equivalent to the differentials of later versions of the differential calculus) as a genius while deriding his well-known religiosity. Since Berkeley is here explicitly calling attention to Newton's religious faith, that seems to indicate he did not mean his readers to identify the "infidel (i.e., lacking faith) mathematician" with Newton.
Mathematics historian Judith Grabiner comments, "Berkeley's criticisms of the rigor of the calculus were witty, unkind, and -- with respect to the mathematical practices he was criticizing -- essentially correct" (Grabiner 1997). While his critiques of the mathematical practices were sound, his essay has been criticized on logical and philosophical grounds.
For example, David Sherry argues that Berkeley's criticism of infinitesimal calculus consists of a logical criticism and a metaphysical criticism. The logical criticism is that of a fallacia suppositionis, which means gaining points in an argument by means of one assumption and, while keeping those points, concluding the argument with a contradictory assumption. The metaphysical criticism is a challenge to the existence itself of concepts such as fluxions, moments, and infinitesimals, and is rooted in Berkeley's empiricist philosophy which tolerates no expression without a referent (Sherry 1987). Andersen (2011) showed that Berkeley's doctrine of the compensation of errors contains a logical circularity. Namely, Berkeley relies upon Apollonius's determination of the tangent of the parabola in Berkeley's own determination of the derivative of the quadratic function.
Two years after this publication, Thomas Bayes published anonymously "An Introduction to the Doctrine of Fluxions, and a Defence of the Mathematicians Against the Objections of the Author of the Analyst" (1736), in which he defended the logical foundation of Isaac Newton's calculus against the criticism outlined in The Analyst. Colin Maclaurin's two-volume Treatise of Fluxions published in 1742 also began as a response to Berkeley attacks, intended to show that Newton's calculus was rigorous by reducing it to the methods of Greek geometry (Grabiner 1997).
Despite these attempts calculus continued to be developed using non-rigorous methods until around 1830 when Augustin Cauchy, and later Bernhard Riemann and Karl Weierstrass, redefined the derivative and integral using a rigorous definition of the concept of limit. The concept of using limits as a foundation for calculus had been suggested by d'Alembert, but d'Alembert's definition was not rigorous by modern standards (Burton 1997). The concept of limits had already appeared in the work of Newton (Pourciau 2001), but was not stated with sufficient clarity to hold up to the criticism of Berkeley (Edwards 1994).
In 1966, Abraham Robinson introduced Non-standard Analysis, which provided a rigorous foundation for working with infinitely small quantities. This provided another way of putting calculus on a mathematically rigorous foundation that was in a similar spirit to the way calculus was done before the (?, ?)-definition of limit had been fully developed.
Towards the end of The Analyst, Berkeley addresses possible justifications for the foundations of calculus that mathematicians may put forward. In response to the idea fluxions could be defined using ultimate ratios of vanishing quantities (Boyer 1991) harv error: no target: CITEREFBoyer1991 (help), Berkeley wrote:
It must, indeed, be acknowledged, that [Newton] used Fluxions, like the Scaffold of a building, as things to be laid aside or got rid of, as soon as finite Lines were found proportional to them. But then these finite Exponents are found by the help of Fluxions. Whatever therefore is got by such Exponents and Proportions is to be ascribed to Fluxions: which must therefore be previously understood. And what are these Fluxions? The Velocities of evanescent Increments? And what are these same evanescent Increments? They are neither finite Quantities nor Quantities infinitely small, nor yet nothing. May we not call them the Ghosts of departed Quantities?
Edwards describes this as the most memorable point of the book (Edwards 1994). Katz and Sherry argue that the expression was intended to address both infinitesimals and Newton's theory of fluxions. (Katz & Sherry 2012)
Today the phrase "ghosts of departed quantities" is also used when discussing Berkeley's attacks on other possible foundations of Calculus. In particular it is used when discussing infinitesimals (Arkeryd 2005), but it is also used when discussing differentials (Leader 1986), and adequality (Kleiner & Movshovitz-Hadar 1994).
The Analyst is also reproduced, with commentary, in recent works:
Ewald concludes that Berkeley's objections to the calculus of his day were mostly well taken at the time.