Skip to content

Commit

Permalink
Update to v0.92
Browse files Browse the repository at this point in the history
  • Loading branch information
SPPearce committed Jan 15, 2023
1 parent ffdf081 commit ac1cab0
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 11 deletions.
Binary file removed CompoundMatrixMethod-0.91.paclet
Binary file not shown.
Binary file added CompoundMatrixMethod-0.92.paclet
Binary file not shown.
22 changes: 16 additions & 6 deletions CompoundMatrixMethod/CompoundMatrixMethod.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
(* Mathematica Package *)

(* :Title: CompoundMatrixMethod *)
(* :Author: Simon Pearce <[email protected]> *)
(* :Author: Simon Pearce <simon.pearce@cruk.manchester.ac.uk> *)
(* :Context: CompoundMatrixMethod` *)
(* :Version: 0.91 *)
(* :Date: 2022-02-09 *)
(* :Version: 0.92 *)
(* :Date: 2022-01-15 *)

(* :Mathematica Version: 10+ *)
(* :Copyright: (c) 2017-22 Simon Pearce *)
(* :Copyright: (c) 2017-23 Simon Pearce *)

BeginPackage["CompoundMatrixMethod`"];

Expand Down Expand Up @@ -389,7 +389,7 @@ with radius controlled by ContourRadius (default 1), for a system defined from T
FMatrix = ExtractInterface[interfaceBCs, depvarLeft, {x, xmatch}];
GMatrix = ExtractInterface[interfaceBCs, depvarRight, {x, xmatch}];
{leftAMatrix, leftBCMatrix, stuff, xLeft} = ToMatrixSystem[leftEqns, leftBCs, depvarLeft, {x, xa, xmatch}, a];
{rightAMatrix, stuff, rightBCMatrix, xRight} = ToMatrixSystem[rightEqns, rightBCs, depvarRight, {x, xmatch, xb}, a];
{rightAMatrix, stuff, rightBCMatrix, xRight} = ToMatrixSystem[rightEqns, rightBCs, depvarRight, {x, xmatch, xb}, a];
(*Return the system for using in CMM function*)
{{leftAMatrix, rightAMatrix}, leftBCMatrix,rightBCMatrix, {FMatrix, GMatrix}, {x, xa, xmatch, xb}} /. a -> \[FormalLambda]

Expand Down Expand Up @@ -418,7 +418,7 @@ with radius controlled by ContourRadius (default 1), for a system defined from T
(*Replace all the original variables with a set indexed by Y*)
newYs = Through[Array[\[FormalY], {Length[originalYVariables]}][x]];
newYSubs = Thread[originalYVariables -> newYs];
Transpose[Table[Coefficient[neweqn /. newYSubs /. Equal -> Subtract, i], {i, newYs}]]
Transpose[Table[Coefficient[neweqn /. newYSubs /. Equal -> Subtract, i], {i, Join[newYs,undifferentiatedVariables]}]]
]

SelectNegativeEigenvectors[mat_?MatrixQ, x_ /; !NumericQ[x]] := Module[{limitMatrix,eigvecs},
Expand All @@ -442,6 +442,16 @@ with radius controlled by ContourRadius (default 1), for a system defined from T
leftBCMatrix_?MatrixQ, rightBCMatrix_?MatrixQ, {FMatrix_?MatrixQ, GMatrix_?MatrixQ}, {x_ /; ! NumericQ[x], xa_, xm_, xb_}},opts:OptionsPattern[{Evans,NDSolve}]] :=
Evans[\[FormalLambda]0, {ALeftMatrix, ARightMatrix}, leftBCMatrix, rightBCMatrix, {FMatrix, GMatrix}, {x, xa, xm, xb},opts]

Evans[\[FormalLambda]0_?NumericQ, {{ALeftMatrix_?MatrixQ,ARightMatrix_?MatrixQ},{}, rightBCMatrix_?MatrixQ, {FMatrix_?MatrixQ,GMatrix_?MatrixQ}, {x_ /; ! NumericQ[x], xa_, xm_, xb_}},opts:OptionsPattern[{Evans,NDSolve}]] :=
Evans[\[FormalLambda]0, {ALeftMatrix,ARightMatrix}, N@SelectNegativeEigenvectors[ALeftMatrix /. \[FormalLambda] -> \[FormalLambda]0, x], rightBCMatrix,{FMatrix,GMatrix}, {x, xa, xm, xb},opts]

