# M64. Nonlinear stationary equations, between walls **Package:** A9: a stationary equation on a box with walls or on a round domain with a term that is nonlinear in the unknown, such as $\nabla^2 u - u^3 = f$ or $\nabla\cdot(\varepsilon\nabla u) + \lambda e^u = 0$, by Newton's method. Each of its steps is a linear equation with a coefficient that varies, which milestone 63 solves. ## What was built - **Newton's method in `bounded_varying`.** The summands of a stationary equation that are nonlinear in the unknown are its nonlinear term, with its slope by symbolic differentiation. A step solves the linearized equation for the next iterate, with the slope at the points of the grid as one more coefficient that varies. - **The solve of milestone 63 as a part.** It was one function for one equation. It is now a setup on a grid that solves for one right-hand side after another, with or without a slope, and returns the effective source with the solution. - **A starting value** from `guess=`, which the description of a problem has since milestone 23. - **The method `collocation_newton`** in a plan, with the tolerance, the most steps of Newton's method and the most steps of the iteration inside each. The diagnostics hold `newton_steps`, the steps of all iterations together, and the residual of the nonlinear equation. - **Refused, with the reason**: a derivative of the unknown in the nonlinear term, an array in it or in the starting value, the magnitude of a complex unknown, and a linear part that leaves the solution open up to a constant. ## What it reaches For solutions that are known: | Equation | Grid | Steps of Newton's method | Steps inside them | Largest error | Time | |---|---|---|---|---|---| | $\nabla\cdot(\varepsilon\nabla u) - u^3 = f$ on the unit square, $\varepsilon = 1 + xy$ | $24^2$ | 4 | 35 | $3\cdot10^{-13}$ | 0.02 s | | $\nabla^2 u - u^3 = f$ in the unit cube | $24^3$ | 3 | 11 | $4\cdot10^{-14}$ | 0.09 s | | $\nabla^2 u - e^u = f$ in the unit ball | $24\times24\times48$ | 4 | 24 | $3\cdot10^{-13}$ | 0.3 s | | $u'' + e^u = 0$ on a string, from zero | 24 | 3 | 15 | $3\cdot10^{-15}$ | 0.004 s | The problem of Bratu on a string has two solutions, with the values 0.1405392 and 4.0914672 in the middle. From zero Newton's method reaches the lower one, and from the arch $16x(1 - x)$ the upper one: the tests check both against their formula. ## Decisions ### D64.1. Newton's method on the iteration, with one reference *Developer, 2026-11-20.* The linearized equation of a step has the slope of the nonlinear term as a coefficient that varies, which is what milestone 63 solves. Its reference operator could follow the iterate, with the mean of the slope in it. It does not: the modes of the domain are computed once, for the linear part of the equation, and every step iterates on them. The slope is a term without derivatives, which the iteration takes in a few steps more. ### D64.2. The residual from the effective source *Developer, 2026-11-20.* On a shape the residual of the nonlinear equation at a new iterate is known because the linear solve is direct: what is left is the nonlinear term less its tangent. Here the linear solve is an iteration, and that shortcut would count its residual as zero. But the iteration returns the effective source of its solution, which is what the operator of the modes makes of it, and that is linear along a step. So the residual of the equation, $L_0 u + R(u) + N(u) - f$, is computed as it stands at every trial, for the cost of the remainder. ### D64.3. The linear part must fix the solution *Developer, 2026-11-20.* With the slope given on every face and no linear term that holds the unknown, the reference operator has no inverse, and there is nothing to iterate on, although the nonlinear equation may well have one solution. It is refused with that reason. To take it, the mean of the slope would have to join the reference operator, step by step, which D64.1 left out. It is what is left of the package. ### D64.4. A step is solved more closely than Newton's method asks *Developer, 2026-11-20.* The iteration inside a step stops at a tenth of the tolerance of Newton's method. At the same tolerance the residual of the last step would be that of its linear solve, and the method would take one step more to see that it has arrived. ## What is left - A linear part that leaves the constant open. - An array in the nonlinear term or in the starting value. - A derivative of the unknown in a nonlinear term, as everywhere.