Example #1
0
 //static SenderSample Sender = new SenderSample(new Equation());
 static public AddToTree.Tree DerivasionOfFX(AddToTree.Tree Node, ref UknownIntegralSolver UIS)
 {
     AddToTree.Tree Dummy = new AddToTree.Tree(null, false);
     Dummy = Derivasion.DerivasionCalculator(Node, Dummy, ref UIS);
     Dummy = Simplifier.SimplifierFx(Dummy, ref UIS);
     return(Dummy);
 }
Example #2
0
 static AddToTree.Tree ReplaceXToFX(AddToTree.Tree Dummy, AddToTree.Tree FX)
 {
     if (Dummy.LeftSideAccess != null)
     {
         if (Dummy.LeftSideAccess.SampleAccess == "x")
         {
             Dummy.SetLefTandRightCommonlySide(FX, Dummy.RightSideAccess);
             Dummy.LeftSideAccess.ThreadAccess  = Dummy;
             Dummy.RightSideAccess.ThreadAccess = Dummy;
             return(Dummy);
         }
     }
     else
     {
         return(Dummy);
     }
     if (Dummy.RightSideAccess != null)
     {
         if (Dummy.RightSideAccess.SampleAccess == "x")
         {
             Dummy.SetLefTandRightCommonlySide(Dummy.LeftSideAccess, FX);
             Dummy.LeftSideAccess.ThreadAccess  = Dummy;
             Dummy.RightSideAccess.ThreadAccess = Dummy;
             return(Dummy);
         }
     }
     else
     {
         return(Dummy);
     }
     Derivasion.ReplaceXToFX(Dummy.LeftSideAccess, FX);
     Derivasion.ReplaceXToFX(Dummy.RightSideAccess, FX);
     return(Dummy);
 }
