コード例 #1
0
        public void Init()
        {
            InitCalculatorEntry();

            _firstEntry = string.Empty;
            _mathFunc   = MathFunc.Mf_None;
        }
        } //End Method

        public static void SaveSkeletonUpFrames(this DepthSensorKinect2 sensor, string _filenamePattern)
        {
            List <IList <Body> > _listOfBodies = sensor.Data.AllListOfBodies;
            int            fileCount           = 1;
            string         filename;
            SkeletonOfBody skeleton = new SkeletonOfBody(Constants.SKEL_UP_TOTAL_JOINTS);

            // Traverse the skeleton list
            foreach (IList <Body> _bodies in _listOfBodies)
            {
                // Get the most closest tracked skeleton
                Body body = Util.GetClosestBody(_bodies);
                //Body body = _bodies.Where(b => b.IsTracked).FirstOrDefault();

                // Process the tracked body
                if (body != null && body.IsTracked)
                {
                    // Get the upper skeleton
                    skeleton = Util.GetSkeletonUpperBody(sensor.Mapper, body);
                } // EndIf


                // Write the skeleton position in a file
                filename = _filenamePattern + MathFunc.ToFourDigits(fileCount) + ".csv";
                Util.Skeleton2File(filename, skeleton);

                fileCount++;
            }// EndForEach

            Console.WriteLine("Saved {0} Body Data Files", fileCount - 1);
        } //End Method
コード例 #3
0
ファイル: Form1.cs プロジェクト: vadimart92/SGG-TRF-Analyzer
        private void button5_Click(object sender, EventArgs e)
        {
            int t = 0; double d = 0, c = 0, c2 = 0, le = 0, lw = 0;

            if (int.TryParse(textBox1.Text, out t) && double.TryParse(textBox3.Text, out d) &&
                double.TryParse(textBox6.Text, out c2) && double.TryParse(textBox7.Text, out c) &&
                double.TryParse(textBox8.Text, out lw) && double.TryParse(textBox9.Text, out le) &&
                c2 < c && le > lw)
            {
                c = 90 - c; c2 = 90 - c2;
                SphericalHarmonicAnalyze.Properties.Settings.Default.modelMaxOrder = t;
                SphericalHarmonicAnalyze.Properties.Settings.Default.GridCellSize  = d;
                SphericalHarmonicAnalyze.Properties.Settings.Default.minCoLatitude = c;
                SphericalHarmonicAnalyze.Properties.Settings.Default.maxCoLatitude = c2;
                SphericalHarmonicAnalyze.Properties.Settings.Default.longW         = lw;
                SphericalHarmonicAnalyze.Properties.Settings.Default.longE         = le;
                button4.Enabled = true;
                button5.Enabled = false;
                int col = 0, row = 0;
                var gr = MathFunc.generateGrid(d, out col, out row, c, c2, lw, le);
                SphericalHarmonicAnalyze.Properties.Settings.Default.pointsCount = (col * row);
                label12.Text = string.Format("{0} шт.", SphericalHarmonicAnalyze.Properties.Settings.Default.pointsCount);
                SphericalHarmonicAnalyze.Properties.Settings.Default.Save();
            }
        }
コード例 #4
0
        static void Main(string[] args)
        {
            MathFunc mf;
            MathFunc myAdd = MyMath.add5;
            MathFunc mySub = MyMath.sub3;
            MathFunc myMul = MyMath.mul10;

            mf  = myAdd;
            mf += mySub;

            int number = 10;

            mf(ref number);

            mf -= mySub;
            mf += myMul;

            number = 10;

            mf(ref number);


            Console.WriteLine($"Final number: {number}");

            Console.ReadKey();
        }
