Esempio n. 1
0
 /// <inheritdoc/>
 public override ExpNode Execute(VarValueNode node)
 {
     if (node.Character != _variable.Character)
     {
         return(ConstantRule(node));
     }
     return(QuickOpers.Multiply(.5, QuickOpers.Pow(node, 2)));
 }
Esempio n. 2
0
 /// <inheritdoc/>
 public override bool IsConstantBy(VarValueNode variable)
 {
     foreach (var child in Children)
     {
         if (!child.IsConstantBy(variable))
         {
             return(false);
         }
     }
     return(true);
 }
Esempio n. 3
0
 /// <summary>
 /// Executes operation on a <see cref="VarValueNode"/>.
 /// </summary>
 /// <param name="node">The <see cref="VarValueNode"/> to execute operation on.</param>
 /// <returns>The result of the operation on a <see cref="VarValueNode"/>.</returns>
 public virtual ExpNode Execute(VarValueNode node) => Execute((ValueNode)node);
Esempio n. 4
0
 /// <inheritdoc/>
 public override string Print(VarValueNode node)
 {
     return($"{node.Character}");
 }
Esempio n. 5
0
 /// <summary>
 /// Gets if this <see cref="ExpNode"/> or and its children are constant with all <see cref="VarValueNode"/> constant except <paramref name="variable"/>.
 /// </summary>
 /// <remarks>
 /// An <see cref="ExpNode"/> is constant by <paramref name="variable"/> if neither it or any of its children are <paramref name="variable"/>.
 /// </remarks>
 /// <param name="variable">The <see cref="VarValueNode"/> that is not constant.</param>
 /// <returns>a value indicating whether or not the <see cref="ExpNode"/> is constant.</returns>
 public abstract bool IsConstantBy(VarValueNode variable);
Esempio n. 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Differentiator"/> class.
 /// </summary>
 /// <param name="variable">The variable to take the derivative over.</param>
 public Differentiator(VarValueNode variable)
 {
     _variable = variable;
 }
Esempio n. 7
0
 /// <inheritdoc/>
 public override ExpNode Execute(VarValueNode node)
 {
     return(QuickOpers.MakeNumericalNode(node.Character == _variable.Character ? 1 : 0));
 }
Esempio n. 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Integrator"/> class.
 /// </summary>
 /// <param name="variable">The variable to find the integral for.</param>
 public Integrator(VarValueNode variable)
 {
     _variable = variable;
 }
Esempio n. 9
0
 /// <inheritdoc/>
 public override bool IsConstantBy(VarValueNode variable) => true;
Esempio n. 10
0
 /// <summary>
 /// Prints a <see cref="VarValueNode"/>.
 /// </summary>
 /// <param name="node">The <see cref="VarValueNode"/> to print.</param>
 /// <returns>The <see cref="VarValueNode"/> printed to a string.</returns>
 public virtual string Print(VarValueNode node) => Print((ValueNode)node);