Example #1
0
        private void ButtonDivide_Click(object sender, RoutedEventArgs e)
        {
            plotView.Model.Series.Clear();
            FuzzyNumber result = new FuzzyNumber();
            int         scale;

            ParseFNTextBoxes();
            TryParse(textBoxDiscretization.Text, out var disPara);
            FuzzyNumber fuzzyNumberA = new FuzzyNumber(a1, a2, a3, a4, disPara);
            FuzzyNumber fuzzyNumberB = new FuzzyNumber(b1, b2, b3, b4, disPara);

            result = FNAlgebra.divideAB(fuzzyNumberA, fuzzyNumberB);
            if (fuzzyNumberA.detectFailureChange(result))
            {
                textBoxOutput.Text = "You can't divide by 0";
            }
            else
            {
                resultToContinue   = result;
                textBoxOutput.Text = "{ " + result + "}";
                scale = result.findMaxValueOfFuzzyNumber(fuzzyNumberA, fuzzyNumberB, result);
                PlotModelDefine.ScalePlotOFN(plotView.Model, scale);

                plotView.Model.Series.Add(PlotModelDefine.drawFuzzyNumber(fuzzyNumberA, disPara, "Number A"));
                plotView.Model.Series.Add(PlotModelDefine.drawFuzzyNumber(fuzzyNumberB, disPara, "Number B"));
                plotView.Model.Series.Add(PlotModelDefine.drawFuzzyNumber(result, disPara, "Result"));
                plotView.Model.Series.Add(PlotModelDefine.drawFuzzyNumberOrder(fuzzyNumberA, disPara, "Number A"));
                plotView.Model.Series.Add(PlotModelDefine.drawFuzzyNumberOrder(fuzzyNumberB, disPara, "Number B"));
                plotView.Model.Series.Add(PlotModelDefine.drawFuzzyNumberOrder(result, disPara, "Result"));
                plotView.InvalidatePlot();
            }
        }
Example #2
0
        private void ButtonMultiply_Click(object sender, RoutedEventArgs e)
        {
            plotView.Model.Series.Clear();
            FuzzyNumber result;

            ParseFNTextBoxes();
            int disPara;

            TryParse(textBoxDiscretization.Text, out disPara);
            FuzzyNumber fuzzyNumberA = new FuzzyNumber(a1, a2, a3, a4, disPara);
            FuzzyNumber fuzzyNumberB = new FuzzyNumber(b1, b2, b3, b4, disPara);

            result             = FNAlgebra.multiplyAB(fuzzyNumberA, fuzzyNumberB);
            resultToContinue   = result;
            textBoxOutput.Text = "{ " + result + "}";
            var scale = result.findMaxValueOfFuzzyNumber(fuzzyNumberA, fuzzyNumberB, result);

            PlotModelDefine.ScalePlotOFN(plotView.Model, scale);

            plotView.Model.Series.Add(PlotModelDefine.drawFuzzyNumber(fuzzyNumberA, disPara, "Number A"));
            plotView.Model.Series.Add(PlotModelDefine.drawFuzzyNumber(fuzzyNumberB, disPara, "Number B"));
            plotView.Model.Series.Add(PlotModelDefine.drawFuzzyNumber(result, disPara, "Result"));
            plotView.Model.Series.Add(PlotModelDefine.drawFuzzyNumberOrder(fuzzyNumberA, disPara, "Number A"));
            plotView.Model.Series.Add(PlotModelDefine.drawFuzzyNumberOrder(fuzzyNumberB, disPara, "Number B"));
            plotView.Model.Series.Add(PlotModelDefine.drawFuzzyNumberOrder(result, disPara, "Result"));
            plotView.InvalidatePlot();
        }