29 std::set<storm::RationalFunctionVariable> polynomialVariables;
31 for (
auto const& variable : polynomialVariables) {
32 if (!manager->hasVariable(variable.name())) {
33 manager->declareRationalVariable(variable.name());
39 polynomial.makeOrdered();
45 bool isFirstTerm =
true;
46 for (
auto const& term : polynomial) {
49 std::set<storm::RationalFunctionVariable> termVariables;
50 term.gatherVariables(termVariables);
53 bool const isNegative = coefficient < zero;
54 auto absoluteCoefficient = isNegative ? -coefficient : coefficient;
57 for (
auto const& variable : termVariables) {
58 auto exponent =
static_cast<int64_t
>(term.monomial()->exponentOfVariable(variable));
59 auto variableExpression = manager->getVariable(variable.name());
60 auto factor = exponent == 1 ? variableExpression :
pow(variableExpression, manager->integer(exponent));
61 variablesPart = variablesPart.
isInitialized() ? variablesPart * factor : factor;
67 Expression termExpression = isConstantTerm ? manager->rational(coefficient)
68 : (absoluteCoefficient == one ? variablesPart : manager->rational(absoluteCoefficient) * variablesPart);
72 result = isNegative && !isConstantTerm ? -termExpression : termExpression;
74 result = isNegative && !isConstantTerm ? result - termExpression : result + termExpression;
81 result = manager->rational(zero);