# The nonlinear shooting method for a problem with "mixed" boundary conditions

See attached image.

I don't necessarily need a worked solution - If someone could explain how I would modify the shooting method to solve a nonlinear problem with BC's of this type (ie the right hand BC is a derivative), that would be very helpful.

## Answer

Here is a detailed description of the solution steps, additional context, another (slightly different) approach.

I hope it is easy to follow and repeat. If you like the content provided, a tip is appreciated.

Best,

Kav10

By using a numerical solver to iteratively adjust an initial condition until the right-hand boundary condition is satisfied, you can modify the shooting method to solve nonlinear problems like this with boundary conditions.

The general process is:**Transform:** transform the nonlinear partial differential equation (PDE) into a system of first-order ordinary differential equations (ODEs) by introducing auxiliary variables.**Initial Condition:** specify the initial condition and the boundary conditions.**Numerical Solver:** use a numerical ODE solver to integrate the system from the initial condition to the right-hand boundary.**Evaluate and reiterate:** evaluate the right-hand boundary condition and compare it with the desired value. If the difference is above a certain tolerance, adjust the initial condition and repeat the integration and evaluation steps until the difference is within the desired tolerance.**Final Solution:** The final value of the initial condition that satisfies the right-hand boundary condition is the solution to the nonlinear problem.

For the case where the right-hand boundary condition is a derivative, you would need to evaluate the derivative numerically using finite differences or other methods, and use that value in step 4 when comparing with the desired value.

**Additional context:**

The shooting method, in general, is a numerical technique for finding approximate solutions to a nonlinear boundary value problem.

To apply it to the given nonlinear ODE, you have to make an initial guess (like described above) for y'(0), say y'(0) = M.

Then, you can use an ODE solver to numerically integrate the ODE from x = 0 to x = 1 and obtain an approximation for y(1).

Finally, by comparing the value of y'(1) obtained from the numerical solution to the boundary condition y'(1) = 0, you can figure out if/how adjustment is needed.

If they are not equal, you adjust the initial guess for y'(0) and repeat the process until you find a value of M that yields a solution that satisfies both boundary conditions.

This can be coded in Python or R, fairly easily.

**Slightly different approach:**

Another approach is to first transform it into a system of first-order ODEs and then solve it.

This can be done by introducing an auxiliary variable z(x) = dy/dx, so that the ODE system becomes:

dy/dx = z

dz/dx = e^x + yz

Next, you should specify the initial conditions and boundary conditions for the ODE system.

So, you have:

y(0) = 1

z(0) = unknown initial value, denoted as z0

y(1) = unknown final value, denoted as y1

z(1) = 0

Now, you can use a numerical ODE solver to integrate the system from x = 0 to x = 1 with a initial value of z0. After integration, you evaluate the final value of y at x = 1, denoted as y1, and compare it with the desired value of 1.

If the difference is above a certain tolerance, you adjust the value of z0 and repeat the integration and evaluation steps until the difference is within the desired tolerance.

The final value of z0 that satisfies the boundary condition y'(1) = 0 is the solution to the nonlinear problem.

Note that the shooting method may require multiple iterations to converge to a solution, and the choice of initial guess can greatly impact the convergence rate.

- answered
- 1657 views
- $15.00

I can provide explanation on how to modify the shooting method. Would that work?

Hi Kav, yes that would be perfect :)