Download presentation
1
Non-Linear Simultaneous Equations
Chapter 8 Solving Simultaneous Equations Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
2
Review: Linear Equations in Matrix Form
The first step in using matrix methods to solve a series of linear simultaneous equations is to write them in matrix form For n simultaneous equations and n unknowns: where A is the coefficient matrix (n × n); X is the matrix of unknowns (n × 1), and C is the constant matrix (n × 1) Engineering Computation: An Introduction Using MATLAB and Excel
3
Review: Linear Simultaneous Equations
Recall that if there are more unknowns then equations, then we cannot find a unique solution If there are more equations than unknowns, then some equations must be redundant If there are exactly the same number of equations and unknowns, then there may be a unique solution. In this case the coefficient matrix will be square Engineering Computation: An Introduction Using MATLAB and Excel
4
Solution of System of Linear Equations
We can find the unknown variables by multiplying the inverse of the coefficient matrix by the constant matrix Engineering Computation: An Introduction Using MATLAB and Excel
5
Summary – Linear Equations
If the inverse of the coefficient matrix exists, then there is a solution, and that solution is unique If the inverse does not exist, then there are two possibilities: The equations are incompatible, and so there are no solutions, or At least two of the equations are redundant, and so there are more unknowns than unique equations. Therefore, there are an infinite number of solutions Engineering Computation: An Introduction Using MATLAB and Excel
6
Non-Linear Equations If any of the equations are non-linear, then the matrix method will not work Example: Consider these two equations: The x2 term in the first equation prevents the use of a matrix solution Engineering Computation: An Introduction Using MATLAB and Excel
7
Excel Solver Solver is an Excel Add-In that can find solutions to many problems with multiple independent variables The first step is to check that Solver is installed If so, it will appear in the Data group of the ribbon: Engineering Computation: An Introduction Using MATLAB and Excel
8
Installing Solver If Solver is not present on the ribbon, start by clicking the Office Button… And selecting Excel Options… Engineering Computation: An Introduction Using MATLAB and Excel
9
Installing Solver Choose Add-Ins… And click Go beside Excel Add-Ins…
Engineering Computation: An Introduction Using MATLAB and Excel
10
Installing Solver Check Solver and click OK
If Solver has not been installed, click Yes to install it now Engineering Computation: An Introduction Using MATLAB and Excel
11
Using Solver Solver attempts to set the value of a target cell to its minimum, its maximum, or a specific value, By changing one or more input cells (independent variables, While maintaining specified constraints (optional) Engineering Computation: An Introduction Using MATLAB and Excel
12
Solver Example Consider this equation:
Use Solver to find values of x for which y is minimized y is equal to exactly 50 y is maximized, within limits of x from 0 to 10 Engineering Computation: An Introduction Using MATLAB and Excel
13
Solver Example To better understand this problem, consider this plot of y vs. x: Engineering Computation: An Introduction Using MATLAB and Excel
14
Solver Example Label a cell for the independent variable x and enter the formula for y in another cell: Engineering Computation: An Introduction Using MATLAB and Excel
15
Solver Example Start Solver. For the first part of the problem we want to minimize y (Target Cell C4) by changing x (cell C2): Engineering Computation: An Introduction Using MATLAB and Excel
16
Solver Example The answer is that when x = 2, y = 16, the minimum value of y that is possible: Engineering Computation: An Introduction Using MATLAB and Excel
17
Solver Example Next, find the value of x for which y = 80:
Engineering Computation: An Introduction Using MATLAB and Excel
18
Solver Example But we can see from the graph that there are two solutions to the problem This is typical for non-linear problems; multiple solutions are possible The solution found often depend on the initial guess entered before running Solver Engineering Computation: An Introduction Using MATLAB and Excel
19
Solver Example Try x = -10 as the initial guess and run Solver again:
Engineering Computation: An Introduction Using MATLAB and Excel
20
Solver Example Now try to maximize y:
Engineering Computation: An Introduction Using MATLAB and Excel
21
Solver Example Since the value of y increase to infinity for both increasing and decreasing values of x, there are no maxima values to be found However, we can constrain the problem by requiring the input value of x to be between 0 and 10: Engineering Computation: An Introduction Using MATLAB and Excel
22
Solver Example We find that when x = 10, y = 80. This is the maximum value that y can have, subject to the constraints on x. Engineering Computation: An Introduction Using MATLAB and Excel
23
Solver Example However, even this solution is affected by the initial guess. For example, if we try x = as the initial value: Then we get a different solution, although the value of y is clearly not maximized: Engineering Computation: An Introduction Using MATLAB and Excel
24
Solver Example It is important to realize that Solver finds local maximum and minimum values Allowable x-values Engineering Computation: An Introduction Using MATLAB and Excel
25
Simultaneous Equation Example
Back to our earlier example - consider these two equations: Can we find values of x and y that satisfy both equations? Engineering Computation: An Introduction Using MATLAB and Excel
26
Simultaneous Equation Example
With non-linear simultaneous equations, the first step is to write the equations with all of the variables and constants on the same side of the equal sign We give the resulting expressions variable names (f1 and f2 here): When both f1 and f2 are zero, then the equations are satisfied Engineering Computation: An Introduction Using MATLAB and Excel
27
Simultaneous Equation Example
Start by labeling two cells for the input variables (x and y) Label two cells for f1 and f2, and enter their formulas: Engineering Computation: An Introduction Using MATLAB and Excel
28
Simultaneous Equation Example
Remember that Solver must have a single target cell: we cannot specify that both f1 and f2 are to be zero We could specify that the sum of f1 and f2 be zero; however, this would not guarantee that both are zero as one could be positive and the other negative If we square both values, then both these values must be greater than or equal to zero If the sum of the squares equals zero, then both f1 and f2 must be zero Engineering Computation: An Introduction Using MATLAB and Excel
29
Simultaneous Equation Example
Add cells for the squares and their sum. The sum (cell C7) will be the Target Cell in the Solver setup: Engineering Computation: An Introduction Using MATLAB and Excel
30
Simultaneous Equation Example
Engineering Computation: An Introduction Using MATLAB and Excel
31
Simultaneous Equation Example
Solver has found a solution: x is about -1 and y is about 0 Engineering Computation: An Introduction Using MATLAB and Excel
32
Simultaneous Equation Example
These are the exact values for the solution: Engineering Computation: An Introduction Using MATLAB and Excel
33
Simultaneous Equation Example
Try different guess values of x and y: Engineering Computation: An Introduction Using MATLAB and Excel
34
Simultaneous Equation Example
A second solution if found: x = 1.5 and y = 12.5 Engineering Computation: An Introduction Using MATLAB and Excel
35
Simultaneous Equation Example
A graphical solution is possible with two equations. Notice that the curves intersect in two places Engineering Computation: An Introduction Using MATLAB and Excel
36
Simultaneous Equation Example
Zooming in, we can see the solutions that we found with Solver Engineering Computation: An Introduction Using MATLAB and Excel
37
Simultaneous Equation Example
Now try these equations (only the second is changed) Engineering Computation: An Introduction Using MATLAB and Excel
38
Simultaneous Equation Example
In this case, no solution can be found Engineering Computation: An Introduction Using MATLAB and Excel
39
Simultaneous Equation Example
Graphing the equations shows that they do not intersect Engineering Computation: An Introduction Using MATLAB and Excel
40
Summary Excel Solver can be used to numerically find maxima, minima, and specific values of a target cell by varying one or more input cells, with or without additional constraints Solver can also find solutions of simultaneous non-linear equations Important to recognize that multiple solutions may exist for non-linear problems Engineering Computation: An Introduction Using MATLAB and Excel
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.