コード例 #5
0
        /// <summary>
        /// Сохранение вектора как звука
        /// </summary>
        /// <param name="path"></param>
        /// <param name="vector"></param>
        /// <param name="fd"></param>
        public void SaveVector(string path, Vector vector, int fd)
        {
            File.Delete(path);
            Stream       waveFileStream = File.OpenWrite(path);
            BinaryWriter br             = new BinaryWriter(waveFileStream);

            br.Write(1179011410);
            br.Write(2 * vector.N + 36);
            br.Write(1163280727);
            br.Write(544501094);
            br.Write(16);
            br.Write((short)1);
            br.Write((short)1);
            br.Write(fd);
            br.Write(2 * fd);
            br.Write((short)2);
            br.Write((short)16);
            br.Write(1635017060);
            br.Write(2 * vector.N);

            double max = Statistic.MaximalValue(MathFunc.abs(vector));

            vector /= max;

            for (int i = 0; i < vector.N; i++)
            {
                br.Write((int)(vector[i] * 32000));
            }

            br.Close();
        }
コード例 #6
0
        public void TestMultVariableCollection2()
        {
            var collection = new Dictionary <char, string>[]
            {
                new Dictionary <char, string>
                {
                    { 'a', "0.5" },
                    { 'b', "2" },
                    { 'c', "3" }
                },
                new Dictionary <char, string>
                {
                    { 'a', "2" },
                    { 'b', "0.5" },
                    { 'c', "0.5" }
                },
                new Dictionary <char, string>
                {
                    { 'a', "5" },
                    { 'b', "3" },
                    { 'c', "-7" }
                }
            };

            var output   = MathFunc.MultExec(TL.Scan("a*b+c"), collection);
            var expected = new string[] { "4", "1.5", "8" };

            CollectionAssert.AreEqual(expected, output);
        }
コード例 #7
0
        /// <summary>
        /// Визуализация матрицы
        /// </summary>
        public static Bitmap Visualiz(Matrix matr)
        {
            Bitmap bmp = new Bitmap(matr.M, matr.N);
            Color  color;
            Vector a   = matr.Spagetiz();
            double max = new Statistic(MathFunc.abs(a)).MaxValue;
            double k   = 250.0 / max;
            double intensiv;


            for (int i = 0; i < matr.M; i++)
            {
                for (int j = 0; j < matr.N; j++)
                {
                    intensiv = Math.Abs(k * matr.Matr[i, j]);
                    try
                    {
                        color = Color.FromArgb((int)(RedInt(intensiv) * intensiv), (int)(0.2 * intensiv), (int)(BiueInt(intensiv) * intensiv));
                    }
                    catch { color = Color.Coral; }
                    bmp.SetPixel(i, j, color);
                }
            }


            return(bmp);
        }
コード例 #8
0
        public void OneDivOneDerivativeTest()
        {
            var f          = new MathFunc("1 / x");
            var derivative = f.GetDerivative();

            Assert.IsTrue(derivative == "-(x ^ -2)");
        }
コード例 #9
0
        public void XinPowerXDerivativeTest()
        {
            var f          = new MathFunc("x ^ x");
            var derivative = f.GetDerivative();

            Assert.IsTrue(derivative == "x ^ x * (ln(x) + 1)");
        }
コード例 #10
0
        public void DerivativeDerivativeTest()
        {
            var f          = new MathFunc("diff(x ^ 3, x)");
            var derivative = f.GetDerivative();

            Assert.IsTrue(derivative == "x * 6");
        }
コード例 #11
0
        /// <summary>
        /// Окно ханна дает уровень боковых лепестков -31.5 db
        /// </summary>
        /// <param name="windowSize">Размер окна</param>
        public static Vector HannWindow(int windowSize)
        {
            Vector n = Vector.Seq0(1, windowSize);
            Vector w = 0.5 * (1 - MathFunc.cos(Math.PI * 2.0 * n / (windowSize - 1)));

            return(w);
        }
コード例 #12
0
        public void UnknownFuncThirdDerivativeTest()
        {
            var f          = new MathFunc("f(x)");
            var derivative = f.GetDerivative().GetDerivative().GetDerivative();

            Assert.IsTrue(derivative == "diff(diff(diff(f(x), x), x), x)");
        }
コード例 #13
0
        /// <summary>
        /// Окно Хэмминга дает уровень боковых лепестков -42 db
        /// </summary>
        /// <param name="windowSize">Размер окна</param>
        public static Vector HammingWindow(int windowSize)
        {
            Vector n = Vector.Seq0(1, windowSize);
            Vector w = 0.53836 - 0.46164 * MathFunc.cos(Math.PI * 2.0 * n / (windowSize - 1));

            return(w);
        }
