anchor.diff:     * Creates a natural logarithm function with given argument.
      * 
      * For example, to create ln(10):
  -   *     ln = new Ln(10);
  +   *     num10 = new Number(10);
  +   *     ln = new Ln(num10);
      *     
      * To create a logarithm with arbitrary base, see [Log].
      */
  -  Ln(arg): super(Math.E, arg);
  +  Ln(Expression arg): super._ln(arg);
     
     Expression derive(String toVar) => arg.derive(toVar) / arg;
  +  
     String toString() => 'ln(${arg.toString()})';
  +}
  +
  +/**
  + * The n-th root function.
  + */
  +class Root extends MathFunction {
  +  
  +  /// N-th root.
  +  int n;
  +  
  +  /**
  +   * Creates the n-th root of arg.
  +   * 
  +   * For example, to create the 5th root of x:
  +   *     root = new Root(5, new Variable('x'));
  +   */
  +  Root(int this.n, arg): super.unary('root', arg);
  +  
  +  /**
  +   * Creates the square root of arg.
  +   * 
  +   * For example, to create the square root of x:
  +   *     sqrt = new Root.sqrt(new Variable('x'));
  +   *     
  +   * Note: For better simplification and display, use the [Sqrt] class.
  +   */
  +  Root.sqrt(arg): super.unary('sqrt', arg), n = 2;
  +  
  +  Expression get arg => getParam(0);
  +  
  +  Expression derive(String toVar) => this.asPower().derive(toVar);
  +  
  +  String toString() => 'nrt_$n(${arg.toString()})';
  +  
  +  /**
  +   * Returns the power form of this root.
  +   * E.g. root_5(x) = x^(1/5)
  +   *    
  +   * This method is used to determine the derivation of a root
  +   * expression.
  +   */
  +  Expression asPower() => new Power(arg, new Divide(1,n));
  +}
  +
  +/**
  + * The square root function.
  + */
  +class Sqrt extends Root {
  +  
  +  /**
  +   * Creates the square root of arg.
  +   * 
  +   * For example, to create the square root of x:
  +   *     sqrt = new Sqrt(new Variable('x'));
  +   */
  +  Sqrt(arg): super.sqrt(arg);
  +
  +  String toString() => 'sqrt(${arg.toString()})';
  +  
  +  /**
  +   * Possible simplifications:
  +   * 
  +   * 1. sqrt(x^2) = x
  +   * 
  +   * Note: This simplification works _only_ for real numbers and 
  +   * _not_ for complex numbers.
  +   */
  +  Expression simplify() {
  +    Expression argSimpl = arg.simplify();
  +    
  +    if (argSimpl is Power) {
  +      Expression exponent = argSimpl.second;
  +      if (exponent is Number) {
  +        if (exponent.value == 2) {
  +          return argSimpl.first; // sqrt(x^2)
  +        }
  +      }
  +    }
  +    
  +    return new Sqrt(argSimpl);
  +  }
   }
   
   /**
  
positive.code:    * 
     * If an argument is not an expression, it will be wrapped in an appropriate
     * literal.
     *  - A (positive) number will be encapsulated in a [Number] Literal,
     *  - A string will be encapsulated in a [Variable] Literal.
     */
    BinaryOperator(first, second) {
      this.first = _toExpression(first);
  
negative.code:    */
    Plus(first, second): super(first, second);
    
    Expression derive(String toVar) => new Plus(first.derive(toVar),
                                                second.derive(toVar));
    
    /**
     * Possible simplifications:
     * 
     * 1. a + 0 = a
     * 2. 0 + a = a
     */
    Expression simplify() {
      Expression firstOp = first.simplify();
      Expression secondOp = second.simplify();
      
      if (_isNumber(firstOp, 0)) {
        return secondOp;
      }
      
      if (_isNumber(secondOp, 0)) {
        return firstOp;
      }
      
      return new Plus(firstOp, secondOp);
      
      //TODO -a + b = b - a 
      //TODO -a - b = - (a+b)
    }
    
    String toString() => '(${first.toString()} + ${second.toString()})';
  }
  
  