You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/tutorials/perturbation.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,9 +47,8 @@ quintic = x^5 + ϵ*x ~ 1
47
47
```
48
48
If $ϵ = 1$, we get our original problem. With $ϵ = 0$, the problem transforms to the easy quintic equation $x^5 = 1$ with the trivial real solution $x = 1$ (and four complex solutions which we ignore). Next, expand $x$ as a power series in $ϵ$:
49
49
```@example perturb
50
-
x_taylor = series(x, ϵ, 0:7) # expand x in a power series in ϵ
51
-
x_coeffs = taylor_coeff(x_taylor, ϵ) # TODO: get coefficients at series creation
52
-
x_taylor
50
+
x_coeffs, = @variables a[0:7] # create Taylor series coefficients
51
+
x_taylor = series(x_coeffs, ϵ) # expand x in a power series in ϵ
53
52
```
54
53
Then insert this into the quintic equation and expand it, too, to the same order:
Next, let us solve the same problem with the perturbative method. It is most common to expand $E$ as a series in $M$. Repeating the procedure from the quintic example, we get these equations:
119
119
```@example perturb
120
-
E_taylor = series(E, M, 0:5)
121
-
E_coeffs = taylor_coeff(E_taylor, M) # TODO: get coefficients at series creation
120
+
E_taylor = series(E, M, 0:5) # this auto-creates coefficients E[0:5]
121
+
E_coeffs = taylor_coeff(E_taylor, M) # get a handle to the coefficients
122
122
kepler_eqs = taylor_coeff(substitute(kepler, E => E_taylor), M, 0:5)
0 commit comments