コード例 #14
0
        public static float GetCanyonNoise(Vector2 position, NoiseParameters noiseParameters, FastNoise noise, CanyonParameters canyonParameters, int seed = 0)
        {
            //Noise Height, Value bettween CayonParameters's limits, Results
            float n  = 1.0f - GetFractalErosionNoise(position, noiseParameters, noise, seed);
            float n2 = MathFunc.Clamp01(MathFunc.Lerp(0f, 1f, MathFunc.InverseLerp(canyonParameters.minCanyonHeight, canyonParameters.canyonPlateauHeight, n)));
            float h  = 0f;
            float t  = (canyonParameters.canyonPlateauHeight - canyonParameters.minCanyonHeight);

            if (n <= canyonParameters.canyonPlateauHeight)
            {
                if (n >= canyonParameters.minCanyonHeight)
                {
                    h = canyonParameters.GetValueAtHeight(n2);
                    return(h);
                }
                else
                {
                    return(canyonParameters.minCanyonHeight - n * -3f);
                }
            }
            else
            {
                //h = (n*(canyonParameters.canyonPlateauHeight-canyonParameters.minCanyonHeight)/2f)+1f;
                //h = (n-t)*0.2f+t;
                float x = 1f;
                //h = (n)*x+(t*(x*2)+0);
                h = 1 + (n - canyonParameters.canyonPlateauHeight) * 0.2f;
                return(h);
            }
        }
コード例 #15
0
        /// <summary>
        /// Среднее геометрическое
        /// </summary>
        public static double MeanGeom(Vector vect)
        {
            int numMinus = 0;

            for (int i = 0; i < vect.N; i++)
            {
                if (vect[i] < 0)
                {
                    numMinus++;
                }
            }

            Vector res  = MathFunc.ln(MathFunc.abs(vect));
            double summ = Functions.Summ(res);

            summ /= vect.N;

            switch (numMinus % 2)
            {
            case 1:
                return(-Math.Exp(summ));

            default:
                return(Math.Exp(summ));
            }
        }
コード例 #16
0
        public void SimpleAdditionDerivativeTest2()
        {
            var f          = new MathFunc("x + sin(x) + ln(x)");
            var derivative = f.GetDerivative();

            Assert.IsTrue(derivative == "x ^ -1 + cos(x) + 1");
        }
コード例 #17
0
        } // EndMethod

        public static SkeletonOfBody GetSkeletonUpperBody(CoordinateMapper mapper, Body body)
        {
            // Skeleton structure
            SkeletonOfBody skel = new SkeletonOfBody(Constants.SKEL_UP_TOTAL_JOINTS);

            // Process the tracked body
            if (body != null && body.IsTracked)
            {
                //Extract body information
                IReadOnlyDictionary <JointType, Joint>            joints       = body.Joints;
                IReadOnlyDictionary <JointType, JointOrientation> orientations = body.JointOrientations;

                int cont = 0;
                foreach (var pos in Constants.SKEL_UP_INDEX)
                {
                    Point pointInColor = MathFunc.ToPoint(mapper, VisTypes.Color, joints[(JointType)pos].Position);
                    Point pointInDepth = MathFunc.ToPoint(mapper, VisTypes.Depth, joints[(JointType)pos].Position);

                    // Discard joint that are not being tracked
                    if (joints[(JointType)pos].TrackingState == TrackingState.Tracked || joints[(JointType)pos].TrackingState == TrackingState.Inferred)
                    {
                        skel.jointName[cont]        = joints[(JointType)pos].JointType.ToString().Trim(); // Name
                        skel.jointColorSpace[cont]  = pointInColor;                                       // 2D Point
                        skel.jointDepthSpace[cont]  = pointInDepth;                                       // 2D Point
                        skel.jointCameraSpace[cont] = joints[(JointType)pos].Position;                    // 3D Point
                        skel.jointQuaternion[cont]  = orientations[(JointType)pos].Orientation;           // Vector 4D
                    }
                    cont++;
                } // EndForEach
            }     // EndIf

            return(skel);
        } // EndMethod
