WEEK#3, Lecture 3 Non-Linear Equations

Document Sample
WEEK#3, Lecture 3 Non-Linear Equations Powered By Docstoc
					 WEEK #3, Lecture 3: Non-Linear Equations

Linear Review
We have been solving equations like

                                        x − 4y = 10

                                        2x − 3y = 4
only we have done this for over 100,000 equations and variables!

To manage this feat, we have relied on the linearity of the equations (no x2 , ln(x), sin(x),
etc. terms) In particular, we had a square matrix of coefficients, A, which linear algebra
theorems guaranteed (for det(A) = 0) that
   • a solution exists to AX = B,
   • the solution is unique, and
   • Gaussian Elimination will find the solution

Non-Linear Equations
If equations are non-linear, all bets are off.
   • There may be no solution
   • There may be multiple or an infinite number of solutions
   • There is no guarantee we can find a solution, even if it exists
Worse yet, we will encounter significant challenges with even a single variable, let alone
thousands of them.

Compare the difficulty in solving these two single-variable equations.
Linear: 5x = 10

Non-linear: ex = x + 5
Some types of non-linear equations can be solved algebraically.
Find, by hand or with the help of a calculator, the solutions to the following equations.

                                    x2 + 2x + 3 = 0

                                      log10 (x) = 3

                                    sin(3x) = cos(3x)

Unfortunately, solving using algebra requires understanding of how to manipulate par-
ticular functions. Worse yet, equations can be simply too complex to solve algebraically.
Try to solve the following equations by hand:

                                       sin(3x) = x

                                        xe−x = 5

In these more difficult cases, if we want a solution we must resort to numerical meth-
ods, which are all fancy versions of guess and check! This means numerical
solutions are a poor second choice:
   • Numerical solutions give no insight into solution (existence, patterns)
   • Numerical solving usually requires some amount of trial and error.
Example - Trajectories
To generate a motivation for solving non-linear equations, we are going to simulate the
launch a car off the end of a ramp. The launch parameters are v0 , y0 , and θ0 .
Write the equations for the position of x and y as functions of time.

Use those functions to write the trajectory in the form y = f (x).

Exercise: Write a MATLAB script, L3 1.m that plots the trajectory of the car. Set
   • y0 = 3 m,
   • v0 = 20 m/s, and
   • θ0 = 30 degrees.
and choose the x interval so it shows the impact point.

Exercise: Add a horizontal line on the trajectory graph that shows the ground level,
y = 0. Draw it in black.
Landing Point
Now that we have our trajectory in the form y = f (x), an obvious follow-up question is
        Knowing v0 , y0 , and θ0 , what is value of x at impact with the ground?
Express this question mathematically.

Is the equation you get linear in x?

What kind of equation is this in x?

Polynomial Roots in MATLAB
Polynomials are an incredibly important subset of non-linear functions. They are special
in that tools exist to find all of their roots in one command.
Exercise: Look up the roots command in MATLAB, and use it to find the impact
point of the car, given y0 , v0 and θ0 .

Exercise: In the L3 1.m script, add the solving for the impact point, and draw a dot at
the impact location on top of the trajectory graph.
Launch Angle - Ballistics
We now now how to determine the impact point, given the details of the launch. There
is a related ballistics problem, with practical consequences on battlefields around the
 Given the launch velocity, height, and a target x, what launch angle should be used?
Can we solve this new version of the problem using roots in MATLAB?

Exercise: Set y0 = 3, v0 = 20. Experiment to find a launch angle that lands the car at
x = 30.

We notice that there is an inescapable element of trial-and-error in our search for the
right θ0 . To avoid unnecessary work, and to maximize our overall efficiency, we should
consider both
   • how long it takes us to code our approach,
   • how quickly our program produces an answer, and
   • how accurate the program’s answer is.
We will look more deeply into these ideas next class.

Shared By: