Thanks for the reply. I am thinking more along the lines of analytic solutions, rather than numerical solutions. e.g. for simple ODEs just solving the equivalent polynomial. For example if the ODE is y'' -3y' +2y=0 then I would like to return the verb (function) y = A*exp(-2x) +B*exp(-x) (A and B arbitrary, need some initial boundary values to recover them).Similar to how Maple and (I presume) Mathematica can analytically solve such equations.
> Date: Fri, 13 Mar 2015 11:32:08 -0400 > From: [email protected] > To: [email protected] > Subject: Re: [Jprogramming] Solving Differential Eqns with J > > 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 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
