text:
Universal genius

 A 1974 cover story article on Iranian polymath Abu Al-Biruni, who is described as a universal genius, for his his multifarious work in astronomy, history, botany, pharmacology, geology, poetry, philosophy, mathematics, geography, and comparative religion, and the humanities. [2]
In intelligence rankings, universal genius is a term used to signify a genius, polymath, or person with a great or varied learning, albeit to a heightened degree, with a near universal grasp of knowledge, in possession of a mean IQ of 195 range (mean IQs of those listed below) or at a minimum an IQ of 170, of which there are about a dozen known. [1]

The following page lists the known group of people called “universal geniuses”, the foremost example being Leonardo da Vinci, to whom it seems this term was first invented, since becoming his tag line, so to speak, along with: Gottfried Leibniz, Johann Goethe, Hermann Helmholtz, Emanuel Swedenborg, Albert Einstein, John Neumann, Benjamin Franklin, Homer, Richard Wagner, and Abu Al-Biruni, Hypatia, among others (a work in progress).

The following is the list of the known and cited-to-be "universal geniuses", in chronological order, according to year of reaction end (death):

Homer (800-701BC)

“Goethe was a universal genius such as even Greece had not known, except perhaps (who can say?) in Homer.”
Humphry Trevelyan (1981), Goethe and the Greeks [11]

“Temple praises Homer as 'the greatest universal genius'.”
Kirsti Simonsuuri (2010), Homer’s Original Genius [16]

Hypatia (350-415)

“In Fact, the only woman acknowledged as a universal genius [is] Hypatia, a somewhat obscure and mysterious woman of ancient times.”
Julie Creech (c.2005) [16]

Abu Al-Biruni (973-1048)

● Gafurov, Bobojan. (1974). “Al-Biruni: A Universal Genius in Central Asia a Thousand Years Ago”, Courier (pgs. 4-9), Jun.
 An online/book/museum showcase of the mind of Leonardo Da Vinci, at the Institute and Museum of the History of Science, Florence, Italy. [31]

Da Vinci (1452-1519)

“That ‘universal genius’ Leonardo da Vinci, as Freud called him, had enlisted Freud’s interest years before he ventured to write on ‘this great and mysterious man’.”
— Peter Gay (1964), “Introduction” to Sigmund Freud: Leonardo da Vinci and a Memory of His Childhood [30]

“Freud had long been fascinated by the enigma which represented for a psychoanalyst the life and work of the universal genius of the Renaissance that was Leonardo da Vinci. His study of Leonardo, written in 1910, enabled Freud to introduce several fundamental psychoanalytic concepts such as sublimation and narcissism and to describe a particular type of homosexuality.”
— Jean-Michel Quinodoz (2005). Reading Freud: A Chronological Exploration of Freud’s Writings [32]

● Silvestri, Paolo de. (2009). Leonardo or the Universal Genius. ATS Italia Editrice.
Leonardo da Vinci: Universal Genius (BBC, 2007) – YouTube.

Erasmus (1466-1536)

“Erasmus was a man of universal genius whose rare capacities would have surfaced in any age and under any circumstances.”
— Daniel Robinson (1995), An Intellectual History of Psychology (pg. 137)

 A Leipzig University stature of Gottfried Leibniz and “universal genius” caption (link).

Leibniz (1646-1716)

“The trend towards the already mentioned diversified society of ‘specialists’ and the related danger of narrower way of thinking (idiot savant) necessarily leads to a growing helplessness of the individual. Related to this is a growing blind belief in science. Since Leibnitz, probably the last universal genius, we know more and more about a shrinking area of knowledge. Biology and physics, chemistry and medicine are divided already today into dozens of individual disciplines, which like a ‘hydra’, keep dividing into other individual disciplines.”
— Hans-Wolff Graf (1995), “We Need a New World View” [21]

“Leibniz was maybe the last universal genius incessantly active in fields of theology, philosophy, mathematics, physics, engineering, history, diplomacy, philology and many others.”
— K. Eriksson (1996), Computational Differential Equations [20]

“Having already postulated differential and integral calculus by the time he visited Spinoza at The Hague, Leibniz spent the next several years of his life developing theories of knowledge and truth that resulted in hundreds of essays and dozens of key encounters with other thinkers that in turn spurred them on to great discoveries and formulations. In his time a belief arose that he was the last universal genius, a judgment made about Goethe that the great minds of Europe were to make three generations later.”
— Larry Peer and Diane Hoeveler (1998), “A Lens for Comparative Romanticisms” [22]

“Remarkable for his encyclopedic knowledge and diverse accomplishments outside the fields of philosophy and mathematics, he was perhaps the last universal genius, spanning the whole of contemporary knowledge.”
Staff (2003). The Houghton Mifflin Dictionary of Biography [12]

“Remembered for his philosophy of ‘preestablished harmony’ on one hand and his bitter feud with Isaac Newton of the invention of calculus on the other, Leibniz was, according to one modern writer, the ‘last universal genius.’ His famous claim that this is the ‘best of all possible worlds’, was later ridiculed by Voltaire in Candide.
— Alan Cutler (2004),The Seashell on the Mountaintop [13]

“Leibniz was one of the greatest geniuses in the history of human thought, perhaps the last universal genius.”
Peter Kreeft (2009), Socrates Meets Kant [14]

“Many consider Gottfried Leibniz history’s last universal genius, a walking encyclopedia of the already-known and inventor of the radically new who juggled so many ambitious projects that he designed a chair in which he could both sleep and work, so as to not waste a minute moving from one location to another.”
— Jeffrey Tlumak (2013), Classical Modern Philosophy [19]

The Universal Genius: Gottfried Leibniz (quote: "known as the last universal genius") (2010) – The Philosopher’s Zone, ABC.net.
Leibniz: Universal Genius: Inventor of Calculus and Binary systems – by Jürgen Schmidhuber, Dalle Molle Institute for Artificial Intelligence.

Swedenborg (1688-1772)

● Groll, Ursula. (2011). “Swedenborg: a Universal Genius”, lecture, Swedenborg Center, Apr 1.

Haller (1708-1777)

“A poet, anatomist, physiologist, botanist, and doctor. Thoughout his life, he continued to do research and to publish in his various fields. Like Leibniz before him, he was known, even in his own time, as ‘the last universal genius’.”
— William Youngren (2003), C.P.E. Bach and the Rebirth of the Strophic Song [26]

Franklin (1706-1790)

● Morison, Sameul E. (1959). “Ben Franklin: the Universal Genius”, address upon the occasion of the publishing of Volume 1 of Labaree ed. Papers of Benjamin Franklin, at New Haven, Nov 22.
● Lemay, J. A. Leo. (date). “Benjamin Franklin: Universal Genius”, The Renaissance Man in the Eighteenth Century, Publisher.
 German polymath Johann Goethe had a 5,000 book personal library, 142 volumes comprise the entirety of his literary output, on topics ranging from: poetry, botany, chemistry, zoology, anatomy, physics, mathematics, nearly every topic, astronomy aside, and he currenty ranks second behind Shakespeare according to WorldCat library holdings.

Goethe (1749-1832)

“Scholars agree that Goethe was the last universal genius: practically nothing within reach of the human mind escaped his attention.”
Walter Wadepuhl (1932), Goethe’s Interest in the New World [3]

“The middle of the eighteenth century witnessed the first powerful revolt against cultural tradition, which is marked by Rousseau. This tradition was restarted by universal genius Goethe. But it was restarted for the last time. Goethe had not been succeeded by another universal genius. He had a very clear consciousness of belonging to this tradition. He pointed to Homer, to Plato, to Aristotle, and to the Bible as its foundations. He was stepping into the shoes elders, many of whom he thought greater than himself. History was to him a sequence of great minds which commanded respect and loyalty. Viewed in the light of the present, he seems to be nearer to Dante and to Shakespeare than to us. He is the last link of that golden chain. Yet he is not too remote from us. We can still grasp that link.”
— Ernst Curtius (1949), “The Medieval Bases of Western Thought” [24]

“We often hear that Goethe was the last man in the world who was a universal genius. By this it is meant that he can be compared with a figure of the Renaissance such as Leonardo da Vinci. To me it never seems that Goethe fills happily the role of modern Leonardo. He is called the last universal genius, of course, because it is impossible to think of anyone born after his time acquiring so much knowledge in so many fields. After his time, no man could be poet, administrator and man of science.”
— Stephen Spender (1950) [10]

“Goethe is often referred to as the last polyhistorian, and is considered the last universal genius with far-reaching interests and the ability to be creative in the most diverse fields. These few giants mark the end of what could be called the Renaissance genius.”
— Walter Sorell (1970), The Duality of Vision: Genius and Versatility in the Arts [25]

“Goethe comes as close to deserving the title of a universal genius as any man who has ever lived.”
Sterling Brown (1973)

“Goethe was a universal genius such as even Greece had not known, except perhaps (who can say?) in Homer.”
— Humphry Trevelyan (1981), Goethe and the Greeks [11]

“To us, Goethe seems an end rather than a beginning: the last universal genius capable of embodying a tradition stretching from the dawn of Greek civilization to his own day; the last man in history able to take all learning for his province; the last incarnation of the humanistic ideal of harmonious individual development.”
— Gustaf Cromphout (1990), Emerson’s Modernity and the Example of Goethe [29]

“Goethe needed to assert himself as an Universalgenie (Sengle repeatedly debunks this to his mind pernicious myth) because of Weimar’s political and geographical position, because of his profession as a courtier, because of his literary and position; the only explanation not offered is that he had a genuine interest in the full range of his activities.”
— Jane Brown (1992), ““Book Review: Sengle, Friedrich, Neuses zu Goethe: Essays und Vortrage” [23]

“Having already postulated differential and integral calculus by the time he visited Spinoza at The Hague, Leibniz spent the next several years of his life developing theories of knowledge and truth that resulted in hundreds of essays and dozens of key encounters with other thinkers that in turn spurred them on to great discoveries and formulations. In his time a belief arose that he was the last universal genius, a judgment made about Goethe that the great minds of Europe were to make three generations later.”
— Larry Peer and Diane Hoeveler (1998), “A Lens for Comparative Romanticisms” [22]

“Since my method is juxtaposition, I delight in bringing together universal genius Goethe, with Sigmund Freud, Samuel Johnson, and Thomas Mann.”
— Harold Bloom (2002), Genius: A Mosaic of One-Hundred Exemplary Creative Minds

● Donat, Sebastian. (2004). Goethe: A Last Universal Genius? Munchen: Wallstein.
 A photo of universal genius Alexander Humboldt (IQ=185) reading in his personal library. [18]