Example #3
0
        static AddToTree.Tree DerivasionCalculator(AddToTree.Tree Node, AddToTree.Tree Dummy, ref UknownIntegralSolver UIS)
        {
            if (Node == null)
            {
                return(Dummy);
            }
            if (Node.SampleAccess == "x")
            {
                Dummy.SampleAccess = "1";
                return(Dummy);
            }
            //ERROR317142 :The structure is ok.refer to page 155.

            //ERRORCORECTION30704012 :The error correced.refer to page 155.
            if (Node.LeftSideAccess != null)
            {
                if (Node.LeftSideAccess.LeftSideAccess == null)
                {
                    if (Node.LeftSideAccess.RightSideAccess == null)
                    {
                        if (IS.IsFunction(Node.SampleAccess))
                        {
                            Dummy = Derivasion.ConsTantFuctionDerivasion(Node);
                            return(Dummy);
                        }
                        else
                        if (IS.IsNumber(Dummy.SampleAccess))
                        {
                            Dummy = null;
                            return(Dummy);
                        }
                    }
                }
            }
            if (Node.SampleAccess == "/")
            {
                AddToTree.Tree Minuse = new AddToTree.Tree("-", false);
                AddToTree.Tree MulL   = new AddToTree.Tree("*", false);
                AddToTree.Tree MulR   = new AddToTree.Tree("*", false);
                AddToTree.Tree Power  = new AddToTree.Tree("^", false);
                AddToTree.Tree DFX    = new AddToTree.Tree(null, false);
                AddToTree.Tree DGX    = new AddToTree.Tree(null, false);
                AddToTree.Tree NRMulL = new AddToTree.Tree(null, false);
                AddToTree.Tree NRMulR = new AddToTree.Tree(null, false);
                AddToTree.Tree GX     = Node.CopyNewTree(Node.RightSideAccess);
                AddToTree.Tree IND    = new AddToTree.Tree("2", false);

                DFX    = Derivasion.DerivasionOfFX(Node.LeftSideAccess, ref UIS);
                NRMulL = Node.RightSideAccess;

                MulL.SetLefTandRightCommonlySide(DFX, NRMulL);
                MulL.LeftSideAccess.ThreadAccess  = MulL;
                MulL.RightSideAccess.ThreadAccess = MulL;

                DGX    = Derivasion.DerivasionOfFX(Node.RightSideAccess, ref UIS);
                NRMulR = Node.LeftSideAccess;

                MulR.SetLefTandRightCommonlySide(DGX, NRMulR);
                MulR.LeftSideAccess.ThreadAccess  = MulR;
                MulR.RightSideAccess.ThreadAccess = MulR;

                Minuse.SetLefTandRightCommonlySide(MulL, MulR);
                Minuse.LeftSideAccess.ThreadAccess  = Minuse;
                Minuse.RightSideAccess.ThreadAccess = Minuse;

                Power.SetLefTandRightCommonlySide(GX, IND);
                Power.LeftSideAccess.ThreadAccess  = Power;
                Power.RightSideAccess.ThreadAccess = Power;

                Dummy.SampleAccess = "/";
                Dummy.SetLefTandRightCommonlySide(Minuse, Power);
                Dummy.LeftSideAccess.ThreadAccess  = Dummy;
                Dummy.RightSideAccess.ThreadAccess = Dummy;
            }
            else
            if (Node.SampleAccess == "*")
            {
                AddToTree.Tree MulL   = new AddToTree.Tree("*", false);
                AddToTree.Tree MulR   = new AddToTree.Tree("*", false);
                AddToTree.Tree DFX    = new AddToTree.Tree(null, false);
                AddToTree.Tree DGX    = new AddToTree.Tree(null, false);
                AddToTree.Tree NRMulL = new AddToTree.Tree(null, false);
                AddToTree.Tree NRMulR = new AddToTree.Tree(null, false);

                DFX = Derivasion.DerivasionOfFX(Node.LeftSideAccess, ref UIS);
                DGX = Derivasion.DerivasionOfFX(Node.RightSideAccess, ref UIS);

                NRMulL = Node.LeftSideAccess;
                NRMulR = Node.RightSideAccess;

                MulL.SetLefTandRightCommonlySide(DFX, NRMulR);
                MulL.LeftSideAccess.ThreadAccess = MulL;
                if (NRMulR.SampleAccess != null)
                {
                    MulL.RightSideAccess.ThreadAccess = MulL;
                }

                MulR.SetLefTandRightCommonlySide(Node.LeftSideAccess, DGX);
                MulR.LeftSideAccess.ThreadAccess = MulR;
                if (DGX.SampleAccess != null)
                {
                    MulR.RightSideAccess.ThreadAccess = MulR;
                }

                Dummy.SampleAccess = "+";
                Dummy.SetLefTandRightCommonlySide(MulL, MulR);
                Dummy.LeftSideAccess.ThreadAccess  = Dummy;
                Dummy.RightSideAccess.ThreadAccess = Dummy;
            }
            else
            if (Node.SampleAccess == "-")
            {
                AddToTree.Tree DFX = new AddToTree.Tree(null, false);
                AddToTree.Tree DGX = new AddToTree.Tree(null, false);

                DFX = Derivasion.DerivasionOfFX(Node.LeftSideAccess, ref UIS);
                DGX = Derivasion.DerivasionOfFX(Node.RightSideAccess, ref UIS);

                Dummy.SampleAccess = "-";
                Dummy.SetLefTandRightCommonlySide(DFX, DGX);

                Dummy.LeftSideAccess.ThreadAccess  = Dummy;
                Dummy.RightSideAccess.ThreadAccess = Dummy;
            }
            else
            if (Node.SampleAccess == "+")
            {
                AddToTree.Tree DFX = new AddToTree.Tree(null, false);
                AddToTree.Tree DGX = new AddToTree.Tree(null, false);

                DFX = Derivasion.DerivasionOfFX(Node.LeftSideAccess, ref UIS);
                DGX = Derivasion.DerivasionOfFX(Node.RightSideAccess, ref UIS);

                Dummy.SampleAccess = "+";
                Dummy.SetLefTandRightCommonlySide(DFX, DGX);

                Dummy.LeftSideAccess.ThreadAccess  = Dummy;
                Dummy.RightSideAccess.ThreadAccess = Dummy;
            }
            else
            if (Node.SampleAccess == "^")
            {
                AddToTree.Tree ADD          = new AddToTree.Tree("+", false);
                AddToTree.Tree Copy         = Node.CopyNewTree(Node);
                AddToTree.Tree LnFX         = new AddToTree.Tree("Ln", false);
                AddToTree.Tree FXONE        = Node.CopyNewTree(Node.LeftSideAccess);
                AddToTree.Tree FXTOW        = Node.CopyNewTree(Node.LeftSideAccess);
                AddToTree.Tree GX           = Node.CopyNewTree(Node.RightSideAccess);
                AddToTree.Tree DFX          = new AddToTree.Tree(null, false);
                AddToTree.Tree DGX          = new AddToTree.Tree(null, false);
                AddToTree.Tree MulLevelTowL = new AddToTree.Tree("*", false);
                AddToTree.Tree MulLevelTowR = new AddToTree.Tree("*", false);
                AddToTree.Tree DIVThree     = new AddToTree.Tree("/", false);

                FXONE.ThreadAccess = null;
                DFX             = Derivasion.DerivasionOfFX(FXONE, ref UIS);
                GX.ThreadAccess = null;
                DGX             = Derivasion.DerivasionOfFX(GX, ref UIS);


                DIVThree.SetLefTandRightCommonlySide(DFX, FXONE);
                DIVThree.LeftSideAccess.ThreadAccess  = DIVThree;
                DIVThree.RightSideAccess.ThreadAccess = DIVThree;

                MulLevelTowR.SetLefTandRightCommonlySide(GX, DIVThree);
                MulLevelTowR.LeftSideAccess.ThreadAccess  = MulLevelTowR;
                MulLevelTowR.RightSideAccess.ThreadAccess = MulLevelTowR;

                LnFX.SetLefTandRightCommonlySide(FXTOW, null);
                LnFX.LeftSideAccess.ThreadAccess = LnFX;
                LnFX.RightSideAccess             = null;

                MulLevelTowL.SetLefTandRightCommonlySide(DGX, LnFX);
                MulLevelTowL.LeftSideAccess.ThreadAccess  = MulLevelTowL;
                MulLevelTowL.RightSideAccess.ThreadAccess = MulLevelTowL;

                ADD.SetLefTandRightCommonlySide(MulLevelTowL, MulLevelTowR);
                ADD.LeftSideAccess.ThreadAccess  = ADD;
                ADD.RightSideAccess.ThreadAccess = ADD;

                Dummy.SampleAccess = "*";
                Dummy.SetLefTandRightCommonlySide(Copy, ADD);
                Dummy.LeftSideAccess.ThreadAccess  = Dummy;
                Dummy.RightSideAccess.ThreadAccess = Dummy;
            }
            else
            if (IS.IsFunction(Node.SampleAccess))
            {
                AddToTree.Tree DFoGX = Node.CopyNewTree(Node);
                AddToTree.Tree FX    = (Node);
                AddToTree.Tree GX    = Node.RightSideAccess;
                AddToTree.Tree DFX   = new AddToTree.Tree(null, false);
                AddToTree.Tree DGX   = new AddToTree.Tree(null, false);


                FX.LeftSideAccess.SetLefTandRightCommonlySide(null, null);
                FX.LeftSideAccess.SampleAccess = "x";

                DFX = Derivasion.DerivasionOfFX(FX, ref UIS);
                DGX = Derivasion.DerivasionOfFX(Node.LeftSideAccess, ref UIS);

                /*DFoGX.SetLefTandRightCommonlySide(DFX,null);
                 * DFoGX.SampleAccess = DFX.SampleAccess;
                 * DFoGX.LeftSideAccess.ThreadAccess = DFoGX;
                 * if(DFoGX.RightSideAccess!=null)
                 * DFoGX.RightSideAccess.ThreadAccess = DFoGX;
                 */
                DFoGX = Derivasion.ReplaceXToFX(DFX, Node.RightSideAccess);

                Dummy.SampleAccess = "*";
                Dummy.SetLefTandRightCommonlySide(DGX, DFoGX);
                Dummy.LeftSideAccess.ThreadAccess  = Dummy;
                Dummy.RightSideAccess.ThreadAccess = Dummy;
            }
            return(Dummy);
        }
