@@ -1165,10 +1165,34 @@ Power series special functions
11651165 int _gr_poly_exp_series(gr_ptr res, gr_srcptr f, slong flen, slong len, gr_ctx_t ctx)
11661166 int gr_poly_exp_series(gr_poly_t f, const gr_poly_t h, slong n, gr_ctx_t ctx)
11671167
1168+ .. function :: int _gr_poly_sin_cos_series(gr_ptr s, gr_ptr c, gr_srcptr h, slong hlen, slong n, gr_ctx_t ctx)
1169+ int _gr_poly_sin_cos_pi_series(gr_ptr s, gr_ptr c, gr_srcptr h, slong hlen, slong n, gr_ctx_t ctx)
1170+ int gr_poly_sin_cos_series(gr_poly_t s, gr_poly_t c, const gr_poly_t h, slong n, gr_ctx_t ctx)
1171+ int gr_poly_sin_cos_pi_series(gr_poly_t s, gr_poly_t c, const gr_poly_t h, slong n, gr_ctx_t ctx)
1172+ int _gr_poly_sin_series(gr_ptr s, gr_srcptr h, slong hlen, slong n, gr_ctx_t ctx)
1173+ int gr_poly_sin_series(gr_poly_t s, const gr_poly_t h, slong n, gr_ctx_t ctx)
1174+ int _gr_poly_sin_pi_series(gr_ptr s, gr_srcptr h, slong hlen, slong n, gr_ctx_t ctx)
1175+ int gr_poly_sin_pi_series(gr_poly_t s, const gr_poly_t h, slong n, gr_ctx_t ctx)
1176+ int _gr_poly_cos_series(gr_ptr c, gr_srcptr h, slong hlen, slong n, gr_ctx_t ctx)
1177+ int gr_poly_cos_series(gr_poly_t c, const gr_poly_t h, slong n, gr_ctx_t ctx)
1178+ int _gr_poly_cos_pi_series(gr_ptr c, gr_srcptr h, slong hlen, slong n, gr_ctx_t ctx)
1179+ int gr_poly_cos_pi_series(gr_poly_t c, const gr_poly_t h, slong n, gr_ctx_t ctx);
1180+
1181+ Compute `s = \sin(h) `, `c = \cos(h) ` as power series truncated to length `m `,
1182+ or `s = \sin(\pi h) `, `c = \cos(\pi h) ` for the ``pi `` variants.
1183+ The underscore methods allow aliasing.
1184+
11681185.. function :: int _gr_poly_sin_cos_series_basecase(gr_ptr s, gr_ptr c, gr_srcptr h, slong hlen, slong n, int times_pi, gr_ctx_t ctx)
11691186 int gr_poly_sin_cos_series_basecase(gr_poly_t s, gr_poly_t c, const gr_poly_t h, slong n, int times_pi, gr_ctx_t ctx)
11701187 int _gr_poly_sin_cos_series_tangent(gr_ptr s, gr_ptr c, gr_srcptr h, slong hlen, slong n, int times_pi, gr_ctx_t ctx)
11711188 int gr_poly_sin_cos_series_tangent(gr_poly_t s, gr_poly_t c, const gr_poly_t h, slong n, int times_pi, gr_ctx_t ctx)
1189+ int _gr_poly_sin_cos_series_newton(gr_ptr s, gr_ptr c, gr_srcptr h, slong hlen, slong n, slong cutoff, int times_pi, gr_ctx_t ctx)
1190+ int gr_poly_sin_cos_series_newton(gr_poly_t s, gr_poly_t c, const gr_poly_t h, slong n, slong cutoff, int times_pi, gr_ctx_t ctx)
1191+
1192+ Various algorithms to compute sine and cosine of power series.
1193+ The default functions (:func: `_gr_poly_sin_cos_series ` et al.)
1194+ choose an algorithm automatically.
1195+ The *times_pi * flag specifies that the input is to be multiplied by `\pi `.
11721196
11731197 The *basecase * version uses a simple recurrence for the coefficients,
11741198 requiring `O(nm) ` operations where `m ` is the length of `h `.
@@ -1181,8 +1205,10 @@ Power series special functions
11811205 `\sin(h_0 + h_1) = \cos(h_0) \sin(h_1) + \sin(h_0) \cos(h_1) `,
11821206 `\cos(h_0 + h_1) = \cos(h_0) \cos(h_1) - \sin(h_0) \sin(h_1) `.
11831207
1184- The *basecase * and *tangent * versions take a flag *times_pi *
1185- specifying that the input is to be multiplied by `\pi `.
1208+ The *newton * version uses Newton iteration for `\exp(ih) `. The complex
1209+ parts are represented formally; complex arithmetic is not required.
1210+ The *cutoff * parameter specifies the cutoff for using the basecase
1211+ algorithm.
11861212
11871213.. function :: int _gr_poly_tan_series_basecase(gr_ptr f, gr_srcptr h, slong hlen, slong n, gr_ctx_t ctx)
11881214 int gr_poly_tan_series_basecase(gr_poly_t f, const gr_poly_t h, slong n, gr_ctx_t ctx)
0 commit comments