# Issue solving nonlinear equation containing a quotient

I have a coupled set of PDEs that need to be solved as part of a larger problem. I am currently approaching this by computing spatial derivatives with finite differences and using PETSc's nonlinear conjugate gradient solver. This does converge in terms of an absolute tolerance, however, when I started thinking about the structure of my equations, I've noticed a problem.

Consider $$\partial_x F\!\left(x\right) = G\!\left(x\right)$$ where $$F$$, $$G$$ are given by $$F\!\left(x\right) = \frac{1}{1 + f\left(x\right)^2}$$ $$G\!\left(x\right) = \frac{f(x)}{1 + f\left(x\right)^2}.$$ We would be solving for $$f\!\left(x\right)$$. (This is not one of the equations I am solving, but it's similar in structure and just an illustration anyway.)

What would stop the nonlinear solver from, say, making $$f\!\left(x\right)$$ larger and larger until the "signal" (residual) falls below the "noise" (tolerance) level?

I've observed this happening in my own equations, and I think that my "convergence" might not be real. Yet the solver is doing exactly what it should, and what I asked it to do. Is there a way around this problem? Or is this not a problem at all?

• For the $f,g$ you give, it's not true that $f'=g$... Jul 3, 2020 at 17:18
• @WolfgangBangerth, Just realized that! Fixed now. Sorry for the confusion, I probably shouldn't post late at night. Jul 3, 2020 at 17:20

We can rewrite the equation as

$$\frac{-2 f f'}{(1+f^2)^2} = \frac{f}{1+f^2}$$

which reduces to

$$f' = - \frac{1+f^2}{2}$$

The latter does not have $$1+f^2$$ in the denominator, so it should not have the aforementioned numerical problem and can be easily integrated numerically.

In fact, now the equation can be easily seen to have a trivial analytic solution, which is always useful for numerical solution verification,

$$\frac{df}{1+f^2} = - \frac{dx}{2}$$

so

$$\arctan(f) = - \frac{x}{2} + const$$