コード例 #18
0
        /// <summary>
        /// Размещение без повторов
        /// </summary>
        /// <param name="k">Количество элементов</param>
        /// <param name="n">Количество возможных позиций</param>
        public static double PlacingWithoutRepetition(int k, int n)
        {
            int    newN = n + 1;
            Vector vect = MathFunc.GenerateTheSequence(newN - k, newN);

            return(Functions.Multiplication(vect));
        }
コード例 #19
0
        /// <summary>
        /// Ф-я активации
        /// </summary>
        public override Vector FActivation(Vector inp)
        {
            Vector oupt = MathFunc.exp(inp);

            oupt /= Functions.Summ(oupt);
            return(oupt);
        }
コード例 #20
0
 public void TestMultVariableCollection3()
 {
     try
     {
         var collection = new Dictionary <char, string>[]
         {
             new Dictionary <char, string>
             {
                 { 'a', "0.5" },
                 { 'b', "2" },
                 { 'c', "3" }
             },
             new Dictionary <char, string>
             {
                 { 'a', "2" },
                 { 'b', "0.5" },
                 { 'c', "0.5" }
             },
             new Dictionary <char, string>
             {
                 { 'a', "5" },
                 { 'b', "3" }
             }
         };
         var output   = MathFunc.MultExec(TL.Scan("a*b+c"), collection);
         var expected = new string[] { "4", "1.5", "8" };
     }
     catch (Exception e)
     {
         Assert.AreEqual("Error occured during processing the equation", e.Message);
     }
 }
コード例 #21
0
        private float GetPrice(char aCamel, List <Dictionary <char, float> > aList)
        {
            if (aList.Count == 0)
            {
                return(GameRules.LONG_TERM_PRICE[0]);
            }

            float retval = 0f;
            var   comb   = MathFunc.AllCombinationsBooleans(aList.Count);

            for (int i = 0; i < comb.Count; i++)
            {
                float combTotal = 1f;
                int   trueTotal = 0;
                for (int boolIndex = 0; boolIndex < comb[i].Length; boolIndex++)
                {
                    if (comb[i][boolIndex])
                    {
                        trueTotal++;
                        combTotal *= aList[boolIndex][aCamel];
                    }
                    else
                    {
                        combTotal *= 1 - aList[boolIndex][aCamel];
                    }
                }

                retval += combTotal * GameRules.LONG_TERM_PRICE[trueTotal];
            }

            return(retval);
        }
コード例 #22
0
        /// <summary>
        /// Быстрое кепстральное преобразование
        /// </summary>
        /// <param name="signal">Сигнал</param>
        /// <returns></returns>
        public static Vector FKT(ComplexVector signal)
        {
            ComplexVector spectr  = Furie.fft(signal);
            Vector        Aspectr = MathFunc.ln(spectr.MagnitudeToVector().TransformVector(x => x * x));

            return(Furie.fft(Aspectr).RealToVector() / Aspectr.N);
        }
コード例 #23
0
ファイル: Samurai.cs プロジェクト: Absidion/Irkalla
    protected override void RangedAttack()
    {
        for (int pellet = 0; pellet < 25; pellet++)
        {
            //calculate the normal distribution of the pellet
            float   angleRadians = Random.Range(0.0f, 2.0f * Mathf.PI);
            Vector3 randomOffset = new Vector3(Mathf.Cos(angleRadians), Mathf.Sin(angleRadians), Mathf.Sin(angleRadians));
            randomOffset *= MathFunc.ApproximateNormalDistribution() * SpreadAmount;

            //calcualte the direction offset for the current pellet shot
            Vector3 directionOffset = new Vector3();
            directionOffset.x += randomOffset.x;
            directionOffset.y += randomOffset.y;
            directionOffset.z += randomOffset.z;

            directionOffset = m_FirstPersonCamera.transform.forward + m_FirstPersonCamera.transform.TransformDirection(directionOffset);

            photonView.RPC("FireSingleTargetMultipleHitscan", PhotonTargets.All, m_FirstPersonCamera.transform.position, directionOffset, (BoostedRangedDamage) * m_NumOfAttacks, PlayerNumber,
                           m_Range, m_IgnoreMask, m_WeaponLayerMask, GunLocation.transform.position, pellet * 3, pellet * 3 + 1);
        }
        SoundManager.GetInstance().photonView.RPC("PlaySFXRandomizedPitchNetworked", PhotonTargets.All, "BoomstickShot", GunLocation.transform.position);

        ResetAnimationTriggers();
        m_IsAttacking = true;
    }
