7 | | {{{ |
8 | | sage: R.<t> = QQ[] |
9 | | sage: p = (1 + 2*t + 5*t^2 + 7*t^3 + O(t^4))^3 |
10 | | sage: p.nth_root(3) |
11 | | 1 + 2*t + 5*t^2 + 7*t^3 + O(t^4) |
12 | | sage: p = (1 + 2*t + 5*t^2 + 7*t^3 + O(t^4))^-3 |
13 | | sage: p.nth_root(-3) |
14 | | 1 + 2*t + 5*t^2 + 7*t^3 + O(t^4) |
15 | | }}} |
16 | | |
17 | | The iterations are division-free; |
18 | | in the case `n=2` one can compare this division-free iteration |
19 | | with the iteration used in the Newton method for `sqrt` |
20 | | {{{ |
21 | | x' = (x +y/x)/2 (2) |
22 | | }}} |
23 | | |
24 | | |
25 | | `nth_root` can be used to compute the square root of series which |
26 | | currently `sqrt` does not support |
27 | | {{{ |
28 | | sage: R.<x,y> = QQ[] |
29 | | sage: S.<t> = R[[]] |
30 | | sage: p = 1 + x*t + (x^2+y^2)*t^2 + O(t^3) |
31 | | sage: p1 = p.nth_root(2); p1 |
32 | | 1 + 1/2*x*t + (3/8*x^2 + 1/2*y^2)*t^2 + O(t^3) |
33 | | sage: p1^2 |
34 | | 1 + x*t + (x^2 + y^2)*t^2 + O(t^3) |
35 | | }}} |
36 | | |
37 | | In particular it can be used in the multivariate series considered |
38 | | in ticket #1956 . |
| 3 | Apply trac_10720_power_series_nth_root_2.patch |