Index: trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionLatexFormatter.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionLatexFormatter.cs	(revision 7694)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionLatexFormatter.cs	(revision 7695)
@@ -112,4 +112,8 @@
       } else if (node.Symbol is Exponential) {
         strBuilder.Append(@"\exp \left( ");
+      } else if (node.Symbol is Square) {
+        strBuilder.Append(@"\left(");
+      } else if (node.Symbol is SquareRoot) {
+        strBuilder.Append(@"\sqrt{");
       } else if (node.Symbol is Sine) {
         strBuilder.Append(@"\sin \left( ");
@@ -209,4 +213,8 @@
       } else if (node.Symbol is Exponential) {
         throw new InvalidOperationException();
+      } else if (node.Symbol is Square) {
+        throw new InvalidOperationException();
+      } else if (node.Symbol is SquareRoot) {
+        throw new InvalidOperationException();
       } else if (node.Symbol is Sine) {
         throw new InvalidOperationException();
@@ -266,4 +274,8 @@
       } else if (node.Symbol is Exponential) {
         strBuilder.Append(@" \right) ");
+      } else if (node.Symbol is Square) {
+        strBuilder.Append(@"\right)^2");
+      } else if (node.Symbol is SquareRoot) {
+        strBuilder.Append(@"}");
       } else if (node.Symbol is Sine) {
         strBuilder.Append(@" \right) ");
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionMATLABFormatter.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionMATLABFormatter.cs	(revision 7694)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionMATLABFormatter.cs	(revision 7695)
@@ -20,14 +20,10 @@
 #endregion
 
+using System.Globalization;
 using System.Text;
-using System.Linq;
+using HeuristicLab.Common;
 using HeuristicLab.Core;
-using HeuristicLab.Common;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-using HeuristicLab.Problems.DataAnalysis;
-using System.Collections.Generic;
-using System;
-using System.Globalization;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
@@ -84,6 +80,5 @@
     }
 