コード例 #24
0
    protected void StepUp()
    {
        float CheckForGroundRadius    = 1.0f;
        float GroundCheckStartOffsetY = 0.5f;
        //float GroundResolutionOverlap = 0.05f;
        float m_CenterHeight = transform.position.y;
        //Check for the ground below the player
        float footHeight        = FootLocationObj.transform.position.y;
        float halfCapsuleHeight = m_CenterHeight - footHeight;
        // get start of raycast
        Vector3 rayStart = transform.position;

        rayStart.y += GroundCheckStartOffsetY;
        // get direction and distance of raycast
        Vector3    rayDir  = Vector3.down;
        float      rayDist = halfCapsuleHeight + GroundCheckStartOffsetY - CheckForGroundRadius;
        RaycastHit groundHitInfo;

        //Physics.SphereCast(rayStart, CheckForGroundRadius, rayDir, out groundHitInfo, rayDist);
        //string tag = groundHitInfo.collider.tag;
        //int layer = groundHitInfo.collider.gameObject.layer;
        if (Physics.SphereCast(rayStart, CheckForGroundRadius, rayDir, out groundHitInfo, rayDist, m_GroundCheckMask))
        {
            //step-up
            Vector3 bottomAtHitPoint = MathFunc.ProjectToBottomOfCapsule(groundHitInfo.point, transform.position, halfCapsuleHeight * 2.0f, CheckForGroundRadius);
            float   stepUpAmount     = groundHitInfo.point.y - bottomAtHitPoint.y;
            m_CenterHeight += stepUpAmount; //- GroundResolutionOverlap;
            Vector3 playerCenter = transform.position;
            playerCenter.y     = m_CenterHeight;
            transform.position = playerCenter;
        }

        m_GroundNormal = groundHitInfo.normal;
    }
コード例 #25
0
        private void OnTriggerEnter(Collider other)
        {
            Player player = other.GetComponent <Player>();

            //if the player component of the object we collided with isn't null and the nerg is coming out of the ground
            if ((player != null) && m_IsAttacking)
            {
                if (PhotonNetwork.isMasterClient)
                {
                    //figure out if who ever we collided with is are target
                    if (m_AIReference.Target != player)
                    {
                        //if they weren't are target, they are now
                        m_AIReference.Target = player;
                    }
                }

                if (player.photonView.isMine)
                {
                    //Status[] statuses = { m_AIReference.ElementType, Status.Stun };
                    Status[] statuses = { Status.Stun };
                    player.TakeDamage(m_Damage, m_AIReference.transform.position, statuses);
                }

                if (PhotonNetwork.isMasterClient)
                {
                    //set the player to be right at the player they collided with's mid area
                    m_AIReference.transform.position = m_AIReference.Target.transform.position;

                    //increment the current step
                    m_CurrentStep++;
                    m_MoveLocation = MathFunc.CalculateClosestGroundPosition(m_AIReference.transform.position);
                }
            }
        }
コード例 #26
0
        public void SimpleAdditionDerivativeTest()
        {
            var f          = new MathFunc("x + 5 + 2*x");
            var derivative = f.GetDerivative();

            Assert.IsTrue(derivative == "3");
        }
