Example 2: Roots of Quadratic Equations
This example shows the equation for finding the roots of quadratic equations represented by
The roots are:
We can construct a computation flow diagram as following:
Starting from the upper-left corner, the value of constant b is sent to Times1 twice for the b-square portion of the equation. The constants 4, a, and c are multiplied in Times2. The Minus1 part calculates the inside of the square root operation, to be performed in SQRT. The result of the square root value is sent to the Plus and Minus2 parts for calculating the denominators of the two roots. The denominators are divided by the numerators (2 and a) for the final results. Notice again that both division operators, Div1 and Div2, have Port 0 connected to the dividends.
The highlighted link between Minus and SQRT is named b2-4ac. We log its value so that we can examine if real roots exist (when its value >= 0). The input and result values for the test case are shown in the Result View in the Bottom Pane, after 1 cycle of the simulation is run.
To test another set of values for a, b, and c, simply click on the Constant class in the Tree View in the Left Pane and enter the values in the Grid View in the Right Pane. Run the simulation again to obtain the answer. If SansGUI cannot find the simulator DLL, please consult the instructions on Setting Simulator DLL Location at the bottom of Example 1.
Go back to Introduction.
Visual Calculator for SansGUI Version 1.1
Copyright © 2001-2003 ProtoDesign, Inc. All rights reserved.