A1334 of 55
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

A13 · Lesson 34 · Nonlinear systems: Newton's method in several variables

Linearize everything at once, solve, repeat: how a circuit simulator works

Two diodes in a resistor network: two node voltages, two KCL equations, each with an exponential in it. Newton's method from lesson 6 extends directly. At the current guess, replace every equation by its tangent plane, which turns the problem into a linear system whose matrix is the Jacobian; solve it, move, and repeat. Near the answer the error squares each step, just as in one dimension. This is exactly the inner loop of SPICE and of the simulator behind this course's circuit sims: each Newton step solves a linear circuit in which every diode has been replaced by a conductance and a current source.

  • The circle x2+y2=4 and the curve y=1−ex cross at two points; those are the solutions of F(x,y)=0. Drag the start x0 with the sliders.
  • The dots are the first two Newton steps. From (−1, 1), x2 is already within 0.05 of the crossing near (−1.82, 0.84), and the readout shows |F| collapsing.
  • Start near where the curves' tangents line up (the Jacobian is nearly singular) and the first step flies off: the multidimensional version of a flat spot.

Predict

A circuit has 1000 nodes and 50 diodes. What does each Newton step have to solve?

Name it

Newton's method for F(x) = 0

For n equations in n unknowns, with Jacobian Jij=∂Fi/∂xj:

J(xk)Δk=−F(xk),xk+1=xk+Δk

Near a solution where J is nonsingular, convergence is quadratic. Each step costs forming J (analytically, or with n extra evaluations of F by finite differences) and one linear solve.

Circuits

Writing KCL at each node, a diode from node a to node b contributes Id=Is(eV/nVT−1) with V=Va−Vb. Its linearization at the current guess V(k) is

Id≈gdV+Ieq,gd=IsnVTeV(k)/nVT,Ieq=Id(V(k))−gdV(k)

a conductance and a current source, stamped into the nodal matrix like any resistor and source. Transistors linearize the same way into conductances and controlled sources.

Keeping it on track

  • Limiting: cap each diode's voltage change at a few nVT (lesson 6's overflow).
  • Damping: if ‖F(xk+Δ)‖ isn't smaller than ‖F(xk)‖, try xk+12Δ, and so on (a line search).
  • Continuation: ramp the sources up from zero, or start with a small conductance across every junction and remove it (source and gmin stepping), solving each easier problem from the last one's answer.
  • Quasi-Newton (Broyden): update an approximate Jacobian from successive steps instead of recomputing it.

Worked example

A 5 V source feeds node 1 through 1 kΩ; diode D1 goes from node 1 to ground, and 1 kΩ connects node 1 to node 2, where D2 goes to ground (Is=10−14 A, nVT = 25.85 mV). Solve by Newton from (0.7, 0.6) V.

Show the solution
  1. The residuals. Their norms are 1.6×10−3, 1.9×10−4, 4.0×10−6, 1.9×10−9 and 4×10−16 A: quadratic once it's close.
  2. The solution. V1=0.691903VV2=0.594530V
  3. Check the currents. D2 carries V1−V21kΩ=97µA and D1 the rest of the 4.3 mA.

Answer V1=0.691903 V and V2=0.594530 V, with 97 µA in D2.

Worked example

Linearize a diode at 0.65 V.

Show the solution
  1. Diode current. Id=10−14(e0.65/0.02585−1)=0.832mA
  2. Its conductance. gd=Id/nVT≈32.2mS a 31 Ω resistor.
  3. The equivalent source. Ieq=0.832−32.2×0.65=−20.1mA
  4. The linear model. In the next linear solve the diode is a 31 Ω resistor in parallel with a −20.1 mA source.

Answer a 32.2 mS conductance (31 Ω) in parallel with a −20.1 mA source.

Worked example

Solve x2+y2=4, ex+y=1 by Newton's method from (1, −1.7).

Show the solution
  1. At the start. F=(−0.11,0.0183), and the Jacobian is J=(2x2yex1)=(2−3.42.7181)
  2. First step. Solving Jδ=−F gives δ=(0.00426,−0.0298), so the next point is (1.004256, −1.729850), where ‖F‖=9×10−4.
  3. Second step. It reaches (1.004169, −1.729637) with ‖F‖=5×10−8.
  4. Third step. It is exact to rounding. The residual squares each step, as Newton's method should once it's close.

Answer (x,y)=(1.004169,−1.729637), exact to rounding after three steps.

Check

What's the companion conductance gd of a diode (Is=10−14 A, nVT = 25.85 mV) linearized at 0.65 V?

Write units the way you normally would: 1.5 mS, 1500 µS and 0.0015 S are the same answer.

Check

And the companion current source Ieq=Id−gdV at 0.65 V?

Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.

Check

For F=(x2+y2−4,ex+y−1), what's the Jacobian's determinant at (1, 1)?

Check

Forming a Jacobian of n = 1000 equations by forward differences: how many evaluations of F does it take, counting F at the current point?

Check

Newton on F=(x2−3,y−x) from (1, 0): what's x1?

Check

Newton's method on a circuit oscillates between two guesses and ‖F‖ doesn't shrink. What's a standard remedy?

Check

Solve F=(x2−2,xy−1)=0 by Newton's method from (1.5,0.5).

(a)

What is the new x? (The first equation involves x alone.)

(b)

What is the new y? The second row of Jδ=−F is yδx+xδy=−(xy−b).

Check

Newton's method on F=(x2+y2−r2,y−mx) at the point (x, y).

Step 1

What is the Jacobian's determinant?

Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.

Explain why

Why is each Newton step for a nonlinear circuit the same as solving a linear circuit?

Practice

Keep practicing

9 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.