-    public string FormatOnlyExpression(ISymbolicExpressionTreeNode expressionNode)
-    {
+    public string FormatOnlyExpression(ISymbolicExpressionTreeNode expressionNode) {
       var stringBuilder = new StringBuilder();
       stringBuilder.AppendLine("  for " + CurrentIndexVariable + " = 1:1:rows");
@@ -151,4 +146,12 @@
       } else if (symbol is Exponential) {
         stringBuilder.Append("exp(");
+        stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
+        stringBuilder.Append(")");
+      } else if (symbol is Square) {
+        stringBuilder.Append("(");
+        stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
+        stringBuilder.Append(").^2");
+      } else if (symbol is SquareRoot) {
+        stringBuilder.Append("sqrt(");
         stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
         stringBuilder.Append(")");
@@ -283,6 +286,5 @@
 
 
-    private string LagToString(int lag)
-    {
+    private string LagToString(int lag) {
       if (lag < 0) {
         return "(" + CurrentIndexVariable + "" + lag + ")";
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/FullFunctionalExpressionGrammar.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/FullFunctionalExpressionGrammar.cs	(revision 7694)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/FullFunctionalExpressionGrammar.cs	(revision 7695)
@@ -55,6 +55,10 @@
       var pow = new Power();
       pow.InitialFrequency = 0.0;
+      var square = new Square();
+      square.InitialFrequency = 0.0;
       var root = new Root();
       root.InitialFrequency = 0.0;
+      var sqrt = new SquareRoot();
+      sqrt.InitialFrequency = 0.0;
       var exp = new Exponential();
       var @if = new IfThenElse();
@@ -82,6 +86,6 @@
       laggedVariable.InitialFrequency = 0.0;
 
-      var allSymbols = new List<Symbol>() { add, sub, mul, div, mean, sin, cos, tan, log, pow, root, exp, @if, gt, lt, and, or, not, timeLag, integral, derivative, constant, variableSymbol, laggedVariable, variableCondition };
-      var unaryFunctionSymbols = new List<Symbol>() { sin, cos, tan, log, exp, not, timeLag, integral, derivative };
+      var allSymbols = new List<Symbol>() { add, sub, mul, div, mean, sin, cos, tan, log, square, pow, sqrt, root, exp, @if, gt, lt, and, or, not, timeLag, integral, derivative, constant, variableSymbol, laggedVariable, variableCondition };
+      var unaryFunctionSymbols = new List<Symbol>() { square, sqrt, sin, cos, tan, log, exp, not, timeLag, integral, derivative };
 
       var binaryFunctionSymbols = new List<Symbol>() { pow, root, gt, lt, variableCondition };
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/TypeCoherentExpressionGrammar.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/TypeCoherentExpressionGrammar.cs	(revision 7694)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/TypeCoherentExpressionGrammar.cs	(revision 7695)
@@ -65,5 +65,7 @@
       var log = new Logarithm();
       var pow = new Power();
+      var square = new Square();
       var root = new Root();
+      var sqrt = new SquareRoot();
       var exp = new Exponential();
       var @if = new IfThenElse();
@@ -93,5 +95,5 @@
       var realValuedSymbols = new GroupSymbol(RealValuedSymbolsName, new List<ISymbol>() { arithmeticSymbols, trigonometricSymbols, exponentialAndLogarithmicSymbols, terminalSymbols });
 
-      var powerSymbols = new GroupSymbol(PowerFunctionsName, new List<ISymbol> { pow, root });
+      var powerSymbols = new GroupSymbol(PowerFunctionsName, new List<ISymbol> { square, pow, sqrt, root });
 
       var conditionSymbols = new GroupSymbol(ConditionsName, new List<ISymbol> { @if, variableCondition });
@@ -111,5 +113,8 @@
       SetSubtreeCount(arithmeticSymbols, 2, 2);
       SetSubtreeCount(trigonometricSymbols, 1, 1);
-      SetSubtreeCount(powerSymbols, 2, 2);
+      SetSubtreeCount(pow, 2, 2);
+      SetSubtreeCount(root, 2, 2);
+      SetSubtreeCount(square, 1, 1);
+      SetSubtreeCount(sqrt, 1, 1);
       SetSubtreeCount(exponentialAndLogarithmicSymbols, 1, 1);
       SetSubtreeCount(terminalSymbols, 0, 0);
@@ -140,4 +145,6 @@
       AddAllowedChildSymbol(powerSymbols, laggedVariable, 0);
       AddAllowedChildSymbol(powerSymbols, constant, 1);
+      AddAllowedChildSymbol(square, realValuedSymbols, 0);
+      AddAllowedChildSymbol(sqrt, realValuedSymbols, 0);
 
       AddAllowedChildSymbol(@if, comparisonSymbols, 0);
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj	(revision 7694)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj	(revision 7695)
@@ -161,4 +161,6 @@
     <Compile Include="Symbols\Constant.cs" />
     <Compile Include="Symbols\ConstantTreeNode.cs" />
+    <Compile Include="Symbols\SquareRoot.cs" />
+    <Compile Include="Symbols\Square.cs" />
     <Compile Include="Symbols\Cosine.cs" />
     <Compile Include="Symbols\Derivative.cs" />
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeInterpreter.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeInterpreter.cs	(revision 7694)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeInterpreter.cs	(revision 7695)
@@ -133,4 +133,7 @@
 
       public const byte VariableCondition = 27;
+
+      public const byte Square = 28;
+      public const byte SquareRoot = 29;
     }
     #endregion
@@ -154,5 +157,5 @@
       { typeof(Average), OpCodes.Average},
       { typeof(InvokeFunction), OpCodes.Call },
-      { typeof(HeuristicLab.Problems.DataAnalysis.Symbolic.Variable), OpCodes.Variable },
+      { typeof(Variable), OpCodes.Variable },
       { typeof(LaggedVariable), OpCodes.LagVariable },
       { typeof(Constant), OpCodes.Constant },
@@ -163,5 +166,7 @@
       { typeof(Integral), OpCodes.Integral},
       { typeof(Derivative), OpCodes.Derivative},
-      { typeof(VariableCondition),OpCodes.VariableCondition}
+      { typeof(VariableCondition),OpCodes.VariableCondition},
+      { typeof(Square),OpCodes.Square},
+      {typeof(SquareRoot),OpCodes.SquareRoot}
     };
 
@@ -305,8 +310,14 @@
             return Math.Tan(Evaluate(dataset, ref row, state));
           }
+        case OpCodes.Square: {
+            return Math.Pow(Evaluate(dataset, ref row, state), 2);
+          }
         case OpCodes.Power: {
             double x = Evaluate(dataset, ref row, state);
             double y = Math.Round(Evaluate(dataset, ref row, state));
             return Math.Pow(x, y);
+          }
+        case OpCodes.SquareRoot: {
+            return Math.Sqrt(Evaluate(dataset, ref row, state));
           }
         case OpCodes.Root: {
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeSimplifier.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeSimplifier.cs	(revision 7694)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeSimplifier.cs	(revision 7695)
@@ -22,5 +22,4 @@
 using System;
 using System.Collections.Generic;
-using System.Diagnostics;
 using System.Linq;
 using HeuristicLab.Common;
@@ -41,4 +40,6 @@
     private Exponential expSymbol = new Exponential();
     private Root rootSymbol = new Root();
+    private Square sqrSymbol = new Square();
+    private SquareRoot sqrtSymbol = new SquareRoot();
     private Power powSymbol = new Power();
     private Sine sineSymbol = new Sine();
@@ -125,4 +126,10 @@
     private bool IsRoot(ISymbolicExpressionTreeNode node) {
       return node.Symbol is Root;
+    }
+    private bool IsSquare(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is Square;
+    }
+    private bool IsSquareRoot(ISymbolicExpressionTreeNode node) {
+      return node.Symbol is SquareRoot;
     }
     private bool IsPower(ISymbolicExpressionTreeNode node) {
@@ -201,8 +208,12 @@
       } else if (IsExp(original)) {
         return SimplifyExp(original);
+      } else if (IsSquare(original)) {
+        return SimplifySquare(original);
+      } else if (IsSquareRoot(original)) {
+        return SimplifySquareRoot(original);
+      } else if (IsPower(original)) {
+        return SimplifyPower(original);
       } else if (IsRoot(original)) {
         return SimplifyRoot(original);
-      } else if (IsPower(original)) {
-        return SimplifyPower(original);
       } else if (IsSine(original)) {
         return SimplifySine(original);
@@ -348,4 +359,10 @@
       return MakeExp(GetSimplifiedTree(original.GetSubtree(0)));
     }
+    private ISymbolicExpressionTreeNode SimplifySquare(ISymbolicExpressionTreeNode original) {
+      return MakeSquare(GetSimplifiedTree(original.GetSubtree(0)));
+    }
+    private ISymbolicExpressionTreeNode SimplifySquareRoot(ISymbolicExpressionTreeNode original) {
+      return MakeSquareRoot(GetSimplifiedTree(original.GetSubtree(0)));
+    }
 
     private ISymbolicExpressionTreeNode SimplifyLog(ISymbolicExpressionTreeNode original) {
@@ -532,4 +549,30 @@
       }
     }
+
+    private ISymbolicExpressionTreeNode MakeSquare(ISymbolicExpressionTreeNode node) {
+      if (IsConstant(node)) {
+        var constT = node as ConstantTreeNode;
+        return MakeConstant(constT.Value * constT.Value);
+      } else if (IsSquareRoot(node)) {
+        return node.GetSubtree(0);
+      } else {
+        var sqrNode = sqrSymbol.CreateTreeNode();
+        sqrNode.AddSubtree(node);
+        return sqrNode;
+      }
+    }
+    private ISymbolicExpressionTreeNode MakeSquareRoot(ISymbolicExpressionTreeNode node) {
+      if (IsConstant(node)) {
+        var constT = node as ConstantTreeNode;
+        return MakeConstant(Math.Sqrt(constT.Value));
+      } else if (IsSquare(node)) {
+        return node.GetSubtree(0);
+      } else {
+        var sqrtNode = sqrtSymbol.CreateTreeNode();
+        sqrtNode.AddSubtree(node);
+        return sqrtNode;
+      }
+    }
+
     private ISymbolicExpressionTreeNode MakeLog(ISymbolicExpressionTreeNode node) {
       if (IsConstant(node)) {
@@ -636,18 +679,13 @@
       } else if (IsDivision(a) && IsConstant(b)) {
         // (a1 / a2) / c => (a1 / (a2 * c))
-        Trace.Assert(a.Subtrees.Count() == 2);
         return MakeFraction(a.GetSubtree(0), MakeProduct(a.GetSubtree(1), b));
       } else if (IsDivision(a) && IsDivision(b)) {
         // (a1 / a2) / (b1 / b2) => 
-        Trace.Assert(a.Subtrees.Count() == 2);
-        Trace.Assert(b.Subtrees.Count() == 2);
         return MakeFraction(MakeProduct(a.GetSubtree(0), b.GetSubtree(1)), MakeProduct(a.GetSubtree(1), b.GetSubtree(0)));
       } else if (IsDivision(a)) {
         // (a1 / a2) / b => (a1 / (a2 * b))
-        Trace.Assert(a.Subtrees.Count() == 2);
         return MakeFraction(a.GetSubtree(0), MakeProduct(a.GetSubtree(1), b));
       } else if (IsDivision(b)) {
         // a / (b1 / b2) => (a * b2) / b1
-        Trace.Assert(b.Subtrees.Count() == 2);
         return MakeFraction(MakeProduct(a, b.GetSubtree(1)), b.GetSubtree(0));
       } else {
@@ -774,14 +812,10 @@
       } else if (IsDivision(a) && IsDivision(b)) {
         // (a1 / a2) * (b1 / b2) => (a1 * b1) / (a2 * b2)
-        Trace.Assert(a.Subtrees.Count() == 2);
-        Trace.Assert(b.Subtrees.Count() == 2);
         return MakeFraction(MakeProduct(a.GetSubtree(0), b.GetSubtree(0)), MakeProduct(a.GetSubtree(1), b.GetSubtree(1)));
       } else if (IsDivision(a)) {
         // (a1 / a2) * b => (a1 * b) / a2
-        Trace.Assert(a.Subtrees.Count() == 2);
         return MakeFraction(MakeProduct(a.GetSubtree(0), b), a.GetSubtree(1));
       } else if (IsDivision(b)) {
         // a * (b1 / b2) => (b1 * a) / b2
-        Trace.Assert(b.Subtrees.Count() == 2);
         return MakeFraction(MakeProduct(b.GetSubtree(0), a), b.GetSubtree(1));
       } else if (IsMultiplication(a) && IsMultiplication(b)) {
@@ -912,5 +946,4 @@
         return MakeConstant(1.0 / ((ConstantTreeNode)x).Value);
       } else if (IsDivision(x)) {
-        Trace.Assert(x.Subtrees.Count() == 2);
         return MakeFraction(x.GetSubtree(1), x.GetSubtree(0));
       } else {
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Square.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Square.cs	(revision 7695)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Square.cs	(revision 7695)
@@ -0,0 +1,48 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableClass]
+  [Item("Square", "Symbol that represents the square function.")]
+  public sealed class Square : Symbol {
+    private const int minimumArity = 1;
+    private const int maximumArity = 1;
+
+    public override int MinimumArity {
+      get { return minimumArity; }
+    }
+    public override int MaximumArity {
+      get { return maximumArity; }
+    }
+
+    [StorableConstructor]
+    private Square(bool deserializing) : base(deserializing) { }
+    private Square(Square original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new Square(this, cloner);
+    }
+    public Square() : base("Square", "Symbol that represents the square function.") { }
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/SquareRoot.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/SquareRoot.cs	(revision 7695)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/SquareRoot.cs	(revision 7695)
@@ -0,0 +1,48 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  [StorableClass]
+  [Item("SquareRoot", "Symbol that represents the square root function.")]
+  public sealed class SquareRoot : Symbol {
+    private const int minimumArity = 1;
+    private const int maximumArity = 1;
+
+    public override int MinimumArity {
+      get { return minimumArity; }
+    }
+    public override int MaximumArity {
+      get { return maximumArity; }
+    }
+
+    [StorableConstructor]
+    private SquareRoot(bool deserializing) : base(deserializing) { }
+    private SquareRoot(SquareRoot original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SquareRoot(this, cloner);
+    }
+    public SquareRoot() : base("SquareRoot", "Symbol that represents the square root function.") { }
+  }
+}
Index: trunk/sources/HeuristicLab.Tests/HeuristicLab.Tests.csproj
===================================================================
--- trunk/sources/HeuristicLab.Tests/HeuristicLab.Tests.csproj	(revision 7694)
+++ trunk/sources/HeuristicLab.Tests/HeuristicLab.Tests.csproj	(revision 7695)
@@ -102,6 +102,6 @@
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="ALGLIB-3.4.0">
-      <HintPath>..\bin\ALGLIB-3.4.0.dll</HintPath>
+    <Reference Include="ALGLIB-3.5.0, Version=3.5.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\bin\ALGLIB-3.5.0.dll</HintPath>
     </Reference>
     <Reference Include="Calendar.DayView">
@@ -112,7 +112,4 @@
       <HintPath>..\bin\Google.ProtocolBuffers-0.9.1.dll</HintPath>
       <Private>True</Private>
-    </Reference>
-    <Reference Include="HeuristicLab.ALGLIB-3.4.0">
-      <HintPath>..\bin\HeuristicLab.ALGLIB-3.4.0.dll</HintPath>
     </Reference>
     <Reference Include="HeuristicLab.LibSVM-1.6.3">
