Lecture 3 - Solving Equations Using Excel - Jan 2018

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

Solving Equations using Excel

Kazi Bayzid Kabir, PhD


Learning Objectives
• In this section we examine methods of finding
roots of non-linear equations such as
polynomial and transcendental
Let’s solve a simple quadratic equation
• 2𝑥 2 − 5𝑥 − 12 = 0

• To make it easy let’s plot the equation


Using Goal Seek to solve
2
To sove 2x -5x-12 = 0
Root Function
0 -12
3 -9
Finding both roots
Cubic equation
• 2𝑥 3 + 𝑥 2 − 246𝑥 + 360 = 0

How to proceed??
Transcendental equations

How to proceed??
Solver Add-in
• The Solver Add-In is much more powerful than
Goal Seek

• originally designed for optimization problems

• also useful for root finding and similar


mathematical problems
Goal Seek vs Solver
• When you have used Solver once on a worksheet, it will
retain its settings when it is next used on that worksheet.

• Whereas Goal Seek allows you to vary one cell, with Solver
you can vary 200 cells but using no more than 16 ranges.
We could vary, for example, A1 :A10 and B1

• Solver may be used to find the value of the variables that


give the formula a maximum or a minimum value as well as
a set numeric value

• We may control how Solver finds a solution


Cubic Equation again using solver
• 2𝑥 3 + 𝑥 2 − 246𝑥 + 360 = 0
Solver Options
• Max Time sets the maximum amount of time Solver may spend on
the problem. The default value of 100 seconds is ample with a
modern PC for all but very large problems.

• Iterations sets the limit of the number of attempts Solver has to


find a satisfactory solution.

• Precision pertains to the constraints. Let the Precision be 1 x and


suppose we specify the constraint A1 >= 0. After some iterations
Solver find a solution but A1 = -1 x lo-’ . Solver will consider the
constraint has been met since it is within the precision.

• Tolerance pertains to integer constraints. An integer constraint


makes the problem much harder. Try initially solving without
integer constraints.
Solving Simultaneous Equations
• 2𝑥 + 3𝑦 − 3 = 0
• 3𝑥 + 2𝑦 − 5 = 0
Using a Constraint
Matrix Algebra
• MDETERM(A)
– Returns the matrix determinant of an array
• MINVERSE(A)
– Returns the inverse of the matrix of an array.
• MMULT(A,B)
– Returns the matrix product.
• TRANSPOSE(A)
– Returns the transpose of an array. The first row of the
input array becomes the first column of the output
array, etc.
Points to ponder
• For all but TRANSPOSE(), every cell in the array must
contain a numeric value otherwise the #VALUE! Error
results.

• The #VALUE! error results when an illegal matrix operation


is attempted.

• Because the first two functions use an accuracy of 16 digits,


small numeric errors may occur. For example, a singular
array may return a result that differs from zero by 1E-16.

• Except for MDTERM(), these are array functions and must


be completed with [Ctrl]+[Shift]+[Enter]
Solving systems of linear equations
using matrix operations
• 𝑥 − 2𝑦 = −1
• 3𝑥 + 4𝑦 = 17

1 −2 𝑥 −1
• 𝑦 =
3 4 17

• 𝐴𝑋 = 𝐶
• 𝑋 = 𝐴−1 𝐶
Example: 3 equations to solve
• 2𝑥 + 3𝑦 − 2𝑧 = 15
• 3𝑥 − 2𝑦 + 2𝑧 = −2
• 4𝑥 − 𝑦 + 3𝑧 = 2

You might also like