Jon,
If you are looking for a standard numerical solution, here are
is the standard Runge-Kutta approach, translated to J from Fortran:
http://www.astro.umd.edu/~jph/runge_kutta.ijs
and for stiff diff-eq's:
http://www.astro.umd.edu/~jph/stiff.ijs
As applied to the classic astrophysics problem of at polytropic star:
http://www.astro.umd.edu/~jph/polytrope.ijs
http://www.astro.umd.edu/~jph/iso_sphere.ijs
Patrick
On Fri, 13 Mar 2015, Jon Hough wrote:
I have looked through Jsoftware pages but cannot find explicit idea for solving
linear ODEs in J.
This page http://www.jsoftware.com/papers/MSLDE.htm has some overall
information, but not specific J code.
My attempt at some solution follows:e.g. Solve 7y'' -3y' - 2y = 0
Solution (of sorts):
S =: p. 7 _3 _2 NB. consider the ODE problem as a polynomial
S =: >1{S NB. Get and unbox the two solutions.
F =: 2 : 'u@:(n&*)' NB. conjunction for exponentiation
Solve =: +/@: (^ F S) NB. returns verb as a (not the) solution to the original
ODE.
So Solve is the solution, or at least a solution. In the above case solve is
+/@:(^@:(_2.76556443707463728 1.26556443707463728&*))
Solve 0
returns 2.
This is as far as I have got, and I already notice several issues.
1. In Solve, there is no way to show general solutions of the form
A*exp(ax)+B*exp(bx) where A and B are arbitrary constants.
2. My approach needs to be modified slightly for repeated solutions to the
polynoimial.
Is there any work already done on this? I can't imagine I'm the first to think
of attempting this.
Regards,
Jon
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm