function displaySymSolution(s,n)
  if nargin == 2
      savedigits = digits(n);
      cleanupObj = onCleanup(@() digits(savedigits));
  end
  evalin('caller', ['display(' inputname(1) ')']);
  if isa(s,'sym') && isempty(s)
      disp(message('symbolic:tasks:displaySymSolution:NoSolution').getString);
  end
  if ~isstruct(s)
      return;
  end
  values = s;
      try
          parameters = s.parameters;
          values = rmfield(values, 'parameters');
      catch
          parameters = sym([]);
      end
      try
          conditions = s.conditions;
          values = rmfield(values, 'conditions');
      catch
          conditions = sym([]);
      end
      names = string(fields(values));
      % convert struct to array
      values = struct2cell(values);
      values = [values{:}];
      numOfVariables = numel(names);
      numOfSolutions = size(values,1);

      if numOfSolutions == 0
          disp(message('symbolic:tasks:displaySymSolution:NoSolution').getString);
      else
          disp(message('symbolic:tasks:displaySymSolution:Where').getString);
      end

      for i=1:numOfSolutions
          vars = names;
          if numOfSolutions > 1
              vars = vars + "(" + i + ")";
          end
          vars = join(vars, ", ");
          if numOfVariables > 1
              vars = "[ " + vars + " ]";
          end

          solution = values(i,:);
          % for all 'parameters', intersect the parameter with the solution
          % if there is no parameter inside the condition than 'if' instead of 'with'
          ps = intersect(parameters, symvar(solution));
          if sympref('FloatingPointOutput')
            solution = feval2sym_NaNsingularity(symengine,"symobj::floatForDisplay", solution);
          end
          if isempty(conditions) || conditions(i) == evalin(symengine,"TRUE")
              if isempty(ps)
                  displayFormula([vars+"  = solution"], {'solution'}, {solution});
              else
                  displayFormula([vars+"  = solution", "'  for all  '", "ps"], {'solution', 'ps'}, {solution, ps});
              end
          else
              currentCondition = conditions(i);
              if sympref('FloatingPointOutput')
                  currentCondition = feval2sym_NaNsingularity(symengine,"symobj::floatForDisplay", currentCondition);
              end
              if isempty(intersect(ps, symvar(conditions(i))))
                  displayFormula([vars+"  = solution", "'  if  '", "condition"], {'solution', 'condition'}, {solution, currentCondition});
              else
                  displayFormula([vars+"  = solution", "'  for all  '", "ps", "'  with  '", "condition"], {'solution', 'ps' 'condition'}, {solution, ps, currentCondition});
              end
          end
      end
end
