Пример #1
0
        public override Function GetDerivative(FVar var)
        {
            if (Operand().HasVariable(var))
            {
                return(new FMul(new FCos(Operand().GetCopy()), Operand().GetDerivative(var)));
            }

            return(new FCons(0));
        }
Пример #2
0
        public override Function GetDerivative(FVar var)
        {
            if (this.HasVariable(var))
            {
                return(new FCons(1));
            }

            return(new FCons(0));
        }
Пример #3
0
        public override Function GetDerivative(FVar var)
        {
            bool checkLHS  = LHS().HasVariable(var);
            bool checkRHS  = RHS().HasVariable(var);
            bool checkBoth = checkLHS && checkRHS;

            if (checkLHS && !checkRHS)
            {
                return(new FMul(LHS().GetDerivative(var), RHS().GetCopy()));
            }

            if (!checkLHS && checkRHS)
            {
                return(new FMul(LHS().GetCopy(), RHS().GetDerivative(var)));
            }

            if (checkBoth)
            {
                return(new FAdd(new FMul(LHS().GetDerivative(var), RHS().GetCopy()), new FMul(LHS().GetCopy(), RHS().GetDerivative(var))));
            }

            return(new FCons(0));
        }
Пример #4
0
		public override Function GetDerivative(FVar var)
		{

			bool checkLHS = LHS().HasVariable(var);
			bool checkRHS = RHS().HasVariable(var);
			bool checkBoth = checkLHS && checkRHS;

            if (checkLHS && Exponent().GetID() == FCons.ID)
            {
                if (Exponent().GetValue() == 0)
                {
                    return new FCons(0);
                }

                if (Exponent().GetValue() == 1)
                {
                    return Base().GetDerivative(var);
                }
            }

            if (checkLHS && !checkRHS)
			{
				return new FMul(RHS().GetCopy(), new FMul(new FPow(LHS().GetCopy(), new FSub(RHS().GetCopy(), new FCons(1))), LHS().GetDerivative(var)));
			}

			if (!checkLHS && checkRHS)
			{
				return new FMul(this.GetCopy(), new FMul(new FLn(LHS().GetCopy()), RHS().GetDerivative(var)));
			}

			if (checkBoth)
			{
				return new FMul(this.GetCopy(), new FAdd(new FMul(RHS().GetDerivative(var), new FLn(LHS().GetCopy())), new FMul(new FDiv(RHS().GetCopy(), LHS().GetCopy()), LHS().GetDerivative(var))));
			}

			return new FCons(0);
		}
Пример #5
0
 public override Function GetIntegral(FVar var)
 {
     // TODO Auto-generated method stub
     return(null);
 }
Пример #6
0
 public override Function GetIntegral(FVar @var)
 {
     return(null);
 }
Пример #7
0
 public override bool HasVariable(FVar var)
 {
     return(base.HasVariable(var));
 }
Пример #8
0
 public override Function GetIntegral(FVar var)
 {
     throw new System.NotImplementedException();
 }
Пример #9
0
 public override Function GetDerivative(FVar var)
 {
     throw new System.NotImplementedException();
 }
Пример #10
0
 public override Function GetDerivative(FVar var)
 {
     return(new FCons(0));
 }
Пример #11
0
		public override Function GetIntegral(FVar var)
        {
			return null;
		}