private void Calculate_Click(object sender, RoutedEventArgs e)
        {
            Equation equation = new Equation(Input_Equation.Text);

            equation.EquationParser();
            StringBuilder   TextBlockShow = new StringBuilder();
            Matrix <double> Result        = new Matrix <double>(equation.Variables.Count, 1);
            bool            Error         = false;

            try
            {
                Result = equation.FindResult();
            }
            catch
            {
                if (equation.Hamgen == true)
                {
                    TextBlockShow.Append("No Unique Solution");
                }
                else
                {
                    TextBlockShow.Append("No Solution");
                }
                Error = true;
            }
            if (!Error)
            {
                for (int i = 0; i < equation.Variables.Count; i++)
                {
                    TextBlockShow.Append($"{equation.Variables[i]}={Result[i, 0]}");
                    if (i != equation.Variables.Count - 1)
                    {
                        TextBlockShow.Append(",");
                    }
                }
            }
            Answer_Equation.Text = TextBlockShow.ToString();
        }
Beispiel #2
0
 public static Func <double, double> EquationFunc(Equation equations, int n)
 {
     return((double d) =>
            (-d * equations.Coefficients[n, 0] + equations.Numbers[n, 0]) / equations.Coefficients[n, 1]);
 }
 private void Clear_E_Click(object sender, RoutedEventArgs e)
 {
     Equation.Clear();
 }
Beispiel #4
0
 /// <summary>
 /// Calls draw event to send event to draw diagram for drawing new equation.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void NewEquation_Draw(object sender, Equation e)
 {
     DrawChart(sender, e);
 }
Beispiel #5
0
 private void EquationHandler_Draw(object sender, Equation e)
 {
     PlottingSpace.DrawEquation(e);
 }
Beispiel #6
0
 /// <summary>
 /// Delete Charts from plotting space.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void EquationHandler_DeleteChart(object sender, Equation e)
 {
     PlottingSpace.DeleteEquation(e);
 }