Functions > Solving and Optimization > Root and Linear System Solvers > Example: Solving an Equation in a Single Unknown
  
Example: Solving an Equation in a Single Unknown
Find the solution to f(x)=0 where f(x) is specified using the root function.
1. Define the function f(x).
Click to copy this expression
2. Enter a guess value x for the solution, and modify until the solver converges appropriately.
For a complex solution, input a complex guess value. It is helpful to graph the function to find a value that is reasonably close to the root as a starting guess value.
Click to copy this expression
3. Define the first root value (without the optional interval parameters).
Click to copy this expression
Click to copy this expression
4. Define the second root value and specify the optional interval parameters.
Click to copy this expression
Click to copy this expression
5. Graph the function and show its r0 and r1 roots.
Click to copy this expression
In the case of complex roots, only the real part of the root is shown on the plot.
Finding Multiple Roots
For an expression with multiple roots, it is possible to solve for additional roots by leaving out known roots and reusing the same guess value.
1. Define the expression.
Click to copy this expression
2. Solve for f as a function of r0.
Click to copy this expression
Click to copy this expression
3. Solve for f as a function of r1.
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
4. Solve for f as a function of r2.
Click to copy this expression
Click to copy this expression
Click to copy this expression
For more accurate roots, reduce the value of TOL. The root function is set with a maximum TOL of 10-5, because this value is speedy for most evaluations, and larger values produce poor convergence. If your equation is a polynomial, you can find all roots at once using the polyroots function.
Units and the Root Function
You may also use units with the root function.
1. Define R in ohms and C in Farads.
Click to copy this expression
Click to copy this expression
2. Calculate the product RC and ensure that the answer has units of seconds.
Click to copy this expression
Click to copy this expression
3. Define the voltage as a function of γ.
Click to copy this expression
4. Enter a guess value for the solution. If you are searching for a root with units, use units in the guess value.
Click to copy this expression
Click to copy this expression
5. Call the root function (without the optional interval parameters).
Click to copy this expression
Click to copy this expression
Click to copy this expression
6. Change the value of st to find different rise times at which the particular voltage is reached.
Click to copy this expression
Solving Tolerance
You can change the accuracy of root function solutions by changing TOL for your worksheet.
1. Display previous values.
Click to copy this expression
Click to copy this expression
Click to copy this expression
2. Reduce the value of TOL (increase the tolerance) from its default value of 10-3.
Click to copy this expression
3. Repeat the calculations using the new TOL value.
Click to copy this expression
Click to copy this expression
Click to copy this expression
Reducing TOL to excessively small values may increase calculation time and can also cause the solver not to converge, if the convergence criteria of the value of the function at the root, and the change between successive solutions never meet the specified tolerance. Values smaller than 10-12 are probably not meaningful.