public override void CopyDerivedFunctionToStack(ExpressionTree cur, ExpressionTree inner, StaticStack<MathOperation> DeriveStack, MathState State) { //ln(x)' = 1/x // 1 x / DeriveStack.Push((Number)1); inner.CopyToStack(DeriveStack); DeriveStack.Push(State.GetOperator("/")); }
public virtual void CopyDerivedFunctionToStack(ExpressionTree cur,ExpressionTree inner, StaticStack<MathOperation> DeriveStack,MathState State) { throw new MathEvaluator.Exceptions.UndefinedResultException(ToString() + " is not derivable"); }
public override void CopyDerivedFunctionToStack(ExpressionTree cur, ExpressionTree inner, StaticStack<MathOperation> DeriveStack, MathState State) { //sqrt(x)' = 1/(2*sqrt(x)) // 1 2 x sqrt * / DeriveStack.Push((Number)1,(Number)2); inner.CopyToStack(DeriveStack); DeriveStack.Push(State.GetFunction("sqrt"), State.GetOperator("*"), State.GetOperator("/")); }
public override void CopyDerivedFunctionToStack(ExpressionTree cur, ExpressionTree inner, StaticStack<MathOperation> DeriveStack, MathState State) { //sqrt(x)' = 1/(x * ln 10) // 1 x 10 ln * / DeriveStack.Push((Number)1); inner.CopyToStack(DeriveStack); DeriveStack.Push((Number)10,State.GetFunction("ln"),State.GetOperator("*"), State.GetOperator("/")); }
public override void CopyDerivedFunctionToStack(ExpressionTree cur,ExpressionTree inner, StaticStack<MathOperation> DeriveStack,MathState State) { inner.CopyToStack(DeriveStack); DeriveStack.Push(State.GetFunction("cos")); }
public override void CopyDerivedFunctionToStack(ExpressionTree cur, ExpressionTree inner, StaticStack<MathOperation> DeriveStack,MathState State) { inner.CopyToStack(DeriveStack); DeriveStack.Push(State.GetFunction("sin"), (Number)(-1), State.GetOperator("*")); }
public override void DeriveToStack(ExpressionTree cur, MathState State, StaticStack<MathOperation> DeriveStack) { DeriveStack.Push((Number)0); }
public override void DeriveToStack(ExpressionTree cur, MathState State, StaticStack<MathOperation> DeriveStack) { //f(x) = u(v(x)) //f'(x) = u'(v(x))*v'(x) // v u' v' * if(ArgumentCount != 1) throw new MathEvaluator.Exceptions.UndefinedResultException(ToString() + " is not derivable"); ExpressionTree inner = cur.FunctionParameters[0]; CopyDerivedFunctionToStack(cur,inner, DeriveStack,State); inner.DeriveToStack(DeriveStack,State); DeriveStack.Push(new Multiplication()); }
public override void DeriveToStack(ExpressionTree cur, MathState State, StaticStack<MathOperation> DeriveStack) { throw new UndefinedResultException(ToString() + " is not derivable"); }
public override void DeriveToStack(ExpressionTree cur, MathState State, StaticStack<MathOperation> DeriveStack) { DeriveStack.Push((Number)(_name.ToLower() == "x" ? 1 : 0)); }
public override void DeriveToStack(ExpressionTree cur, MathState State, StaticStack<MathOperation> DeriveStack) { // (f(x)^g(x))' // f(x)^(g(x)-1) (g(x) f'(x)+f(x) ln(f(x)) g'(x)) // f(x) g(x) 1 - ^ g(x) f'(x) * f(x) f(x) ln * + * g'(x) * // f g 1 - ^ g v * f f ln * b * + * ExpressionTree f = cur.Left; ExpressionTree g = cur.Right; f.CopyToStack(DeriveStack); g.CopyToStack(DeriveStack); DeriveStack.Push((Number)1, State.GetOperator("-"), State.GetOperator("^")); g.CopyToStack(DeriveStack); f.DeriveToStack(DeriveStack,State); DeriveStack.Push(State.GetOperator("*")); f.CopyToStack(DeriveStack); f.CopyToStack(DeriveStack); DeriveStack.Push(State.GetFunction("ln"), State.GetOperator("*")); g.DeriveToStack(DeriveStack,State); DeriveStack.Push(State.GetOperator("*"), State.GetOperator("+"), State.GetOperator("*")); /* if (cur.Left.ContainsVariable("x")) { //(x^n)' = n * x^(n-1) ExpressionTree left = cur.Left; ExpressionTree right = cur.Right; right.CopyToStack(DeriveStack); left.CopyToStack(DeriveStack); right.CopyToStack(DeriveStack); DeriveStack.Push((Number)1,State.GetOperator("-"),State.GetOperator("^"),State.GetOperator("*")); } else if (cur.Right.ContainsVariable("x")) { // (a^x)' = a^x * ln a // a x ^ a ln * ExpressionTree left = cur.Left; ExpressionTree right = cur.Right; left.CopyToStack(DeriveStack); right.CopyToStack(DeriveStack); DeriveStack.Push(State.GetOperator("^")); left.CopyToStack(DeriveStack); DeriveStack.Push(State.GetFunction("ln"), State.GetOperator("*")); //chain rule right.DeriveToStack(DeriveStack, State); DeriveStack.Push(State.GetOperator("*")); } else if (cur.Left.ToString() == "e" && cur.Right.ToString() == "x") { cur.Left.CopyToStack(DeriveStack); cur.Right.CopyToStack(DeriveStack); DeriveStack.Push(this); } else { DeriveStack.Push((Number)0); }*/ }
public override void DeriveToStack(ExpressionTree cur, MathState State, StaticStack<MathOperation> DeriveStack) { //(u * v)' = u' * v + u * v' //PF: = u' v * u v' * + ExpressionTree left = cur.Left; ExpressionTree right = cur.Right; left.DeriveToStack(DeriveStack,State); right.CopyToStack(DeriveStack); DeriveStack.Push(State.GetOperator("*")); left.CopyToStack(DeriveStack); right.DeriveToStack(DeriveStack,State); DeriveStack.Push(State.GetOperator("*"), State.GetOperator("+")); }
public abstract void DeriveToStack(ExpressionTree cur,MathState State,StaticStack<MathOperation> DeriveStack);
public override void DeriveToStack(ExpressionTree cur, MathState State, StaticStack<MathOperation> DeriveStack) { //(u * v)' = (u'v - uv')/v² //PF: = u' v * u v' * - v 2 ^ / ExpressionTree left = cur.Left; ExpressionTree right = cur.Right; left.DeriveToStack(DeriveStack,State); right.CopyToStack(DeriveStack); DeriveStack.Push(State.GetOperator("*")); left.CopyToStack(DeriveStack); right.DeriveToStack(DeriveStack,State); DeriveStack.Push(State.GetOperator("*"), State.GetOperator("-")); right.CopyToStack(DeriveStack); DeriveStack.Push((Number)2, State.GetOperator("^"), State.GetOperator("/")); }
public override void DeriveToStack(ExpressionTree cur, MathState State, StaticStack<MathOperation> DeriveStack) { cur.Left.DeriveToStack(DeriveStack, State); cur.Right.DeriveToStack(DeriveStack, State); DeriveStack.Push(this); }