I might be too old for Youtube. I just get impatient and cranky.

I suspect they mis-spoke about the “sum of the residue current over all the nodes” Σ node_i being tested against tolerance, because that would ignore a current-error in a nonlinear element between two (non-ground) nodes. He is talking about Spectre, and their engineer’s explainer (p6) indicates that the current imbalance at each node is tested.

The best corresponding documentation that I found for Spice, so far, is the NGspice manual §1.4.2

The Youtube video on nodal analysis is long and somehow still superficial, so I found the original paper on modified nodal analysis and applied it to the circuit above. That paper makes it clear, at the bottom of its second page, that tracking in detail the current from a current source is optional (surprisingly) and not recommended for the sake of speed.

So with the details as context, everything seems obvious:

- Qspice iterates until each voltage is stable to ±0.1%

so at some timestep the iteration might tell us `V(e)`

=3.000V±3mV

and at the same timestep it happens to tell us that `V(out)`

=2.496V±2mV
- Qspice figures my well-intentioned soft minimum
`minf(dV, 3V, e)`

=2.500V

and the difference between that result and `V(out)`

=2.496V±2mV, which is 4mV ±2mV
- The calculated current through
`B1`

has a large relative uncertainly, because it is the difference between the two voltages that Qspice tested for tolerance.

Both Spice and Spectre check that all the voltages, and I(V1), in that column vector have converged.

As I understand the Spectre criteria for convergence, they would also put the final voltages, ‘out_(g+1)’ etc., into the nonlinear function f(e_(g+1),out_(g+1)) and re-check the matrix equation. (The terms with the partial derivatives ∂ all cancel if we have g+1 on both sides) Now, the matrix solve found voltages that exactly solve the matrix equation for the *linear approximation* to f(e_(g+1),out_(g+1)), based on evaluations at e_g, etc., so this is a way to see how well that linear prediction held true. It seems this test would have checked that my `B1`

also came out within specified tolerances.

The NGSpice docs say they also check convergence of currents through nonlinear devices, but for *each branch* going into a node, which seems they are being more careful if there are many branches with nonlinear elements feeding one node. Reading carefully, NGSpice don’t say they figure the nonlinear function at the final voltages, f(e_(g+1),out_(g+1)), but only that the final update, g to g+1, made a small change, given the linear approximation using derivatives at iteration g. I do not want to need to worry about such details.

Moral: use zero-volt voltage sources to have Spice report currents, like the Spice textbooks tell you.

[Edit: The issue with `I(B1)`

being more inaccurate than RELTOL implies, does seem to violate the promise of SPICE as described in the NGspice user manual. Also, the NGspice source code (which is close to the original core SPICE) seems to have an error in its convergence check, affecting only B-devices, not real devices, so I’ve submitted a bug report there (with a very simple circuit deviously designed to be difficult for Newton’s method, to help isolate the issue). ]