[GiNaC-list] Add series_to_poly to ginsh

Vitaly Magerya vmagerya at gmail.com
Fri Feb 4 17:29:59 CET 2022


Hi, all. Could we add "series_to_poly" to ginsh? It would make
operating on series easier; as it stands there's no way to discard
the Order() term in ginsh.

The patch is attached (does this list accept attachments?).
-------------- next part --------------
diff --git a/ginsh/ginsh_parser.ypp b/ginsh/ginsh_parser.ypp
index 4b82d32f..88d1ce78 100644
--- a/ginsh/ginsh_parser.ypp
+++ b/ginsh/ginsh_parser.ypp
@@ -530,6 +530,12 @@ static ex f_series(const exprseq &e)
 	return e[0].series(e[1], ex_to<numeric>(e[2]).to_int());
 }
 
+static ex f_series_to_poly(const exprseq &e)
+{
+	CHECK_ARG(0, pseries, series_to_poly);
+	return series_to_poly(ex_to<pseries>(e[0]));
+}
+
 static ex f_sprem(const exprseq &e)
 {
 	return sprem(e[0], e[1], e[2]);
@@ -737,6 +743,7 @@ static const fcn_init builtin_fcns[] = {
 	{"rem", f_rem, 3},
 	{"resultant", f_resultant, 3},
 	{"series", f_series, 3},
+	{"series_to_poly", f_series_to_poly, 1},
 	{"sprem", f_sprem, 3},
 	{"sqrfree", f_sqrfree1, 1},
 	{"sqrfree", f_sqrfree2, 2},


More information about the GiNaC-list mailing list