Humboldt (1769-1859)

“Humboldt's apartment on Oranienburger Strasse 67 in Berlin was the first think tank of the world. From here, he built a network including all great scientists of the time using pen and paper - he left more than 50,000 letters. Humboldt is the most recognized universal genius in intellectual history, the first to see the world as a whole: He discovered that all aspects of the world are intertwined.”
The Atlantic Times (2009), “The Conqueror with a Butterfly Net” [18]

Wagner (1813-1883)

● Seung, T.K. (2006). Goethe, Nietzsche, and Wagner: their Spinozan Epics of Love and Power (universal genius, pg. 280). Lexington Books.

Helmholtz (1821-1894)

“The matter of multiplicity of contributors needs no great explanation, for we are all used to this in the modern handbooks. I believe it is a common saying that Helmholtz was the last universal genius, and we are fast arriving at the point where even a single subject becomes too vast for one man. At any rate, whether or not any of my learned colleagues could write an entire chemical engineering handbook, I could not—hence the present form.”
Donald Liddell (1922) Handbook of Chemical Engineering, McGraw-Hill [2]

“Helmholtz, on the other hand, achieved preeminent success within the scientific community. He is regarded by some as the last universal genius, the last Renaissance man.”
Harold Morowitz (1981), The Wine of Life, and Other Essays on Societies, Energy, & Living Things [27]

Rizal (1861-1896)

“Recently, Thomas L.U. Szenes, in a fine analysis of the phenomenon Rizal, called him the ‘last universal genius’. Szenes said: ‘the Germans have a felicitous name for it—‘Universalgenie’, denoting an exceptional type of man who shows superior aptitude in whatever mental activity he chooses to pursue.”
— Diosdado Capino (1982). Stories on Rizal’s Character, Teachings, Examples [28]

Pioncare (1854-1915)

“The earliest work in radar polarimetry is found in the early 1950s [Sinclair, 1950]. The theory was inspired by the work of Stokes [Stokes, 1852] and of the ‘last universal genius’ Poincare [1989], both of whom laid the basis for a unified formalism for electromagnetic waves, regardless of their state of polarization.”
— Massonnet Didier and Jean-Claude Souyris (2008), Imaging with Synthetic Aperture Radar [15]

Einstein (1879-1955)

● Whitaker, Andrew. (2006). Einstein, Bohr, and the Quantum Dilemma: from Quantum Theory to Quantum Information (§: Albert Einstein: universal genius, pg. 6-). Cambridge University Press.
● Neffe, Jurgen. (2007). Einstein: a Biography (universal genius, pg. 306). Macmillan.
● Venezia, Mike. (2009). Albert Einstein: Universal Genius (Getting to Know the World’s Greatest Inventors and Scientists) (abs). Childrens Press.
 Universal genius John Neumann with the stored-program computer at the Institute for Advanced Study, Princeton, New Jersey, in 1945.

Neumann (1903-1957)

“The most radically diverse thinker of the twentieth century was a mathematician: the Hungarian John von Neumann. He quite consciously cultivated this diversity, which led him apparently effortlessly from mathematical logic to quantum physics or from hydrodynamics to meteorology. At times it seems that he directed his interest towards a new field precisely because it was different than anything he had ever done before. For this reason, it would have greatly fascinated him that two completely separate fields, which eh created, have grown together in a surprisingly natural way. First, there is game theory, which he (and his Austrian friend, Oskar Morgenstern) created as a tool for economics. Second, there are the models for artificial life, which his Polish friend, Stanislav Ulam, suggested and for which von Neumann designed, using cellular automatons. This method of combining abstract biology and theoretical economics only became viable with the development of computers, which as is well known, von Neumann influenced more than anybody else. This rounds off the portrait of a universal genius comparable only to Leonardo or Leibniz.”
— Karl Sigmund (2005), “Game Theory and Artificial Life” [7]

“As soon as brilliant people invented the computer, other brilliant people made it better. One of these was John Neumann of the Institute for Advanced Study. Von Neumann was a universal genius. Certain unsolved problems of the ENIAC entranced him, and he wrote out a paper laying out what he believed should be the ‘architecture’ or logic of computers. This included a control to tell the computer what to do and when. Some have called him ‘father of the computer’.”
— James Davis (2004), The Human Story [8]

“Von Neumann, a mathematical universal genius, was interested in the construction of models of living systems, in particular with respect to their ability of self-reproduction.”
— Jeurgen Kleuver and Christina Kleuver (2011), Social Understanding [9]

 Thermodynamics electromagnetics relativity quantum mechanics $N = - \int \frac{dQ}{T} \,$ $i \hbar \frac{\partial}{\partial t}\Psi = \hat H \Psi$ Physics high energy physics Chemistry humanities $F = ma \,$ A sampling of the some of the main intellectual road blocks a "modern" universal genius needs to grapple with, in order to have a modern "universal' understanding of reality.
Idiot savant syndrome | Discussion | 1950s-present
See main: Hydraism
Chronologically, American chemical engineer and mathematician John Neumann, who met his reaction end in 1957, seems to be the "last" of the last known referred-to-as "last universal geniuses", although, to note, no actual citation of the specific term "last universal genius" + "Neumann" can be found. To requote, the following 1995 statement by German social economist Hans-Wolff Graf seems to well-situate the crux of the issue: [21]

“The trend towards the already mentioned diversified society of ‘specialists’ and the related danger of narrower way of thinking (idiot savant) necessarily leads to a growing helplessness of the individual. Related to this is a growing blind belief in science. Since Leibnitz, probably the last universal genius, we know more and more about a shrinking area of knowledge. Biology and physics, chemistry and medicine are divided already today into dozens of individual disciplines, which like a ‘hydra’, keep dividing into other individual disciplines.”

The only other person that comes to mind, following Neumann, is American IQ:225+ cited, former child prodigy (as was Neumann), youngest-ever (age 13) winner of the international Physics Olympiad, thinker Christopher Hirata, noted for his age-17 written circa 2000 human chemical thermodynamics based "Physics of Relationships" theory; presently an astrophysics professor at Ohio State University, working on gravitational lensing, relativity, dark energy, and accelerating universe problems, among other topics on modern astronomy. Hirata is also listed, according to OnlineColleges.net., among “the 10 youngest PhDs of all time” (Neumann, similarly, simultaneously completed a BS in chemical engineering and PhD in mathematics at age 23). [33] Presently, however, Hirata has disassociated himself from relationship physics, and seems to now only confine himself to physical-astronomy problems.

Also, of note, the association of Einstein as a universal genius seems to be a misnomer or over-glorified label, being that Einstein, generally speaking, give or take a few philosophical excursions, only excelled in one field, namely that of pure and applied mathematical physics (radiation thermodynamics and relativity), and notably failed entrance exams in other subjects, and also fumbled famously on the question of how to explain love in the context of modern chemistry and physics.

Last universal genius of "subjects"
See also: Last universal genius; Last person to know everything; Greatest physicist of all time
Of this universal geniuses (list below), only three: Leibniz (1646-1716), Goethe (1749-1832), and Helmholtz (1821-1894), the middle of these three in the most predominant manner, are frequently assigned the very rarefied epitaph of "last universal genius", as shown in bolded text format below, of which the mean IQ of this group is 207, which can be taken as the mean IQ for an archetype last universal genius. [17]

Of significant note, one who (since the 1980s) as been frequently called the "last universal physicist" is Enrico Fermi (1901-1954). [5] To exemplify, Emilio Segrè called Fermi “the last universal physicist in the tradition of great men of the 19th century” and “the last person who knew all of physics of his day”. [6]

Quotes
The following are related quotes:

“Universality is the distinguishing mark of genius. There is no such thing as a special genius, a genius for mathematics, or for music, or even for chess, but only a universal genius. The theory of special genius, according to which for instance, it is supposed that a musical genius should be a fool at other subjects, confuses genius with talent. There are many kinds of talent, but only one kind of genius, and that is able to choose any kind of talent and master it.”
Otto Weininger (1903), Sex and Character [34]

Grotius, Leibnitz, Goethe, three universal geniuses, the evidence of whose overpowering intellect appeared and was recognized in earliest childhood as it was later in their youth, are doubtless among the greatest minds with whom this study is concerned. A minimum childhood IQ for these cannot be less than 180. A maximum is probably close to the maximum for the human race.”
Catherine Cox (1926), Early Mental Traits of Three Hundred Geniuses (pg. 155)

