Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14367 for trunk


Ignore:
Timestamp:
10/31/16 19:03:02 (8 years ago)
Author:
gkronber
Message:

#2692: show constants = 1.0 directly in the formula. Also fixed a bug for division with only one argument.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionLatexFormatter.cs

    r14255 r14367  
    6767        strBuilder.AppendLine(FormatRecursively(symbolicExpressionTree.Root));
    6868        return strBuilder.ToString();
    69       }
    70       catch (NotImplementedException ex) {
     69      } catch (NotImplementedException ex) {
    7170        return ex.Message + Environment.NewLine + ex.StackTrace;
    7271      }
     
    109108      } else if (node.Symbol is Division) {
    110109        if (node.SubtreeCount == 1) {
    111           strBuilder.Append(@" \cfrac{1");
     110          strBuilder.Append(@" \cfrac{1}{");
    112111        } else {
    113112          strBuilder.Append(@" \cfrac{ ");
     
    176175        strBuilder.Append(@" \operatorname{if}  \left( ");
    177176      } else if (node.Symbol is Constant) {
    178         strBuilder.Append("c_{" + constants.Count + "} ");
    179177        var constNode = node as ConstantTreeNode;
    180         constants.Add(constNode.Value);
     178        if (constNode.Value.IsAlmost(1.0)) {
     179          strBuilder.Append("1 ");
     180        } else {
     181          strBuilder.Append("c_{" + constants.Count + "} ");
     182          constants.Add(constNode.Value);
     183        }
    181184      } else if (node.Symbol is LaggedVariable) {
    182185        var laggedVarNode = node as LaggedVariableTreeNode;
Note: See TracChangeset for help on using the changeset viewer.