ROOTS OF FUNCTIONS
There are two built-in Mathcad functions available for finding unknown roots of a function.
root
To find the root values, you can use the root function. It goes like this:
Define your function:
Provide Mathcad with a guess value for the variable you wish to find. In most cases, the better the guess value, the quicker the root function will converge on a solution.
Use the root function; the format is root(function, variable to solve). This returns the value of x at which the function is zero.
Well, nearly. This is a numerical routine after all. To improve the accuracy, reduce the value of the variable TOL in the Built-in Variables pick under the Math menu. This reduces the acceptable error used in the root-finding routine. It also, in general, increases calculation time.
As you may know, a quadratic function has two roots. In order to find the second root, you must change your guess value to a negative number. Try it! What do you do in the general case when you don't know the actual root values? A good idea is to plot the function over a wide range of x to get approximations to the zero crossings, then use those approximate values as your guess values. You will have to run the root function one time for each root of the equation you require.
If you want to solve for the place where the function approaches a value other than zero, simply rewrite the solver as
In general, if a root function is not converging or giving you and unexpected answer, try changing the guess value. In particular, if an imaginary solution is required, you will have to supply and imaginary guess value. The same holds true of Solve Blocks, described below.
Find
To find the unknown values in a set of equations (n equations, n unknowns), you can use Mathcad's Solve Block, which uses the Find function to return solutions. The steps are:
¨
Provide guess values for the variables you want to solve.
¨
Type the word Given as a math region (NOT TEXT!).
¨
Enter your expressions using [ctrl] = rather than :=.
¨
Enter your Find function.
For example,
Enter guess values t : 5j and x : 7 + 2j
Enter Given
Type t + 7j [ctrl]= 5 * x
Type x - t + 1 [ctrl]= 0
Type Find ( x , t ) =
For more information on using Solve Blocks, see the file solvbloc.mcd in this directory.
For a method of finding all the roots of a polynomial simultaneously, see the file polroot.mcd in this directory.