### Outline of the General Construction

The previous installment showed that the main obstacles in constructing a smooth surface of all the sheets are the branch cuts of radicals, `Root`-objects, arctrig, and archyperbolic functions with nontrivial arguments. To avoid discontinuities we would have to restrict carefully the regions in which we calculate the function values. On the other hand, branch cuts can be chosen arbitrarily to a large extent, and only the locations of the branch points represent an inherent property and are well defined (i.e., branch cuts have to connect branch points, but how exactly a branch cut is chosen in the principle sheet between the branch points does not matter--at least as long as we do not form knotted ones). That is why we will completely avoid using closed-form formulas and branch cuts. Instead we will use `NDSolve` to calculate smooth patches inside branch-point-free regions of the complex -plane by solving smooth differential equations that have smooth solutions. Using this treatment we completely avoid dealing with branch cuts (which do not exist on a Riemann surface anyway). The patches will be chosen so that the branch points (which must be treated carefully, as two or more sheets are glued together there) are always at their vertices. Having the branch points as vertices of the patches also allows a good spatial resolution near the branch points. This spatial resolution is important because often varies most near branch points. Using branch points as the vertices of the patches will result in a smooth surface, self-intersecting in 3D, that represents the Riemann surface of the function.

To construct the Riemann surface, we will proceed with the following partially symbolic, partially numerical steps.

1. All branch points come from either arctrig functions, logarithms, or radicals. For a uniform treatment, we convert all arctrig functions into a representation using only logarithms (the function `TrigToExp` comes in handy here). We then extract all log-terms, radicals, and `Root`-objects and determine their branch points. These are the (potential) branch points of the function under consideration. The branch points will be determined using `Solve`. (This means that if `Solve` cannot find all the roots for certain equations, not all branch points will be known, so we cannot generate a picture of the corresponding Riemann surface. In principle one could use numerical root finding techniques, but making sure that all branch points are calculated is a highly nontrivial issue and outside the scope of this article.)
2. We divide the complex -plane radially and azimuthally into sectors generated by the outer product of the radial and azimuthal coordinates of the branch points, so that every sector has no interior branch points.
3. We derive a set of coupled nonlinear ordinary differential equations describing as a rational function in and the for all radical and log expressions.
4. We generate some possible sheets of the function. For radicals and `Root`-objects we generate all possible sheets, and for logarithmic terms we use (by default we will use three sheets) out of the infinitely many sheets.
5. Starting quite near the branch points, we solve the differential equation radially outward for all sheets of every sector. Here it is important to avoid calculating sheets more than once. (A trivial case in which one might calculate more sheets than needed would be the uncollapsed sum , a function that has only one sheet, not sheets.)
6. Starting from the radial solutions of the differential equations constructed in step 3, we solve the differential equation azimuthally inside the sectors constructed in step 2. These solutions result in parametrized parts (parametrized by the radius and the angle ) of all sheets for each sector.
7. We generate polygons from the parametrizations for all sheets and all sectors.
8. We display all polygons together. (After we have finished, we might cut holes into the polygons for better visibility of the inner parts of a Riemann surface.)