コード例 #27
0
        /// <summary>
        /// Метод для реализации операции между двумя числами
        /// </summary>
        /// <param name="x">Значение первой переменной </param>
        /// <param name="y">Значение второй переменной</param>
        /// <param name="t">Операция, которую нужно выполнить</param>
        /// <returns>Значение, получаемое в результате выполнения операции</returns>
        public static double Check(double x, double y, char t)
        {
            switch (t)
            {
            case '+':
                return(x + y);

            case '-':
                return(x - y);

            case '/':
                return(x / y);

            case 'p':
                return(MathFunc.Power((int)x, (int)y));

            case 'g':
                return(MathFunc.Gcd((int)x, (int)y));

            case 'l':
                return(MathFunc.Lcm((int)x, (int)y));

            default:
                return(x * y);
            }
        }
コード例 #28
0
ファイル: Leveling.cs プロジェクト: OlegGelezcov/neb
        public int RemainedExpForNextLevel(int currentExp)
        {
            int clampedExp   = MathFunc.Clamp(currentExp, 0, CapExp());
            int currentLevel = LevelForExp(clampedExp);
            int nextLevelExp = ExpForLevel(currentLevel + 1);

            return(nextLevelExp - clampedExp);
        }
コード例 #29
0
        public string ProcessMathFunction(MathFunc mFunc)
        {
            var addendString = mathFunctions.ProcessMathFunction(mFunc, GetAugend(), Addend);

            Addend = addendString.Equals(mathFunctions.ErrorMessage()) ? //find format to return sci-notatoin
                     0 : double.Parse(addendString);

            return(addendString);
        }
コード例 #30
0
ファイル: Player.cs プロジェクト: Absidion/Irkalla
    //Updates and rotates chest with mouselook
    private void UpdateChestRotation()
    {
        Vector3 rot = transform.rotation.eulerAngles - m_GayQuaternion.eulerAngles - m_StraightQuaternion.eulerAngles;

        rot.z = -m_PitchChange;

        m_GayQuaternion = Quaternion.Euler(m_GayQuaternion.eulerAngles + rot);
        m_GayQuaternion = Chestbone.rotation = MathFunc.ClampQuaternionZRotation(m_GayQuaternion, 200, 340);
    }
コード例 #31
0
ファイル: MatheExt.cs プロジェクト: pgonzbecer/apis-bundle
        // Sums up the given function from k to n
        public static float sum(MathFunc func, int k, int n)
        {
            // Variables
            float	result=	0f;

            flipMinMax(k, n, out k, out n);

            for(int i= k; i< n; i++)
                result+=	func((float)i);

            return result;
        }
コード例 #32
0
		public static void PrecompileTest2()
		{
			MathFunc func = new MathFunc("-(sin(x) ^ -2 * x) + -(sin(x) ^ -1 * cos(x)) + cos(x) ^ -2 * x + cos(x) ^ -1 * sin(x) ^ -1");
			Assert.IsTrue(WolframAlphaUtils.CheckEquality(func.ToString(), func.GetPrecompilied().ToString()));
		}
コード例 #33
0
		public static void FoldConstantsTest()
		{
			MathFunc func = new MathFunc("cos(ln(sin(2)))").GetPrecompilied();
			Assert.IsTrue(double.Parse(func.ToString()) == 0.995483012754421);
		}
コード例 #34
0
ファイル: MathValue.cs プロジェクト: jandk/parsing
 public MathFunction(MathFunc func)
 {
     _func = func;
 }
コード例 #35
0
		public void UnknownFuncsAddTest()
		{
			var f = new MathFunc("arcsin(x) + arccos(x)").Simplify();
			Assert.IsTrue(f == "arcsin(x) + arccos(x)");
		}
コード例 #36
0
		public void SimplicateMultTest2()
		{
			var f = new MathFunc("(2 * x ^ 2 - 1) ^ -1 * (2 * x ^ 2 - 1) ^ -1").Simplify();
			Assert.IsTrue(f == "(2 * x ^ 2 + -1) ^ -2");
		}
コード例 #37
0
ファイル: MathContext.cs プロジェクト: jandk/parsing
 public MathFunction Register(string name, MathFunc function)
 {
     var mathFunction = new MathFunction(function);
     SetNameValue(name, mathFunction);
     return mathFunction;
 }
