Skip to content

Commit

Permalink
update readme and code comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Lightup1 committed Sep 4, 2023
1 parent 74e3909 commit f49498b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Related Package: [MathieuFunctions.jl](https://github.com/BBN-Q/MathieuFunctions
nu,ck=MathieuExponent(a,q)
```
where `nu` is the characteristic exponent and vector `ck` is the Fourier coefficients of the eigenfunction with `norm(ck)≈1`.
Note that `nu` is reduced to the interval `[0,2]` and `c0` corresponds to `ck[(length(ck)-1)÷2]` with the reduced `nu`.
Note that `nu` is reduced to the interval `[0,2]` and `c0` corresponds to `ck[(length(ck)-1)÷2]` with the reduced `nu`. (For `nu` is real, the procedure actually reduces `nu` into `[0,1]`).

```julia
W=MathieuWron(nu,ck::Vector,index::Int)
Expand All @@ -33,10 +33,22 @@ nu,ck=MathieuExponent(a,q)
idx=(length(ck)-1)÷2+1
W=MathieuWron(nu,ck,idx)
```
In some cases, `W` could be negative. One can replace `nu` with `-nu` and reverse `ck`, i.e., `reverse!(ck)`, to get a positive `W`.
If one prefers a positive `nu`, one can further shift `nu` with `nu+=2`.
In this case, `idx` should be `idx+=1`.
Code example:
```julia
nu=2-nu
reverse!(ck)
idx=idx+=1
W_new=MathieuWron(nu,ck,idx)
```
It can be verified that `W_new==-W`.

If one knows `nu` (not reduced) and `q`, one can use
```julia
W=MathieuWron(nu,q)
```
During my test, the result is positive with such method.


6 changes: 4 additions & 2 deletions src/char-coeff-new-indexing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,21 @@ function MathieuCharVecWronλ(ν::Real,q::Real)
end

"""
`W=MathieuWron(ν,q)` or `W=MathieuWron(ν,C_k,index)`.
Return the Wronskian.
For Mathieu's equation
y'' + (B_ν - 2 q cos( 2z )) y = 0,
y'' + (a- 2 q cos( 2z )) y = 0,
the Wronskian is defined by
```math
\\frac{\\dot{f} f^*-f \\dot{f^*}}{2i}
```
where ``f=e^{i\\nu z}\\sum_k{C_{2k}e^{i2kz}}`` with ``\\sum_k{C_{2k}^2}=1`` is the solution of the Mathieu equation and ``f^*`` is its complex conjugate.
where ``f=e^{i\\nu z}\\sum_k{C_{k}e^{i2kz}}`` with ``\\sum_k{C_{k}^2}=1`` is the solution of the Mathieu equation and ``f^*`` is its complex conjugate.
"""
function MathieuWron(ν,q)
_,C_2k,index=MathieuCharVecλ(ν,q)
Expand Down

0 comments on commit f49498b

Please sign in to comment.