Search the web
Sign In
New User? Sign Up
jsci
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Java code for solving ODE   Message List  
Reply | Forward Message #130 of 369 |
Re: Java code for solving ODE

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





Fri May 14, 2004 12:39 am

lydiacetin
Offline Offline
Send Email Send Email

Forward
Message #130 of 369 |
Expand Messages Author Sort by Date

Hi All, I'm hoping someone might be able to help me find a java class or interface that solves for ordinary differential equations using the RK4 integration...
lydiacetin
Offline Send Email
May 7, 2004
3:45 am

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() { ...
Mark Hale
mj_hale
Offline Send Email
May 9, 2004
2:16 am
lydiacetin
Offline Send Email
May 14, 2004
12:31 am

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...
lydiacetin
Offline Send Email
May 14, 2004
12:39 am

What compiler error do you get? If it does not like the use of the inner class you can just use a normal class: class MyDyByDxFunction implements Mapping { ...
Mark Hale
mj_hale
Offline Send Email
May 14, 2004
3:11 am

Thanks Mark, I did manage to get the rungeKutta method working with your new suggestions and my simple ODE worked. Cheers! The ODE that I'm trying to solve is...
lydiacetin
Offline Send Email
Jun 2, 2004
4:24 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help