## Method of continuity for solving nonlinear equations - Part II

November 02, 2011 at 01:25 PM | categories: nonlinear algebra | View Comments

# Method of continuity for solving nonlinear equations - Part II

John Kitchin

clear all; close all; clc

Yesterday in Post 1324 we looked at a way to solve nonlinear equations that takes away some of the burden of initial guess generation. The idea was to reformulate the equations with a new variable , so that at we have a simpler problem we know how to solve, and at we have the original set of equations. Then, we derive a set of ODEs on how the solution changes with , and solve them.

Today we look at a simpler example and explain a little more about what is going on. Consider the equation: , which has two roots, and . We will use the method of continuity to solve this equation to illustrate a few ideas. First, we introduce a new variable as: . For example, we could write . Now, when , we hve the simpler equation , with the solution . The question now is, how does change as changes? We get that from the total derivative of how changes with . The total derivative is:

We can calculate two of those quantities: and analytically from our equation and solve for as

That defines an ordinary differential equation that we can solve by integrating from where we know the solution to which is the solution to the real problem. For this problem: and .

dxdL = @(lambda,x) -x^2/(-5 + 2*lambda*x); [L,x] = ode45(dxdL,[0 1], 6/5); plot(L,x) xlabel('\lambda') ylabel('x') fprintf('One solution is at x = %1.2f\n', x(end))

One solution is at x = 2.00

We found one solution at x=2. What about the other solution? To get that we have to introduce into the equations in another way. We could try: , but this leads to an ODE that is singular at the initial starting point. Another approach is , but now the solution at is imaginary, and we don't have a way to integrate that! What we can do instead is add and subtract a number like this: . Now at , we have a simple equation with roots at , and we already know that is a solution. So, we create our ODE on with initial condition .

dxdL = @(lambda,x) (5*x-10)/(2*x-5*lambda); [L,x] = ode45(dxdL,[0 1], -2); plot(L,x) xlabel('\lambda') ylabel('x') fprintf('One solution is at x = %1.2f\n', x(end))

One solution is at x = 3.00

Now we have the other solution. Note if you choose the other root, , you find that 2 is a root, and learn nothing new. You could choose other values to add, e.g., if you chose to add and subtract 16, then you would find that one starting point leads to one root, and the other starting point leads to the other root. This method does not solve all problems associated with nonlinear root solving, namely, how many roots are there, and which one is "best"? But it does give a way to solve an equation where you have no idea what an initial guess should be. You can see, however, that just like you can get different answers from different initial guesses, here you can get different answers by setting up the equations differently.

% categories: Nonlinear algebra % tags: math