- // Multiplying two series with different variables or expansion points
- // results in an empty (constant) series
- if (!is_compatible_to(other)) {
- epvector nul;
- nul.push_back(expair(Order(_ex1()), _ex0()));
- return pseries(var, point, nul);
- }
-
- // Series multiplication
- epvector new_seq;
-
- const symbol *s = static_cast<symbol *>(var.bp);
- int a_max = degree(*s);
- int b_max = other.degree(*s);
- int a_min = ldegree(*s);
- int b_min = other.ldegree(*s);
- int cdeg_min = a_min + b_min;
- int cdeg_max = a_max + b_max;
-
- int higher_order_a = INT_MAX;
- int higher_order_b = INT_MAX;
- if (is_order_function(coeff(*s, a_max)))
- higher_order_a = a_max + b_min;
- if (is_order_function(other.coeff(*s, b_max)))
- higher_order_b = b_max + a_min;
- int higher_order_c = min(higher_order_a, higher_order_b);
- if (cdeg_max >= higher_order_c)
- cdeg_max = higher_order_c - 1;
-
- for (int cdeg=cdeg_min; cdeg<=cdeg_max; cdeg++) {
- ex co = _ex0();
- // c(i)=a(0)b(i)+...+a(i)b(0)
- for (int i=a_min; cdeg-i>=b_min; i++) {
- ex a_coeff = coeff(*s, i);
- ex b_coeff = other.coeff(*s, cdeg-i);
- if (!is_order_function(a_coeff) && !is_order_function(b_coeff))
- co += coeff(*s, i) * other.coeff(*s, cdeg-i);
- }
- if (!co.is_zero())
- new_seq.push_back(expair(co, numeric(cdeg)));
- }
- if (higher_order_c < INT_MAX)
- new_seq.push_back(expair(Order(_ex1()), numeric(higher_order_c)));
- return pseries(var, point, new_seq);
+ // Multiplying two series with different variables or expansion points
+ // results in an empty (constant) series
+ if (!is_compatible_to(other)) {
+ epvector nul;
+ nul.push_back(expair(Order(_ex1()), _ex0()));
+ return pseries(relational(var,point), nul);
+ }
+
+ // Series multiplication
+ epvector new_seq;
+
+ const symbol *s = static_cast<symbol *>(var.bp);
+ int a_max = degree(*s);
+ int b_max = other.degree(*s);
+ int a_min = ldegree(*s);
+ int b_min = other.ldegree(*s);
+ int cdeg_min = a_min + b_min;
+ int cdeg_max = a_max + b_max;
+
+ int higher_order_a = INT_MAX;
+ int higher_order_b = INT_MAX;
+ if (is_order_function(coeff(*s, a_max)))
+ higher_order_a = a_max + b_min;
+ if (is_order_function(other.coeff(*s, b_max)))
+ higher_order_b = b_max + a_min;
+ int higher_order_c = std::min(higher_order_a, higher_order_b);
+ if (cdeg_max >= higher_order_c)
+ cdeg_max = higher_order_c - 1;
+
+ for (int cdeg=cdeg_min; cdeg<=cdeg_max; ++cdeg) {
+ ex co = _ex0();
+ // c(i)=a(0)b(i)+...+a(i)b(0)
+ for (int i=a_min; cdeg-i>=b_min; ++i) {
+ ex a_coeff = coeff(*s, i);
+ ex b_coeff = other.coeff(*s, cdeg-i);
+ if (!is_order_function(a_coeff) && !is_order_function(b_coeff))
+ co += a_coeff * b_coeff;
+ }
+ if (!co.is_zero())
+ new_seq.push_back(expair(co, numeric(cdeg)));
+ }
+ if (higher_order_c < INT_MAX)
+ new_seq.push_back(expair(Order(_ex1()), numeric(higher_order_c)));
+ return pseries(relational(var,point), new_seq);