NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/

Easy Java Simulations (2001- ) => Information and Download => Topic started by: kahhean on April 01, 2006, 04:11:48 pm



Title: help in programming
Post by: kahhean on April 01, 2006, 04:11:48 pm
Hi,

I have been experimenting with EJS and it has been quite exciting. However, when I run into problems I do not have any one in the office to turn to. :-(

My two big problems are :

1) I wrote a program where I could set the initial trajectory of a body which is subject to gravitational pull towards a fixed point in the centre. So I hope to simulate the different outcomes when the initial velocity is changed (like the newton's cannon). So I set up the acceleration, and use the ODE to work out the velocity and position vector for me. (dvx/dt=ax and dx/dt=vx and so on). However, the outcome has a little error which accumulates after every round. If I changed the time step to a very small number I can eliminate this error but the simulation becomes painfully slow. I tried changing the method used for solving the ODE and none worked. Can anyone tell me how to solve this problem?

2) One thing I commonly want to do is to have two objects in one drawing canvas. Each object has all sorts of arrows associated with it. I find it a chore when making another copy of the same object. I have to copy and paste every arrow. Is there any better way?

Thanks in advance.

Regards
kahhean


Title: topic354
Post by: Fu-Kwun Hwang on April 03, 2006, 02:50:02 pm
You can always post your question here (this forum).

I need to have your ejs source code in order to know your problem better and help you more!
Please send email to hwang@phy,ntnu.edu.tw and attach you ejs source.

The best ODE solver is Runge-Kutta 4th orrder methos. There are several similar example under Simulations subdirectory. Please check out those examples.

If you have several arrow, please use arrowSet instead of arrow for each object.

Fu-Kwun