Finding the solutions to equations:
To solve a single equation in a single unknown,the
root
function can be used. This Mathcad function uses an
expression and one of the variables from the expression.
It varies the variable until the expression is equal
to zero. It then returns the value that makes the
expression equal zero. The root function has the form:
root ( f(z) , z ) where
f(z) is the function, and the value of z which makes
the function equal to zero is returned as the solution.
The function can be a function which is defined elsewhere
in the worksheet or an expression.
To find the solution to the equation
x
3 - e x
1. First define a guess for the value of the variable.
This guess value must be placed before the root function
in the Mathcad worksheet. Define the guess value of
x
as 3:
2. Arrange the function in a form that is equal
to zero. Select a variable name for the scalar which
will be used to define the root of the equation. Using
the variable a
for this:
3. To have Mathcad show the root of the equation
simply type a=
Mathcad returns
the answer:
4. If the equation has more than one root, the
guess value will determine the root which is closest
to the guess value. An alternate way to find multiple
roots is to use the polyroot
function.
The polyroot function does not require a guess
value. However, it returns all of the roots of an
equation at once, whether they are real or complex.
In order to use the polyroot function, the equation
must be expressed as a vector. This will not be covered
in this material.
Systems
of equations:
Mathcad allows you to solve a system of up to fifty
simultaneous equations in fifty unknowns.
There are four steps to solving a system of simultaneous
equations. These are:
1. Provide an initial guess for all of the unknowns
that are desired. The initial guesses give Mathcad
a place to start searching for solutions.
2. Type the word
Given
. This tells Mathcad that what follows is a system
of equations. It can be typed in any combination of
upper and lower case letters and in any font. Be
sure that it is not typed in a text region or paragraph
3. Type the equations and inequalities in any
order below the word Given
. Make sure to use the symbol "=" to separate
the left and right sides of each equation. To get
the correct = sign, press and hold the Ctrl key and then press the =
key. The left and right sides of an inequality can
be seperated with any of the symbols <, >, <, or >.
4. Type an equation that
invloves the Find
function. It can be in any combination of upper and
lower case letters in any font, size or style.
The answer is expressed
as a vector.
If Find
has one argument, it returns the value of that variable
that solves the equation between it and the Given.
If Find
has more than one argument, it returns a vector of
answers.
Mathcad is very specific about the types of expressions
that can appear between the Given and the Find
. The table below lists all the expressions that can
be placed in a solve block between these two functions.
These expressions are often called constraints. In
the table below, x and y represent real-valued
scalar expressions, z and w represent arbitrary
scalar expression.
Condition Keystroke
Description
z=w [Ctrl]=
Constrained to be equal
x>y >
Greater than
x<y <
Less than
x>
y [Ctrl]0 Greater than
or equal to
x<
y [Ctrl]9 Less than
or equal to
Mathcad does not allow contraints with the equals
sign with a slash through it to indicate not equal
to, range variable or expressions involving range variables
of any kind, and inequalities of the form a<b<c
Solve blocks cannot be nested inside each other.
Therefore, each solve block can have only one Given
and one Find. a function like f( x ) :=Find( x ) cna
be defined at the end of one solve block and the same
function used in another solve block.
Never use assignment statements such as initial
guesses ( x
:= 1
) inside a solve block. Mathcad marks them with an
appropriate error message.