コード例 #38
0
		public void SubstractionTest()
		{
			var f = new MathFunc("a - a").Simplify();
			Assert.IsTrue(f == "0");
		}
コード例 #39
0
		public void UnknownFuncMultAndDivTest()
		{
			var f = new MathFunc("g(x) * g(x) / g(x)").Simplify();
			Assert.IsTrue(f == "g(x)");
		}
コード例 #40
0
		public void UnknownFuncsMultTest()
		{
			var f = new MathFunc("f(x) * g(x)").Simplify();
			Assert.IsTrue(f == "f(x) * g(x)");
		}
コード例 #41
0
		public void PowerInPowerSimplicateTest()
		{
			var f = new MathFunc("1 / x ^ 2").Simplify();
			Assert.IsTrue(f == "x ^ -2");
		}
コード例 #42
0
ファイル: frmMain.cs プロジェクト: 0xmono/MathExpressions.NET
		private void UpdateResult()
		{
			this.Invoke(new Action(() =>
			{
				dgvErrors.Rows.Clear();

				Assembly = new MathFuncAssemblyCecil();
				Assembly.Init();

				var variable = string.IsNullOrEmpty(tbVar.Text) ? null : new VarNode(tbVar.Text.ToLowerInvariant());

				string input = tbInput.Text.Replace(Environment.NewLine, "");
				MathFunc simplifiedFunc = null;
				try
				{
					simplifiedFunc = new MathFunc(input, tbVar.Text).Simplify();
					tbSimplification.Text = simplifiedFunc.ToString();
					tbSimplifiedOpt.Text = simplifiedFunc.GetPrecompilied().ToString();
				}
				catch (Exception ex)
				{
					dgvErrors.Rows.Add(string.Empty, ex.Message);
					foreach (var error in Helper.Parser.Errors)
						dgvErrors.Rows.Add(error.Position == null ? string.Empty : error.Position.Column.ToString(), error.Message);
					tbSimplification.Text = null;
					tbSimplifiedOpt.Text = null;
					tbDerivative.Text = null;
					tbDerivativeOpt.Text = null;
					tbIlCode.Text = null;
					tbDerivativeIlCode.Text = null;
				}

				try
				{
					var compileFunc = new MathFunc(input, tbVar.Text, true, true);
					compileFunc.Compile(Assembly, "Func");

					var sb = new StringBuilder();
					compileFunc.Instructions.ToList().ForEach(instr => sb.AppendLine(instr.ToString().Replace("IL_0000: ", "")));
					tbIlCode.Text = sb.ToString();
				}
				catch (Exception ex)
				{
					dgvErrors.Rows.Add(string.Empty, ex.Message);
					tbIlCode.Text = null;
				}

				if (tbSimplification.Text != string.Empty)
				{
					MathFunc derivativeFunc = null;
					try
					{
						derivativeFunc = new MathFunc(input, tbVar.Text).GetDerivative();
						tbDerivative.Text = derivativeFunc.ToString();
						tbDerivativeOpt.Text = derivativeFunc.GetPrecompilied().ToString();
					}
					catch (Exception ex)
					{
						dgvErrors.Rows.Add(string.Empty, ex.Message);
						foreach (var error in Helper.Parser.Errors)
							dgvErrors.Rows.Add(error.Position == null ? string.Empty : error.Position.Column.ToString(), error.Message);
						tbDerivative.Text = null;
						tbDerivativeOpt.Text = null;
						tbDerivativeIlCode.Text = null;
					}

					try
					{
						var compileDerivativeFunc = new MathFunc(tbDerivative.Text, tbVar.Text, true, true);
						compileDerivativeFunc.Compile(Assembly, "FuncDerivative");
						var sb = new StringBuilder();
						compileDerivativeFunc.Instructions.ToList().ForEach(instr => sb.AppendLine(instr.ToString().Replace("IL_0000: ", "")));

						tbDerivativeIlCode.Text = sb.ToString();
					}
					catch (Exception ex)
					{
						dgvErrors.Rows.Add(string.Empty, ex.Message);
						tbDerivativeIlCode.Text = null;
					}
				}
			}));
		}