 				(if @children.left.copy? then @children.left.copy() else @children.left),
 				(if @children.right.copy? then @children.right.copy() else @children.right)
 			)
+
+		sort: ->
+			@children.left.sort?()
+			@children.right.sort?()
 
 		compareSameType: (b) ->
 			# Compare this object with another of the same type.

		-1: Addition nodes, by first child
		###

		if a instanceof terminals.Constant
			if b instanceof terminals.Constant
				# Compare by value.
				if a.evaluate() < b.evaluate()
					return -1
				else if a.evaluate() == b.evaluate()
					return 0
				else
					return 1
			else
				return -1
		else if a instanceof terminals.SymbolicConstant
			if b instanceof terminals.Constant
				return 1
			else if b instanceof terminals.SymbolicConstant
				# Compare by label.
			else
				return -1
		else if a instanceof terminals.Variable
			if b instanceof terminals.Constant or b instanceof terminals.SymbolicConstant
				return 1
			else if b instanceof terminals.Variable
				# Compare by label.
			else
				return -1
		else if a instanceof Pow
			if (b instanceof terminals.Constant or
				b instanceof terminals.SymbolicConstant or
				b instanceof terminals.Variable)
				return 1
			else if b instanceof Pow
				# Compare by base.
				return compare(a.children.left, b.children.left)
			else
				return -1
		else if a instanceof Mul
			if (b instanceof terminals.Constant or
				b instanceof terminals.SymbolicConstant or
				b instanceof terminals.Variable or
				b instanceof Pow)
				return 1
			else if b instanceof Mul
				# Compare by first child.
				return compare(a.children[0], b.children[0])
			else
				return -1
		else if a instanceof Add
			if (b instanceof terminals.Constant or
				b instanceof terminals.SymbolicConstant or
				b instanceof terminals.Variable or
				b instanceof Pow or
				b instanceof Mul)
				return 1
			else if b instanceof Add
				# Compare by first child.
				return compare(a.children[0], b.children[0])
			else
				return -1
		else
			return 1

	return {



			return new Pow(left, right)

		sort: ->
			# Sort this node.
			for child in @children
				children.sort?()
			@children.sort(compare)

	class Pow extends nodes.BinaryNode
		# Represent powers.
