Example Suggestions: Heat quation, Lorenz equations, Lotka-Volterra equations and Sturm-Liouville Equation
Hi,
I'm quite the fan of this Python module, and I wanted to suggest the following examples:
- The Heat equation, that is:
- The Lorenz equations:
Would be best to solve it with the original parameters: ,
and
.
x[0] = y[0] = z[0] = 1 on t ∈ [0,100].
- The Lotka-Volterra equations, that is:
- The Sturm-Liouville Equation, specifically the example:
where lambda is the eigenvalue of the equation. This problem is integrated over the range x ∈ [0,∞], although a range of [0,100] is good enough to get the first 10 or more eigenvalues. Plus it has the boundary conditions y(0) = y(∞) = 0. This equation has the exact solution:
where Ai is the Airy Ai function. The eigenvalues are the zeros of the Airy Ai function, with their negative sign replaced with a positive sign.
@fusion809 Thanks! Always good to hear from a user. I will look into adding these as examples. Please fell free to submit a PR for you favorite examples and I will certainly include it!
I don't think this module can presently be used to solve Sturm-Liouville problems, can it?
I do know. I have never solved a Sturm-Liouville problem before. Can you explain what is required?
Well, I must admit part of the reason I want more examples is because I am so unfamiliar with your present examples that I can't gather how to use pyCollocation from them. So I was hoping examples I'm more familiar with might help me follow it, although it does like quite a helpful tool. Essentially what you do is you express the problem in terms of matrices, e.g., say the H matrix represents LHS of the above SL problem then you can express the problem as the matrix equation:
Hy = lambda y
then it becomes a eigenvalue/eigenvector problem from linear algebra, with the solution contained in the y vector being the eigenvector and lambda being the eigenvalues. In terms of what you'd use, Python module-wise, it'd probably be linalg.eig.
PyCollocation was designed to solve non-linear boundary problems commonly encountered in economics. Which might be why the examples seem so unfamiliar. Currently you need to be able to express your problem as y = f(t, y)` along with some boundary conditions. Is the SL problem always linear?
Yep they are always linear, their most generalized form is:
Most notable one is the Schrodinger equation. Although nonlinear ODE eigenvalue problems do exist.
OK. I have never tried to solve a linear problem using pyCollocation. I am pretty busy at the moment, but when I get some free time I will see if it is possible. I am pretty sure it is possible...