Example #4
0
        private AddToTree.Tree Solver()
        {
            UknownIntegralSolver UNKNOWN = this;

            this.SetProgressValue(progressBar1, 0);

            int INCREASE = 2147483647 / 10;

            this.SetProgressValue(progressBar1, this.progressBar1.Value + INCREASE);


            //ERRORCUASE1715 :ERRROR cause of ERROR317142.the copy operation is not valid.
            //ERROR3175 :Error in data structure .
            //ERRORCAUSE0981243  ;The cause ERROR3175 of  is at here.Error on copy tree.refer to page 177.
            if (Enterface.SenderAccess.AutoSenderAccess.NodeAccess.SampleAccess == null && Enterface.SenderAccess.AutoSenderAccess != null)
            {
                Enterface.SenderAccess.AutoSenderAccess.NodeAccess = new AddToTree.Tree(Enterface.SenderAccess.AutoSenderAccess.CurrentStirngAccess, false);
            }
            AddToTree.Tree Copy = Enterface.SenderAccess.AutoSenderAccess.NodeAccess.CopyNewTree(Enterface.SenderAccess.AutoSenderAccess.NodeAccess);
            //Copy = TransmisionToDeleteingMinusPluse.TrasmisionToDeleteingMinusPluseFx(Copy);
            //ERROR918243 :The error at splitation.refer to page 176.
            //Copy = TransmisionToDeleteingMinusPluse.TrasmisionToDeleteingMinusPluseFx(Copy);

            AddToTree.Tree CopyNode = null;
            CopyNode = Copy.CopyNewTree(Copy);
            this.SetProgressValue(progressBar1, this.progressBar1.Value + INCREASE);

            Copy = DeleteingMinusPluseTree.DeleteingMinusPluseFx(Copy);

            this.SetProgressValue(progressBar1, this.progressBar1.Value + INCREASE);

            Copy = Spliter.SpliterFx(Copy, ref UNKNOWN);

            this.SetProgressValue(progressBar1, this.progressBar1.Value + INCREASE);

            Copy = Simplifier.ArrangmentForSpliter(Copy);
            //ERROR30175541  :SIMPLIFIER HAS CUASED TO SOME ERRRO.refer to page 176.
            //ERROR312317 & ERRROR317140 :Error in simplification.refer to page 182.

            this.SetProgressValue(progressBar1, this.progressBar1.Value + INCREASE);

            //Copy = Simplifier.SimplifierFx(Copy,ref UNKNOWN);
            //ERROR30174213  :The Simplified is invalid here.refer to page 180.
            //Copy = Derivasion.DerivasionOfFX(Copy);

            this.SetProgressValue(progressBar1, this.progressBar1.Value + INCREASE);

            Copy = Integral.IntegralOfFX(Copy, ref UNKNOWN);

            /*int i = 0;
             * while (true)new AddToTree.Tree(null, false);
             * {
             *  //Copy = Integral.DervisionI(i, Copy);
             *  //ERROR981273987 :The error at derivation.refer to page 205.
             *   Copy = Derivasion.DerivasionOfFX(Copy);
             *  //ERROR3017181920 :refer to page 188.
             *
             *  Copy=Simplifier.SimplifierFx(Copy);
             *  i++;
             * }
             */

            //LOCATION13174253. refer to page 208.
            //ERROR3070405060 :The error is here.refer to page 220.
            //int NUM1 = Integral.NumberOfElements(Copy);
            this.SetProgressValue(progressBar1, this.progressBar1.Value + INCREASE);

            int NUM1 = Integral.NumberOfElements(Copy);

            this.SetProgressValue(progressBar1, this.progressBar1.Value + INCREASE);

            Copy = Simplifier.SimplifierFx(Copy, ref UNKNOWN);

            this.SetProgressValue(progressBar1, this.progressBar1.Value + INCREASE);

            int NUM2 = Integral.NumberOfElements(Copy);

            this.SetProgressValue(progressBar1, this.progressBar1.Value + INCREASE);

            //Copy = RoundTree.RoundTreeMethod(Copy,0);

            Copy.ThreadAccess = null;
            Thread t = new Thread(new ThreadStart(Verifing));

            t.Start();
            //ERRORCORECTION6646464654643211:The Verification Return Valid result:1394/4/9
            if (EqualToObject.IsEqualWithOutThreadConsiderationCommonly(Simplifier.SimplifierFx(RoundTree.RoundTreeMethod(ChangeFunction.ChangeFunctionFx(Derivasion.DerivasionOfFX(Copy.CopyNewTree(Copy), ref UNKNOWN), ref UNKNOWN), RoundTree.MaxFractionalDesimal(CopyNode)), ref UNKNOWN), CopyNode))
            {
                t.Abort();
                SetLableValue(label17, "Verifing finished.Integral Answer Calculated is :");
                MessageBox.Show("Verify OK");
            }
            else
            {
                t.Abort();
                SetLableValue(label17, "Verifing finished.Integral Answer Calculated is :");
                MessageBox.Show("Verify Failed.");
            }

            return(Copy);

            //this.SetProgressValue(progressBar1, this.progressBar1.Value + INCREASE);
        }