Expo/Science & Industry/Cosmos in a Computer

## Brain Boggler: Analytic Versus Numerical

Imagine you are trying to solve an equation for an unknown variable, such as: x - 5 = 0. We say we have an analytic solution if we can actually solve the equation explicitly for the unknown variable. In this case, it is easy to see that the explicit analytic solution is x = 5, and that this is the exact solution. If we were not so smart, we might develop an "algorithm" on a computer to solve this equation numerically.

The algorithm would test various values for x, and then stop with a "solution" when the equation was satisfied to some chosen tolerance. For example, we might demand that the computer should solve this equation to an accuracy of 0.5. Then the computer would follow the algorithm until it found a solution to this degree of accuracy. Given an initial guess x = 1, depending on the algorithm, it might come up with the following guesses: x = 2.2 (no good), x = 3.3 (no good), x = 4.6 (good to the tolerance we specified), and return the "solution" x = 4.6! An efficient algorithm would come up with a solution quickly.

Note that if we want to be more accurate, as scientists do in their predictions, we might specify a tolerance that is much smaller, like 0.001. The computer might eventually get a result after the following sequence: 2.2, 3.3, 4.6, 5.2, 5.05, 4.98, 5.0005, and then return with the solution x = 5.0005. Of course, it takes much more work to solve the equation to this level of accuracy.

For such a simple equation we would never use a computer to get a solution. But the equations that cosmologists typically handle are large and complex, describing many coupled physical processes--gas dynamics, radiation transfer, dark matter dynamics, etc., and can contain tens of thousands of terms; no analytic solution is possible. So we must develop algorithms to solve these equations efficiently and accurately on very large computers. The resulting numerical solutions are essentially a collection of numbers that specify state of the cosmic plasma, spectrum of background radiations, dark matter distribution, and strength of the gravitational field at various points in space, and at various times as well. This numerical solution must then be analyzed and understood through graphical representation of the data.