References
1. Universal genius (redirect to polymath) – theFreeDictionary.com.
2. Gafurov, Bobojan. (1974). “Al-Biruni: A Universal Genius in Central Asia a Thousand Years Ago”, Courier (pgs. 4-9), Jun.
3. Wadepuhl, Walter. (1932). Goethe’s Interest in the New World (pg. 7). Publisher.
5. (a) Rafelski, Johann. (1984). Why and How in Theoretical Physics (pg. 3). University of Cape Town.
(b) Cronin, James W. (2004). Fermi Remembered (pg. 31). University of Chicago Press.
(c) Author. (2005). “The Last Universal Physicist”, Physics World, Apr. 1.
(d) Martin, Brian R. (2009). Nuclear and Particle Physics (quote: “Enrico Fermi was probably the last ‘universal physicist’.” pg. 69). Wiley.
6. Holton, James G. (1978). The Scientific Imagination (pg. 157). CUP Archive.
7. Sigmund, Karl. (2005). “Game Theory and Artificial Life”, Beyond Art: A Third Culture: A Comparative Study in Cultures, Art and Science in 20th Century Austria and Hungary (editor: Peter Weibel) (pg. 416). Springer.
8. Davis, James C. (2004). The Human Story: Our History, From the Stone Age to Today (pg. 422). HarperCollins.
9. Kleuver, Jeurgen, and Kleuver, Christina. (2011). Social Understanding: On Hermeneutics, Geometrical Models, and Artificial Intelligence (pg. 10). Springer.
10. Spender, Stephen. (1950). “Article”, The Listener (pg. 151). Vol. 44.
11. Trevelyan, Humphry. (1981). Goethe and the Greeks (pg. 199). Cambridge University Press.
12. Staff. (2003). The Houghton Mifflin Dictionary of Biography (quote: pg. 913). Houghton Mifflin Harcourt.
13. Cutler, Alan. (2004). The Seashell on the Mountaintop: How Nicolaus Steno Solved the Ancient Mystery and Created the Science of the Earth (pg. #). Penguin.
14. Kreeft, Peter. (2009). Socrates Meets Kant (pg. 24). Ignantius Press.
15. Didier, Massonnet, and Souyris, Jean-Claude. (2008). Imaging with Synthetic Aperture Radar (pg. 229). CRC Press.
16. Simonsuuri, Kirsti. (2010). Homer’s Original Genius: Eighteenth-Century Notions of the Early Greek Epic (1688-1798) (pg. 163). Cambridge University Press.
17. Julie E. Creech, founder Hypatia Society.
Liddell. Donald M. (1922). Handbook of Chemical Engineering, Volume 1 (quote, pg. ix). McGraw-Hill Company.
18. Staff. (2009). “The Conqueror with a Butterfly Net”, The Atlantic Times, May.
19. Tlumak, Jeffrey. (2013). Classical Modern Philosophy: A Contemporary Introduction (pg. #). Roiutledge.
20. Eriksson, K. (1996). Computational Differential Equations (pg. 19). Cambridge University Press.
21. Graff, Hans-Wolff. (1995). “Conclusion: We Need a New World View” (pgs. 228-36), in The Path Toward Global Survival: A Social and Economic Study of 162 Countries (editor: Hans-Wolff Graf) (pg. 229). Gordon and Breach Publishers.
22. Peer, Larry H. and Hoeveler, Diane L. (1998). “Introduction: A Lens for Comparative Romanticisms” (pgs. 1-), in: Comparative Romanticisms: Power, Gender, Subjectivity (editors: Larry H. Peer, Diane Long Hoever) (pg. 2). Camden House.
23. Brown, Jane K. (1992). “Book Review: Sengle, Friedrich, Neuses zu Goethe: Essays und Vortrage. Stuttgart: Metzler, 1989” (universal genius, pg. 217), in: Goethe Yearbook, Boydell & Brewer.
24. Curtius, Ernst. (1949). “The Medieval Bases of Western Thought”, in: European Literature and the Latin Middle Ages (pg. 589). Princeton University Press, 1991.
25. Sorell, Walter. (1970). The Duality of Vision: Genius and Versatility in the Arts (pg. 40). Thames & Hudson.
26. Youngren, William. (2003), C.P.E. Bach and the Rebirth of the Strophic Song (pg. 243). Scarecrow Press.
27. Morowitz, Harold J. (1981). The Wine of Life, and Other Essays on Societies, Energy, & Living Things (pg. 104). Bantam Books.
28. Capino, Diosdado G. (1982). Stories on Rizal’s Character, Teachings, Examples (pg. 277). Manlkapaz Pub. Co.
29. Cromphout, Gustaf. (1990). Emerson’s Modernity and the Example of Goethe (pg. 14). University of Missouri Press.
30. Gay, Peter. (1964). “Introduction”, in: Sigmund Freud: Leonardo da Vinci and a Memory of His Childhood (pg. xxiii). W.W. Norton & Co.
31. (a) The Mind of Leonardo: the Universal Genius at Work – Institute and Museum of the History of Science, Florence, Italy.
(b) Galluzzi, Paolo. (2006). The Mind of Leonardo: the Universal Genius at Work. Giunti.
32. Quinodoz, Jean-Michel. (2005). Reading Freud: A Chronological Exploration of Freud’s Writings (pg. 94). Taylor & Francis.
33. Staff. (2012). “The 10 Youngest PhDs of All Time”, OnlineColleges.net, Apr 02.
34. (a) Weininger, Otto. (1903). Eros and Psyche or Sex and Character: A Fundamental Investigation (Geschlecht und Charakter: Eine prinzipielle Untersuchung) (pg. 112). Vienna: Braumüller & Co, 1906.
(b) Otto Weininger – Wikiquote.


text:
# 17.E: Exercises

## 17.1: Common-Ion Effect in Acid-Base Equilibria

### Questions

1. The solubility product Ksp for bismuth sulfide $$\ce{Bi2S3}$$ is $$1.6 \times 10^{-72}$$ at 25 °C. What is the molar solubility of bismuth sulfide in a solution that is 0.0010 M in sodium sulfide $$\ce{Na2S}$$?
2. John poured 1.0 mL of 0.10 M $$\ce{NaCl}$$, 1.0 mL of 0.10 M $$\ce{KOH}$$, and 1.0 mL 0.20 $$\ce{HCl}$$ solutions together and then he made the total volume to be 100.0 mL. What is the $$\ce{[Cl- ]}$$ in the final solution?
3. The Ksp for $$\ce{AgCl}$$ is $$1.0 \times 10^{-10}$$. From which of the following solutions would silver chloride precipitate?
A: A solution 0.10 M in $$\ce{Ag+}$$ and 1.00 M in $$\ce{Cl-}$$
B: A solution $$1.0\times 10^{-5}\; M$$ in $$\ce{Ag+}$$ and 0.20 M in $$\ce{Cl-}$$
C: A solution $$1.0 \times 10^{-7}\; M$$ in $$\ce{Ag+}$$ and 1.0E-7 M in $$\ce{Cl-}$$
1. A only
2. B only
3. C only
4. A and B
5. A, B, and C
Substance Ksp
magnesium hydroxide $$1.2\times 10^{-11}$$
magnesium carbonate $$1.6\times 10^{-5}$$
magnesium fluoride $$6.4\times 10^{-9}$$
4. Addition of which of the following substances will cause the precipitation of a salt from one liter of a $$1\times 10^{-4}\; M$$ $$\ce{Mg^2+}$$ solution?
1. $$1\times 10^{-4}$$ mole NaOH
2. $$1\times 10^{-1}$$ mole nitric acid
3. $$1\times 10^{-5}$$ mole potassium acetate
4. $$1\times 10^{-4}$$ mole ammonium nitrate
5. $$1\times 10^{-2}$$ mole sodium fluoride
5. The Ksp for strontium chromate is $$3.6 \times 10^{-5}$$ and Ksp for barium chromate is $$1.2\times 10^{-10}$$. What concentration of potassium chromate will precipitate the maximum amount of either the barium or the strontium chromate from an equimolar 0.10 M solution of barium and strontium ions without precipitating the other?
6. Iron(II) hydroxide is only sparingly soluble in water at 25 °C; its Ksp is equal to $$7.9\times 10^{-16}$$. Calculate the solubility of iron(II) hydroxide in a solution of pH 6.0.

### Solutions

Consider...
x = molar solubility; (2x)2 (0.0010 + 3x)3 = Ksp; x = ?
Consider...
Evaluate $$\ce{[Na+]}$$, $$\ce{[K+]}$$, $$\ce{[H+]}$$ and $$\ce{[OH- ]}$$ for fun!
Consider...
Calculate the $$\ce{[Ag+] [Cl- ]}$$ for A, B, and C, and compare their values with Ksp.
Consider...
A lot of calculations to figure out, but it's a common ion problem.
Consider...
This problem requires some thinking.
Consider...
$$\ce{[OH- ]}$$ = 10(-14+6) = 1e-8. x * (1e-8 + x)2 = Ksp; x = ?

## 17.3: Acid-Base Indicators

### Q17.3.1

There are numerous natural indicators present in plants. The dye in red cabbage, the purple color of grapes, even the color of some flowers are some examples. What is the cause for some fruits to change color when they ripen?

#### S17.3.1

$$\ce{[H+]}$$ of the juice changes. The changes in pH or $$\ce{[H+]}$$ cause the dye to change color if their conjugate acid-base pairs have different colors. There may be other reasons too. Do colors indicate how good or bad they taste?

### Q17.3.2

Choose the true statement:

1. All weak acids are indicators.
2. All weak bases are indicators.
3. Weak acids and bases are indicators.
4. All indicators are weak acids.
5. An acid-base conjugate pair has different colors.
6. Any indicator changes color when the pH of its solution is 7.

#### S17.3.2

d. Color change is a requirement for indicators.

### Q17.3.3

Do all indicators change color at pH 7 (y/n)?

#### S17.3.3

No! Phenolphthalein changes color at pH ~9. Bromothymol blue has a pKn value of 7.1. At pH 7, its color changes from yellow to blue. Some indicators change color at pH other than 7.

## 17.6: Acid-Base Equilibrium Calculations: A Summary

17.E: Exercises is shared under a not declared license and was authored, remixed, and/or curated by LibreTexts.

format: plain


text:
# Algebra Examples

Solve Using the Square Root Property
Move all terms to the left side of the equation and simplify.
Move to the left side of the equation by subtracting it from both sides.
Subtract from to get .
Use the quadratic formula to find the solutions.
Substitute the values , , and into the quadratic formula and solve for .
Simplify.
Simplify the numerator.
Raise to the power of to get .
Multiply by to get .
Multiply by to get .
Simplify the denominator.
Rewrite.
Multiply by to get .
The final answer is the combination of both solutions.

We're sorry, we were unable to process your request at this time

Step-by-step work + explanations
•    Step-by-step work
•    Detailed explanations
•    Access anywhere
Access the steps on both the Mathway website and mobile apps
$--.--/month$--.--/year (--%)


text:
Last edited by Zutaxe
Tuesday, July 14, 2020 | History

3 edition of radon transform and some of its applications found in the catalog.

radon transform and some of its applications

Stanley R. Deans

# radon transform and some of its applications

## by Stanley R. Deans

Written in English

Subjects:

• Edition Notes

Classifications The Physical Object Statement Stanley R. Deans. LC Classifications QA649 .D4 1993 Pagination xi, 295 p. : Number of Pages 295 Open Library OL1700643M ISBN 10 0894647180 LC Control Number 92001004

Radon Transform Methods and Their Applications in Mapping Mantle Reﬂectivity Structure Yu Jeffrey Gu Æ Mauricio Sacchi Received: 26 October /Accepted: 1 June Springer Science+Business Media B.V. Abstract This paper reviews the fundamentals of Radon-based methods using examples from global seismic applications. Radon in water originates from the decay of Ra, which is either dissolved in water or localized in rock or soil minerals in contact with water. Most of the radon in water originates from Ra in minerals from where radon gas diffuses into pore spaces and dissolves in soil or ground water. Hence, most of radon in water is unsupported and therefore its concentration in water is often.

The Radon transform is an important topic in integral geometry which deals with the problem of expressing a function on a manifold in terms of its integrals over certain submanifolds. Solutions to such problems have a wide range of applications, namely to partial differential equations, group representations, X-ray technology, nuclear magnetic Brand: Birkhäuser Basel. This result, called the Fourier slice theorem, provides a method of inverting the Radon Fourier-transformed quantity d ˆ k u θ is simply the Fourier-transformed image m ˆ ˆ k x k y evaluated along radial lines in the (k x,k y) plane (Fig. ).If the Radon transform is known for all values of (u,θ), then the Fourier-transformed image is known for all (k x,k y), and since.

The Radon transform and, in particular, the corresponding inversion formula (i.e. the formula recovering from its Radon transform) is of central importance in tomography. References [a1] S.R. Deans, "The Radon transform and some of its applications", Wiley () [a2] S. Helgason, "The Radon transform", Birkhäuser (). Keywords: radon transform, tomography, medical imaging, inverse problems - Hide Description This book surveys the main mathematical ideas and techniques behind some well-established imaging modalities such as X-ray CT and emission tomography, as well as a variety of newly developing coupled-physics or hybrid techniques, including thermoacoustic.

You might also like
Mammals of Ohio

Mammals of Ohio

The study of literature

The study of literature

Caring for the widow and her family.

Caring for the widow and her family.

Estimates of the population of Missouri counties and metropolitan areas

Estimates of the population of Missouri counties and metropolitan areas

Books printed and sold at the Bible in George-Yard, Lombard-street

Books printed and sold at the Bible in George-Yard, Lombard-street

Labours next stop

Labours next stop

GSA guide to specifying interoperable building automation and control systems using ANSI/ASHRAE standard 135-1995, BACnet

GSA guide to specifying interoperable building automation and control systems using ANSI/ASHRAE standard 135-1995, BACnet

An exact narrative and description of the wonderfull and stupendious fire-works in honour of Their Majesties coronations

An exact narrative and description of the wonderfull and stupendious fire-works in honour of Their Majesties coronations

Money at work.

Money at work.

Anybody can do anything.

Anybody can do anything.

Anno regni Georgii III. Regis Magnæ Britanniæ, Franciæ & Hiberniæ, decimo tertio.

Anno regni Georgii III. Regis Magnæ Britanniæ, Franciæ & Hiberniæ, decimo tertio.

invertebrate

invertebrate

Top 10 Maui, Molokai & Lanai

Top 10 Maui, Molokai & Lanai

The director

The director

This book discusses the definition of the Radon transform, it's properties, it's relation to other transforms (Fourier, et al.), it's inverse, and so on. It is well documented. (It even contains a translation of Radon's original paper!) This book is the most useful source of such information I've found, so by: Browse and Read The Radon Transform And Some Of Its Applications The Radon Transform And Some Of Its Applications Find loads of the the radon transform and some of its applications book catalogues in this site as the choice of you visiting this page.

You can also join to the website book library that will show you numerous books from any Size: 3KB. Additional Physical Format: Online version: Deans, Stanley R. (Stanley Roderick), Radon transform and some of its applications. New York: Wiley, © Providing basic information about the properties of radon transform, this book contains examples and documents a wide variety of applications.

It offers guidance to literature related to transform, and is aimed at those with a basic undergraduate background in mathematics. Of value to mathematicians, physicists, engineers, and medical imaging scientists this excellent introduction to Radon transform covers both theory and applications.

It also features a rich array of examples and literature that forms a valuable reference. The author, a professor in the Department of Physics at the University of South Florida, wrote this pioneering work in declared its importance to the •eld. Radon was concerned with R2 and R3, but his work was extended to Rn and some more general spaces.

„e Radon transform for Cn is known as the Penrose transform and it is related to integral geometry (the modern approach to integral geometry was largely inspired by integral transforms, speci•cally the File Size: KB. Of value to mathematicians, physicists, and engineers, this excellent introduction to Radon transform covers both theory and applications, with a rich array of examples and literature that forms a valuable reference.

This edition is a revised and updated version by the author of his pioneering work. book The Radon transform and some of its applications Stanley R Deans Published in in New York NY) by Wiley Services. Reference details. More from. Stanley R Deans; More about. Radon transforms The Radon Transform and Some of Its Applications.

New York (N.Y.): Wiley, RIS:Cited by:   The Radon Transform and Some of Its Applications by Stanley R. Deans,available at Book Depository with free delivery worldwide/5(3).

The Radon transform is the mathematical basis of computed tomography and finds application in many other medical imaging modalities as well. In this chapter we present the fundamental mathematics of this transform and its inverse, with emphasis on the central-slice by:   Of value to mathematicians, physicists, engineers, and medical imaging scientists this excellent introduction to Radon transform covers both theory and applications.

It also features a rich array of examples and literature that forms a valuable reference. The author, a professor in the Department of Physics at the University of South Florida, wrote this pioneering work in - Buy The Radon Transform and Some of Its Applications (Dover Books on Mathematics) book online at best prices in India on Read The Radon Transform and Some of Its Applications (Dover Books on Mathematics) book reviews & author details and more at Free delivery on qualified orders/5(4).

In mathematics, the Radon transform is the integral transform which takes a function f defined on the plane to a function Rf defined on the (two-dimensional) space of lines in the plane, whose value at a particular line is equal to the line integral of the function over that line.

The transform was introduced in by Johann Radon, who also provided a formula for the inverse transform. Of value to mathematicians, physicists, engineers, and medical imaging scientists this excellent introduction to Radon transform covers both theory and applications.

It also features a rich array of examples and literature that forms a valuable reference. The author, a professor in the Pages: Deans | Mathematics - More >>; Deans S.R., The Radon Transform and Some of Its Applications, Dover Publications It contains more than worked examples and exercises with answers as well as hints to selected exercises.

pages, The Radon Transform and Some of Its Applications. Of the Radon Transform and the Parseval Relation.

Open Library is an open, editable library catalog, building towards a web page for every book ever published. The Radon Transform and Some of Its Applications by Stanley R. Deans,Wiley edition, in EnglishCited by:   The Radon Transform and Some of Its Applications The Fourier Transforms and its Applications - Duration: Stanford Inverse Radon with rotating center of cone beam.

Buy The Radon Transform and Some of Its Applications (Dover Books on Mathematics) by Deans, Stanley R (ISBN: ) from Amazon's Book /5(4). Revised and updated by the author. value to mathematicians, physicists, and engineers, this excellent introduction to Radon transform covers both theory and applications, with a rich array of examples and literature that forms a valuable reference.

Abstract. For a given function f defined in the plane, which may represent, for instance, the attenuation-coefficient function in a cross section of a sample, the fundamental question of image reconstruction calls on us to consider the value of the integral of f along a typical line $$\,\ell_{t,\,\theta }$$.For each pair of values of t and $$\,\theta$$, we will integrate f along a different by: 2.

The rst edition of this book has been out of print for some time and I have {on the Radon transform and its generalizations. (The term \Radon Transform" is adopted from John [].) a short account of some applications (Chapter I, x7), by adding a few cpro-File Size: 1MB.

Buy The Radon Transform and Some of Its Applications by Stanley R. Deans from Waterstones today! Click and Collect from your local Waterstones Pages: adshelp[at] The ADS is operated by the Smithsonian Astrophysical Observatory under NASA Cooperative Agreement NNX16AC86A.


text:
I wish to return to the inflammatory word I used to characterize PASCAL: fascist. If PASCAL is fascist, APL is anarchist. I tend to prefer anarchists to fascists. (source)

Yesterday, I got lost in the depths of my backup drive’s file system and stumbled over a set of exercises that I did for a class on primality tests and factoring algorithms from when I was studying computer science at university. That semester, I used 4 languages to solve the assignments: Python, because it is convenient; Scala and Haskell, because I love them; and J, presumably because I wanted to make the assignments a bit more interesting (and annoy the TA in the process). I quickly learnt to love J as well.

For the uninitiated, here is one of the J programs I wrote:

((1&=@(#@]|[*])#])i.)

If you find this hard to read1, you might just be interested in reading the rest of the post.

# J - A Modern APL dialect

In the 1960s, Kenneth E. Iverson had a revelation: Programmers waste their precious time typing strings of characters representing concepts that could easily be encoded into single symbols2. Each common operation should have its own symbol and operate on arrays to make it reusable in many contexts. This was the birth of APL, an Array Programming Language. Since there are only so many common ASCII symbols, APL soon extended into what we would now call general Unicode, leading to the development of the APL keyboard. Unfortunately, this meant that many people had a hard time typing APL programs. The following is a sample of APL’s expressiveness, probably saying something deeply philosophical about the true nature of life3:

life←{↑1 ⍵∨.∧3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵}

Years later, Iverson created J as a new approach to convince the world of his APL-ideas, with a focus on making it easier on the fingers4.

Nowadays, J is easily mistaken for a code-golfing language, which is unfortunate because J is actually serious business.

If you have never worked with an APL like language before, it may be difficult to grasp J. This post is not intended as a full-blown J tutorial5, but inevitably there are a few things you need to know (or, as I’d argue, want to know, because J is fun!):

• J is supposed to mimick a real languages. There are no functions, but verbs, no values, but nouns, no expressions, but sentences.
• All verbs are unary or binary. In J’s terminology, binary verbs are dyads and unary verbs are monads. Whether a verb is used as a dyad or monad is determined by context. Dyads take arguments left and right, monads only on their right.
• The only real data structure available are arrays in arbitrary dimensions.
• Verbs apply to all kinds of data, usually vectorising over arrays according to an arcane set of rules related to their verb’s inherent rank.
• Verbs are modified by adverbs and conjunctions. Adverbs can also be used as adjectives to modify nouns. I’m skipping over gerunds, but of course this language has gerund-like features.
• J does not have operator precedence. Evaluation proceeds right-to-left or as parenthesized.
• Not all types of parantheses come in pairs, so don’t get confused.
• Comments start with NB.  and run through to the end of a line.

If you want to follow along on any examples, you can use this online-interpreter. I recommend entering definitions in the Script window below, while using the command prompt above that to execute sentences whose result you’d like to see immediately. The interpreter seems to have a few missing features, especially when it comes to trains and tacit programming (see below), so longer tacit definitions will most likely not work. If you feel like it, install J for yourself.

## Basics

Variable definitions and evaluation proceeds as you would expect after what I have said above:

my_variable =: 15         NB. defines a variable
my_variable =: 2 * 4 + 4  NB. sets value to 16 -- right to left execution!
my_list =: 15 30 45       NB. a list of three values
my_variable + my_list     NB. adds my_variable to each element in the list
NB. yielding the result 31 46 61
my_list + my_list         NB. double each value in my_list
# my_list                 NB. compute number of elements in the list
my_list =: my_list , 60   NB. append 60 to the list
2 { my_list               NB. get 3rd element from the list, i.e. at index 2
i. 5                      NB. the list 0, 1, 2, 3, 4; i. is read as 'integers'
2 < i. 5                  NB. the list 0, 0, 0, 1, 1

## Defining Verbs Procedurally

J supports good ol’ procedural programming with definitions such as a verb that doubles its input:

double =: 3 : 0
y + y
)

You can then form a full sentence such as double 3. Note how the right (and only) argument to double is automatically named y. Also, the fact that there is no opening parenthesis is no typo. This example doesn’t really show off all the things you can do with procedural definitions, but you will likely already expect that there are ifs and whiles available, as are trys and catches. If anything, the example should have convinced you that this is not beautiful.

## Defining Verbs using Operators and Composition

Instead of using procedural definitions of verbs, you can also express verbs in point-free style. This is also known as tacit programming and mainly means that you create a function using function composition only, without mentioning the arguments of the function. For example, we can define addition as

plus =: +

That’s it: Plus is just another name for addition. Much nicer than using the noisy procedural syntax.

### Operators

It might be tempting to think that doubling could be defined as

double =: * 2

but this merely applies the monadic verb * to the argument 2 (yielding a result of 1, because monadic * is the signum of the input). Instead, we need to use the conjunction & to bind the parameter to an argument. Depending on whether we want to bind the left or the right parameter, we swap the order of the operands:

double =: * & 2  NB. 2 bound to right parameter
double =: 2 & *  NB. 2 bound to left parameter

This is a common theme: Operators modify verbs. Monadic operators are adverbs, dyadic operators are conjunctions. In contrast to verbs, adverbs take their argument on the left. Here are some examples:

4 % 2    NB. result is 2, because % is division, not the remainder-operation
2 %~ 6   NB. result is 3, because ~ swaps the arguments of a verb
+/ 1 2 3 NB. result is 6, folds the list using +
NB. since / is the insert adverb

In a sentence, operators are always evaluated before verbs.

### Composition and Trains: Hooks and Forks

All of what we have seen up to this point is still not enough to produce such works of beauty as the verb I showed you in the introduction. This is where trains come in, the true genius of J: Sequences of verbs that are not immediately invoked. Trains have two forms with a special meaning: Hooks and Forks.

#### Hooks

A hook has the form f g where f is a dyad and g is a monad. The resulting verb behaves as follows in a monadic context: (f g) y evaluates as y f (g y) (or equivalently, y f g y). More concisely,

(f g) y = y f (g y) = y f g y

As an example, consider

(+ *:) 2  NB. this produces a result of 6, because monadic *: is squaring
NB. hence (+ *:) 2 = 2 + *: 2 = 2 + 4 = 6

Note the importance of the parentheses in (f g) y: With parentheses, there is a hook on the left. Without parentheses, we have f g y which is equivalent to f (g y). Therefore, trains break the usual form of function composition. This is recovered as f @ g, using the atop conjunction @. Thus f g y = (f @ g) y6.

As a dyad, a hook f g behaves as expected:

x (f g) y = x f (g y) = x f g y

#### Forks

A fork has the form f g h with g a dyad and f, h monadic and dyadic. The behaviour of a fork is as follows:

(f g h) y = (f y) g (h y) = (f y) g h y

and

x (f g h) y = (y f x) g (x h y) = (y f x) g x h y

#### Longer Trains

Longer trains are naturally interpreted as hooks and forks, with the convention that trains of even length begin with a hook and trains of odd length begin with a fork. That is,

f g h ... = f (g h ...)  NB. hook, if total length is even
f g h ... = f g (h ...)  NB. fork, if total length is odd

# Deconstructing Tacit Programs

Now we know enough to understand some of the programs I had written for said class. But let’s first look at some easier examples. If you want to follow along, you may find it helpful to look at J’s vocabulary page or this slightly more structured version of the vocabulary page.

#### Mean

avg =: +/ % #
avg 1 2 3 4 5   NB. computes the mean of 1 2 3 4 5

Can you see why this works?

+/ % # is a train, or more specifically, a fork. It is applied monadically:

(+/ % #) y = (+/ y) % (# y)

The left subsentence sums the list up, the right one takes the length of the list. The middle verb is just division.

#### Inverses Modulo A Number

Now for the verb from the introduction:

(1&=@(#@]|[*])#])i.

It is impossible to see what this verb is doing without the information whether it is used as a monad or a dyad. The actual invocation looks like this

204 ((1&=@(#@]|[*])#])i.) 2015

It computes the value $d$ such that $204 \cdot d = 1 \mod 2015$, if it exists. To understand the implementation of this verb, you must know that | is the remainder operation with swapped arguments and that the brackets [ and ] are dyads that simply return their lefts or right argument, respectively. How does it work?

It works essentially by brute force. It helps to use more reasonable spacing:

  204 ((1&=@(#@]|[*])#]) i.) 2015
= 204 ( ( 1&=@( #@] | [ * ] ) # ] ) i.) 2015

This makes clear that at the top-level, we have a hook, followed by a fork on the left:

f =: 1&=@( #@] | [ * ] )
204 ( (f # ]) i. ) 2015               NB. equivalent to the original sentence
= 204 (f # ]) (i. 2015)                 NB. unfolding the hook
= (204 f (i. 2015)) # (204 ] (i. 2015)) NB. unfolding the fork
= (204 f (i. 2015)) # (i. 2015)         NB. definition of ]

This applies # as a dyad, which means that the elements in the right array are copied to a new array where each element is present as many times as the corresponding number in the left array. That left array should thus be 1 for the inverse and 0 everywhere else. Morally, f is therefore multiplying each of the numbers from 0 to 2014 by 204 mod 2015 and compares the results to 1. This is indeed what is happening:

  204 f (i. 2015)
= 204 (1&=@( #@] | [ * ] )) i. 2015
= 1&= 204 (#@] | [ * ]) i. 2015                NB. definition of @
= 1&= (204 #@] i. 2015) | 204 ([ * ]) i. 2015  NB. definition of fork in a train of odd length
= 1&= #(204 ] i. 2015) | 204 ([ * ]) i. 2015   NB. definition of @
= 1&= #(204 ] i. 2015) | 204 ([ * ]) i. 2015   NB. definition of ]
= 1&= # (i. 2015) | 204 ([ * ]) i. 2015        NB. definition of ]
= 1&= 2015 | 204 ([ * ]) i. 2015               NB. definition of #
= 1&= 2015 | 204 * i. 2015                     NB. definition of fork, [, and ]

As I notice just know, it seems that the poor idiot that past-me was did not see this much simpler solution:

(i.&1)@(]|[*i.@])

#### Quicksort

Another example straight from Wikipedia is quicksort:

quicksort =: (($:@(<#[), (=#[),$:@(>#[)) ({~ ?@#)) ^: (1<#)

You would not use this in J, since there is a sorting verb /: built into the language. But it is not hard to see how this implementation works given the following information and the knowledge that what we see is a quicksort implementation:

• $: is a self-reference to the longest verb containing it, • ? y produces a random number in the range $[0, y)$, • u ^: v is the power-of conjunction, which evaluates as (u ^: v) y = (u y) ^: (v y) meaning that u will be iterated on y for v y many steps. For example, (*: ^: ]) 2 has a result of 16, because it is squaring 2 twice (or rather, it computes :* :* 2) Can you see how this quicksort implementation works? At the top level of the definition, we have the ^: conjunction. Its right argument is (1 < #) which is applied to the input list and evaluates to 1 if and only if its length is greater than one: (1 < #) y = 1 < (# y). This means that the left part of the definition is executed once for lists with at least 2 elements, 0 times otherwise. So that is nothing but an if. The left part can be read fluently (with some practice): (($:@(<#[), (=#[), $:@(>#[)) ({~ ?@#))  This is a hook of the form lhs rhs, evaluating as (lhs rhs) y = y lhs (rhs y). The right part ({~ ?@#) selects a pivot element at random since  rhs y = ({~ ?@#) y NB. definition of rhs = y {~ (?@# y) NB. definition of hook = y {~ (? (# y)) NB. definition of @ = (? (# y)) { y NB. definition of ~ =: pivot y  where x { y is indexing y with x. On the left, we have three groups of verbs u, v, w that should by now almost be self-explanatory, separated by the concatenation verb ,. This forms a train of two forks  y (u, v, w) pivot y = y (u , (v , w)) pivot y NB. rules for long trains = (y u pivot y) , (y (v , w) pivot y) NB. definition of fork = (y u pivot y) , (y v pivot y), (y w pivot y) NB. definition of fork  All that is left is to convince yourself that u, v, w select all elements smaller than, equal to, or greater than the pivot from the list, respectively, and recurse on them. But this is easy to see since for u:  y ($:@(<#[) pivot y
= $: y (<#[) pivot y NB. definition of @ =$: (y < pivot y) # (y [ pivot y) NB. definition of fork
= $: (y < pivot y) # y NB. definition of [ = quicksort (y < pivot y) # y NB. definition of$:, definition of quicksort

Remember that x # y creates a new array where each entry in y is present n times where n is the corresponding value in x. Similar reasoning applies to v, w.

#### Number of Primes up to a Given Bound

To finish off, let’s look at how you could torture a TA who just wants to see a small program that calculates the number of primes up to some given numbers, say 1000, 10000, and 10000. In J, this could be written as

(p:^:_1) 1+10^(3 4 5)

I consider this cheating because here the inbuilt function p: does all the actual work. My submission was:

l =: 0 0&,@(-&1#1:)
s =: *1&<.@((i.&1)|i.@#)
a =: >@[ ([([,i.&1@]))@.((#>i.&1)@]) >@]
primesUpTo =: >@{.@((a/;s@>@]/)^:_)@((>a:)&;@l)
`

I of course included plenty of comments on what the code is doing on a high level (it uses a straight forward implementation of the sieve of Eratosthenes), but I am confident that nobody took the time to check whether the program was actually working (except for me, obviously). I am also pretty sure that this J code is far from the optimum on close to all metrics (speed, brevity, and - well - readability), but, surprisingly, the TA did not deduct any points for my use of J.

# Conclusion

If you long for more tacit programs in J, take a look at its list of phrases and idioms. If you feel the sudden need to read a very political essay on APL, try this article, which is also the source of the opening quote.

Let me know if you come up with an especially convoluted tacit program for a simple problem yourself :)

1. Needless to say, I do not advocate the use of this style and tacit programming in production code. Do it at home or while you are still in University ;) I should also mention that you can write clear, concise, and performant programs in J, but this is not the reason I love this language for.

2. This incident is unfortunately not recorded in the only reliable source on the history of programming lanauges. Check the 1987 entry on Perl for another reasonable explanation of what APL’s inception could have been like.

3. It is an implementation of Conway’s Game of Life, taken straight from Wikipedia

4. I am deliberatly skipping over all the gory details. APL was at one point or another actually a popular language and there are still plenty of people who swear by it. Its Wikipedia entry has an extensive section on APL’s history.

5. There is so much more to learn about this language. As with any language, J has a vocabulary, a book of common phrases and idioms, a dictionary, and a learner’s guide

6. This is mostly true, but due to the way that verbs vectorize over arrays, J needs 4 different kinds of verb composition to reflect the different behaviors. See this page, especially the diagram further down below.


text:
# C++ Developer Information

An overview of Meep's inner workings is provided in Computer Physics Communications, Vol. 181, pp. 687-702, 2010. This page is a supplement which provides a description of the source code.

For additional details, see Chunks and Symmetry

### Data Structures and Chunks

Meep's data structures are defined in meep.hpp. The principal data structure element is the chunk. A chunk is a contiguous rectangular portion of the computational grid. For example, when Meep runs on a parallel system, each process gets one or more disjoint chunks of the grid.

There are several different types of chunks:

• fields and fields_chunks
• structure and structure_chunks
• dft and dft_chunks

As an example, the fields class encapsulates the fields over the entire grid, and one of its members is an array of fields_chunk variables that divides the grid. The fields_chunk variables store the actual field information. Every parallel process has a nearly-identical fields variable with a nearly-identical list of chunks. Chunks on one process which have been assigned to another process do not store their fields arrays; they are just placeholders.

If a given material or field is not present in a given chunk, it need not be stored. For this reason, the PML boundary regions are separated into their own chunks, even on one processor, in order that the extra data for PML need not be stored for the whole grid.

In the future, we may implement support for different chunks with different resolution, to allow nonuniform spatial resolution.

Similarly for structure and structure_chunks, except that it is only for materials parameters such as epsilon, etc. and not for the fields.

dft_chunk stores accumulated Fourier-transformed fields corresponding to a given chunk.

### grid_volume and volume

The volume class declared in meep/vec.hpp represents a rectilinear region, parallel to the $xyz$ axes, in "continuous space" — i.e. the corners can be at any points, not necessarily grid points. This is used, for example, whenever you want to specify the integral of some quantity (e.g., flux, energy) in a box-like region, and Meep interpolates from the grid as necessary to give an illusion of continuity.

The grid_volume class declared in meep/vec.hpp is a box of pixels. It stores the resolution, the number of pixels in each direction, the origin, etcetera. Given a grid_volume, there are functions to get the volume corresponding to the bounding box, etcetera. There is a grid_volume object associated with the whole computational grid, and with each chunk in the grid. There are various tricky aspects to the grid_volume. One is associated with the Yee grid: it has to know about different field components stored at different points. Another is associated with the fact that boundary conditions, not only the overall grid boundaries but also boundaries between chunks, are handled by an extra layer of "not-owned" pixels around the boundaries. So each chunk's grid_volume has "owned" grid points that the chunk is responsible for updating, and "not-owned" grid points that are updated using the boundary conditions. Due to the Yee grid which complicates everything in FDTD, unfortunately, the set of owned and not-owned coordinates is different for each field component. The grid_volume class keeps track of all this.

### File Organization

The core Meep C++ simulation code (all of the physics) is located in the src/ directory, with C++ tests in the tests/ directory. The libmeepgeom/ directory provides a C++ library to specify Meep geometries in terms of a list of geometric objects (spheres, cylinders, boxes) with various material properties (via libctl's geometry library), and is also used by the Python interface.

The Scheme and Python interfaces are found in the scheme/ and python/ directories. Both interfaces use SWIG to generate wrapper code from the C++ header files, but also have hand-written Scheme/Python code to provide a higher-level interface. The libpympb/ directory contains a Python interface to MPB (which may, in the future, be moved to the MPB repository).

The following table briefly describes the purpose of some of the source files:

meep/vec.hpp Declares geometry-related classes like vec, ivec, grid_volume, volume and related utility functions.
meep/mympi.hpp Declares functions for initializing the meep application, cleanup, and data exchange accounting for the presence or absence of MPI. These functions present a unified interface to the rest of the application.
meep.hpp All public classes likes fields, fields_chunks, structure, structure_chunks, src_time, continuous_src_time, material_function, h5_file, polarizability_identifier etc.
meep_internals.hpp Hosts declarations for classes like polarizability, polarization, src_vol, and bandsdata. Also defines macros for frequently-used loop constructs like DOCMP that are internal to Meep implementation.
bicgstab.hpp Declares functions related to an implementation of an iterative solver for non-symmetric linear operators based on a generalization of the stabilized biconjugate-gradient (BiCGSTAB) algorithm proposed by van der Vorst (and described in the book "Templates for the Solution of Linear Systems" by Barrett et al.

The following table briefly describes what is in each .cpp file:

Source File Description
polarization.cpp Implement member functions for the polarization and polarizability classes declared in meep_internals.hpp
bicgstab.cpp Implements the solver described against bicgstab.hpp (see above)

#### Functionality Organization

Functionality Location
Material dispersion polarization.cpp, update_from_e.cpp, and friends.
Vectors, volumes etc. meep/vec.hpp, vec.cpp
Geometric objects handled by libctl functions in libctl's geom.c, called from the Scheme front-end (not handled by Meep)
Fields: initialization, cleanup, chunking, stepping-plan, (dis)affiliation with sources, polarizabilities etc. fields.cpp
Structure: initialization, cleanup, chunking, material parameters, boundary conditions etc. structure.cpp
MPI interface meep/mympi.hpp, mympi.cpp

### Deprecated Interfaces

Beware that some of the interfaces in the source code and in the old manual are now deprecated, as they have been superseded by newer features and may be removed at some point.

In particular, you should probably avoid:

• The monitor_point class. Just declare an array to store the fields you want, get them with fields::get_field, and analyze them with do_harminv. Or, to accumulate the DFT as you run, use the dft_chunk class via fields::add_dft.
• Slice and EPS output. This has been superseded by HDF5 output, which is much more flexible and efficient.

# Python Developer Information

## Overview

The meep Python package consists of a low-level interface and a high-level interface. The low-level interface is the direct result of running SWIG on the C++ headers.

Next, we compile meep-python.cpp, rename meep.py to __init__.py and put them in a folder called meep. Putting all the code in __init__.py allows us to access the symbols directly from the meep namespace rather than going through an additional module like meep.meep.vec. Now we have a complete Python package.

__init__.py contains "proxy" classes for all public meep objects. They hold a this pointer that dispatches to the appropriate C++ functions in the _meep.so extension module. The interface this package exposes is basically the same as the C++ interface. That is, a simulation written in this low-level Python interface would not look much different from the same simulation written in C++. By implementing a high-level interface on top of the basic SWIG wrappers, we can abstract away many of the low details of setting up a simulation, take advantage of Python language features like keyword arguments, and gain productivity from libraries like NumPy.

## Package Organization

After adding the high-level interface files, the meep package looks like this.

meep
├── __init__.py
├── _meep.so
├── geom.py
├── simulation.py
└── source.py

The Python MPB interface is also included in the meep package. It's constructed in the same manner as the meep package. The low-level interface is in meep/mpb/__init__.py and meep/mpb/_mpb.so, and the high-level interface is in solver.py. Here is a view of the complete package.

meep
├── mpb
│   ├── __init__.py
│   ├── _mpb.so
│   ├── mpb_data.py
│   └── solver.py
├── __init__.py
├── _meep.so
├── geom.py
├── simulation.py
└── source.py

## Description of Files

### meep.i

SWIG interface file for the meep Python module. Includes typemaps, helper functions, and module initialization code. The typemaps mostly call other helper functions defined either in meep.i, or in typemap_utils.cpp (if the function is used in mpb.i too). There are also various py_*_wrap functions that handle calling user defined Python functions from C++. Everything in the %pythoncode block at the end of the file is run once when the meep module is first imported. See the SWIG documenation for more details.

### vec.i

SWIG interface file for vec.hpp. Included into meep.i. SWIG warnings are disabled (if found benign) in this file.

### numpy.i

Typemaps for numpy arrays (taken from the NumPy Github repository). See the documentation for instructions on using these typemaps.

### typemap_utils.cpp

Utility functions for writing SWIG typemaps. Since this file is included into both meep.i and mpb.i, only code that is useful to both interface files should be put here (otherwise the compiler complains about unused functions). Code used only by one interface should be put in the respective .i file. The majority of the code in this file is for converting the Python geometric objects defined in geom.py to C objects. The get_attr_* functions are helpers for getting C versions of attributes on Python objects. The convention in the file is for functions to return 1 on success and 0 on failure so that the top level typemaps in meep.i can be written as:

%typemap(in) type {
if(!py_type_to_type($input, &$1)) {
SWIG_fail;
}
}

Keeping the code within %typemap blocks small is valuable because it gets copied everywhere the typemap is used, which can lead to code bloat.

### geom.py

Pure Python implementations of the geometric objects defined in libctl. The user-defined list of objects (Simulation.geometry) gets converted to C objects when meep.set_materials_from_geometry is called in Simulation._init_structure. The function responsible for this conversion is typemap_utils.cpp:py_list_to_gobj_list. This file also contains classes that represent materials (Medium) and susceptibilities, and cartesian/reciprocal/lattice conversion functions. Note that when adding a class or function to this file, it must also be imported in the %pythoncode block at the end of python/meep.i if you want it to be directly accessible from the meep namespace (i.e., to get meep.MyClass instead of meep.geom.MyClass).

### simulation.py

Holds the Simulation class, which is the primary abstraction of the high-level interface. Minimally, a simulation script amounts to passing the desired keyword arguments to the Simulation contructor and calling the run method on the resulting instance. The various step functions are also included in this file. When adding extra functions or class to this file, an import statement should also be added to the %pythoncode block at the bottom of python/meep.i.

### source.py

Holds classes representing sources, including GaussianSource, ContinuousSource, CustomSource, and EigenModeSource. When adding extra functions or class to this file, an import statement should also be added to the %pythoncode block at the bottom of python/meep.i.

### mpb.i

SWIG interface file for the meep.mpb Python module.

### solver.py

Classes and functions related to the high-level Python interface to MPB. Additional classes or functions in this file should be accompanied by an import statement in the %pythoncode block at the bottom of mpb.i.

### mpb_data.py

Definition of MPBData, a Python class useful for MPB data analysis (documented here). This is is a Python port of the functionality available in the mpb-data command line program originally written in C.

## Testing

The tests for the Python interface are located in python/tests. To run the whole test suite, run make check in the python build tree. During development it is more convenient to run individual tests. This can be accomplished by running python <path_to_test>/test.py MyTestCase.test_method. See the Python unittest framework documentation for more info. If you're using an out-of-tree build (recommended), the development process will look something like this:

cd meep/build/python
export PYTHONPATH=pwd

# After making changes, rebuild the Python package
make
# Run test
python ../../python/tests/my_test.py MyNewTest.test_my_feature


text:
# Which is better: r-squared or adjusted r-squared?

I just started to learn about the following statistical measures, r-squared and adjusted r-squared and was wondering why can't we use adjusted r-squared for every regression model considering the fact that it penalizes the model for useless variables, unlike the former. Is there any advantage of r-squared over adjusted r-squared in some conditions?

• Welcome to CV, Ronight. My answer here may prove of interest: stats.stackexchange.com/questions/336690/… Jun 29 '18 at 18:29
• Which ist better: a hammer or a banana? It depends on whether you need to hit a nail or are hungry. $R^2$ is good if you care about the variance explained, $adj. R^2$ is good if you want to know, if an extra predictor is worth it. Apr 6 at 12:05
• Jun 14 at 10:58

Adjusted $R^2$ is the better model when you compare models that have a different amount of variables.

The logic behind it is, that $R^2$ always increases when the number of variables increases. Meaning that even if you add a useless variable to you model, your $R^2$ will still increase. To balance that out, you should always compare models with different number of independent variables with adjusted $R^2$.

Adjusted $R^2$ only increases if the new variable improves the model more than would be expected by chance.

• Yes. I know how both r2 and adjusted r2 are calculated. My question was: should I use adjusted r2 for every regression model, considering the fact that it is better than r2? Jun 29 '18 at 18:39
• It's not about being better or worse. When you compare models use adjusted R2. When you only look at one model report R2, as it is the not adjusted measure of how much variance is explained by your model.
– LN_P
Jun 29 '18 at 18:45
• Considering I have only one model and I use R2, it won't give me an indication of the insignificant variables I am adding to my model, in such a case why should I prefer R2 over adjusted R2? Jun 29 '18 at 18:47
• Neither R2 nor adjusted R2 will give you information about the significance of your variables. you have to look at your model output. When you want to see if some of your variables are insignificant when adding or removing them, then again you are comparing two models. Then you should use adjusted R2, because you are comparing models with a different number of independent variables in it. But if you only have one model , adjusted R2 will not tell you anythign about significant variables, as you don't compare it to another model...
– LN_P
Jun 29 '18 at 19:24
• My bad! I should've framed my question correctly. What I meant was "If I use R2, it does not account for useless variables whereas adjusted R2 does. So why shouldn't I use adjusted R2 even if I have one model?" Jun 29 '18 at 20:31

Before trying to answer the question, we need to clarify at least two things: "What do we mean by adjusted $$R^2$$? and "What do we mean by 'better'"?

Ultimately, the goal is to estimate the true proportion of variance explained in the population $$\rho^2$$. A multitude of different estimators were proposed. Gwowen Shieh$$^{[1]}$$ compares no less than 18 different estimators and Karch$$^{[3]}$$ compares 20 different estimators. A good overview can be found in $$[2]$$ and $$[3]$$. So the term "adjusted $$R^2$$" is ambiguous. It's no help that different software implement different formulas, making it difficult to compare the "adjusted $$R^2$$". R, for example, uses the Wherry Formula-1 according to the nomenclature of Yin et al.$$^{[2]}$$ (see here).

Now what do we mean by "better"? Shieh$$^{[1]}$$ and Karch$$^{[3]}$$ used simulations to compare the different estimators with respect to bias and mean squared error (MSE). Depending on what researches prioritize, what's the "best" estimator varies.

For example, Karch$$^{[3]}$$ found that:

The exact Olkin-Pratt estimator was optimal. It was the only estimator that was unbiased across all conditions. Additionally, it had practically identical MSE within any condition compared to other unbiased estimators within that condition. Consequently, under this perspective, the exact Olkin-Pratt estimator should always be used.

But he also writes:

Only if the researcher is confident that minimizing MSE is more critical than unbiasedness should a different estimator be used. In this case, I recommend an individualized choice based on the strategy described at the beginning of this discussion and if this is not feasible the positive-part version of the Ezekiel estimator.

Interestingly, even the normal, unadjusted $$R^2$$ which is clearly positively biased had the lowest mean squared error in at least one simulation scenario.

References

$$[1]$$: Shieh G (2008): Improved shrinkage estimation of squared multiple correlation coefficient and squared cross-validity coefficient. Organizational Research Methods, 11(2): 387-407 (link)

$$[2]$$: Yin P, Fan X (2001): Estimating $$R^2$$ shrinkage in multiple regression: A comparison of different analytical methods. The Journal of Experimental Education, 69(2): 203-224 (link)

$$[3]$$: Karch J (2020): Improving on adjusted R-squared. Collabra: Psychology (2020) 6 (1): 45. (link)

• That's a good summary of my paper and where we currently are regarding R2. If you want to use any of the other estimators, I made them all available in the cran.r-project.org/web/packages/altR2/index.html package. Apr 6 at 11:27

Yes, there is an advantage to $$R^2$$: It has a direct interpretation as the proportion of variance in the dependent variable that is accounted for by the model. Adjusted $$R^2$$ does not have this interpretation.

Also, you write that adjusted $$R^2$$ "penalizes the model for useless variables". That is true but incomplete. First, almost no variable is totally useless. $$R^2$$ will increase even if we add random noise, because, just by chance, there will be some relationship (see below).

Second, adjusted $$R^2$$ lowers $$R^2$$ for every independent variable, useless or not. In fact, in some cases (see below) it works very badly for noise variables

set.seed(1234)  #Sets a seed

x1 <- rnorm(1000)  #Standard Normal, N = 1000
x2 <- rnorm(1000)  #Normal, N = 1000

y <- 3*x1 + rnorm(1000, 0, 4)  #No relation with X2

m1 <- lm (y~x1)
summary(m1) #R2 = 0.3627, adjusted = 0.3621

m2 <- lm (y~x1 + x2)
summary(m2) #R2 = 0.3635, adjusted = 0.3622

Note that m2 would be slightly preferred, even using adjusted $$R^2$$.

Note also that I didn't have to "fish around" for an example like this, this was the first one I tried.

Adjusted $$R^2$$ is much more useful for comparing models where all the IVs are useful. It's a way of adjusting for the complexity of a model.

• I will argue that your example proves the utility of adjusted R-squared as you would need a very strong argument to chose M2 over M1 because M2 is more complex and requires an additional assumption (X2 is important) for minimal improvement in R-squared (adjusted or not). Further, adjusted R-squared can still be interpreted as R-squared raw, just with the caveat that a penalization has been applied: 'After adjusting for number of independent variables relative to the sample size, approximately Z% of observed variation in Y can be explained by the O-order regression model that utilizes X1-Xi.'
– LSC
Jan 4 '20 at 15:15
• I feel that this answer is very misleading. Adjusted R2 is a much better estimate of explained variance. Random variables don’t explain anything. It is just hallucination under extreme bias. Jan 4 '20 at 15:17
• @LSC Interesting. Would you argue that the adjusted R-squared has more interpretive value? Should we default to the raw r-squared in cases where we are not doing any model comparison? Feb 28 '20 at 14:18
• @Tom, what do you mean by "more interpretive"? I think even without model comparisons R-squared adjusted is helpful in a multiple regression (>1 independent variable) context because it allows you to see the explained variation in the DV after penalization for # of terms in the model. It is also helpful when not comparing models to compare the unadjusted R-squared with the adjusted R-squared (again when # predictors/non-intercept terms>1) because you can see how the R-squared (raw) is inflated due to extra/superfluous terms in the model.
– LSC
Feb 28 '20 at 23:11
• @LSC I should have been more clear. In other words, should the adjusted R-squared take precedence over the unadjusted R-squared in terms of reporting in scientific journals, working papers, etc.? Feb 28 '20 at 23:18


text:
# Writing theorem conditions with automatic numbering and labels

I'm trying to write conditions that are required for a theorem to be valid such that the condition is automatically numbered AND is able to be referenced at a later time (e.g. a link can be used to go back to the initial condition definition.)

The format I am trying to obtain is:

(C1) Statement about the required process

And the in document reference would be:

Following from (C1), we have that blah.

I've tried something along the lines of:

\documentclass{article}
\usepackage{cleveref}

\usepackage{amsthm}

% Define new theorem environment that works only with conditions
\newtheorem{Condition}{C}

\crefname{Condition}{C}{C} % singular and plural forms of label

\begin{document}

% Attempt 1
\begin{Condition}
\begin{enumerate}
\item Statement about the required process. \label{cond:test}
\item Next statement about the required process. \label{cond:test2}
\end{enumerate}
\end{Condition}

% Attempt 2
\begin{Condition}
Statement about the required process. \label{cond:test3}
\end{Condition}

(C\ref{cond:test}, \ref{cond:test2}, \ref{cond:test3}

\end{document}

Any suggestions?

• Your 'reference' system is not yet well-designed – user31729 Jan 30 '17 at 21:51
• Using \Cref for cond:test or cond:test2 it will print Item because that's the counter connected to the label, not Condition! – user31729 Jan 30 '17 at 22:11

Here is a possible way, to use the items of enumerate and make them a subcondition, using the Condition counter as a parent.

'Itemless' conditions should use a similar reference label, being printed as (C2) etc. In order to achieve this, one has to change the \p@Condition macro, in order to grab the counter name first and append the ) afterwards.

\documentclass{article}
\usepackage{amsthm}
\usepackage{enumitem}

\newtheorem{Condition}{C}

\usepackage{hyperref}
\usepackage{cleveref}

\setlist[enumerate,1]{leftmargin={40pt},label=(C\theCondition.\arabic*),ref=(C\theCondition.\arabic*),before={\leavevmode}}

\makeatletter
\def\@grabconditioncounter\csname #1\endcsname{%
(C\csname#1\endcsname)%
}

\renewcommand\p@Condition{\@grabconditioncounter}

\makeatother

\begin{document}

\begin{Condition}
\begin{enumerate}
\item Statement about the required process. \label{cond:test}

\item Next statement about the required process. \label{cond:test2}
\end{enumerate}
\end{Condition}

% Attempt 2
\begin{Condition}
Statement about the required process. \label{cond:test3}
\end{Condition}

Following from \ref{cond:test}, we have that\dots, but \ref{cond:test2} and \ref{cond:test3} are important also.

\end{document}

Update A version with (C1) numbering as 'theorem' head with an environment.

I've put the \setlist changes of enumerate inside of the Condition environment such that other usages of enumerate will not have the 'strange' enumeration labels then.

\documentclass{article}
\usepackage{enumitem}

\newcounter{Condition}
\newenvironment{Condition}{%
\setlist[enumerate,1]{font={\itshape},leftmargin={40pt},label=(C\theCondition.\arabic*),ref=(C\theCondition.\arabic*)}%,before={\leavevmode}}
\parindent=0em
\refstepcounter{Condition}%
\textbf{(C\theCondition)}

%Explicit newline above
}{%
}

\usepackage{hyperref}
\usepackage{cleveref}

\makeatletter
\def\@grabconditioncounter\csname #1\endcsname{%
(C\csname#1\endcsname)%
}
\renewcommand\p@Condition{\@grabconditioncounter}
\makeatother

\begin{document}
\begin{Condition}
\begin{enumerate}
\item Statement about the required process. \label{cond:test}

\item Next statement about the required process. \label{cond:test2}
\end{enumerate}
\end{Condition}

% Attempt 2
\begin{Condition}
Statement about the required process. \label{cond:test3}
\end{Condition}

Following from \ref{cond:test}, we have that\dots, but \ref{cond:test2} and \ref{cond:test3} are important also.

\begin{enumerate}
\item A
\item B
\end{enumerate}

\end{document}

• Exactly what I needed! Thanks. I appreciate it greatly. – coatless Jan 30 '17 at 23:04
• @coatless: You're welcome. Nevertheless, I think you should think about the precise numbering in future documents – user31729 Jan 30 '17 at 23:05
• Could you clarify "Precise numbering?" Also, is there an easy way to get the definition label updated to (C1) vs. the present C 1? – coatless Jan 30 '17 at 23:08
• @coatless: The precise numbering means how sub conditions are numbered (your \items, for example). The (C1) is more difficult since you're using a theorem (unnecessarily, in my point of view, a normal environment would be easier to change) – user31729 Jan 30 '17 at 23:12
• @coatless: \newtheoremstyle is a possible option. I've added a non-theorem approach – user31729 Jan 30 '17 at 23:17


text:
## C Specification

To copy regions of a source image into a destination image, potentially performing format conversion, arbitrary scaling, and filtering, call:

void vkCmdBlitImage(
VkCommandBuffer                             commandBuffer,
VkImage                                     srcImage,
VkImageLayout                               srcImageLayout,
VkImage                                     dstImage,
VkImageLayout                               dstImageLayout,
uint32_t                                    regionCount,
const VkImageBlit*                          pRegions,
VkFilter                                    filter);

## Parameters

• commandBuffer is the command buffer into which the command will be recorded.

• srcImage is the source image.

• srcImageLayout is the layout of the source image subresources for the blit.

• dstImage is the destination image.

• dstImageLayout is the layout of the destination image subresources for the blit.

• regionCount is the number of regions to blit.

• pRegions is a pointer to an array of VkImageBlit structures specifying the regions to blit.

• filter is a VkFilter specifying the filter to apply if the blits require scaling.

## Description

vkCmdBlitImage must not be used for multisampled source or destination images. Use vkCmdResolveImage for this purpose.

As the sizes of the source and destination extents can differ in any dimension, texels in the source extent are scaled and filtered to the destination extent. Scaling occurs via the following operations:

• For each destination texel, the integer coordinate of that texel is converted to an unnormalized texture coordinate, using the effective inverse of the equations described in unnormalized to integer conversion:

ubase = i + ½

vbase = j + ½

wbase = k + ½

• These base coordinates are then offset by the first destination offset:

uoffset = ubase - xdst0

voffset = vbase - ydst0

woffset = wbase - zdst0

aoffset = a - baseArrayCountdst

• The scale is determined from the source and destination regions, and applied to the offset coordinates:

scale_u = (xsrc1 - xsrc0) / (xdst1 - xdst0)

scale_v = (ysrc1 - ysrc0) / (ydst1 - ydst0)

scale_w = (zsrc1 - zsrc0) / (zdst1 - zdst0)

uscaled = uoffset * scaleu

vscaled = voffset * scalev

wscaled = woffset * scalew

• Finally the source offset is added to the scaled coordinates, to determine the final unnormalized coordinates used to sample from srcImage:

u = uscaled + xsrc0

v = vscaled + ysrc0

w = wscaled + zsrc0

q = mipLevel

a = aoffset + baseArrayCountsrc

These coordinates are used to sample from the source image, as described in Image Operations chapter, with the filter mode equal to that of filter, a mipmap mode of VK_SAMPLER_MIPMAP_MODE_NEAREST and an address mode of VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE. Implementations must clamp at the edge of the source image, and may additionally clamp to the edge of the source region.

 Note Due to allowable rounding errors in the generation of the source texture coordinates, it is not always possible to guarantee exactly which source texels will be sampled for a given blit. As rounding errors are implementation dependent, the exact results of a blitting operation are also implementation dependent.

Blits are done layer by layer starting with the baseArrayLayer member of srcSubresource for the source and dstSubresource for the destination. layerCount layers are blitted to the destination image.

3D textures are blitted slice by slice. Slices in the source region bounded by srcOffsets[0].z and srcOffsets[1].z are copied to slices in the destination region bounded by dstOffsets[0].z and dstOffsets[1].z. For each destination slice, a source z coordinate is linearly interpolated between srcOffsets[0].z and srcOffsets[1].z. If the filter parameter is VK_FILTER_LINEAR then the value sampled from the source image is taken by doing linear filtering using the interpolated z coordinate. If filter parameter is VK_FILTER_NEAREST then the value sampled from the source image is taken from the single nearest slice, with an implementation-dependent arithmetic rounding mode.

The following filtering and conversion rules apply:

• Integer formats can only be converted to other integer formats with the same signedness.

• No format conversion is supported between depth/stencil images. The formats must match.

• Format conversions on unorm, snorm, unscaled and packed float formats of the copied aspect of the image are performed by first converting the pixels to float values.

• For sRGB source formats, nonlinear RGB values are converted to linear representation prior to filtering.

• After filtering, the float values are first clamped and then cast to the destination image format. In case of sRGB destination format, linear RGB values are converted to nonlinear representation before writing the pixel to the image.

Signed and unsigned integers are converted by first clamping to the representable range of the destination format, then casting the value.

Valid Usage
• The source region specified by each element of pRegions must be a region that is contained within srcImage

• The destination region specified by each element of pRegions must be a region that is contained within dstImage

• The union of all destination regions, specified by the elements of pRegions, must not overlap in memory with any texel that may be sampled during the blit operation

• The format features of srcImage must contain VK_FORMAT_FEATURE_BLIT_SRC_BIT.

• srcImage must not use a format listed in https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-requiring-sampler-ycbcr-conversion

• srcImage must have been created with VK_IMAGE_USAGE_TRANSFER_SRC_BIT usage flag

• If srcImage is non-sparse then it must be bound completely and contiguously to a single VkDeviceMemory object

• srcImageLayout must specify the layout of the image subresources of srcImage specified in pRegions at the time this command is executed on a VkDevice

• srcImageLayout must be VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL or VK_IMAGE_LAYOUT_GENERAL

• The format features of dstImage must contain VK_FORMAT_FEATURE_BLIT_DST_BIT.

• dstImage must not use a format listed in https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-requiring-sampler-ycbcr-conversion

• dstImage must have been created with VK_IMAGE_USAGE_TRANSFER_DST_BIT usage flag

• If dstImage is non-sparse then it must be bound completely and contiguously to a single VkDeviceMemory object

• dstImageLayout must specify the layout of the image subresources of dstImage specified in pRegions at the time this command is executed on a VkDevice

• dstImageLayout must be VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL or VK_IMAGE_LAYOUT_GENERAL

• The sample count of srcImage and dstImage must both be equal to VK_SAMPLE_COUNT_1_BIT

• If either of srcImage or dstImage was created with a signed integer VkFormat, the other must also have been created with a signed integer VkFormat

• If either of srcImage or dstImage was created with an unsigned integer VkFormat, the other must also have been created with an unsigned integer VkFormat

• If either of srcImage or dstImage was created with a depth/stencil format, the other must have exactly the same format

• If srcImage was created with a depth/stencil format, filter must be VK_FILTER_NEAREST

• srcImage must have been created with a samples value of VK_SAMPLE_COUNT_1_BIT

• dstImage must have been created with a samples value of VK_SAMPLE_COUNT_1_BIT

• If filter is VK_FILTER_LINEAR, then the format features of srcImage must contain VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT.

• If filter is VK_FILTER_CUBIC_EXT, then the format features of srcImage must contain VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT.

• If filter is VK_FILTER_CUBIC_EXT, srcImage must have a VkImageType of VK_IMAGE_TYPE_2D

• If commandBuffer is an unprotected command buffer, then srcImage must not be a protected image

• If commandBuffer is an unprotected command buffer, then dstImage must not be a protected image

• If commandBuffer is a protected command buffer, then dstImage must not be an unprotected image

• The srcSubresource.mipLevel member of each element of pRegions must be less than the mipLevels specified in VkImageCreateInfo when srcImage was created

• The dstSubresource.mipLevel member of each element of pRegions must be less than the mipLevels specified in VkImageCreateInfo when dstImage was created

• The srcSubresource.baseArrayLayer + srcSubresource.layerCount of each element of pRegions must be less than or equal to the arrayLayers specified in VkImageCreateInfo when srcImage was created

• The dstSubresource.baseArrayLayer + dstSubresource.layerCount of each element of pRegions must be less than or equal to the arrayLayers specified in VkImageCreateInfo when dstImage was created

• dstImage and srcImage must not have been created with flags containing VK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT

Valid Usage (Implicit)
• commandBuffer must be a valid VkCommandBuffer handle

• srcImage must be a valid VkImage handle

• srcImageLayout must be a valid VkImageLayout value

• dstImage must be a valid VkImage handle

• dstImageLayout must be a valid VkImageLayout value

• pRegions must be a valid pointer to an array of regionCount valid VkImageBlit structures

• filter must be a valid VkFilter value

• commandBuffer must be in the recording state

• The VkCommandPool that commandBuffer was allocated from must support graphics operations

• This command must only be called outside of a render pass instance

• regionCount must be greater than 0

• Each of commandBuffer, dstImage, and srcImage must have been created, allocated, or retrieved from the same VkDevice

Host Synchronization
• Host access to commandBuffer must be externally synchronized

• Host access to the VkCommandPool that commandBuffer was allocated from must be externally synchronized

Command Properties
Command Buffer Levels Render Pass Scope Supported Queue Types Pipeline Type

Primary
Secondary

Outside

Graphics

Transfer