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/usage/constructors.md
+13-11Lines changed: 13 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,30 +8,32 @@ end
8
8
9
9
`Fun`s in ApproxFun are instances of Julia types with one field to store coefficients and another to describe the function space. Similarly, each function space has one field describing its domain, or another function space. Let's explore:
10
10
11
-
```jldoctest
11
+
```jldoctest Fun
12
12
julia> x = Fun(identity,-1..1);
13
13
14
14
julia> f = exp(x);
15
15
16
-
julia> g = f/sqrt(1-x^2);
16
+
julia> space(f) == Chebyshev(-1..1)
17
+
true
18
+
```
19
+
In this example, `f` is a `Fun` that corresponds to a Chebyshev interpolant to `exp(x)`, and evaluating `f(x)` will generate a close approximation to `exp(x)`. In this case, the space is automatically inferred from the domain.
17
20
18
-
julia> space(f) # Output is pretty version of Chebyshev(Interval(-1.0,1.0))
19
-
Chebyshev(-1 .. 1)
21
+
`Fun`s may also incorporate singularities at the edges of the domain. In such cases, if the variable is in a polynomial space, the resulting space is a [`JacobiWeight`](@ref), which factors out the singularity and interpolates the residual analytical component. Perhaps this is best illustrated through an example:
22
+
```jldoctest Fun
23
+
julia> g = f/sqrt(1-x^2);
20
24
21
-
julia> space(g) # Output is pretty version of JacobiWeight(-0.5, -0.5, -1..1)
The function `g` in this case is expanded the basis ``(1-x^2)^{1/2}\;T_n(x)``, where ``T_n(x)`` are Chebyshev polynomials. This is equivalent to expanding the function `f` in a Chebyshev basis.
24
29
25
30
The absolute value is another case where the space of the output is inferred from the operation:
26
31
27
32
```jldoctest abs_space
28
-
julia> f = Fun(x->cospi(5x),-1..1);
33
+
julia> f = Fun(x->cospi(5x),-1..1);
29
34
30
35
julia> g = abs(f);
31
36
32
-
julia> space(f)
33
-
Chebyshev(-1 .. 1)
34
-
35
37
julia> space(g) isa ContinuousSpace # Piecewise continous functions
36
38
true
37
39
@@ -43,7 +45,7 @@ that of continuous functions over the piecewise domain:
43
45
```jldoctest abs_space
44
46
julia> p = [-1; roots(f); 1];
45
47
46
-
julia> segments = @views [Segment(x,y) for (x,y) in zip(p[1:end-1], p[2:end])];
48
+
julia> segments = [Segment(x,y) for (x,y) in zip(p[1:end-1], p[2:end])];
Copy file name to clipboardExpand all lines: docs/src/usage/spaces.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -148,13 +148,13 @@ and the basis becomes
148
148
149
149
`SumSpace((space_1,space_2,…,space_n))` represents the direct sum of the spaces, where evaluation is defined by adding up each component. A simple example is the following, showing that the coefficients are stored by interlacing:
0 commit comments