Thanks for your response Mark, but I'm having a little trouble
implementing the code. My main problem is that I don't think I can
use the func object in the parameters for the static rungeKutta4()
method (the compiler won't let me anyway!!). Also, can you explain to
me how the Mapping interface works
Thanks
Lydia
--- In jsci@yahoogroups.com, Mark Hale <mj_hale@y...> wrote:
>
> Hi,
>
> Say you have a function dy/dt = f(y). Then, you would
> do the following in code:
>
> // create inner class representing function
> Mapping func = new Mapping() {
> public double map(double y) {
> return f(y);
> }
> };
> int N = 50;
> double dt = 0.1;
> double[] yValues = new double[N]; // will contain y_i
> yValues[0] = y0; // set initial condition
> NumericalMath.rungeKutta(yValues, func, dt);
> // can now plot yValues to see result
>
> I'll improve the docs for this.
>
> Regards,
>
> Mark