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
@@ -54,15 +53,15 @@ derivative, the `norm` is small:
54
53
55
54
```julia
56
55
f =Fun(x->exp(x), -1..1)
57
-
norm(f-f')
56
+
norm(f-f')# 4.4391656415701095e-14
58
57
```
59
58
60
59
Similarly, `cumsum` defines an indefinite integration operator:
61
60
62
61
```julia
63
62
g =cumsum(f)
64
63
g = g +f(-1)
65
-
norm(f-g)
64
+
norm(f-g)# 3.4989733283850415e-15d
66
65
```
67
66
68
67
Algebraic and differential operations are also implemented where possible, and most of Julia's built-in functions are overridden to accept `Fun`s:
@@ -78,17 +77,15 @@ h = airyai(10asin(f)+2g)
78
77
## Solving ordinary differential equations
79
78
80
79
81
-
Solve the Airy ODE `u'' - x u = 0` as a BVP on `[-1000,200]`:
80
+
We can also solve differential equations. Consider the Airy ODE `u'' - x u = 0` as a boundary value problem on `[-1000,200]` with conditions `u(-1000) = 1` and `u(200) = 2`. The unique solution is a linear combination of Airy functions. We can calculate it as follows:
82
81
83
82
```julia
84
-
a,b =-1000,200
85
-
x =Fun(identity, a..b)
86
-
d =domain(x)
87
-
D =Derivative(d)
88
-
B =Dirichlet(d)
89
-
L = D^2- x
90
-
u = [B;L] \ [[airyai(a),airyai(b)],0]
91
-
plot(u)
83
+
x =Fun(identity, -1000..200) # the function x on the interval -1000..200
84
+
D =Derivative() # The derivative operator
85
+
B =Dirichlet() # Dirichlet conditions
86
+
L = D^2- x # the Airy operator
87
+
u = [B;L] \ [[1,2],0] # Calculate u such that B*u == [1,2] and L*u == 0
0 commit comments