Evans[\[FormalLambda]0_?NumericQ, {{ALeftMatrix_?MatrixQ,ARightMatrix_?MatrixQ},leftBCMatrix_?MatrixQ, {}, {FMatrix_?MatrixQ,GMatrix_?MatrixQ}, {x_ /; ! NumericQ[x], xa_, xm_, xb_}},opts:OptionsPattern[{Evans,NDSolve}]] :=
Evans[\[FormalLambda]0, {ALeftMatrix,ARightMatrix}, leftBCMatrix, N@SelectNegativeEigenvectors[ARightMatrix /. \[FormalLambda] -> \[FormalLambda]0, x],{FMatrix,GMatrix}, {x, xa, xm, xb},opts]

Evans[\[FormalLambda]0_?NumericQ, {{ALeftMatrix_?MatrixQ,ARightMatrix_?MatrixQ},{}, {}, {FMatrix_?MatrixQ,GMatrix_?MatrixQ}, {x_ /; ! NumericQ[x], xa_, xm_, xb_}},opts:OptionsPattern[{Evans,NDSolve}]] :=
Evans[\[FormalLambda]0, {ALeftMatrix,ARightMatrix}, N@SelectNegativeEigenvectors[ALeftMatrix /. \[FormalLambda] -> \[FormalLambda]0, x], N@SelectNegativeEigenvectors[ARightMatrix /. \[FormalLambda] -> \[FormalLambda]0, x],{FMatrix,GMatrix}, {x, xa, xm, xb},opts]


Evans[\[FormalLambda]0_?
NumericQ, {ALeftMatrix_?MatrixQ, ARightMatrix_?MatrixQ}, leftBCMatrix_?MatrixQ, rightBCMatrix_?MatrixQ,
{FMatrix_?MatrixQ, GMatrix_?MatrixQ}, {x_ /; !NumericQ[x], xaa_, xmm_, xbb_},opts:OptionsPattern[{Evans,NDSolve}]] :=
Expand Down
2 changes: 1 addition & 1 deletion CompoundMatrixMethod/PacletInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
(* ::Input::Initialization:: *)
Paclet[
Name->"CompoundMatrixMethod",
Version->"0.91",
Version->"0.92",
MathematicaVersion->"10+",
Description->"Solve Eigenvalue Boundary Value Problems using the Compound Matrix Method to generate the Evans function. ",
Creator->"Simon Pearce",
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ The package can then be loaded by calling

The Compound Matrix Method is a package for finding eigenvalues of boundary-value ordinary differential equations.

This includes problems with a single interface, decaying conditions at one or both ends, in an upto 10th order differential system.

First we need to transform the boundary-value problem (BVP) into a set of first order matrix equations. The function ToMatrixSystem will do this, linearising the equations if necessary (with a warning if it does).

sys=ToMatrixSystem[y''[x] + k^2 y[x] == 0, {y[0] == 0, y[1] == 0}, y, {x, 0, 1}, k]
Expand Down Expand Up @@ -47,13 +49,12 @@ A number of further examples are shown in the file `CMMExamples.nb`, available f

I used this method to solve an eigenvalue problem in <a href=https://doi.org//10.1093/imamat/hxq026>my 2010 paper </a>, and the package itself in both <a href=https://link.springer.com/article/10.1007/s11538-018-0505-4>a tenth-order ODE </a> as well as <a href=https://journals.aps.org/pre/abstract/10.1103/PhysRevE.98.033003>an example with an interface</a>.

I'm currently working on an expository paper to detail how the method works and introduce the package.
I have a half-written expository paper (expansion of the <a href=http://www.maths.gla.ac.uk/~xl/FYB-background.pdf>note</a> written by Professor Yibin Fu) to give more details on how the method works and introduce the package, please email me for a copy of that.

## Contact

Feel free to contact me if you have any questions, suggestions or issues, I'm also interested in collaborations involving this work.
My email address is simon (dot) pearce (at) manchester (dot) ac (dot) uk.
Feel free to contact me if you have any questions, suggestions or issues, I'm also interested in collaborations involving this work, but please note my time is severely limited as I am no longer active in this field. My email address is simon (dot) pearce (at) cruk (dot) manchester (dot) ac (dot) uk.

## Funding Acknowledgement

This code was initially written while I held an Early Career Fellowship from the <a href=https://www.leverhulme.ac.uk>Leverhulme Trust</a>. I'm now based at the Cancer Research UK Manchester Institute, part of the University of Manchester, UK.
This code was initially written while I held an Early Career Fellowship from the <a href=https://www.leverhulme.ac.uk>Leverhulme Trust</a>. I'm now based at the Cancer Research UK Manchester Institute, part of the University of Manchester, UK, and work on bioinformatics.

0 comments on commit ac1cab0

Please sign in to comment.