jr226
October 7th, 2011, 10:03 PM
Hi, I'm trying to program an ODE solver (similar to ODE45 in MATLAB). I want this solver to be "stand alone", ie I can pass it the name of the ODE I want it to solve, and it runs the code for that specific Differential equation.
So far I have my main class (where the bulk of the program is) and a class called ODEsolver (where the ODE solver is located). I want to be able to make a call from my main class to ODEsolver, and have ODE look at a method which is referenced by a String arguement (the name of the ODE I want to solve)
The way I envision it is:
public class Main {
double y[];
double x0,xf,y0;
x0 = 0;
xf = 10;
y0 = 1;
ODEsolver ode1 = new ODEsolver("name_of_ode_to_be_solved");
y = ode1.ODE45(x0,xf,y0);
}
where ODE45 is the ODE solver in the ODEsolver class.
However I do not know how I would use the "name_of_ode_to_be_solved" to create a call to that method (the method is not in ODEsolver, it's either in main or some other class)
Thanks!
So far I have my main class (where the bulk of the program is) and a class called ODEsolver (where the ODE solver is located). I want to be able to make a call from my main class to ODEsolver, and have ODE look at a method which is referenced by a String arguement (the name of the ODE I want to solve)
The way I envision it is:
public class Main {
double y[];
double x0,xf,y0;
x0 = 0;
xf = 10;
y0 = 1;
ODEsolver ode1 = new ODEsolver("name_of_ode_to_be_solved");
y = ode1.ODE45(x0,xf,y0);
}
where ODE45 is the ODE solver in the ODEsolver class.
However I do not know how I would use the "name_of_ode_to_be_solved" to create a call to that method (the method is not in ODEsolver, it's either in main or some other class)
Thanks!