Results 1 to 4 of 4
Thread: Using integration in Java
 01112012, 10:56 PM #1Member
 Join Date
 Sep 2011
 Posts
 17
 Rep Power
 0
Using integration in Java
So I am trying to calculate the current position of a vehicle at a constant acceleration, referring to: Acceleration, velocity, and Position
I am trying to get the integral of the current speed in order to get the position at time T.
Anyone has any idea how to do it? I am not that good in Maths.
 01112012, 11:53 PM #2Moderator
 Join Date
 Feb 2009
 Location
 New Zealand
 Posts
 4,716
 Rep Power
 18
Re: Using integration in Java
I am trying to calculate the current position of a vehicle at a constant acceleration ... I am not that good in Maths.
x(T) = x(0) + v(0)T + 1/2 aT^2
As with any equation you have to get a clear idea of what each thing stands for and which of them are "known" and which are "unknown".
T is the time. It is a variable: ie it is always some definite amount (you can regard it as "known"). Other things may depend on the value T has.
x(T) is the position at time T. This is unknown: in fact it is the unknown with which you start your problem. "I am trying to calculate the current position..."
x(0) is the position at time zefro. This is a known quantity (see below).
v(0) is the velocity at time zero. This is a known quantity (see below).
a is the (constant) acceleration. Again it is a known quantity.

If we are trying to calculate the current position of a vehicle it is not enough to know the acceleration only. (For example I can figure out the acceleration of the moon quite easily because I know how long it takes to go around the earth and google will tell me how far away it is: but I have no clue  without looking out of the window  about its current position.) We also need to know where it was and how fast it was going when the measurements started. This is what I called position and velocity at time zero. Without those extra pieces of information we can't tell the current position. That's why I described them as "known".
In many problems this "initial" information is given, or can be assumed. For example a drag racer has initial velocity zero (because of how drag racing works) and initial position zero (because it is convenient to define the starting line that way). Given these two facts the equation will reduce to
x(T) = 1/2 aT^2
and this tells us the current (at any time T) position of a drag racer which has constant acceleration a.

What you have to do is write code that converts the equation in the second box to some Java code. Possibly it can be simplified like the drag racer if you know (or can assume or define) the initial position and/or velocity.
 01122012, 04:21 PM #3Member
 Join Date
 Sep 2011
 Posts
 17
 Rep Power
 0
Re: Using integration in Java
Thank you so much!
yes my case is similar to drag racing as I am dealing with cars so I will be taking the initial position out of the equation.
thank you!
 01122012, 08:46 PM #4Moderator
 Join Date
 Feb 2009
 Location
 New Zealand
 Posts
 4,716
 Rep Power
 18
Similar Threads

jsf+flex integration problem
By mervinjmicky in forum JavaServer Faces (JSF)Replies: 0Last Post: 07032011, 02:16 PM 
JavaScript Integration in NetBeans
By chizbox in forum NetBeansReplies: 1Last Post: 03022010, 12:08 PM 
dialer integration with java application
By 435.mahesh in forum Java SoftwareReplies: 0Last Post: 03092009, 07:30 AM 
PLSQL  JAVA Integration
By ttkong in forum JDBCReplies: 0Last Post: 04092008, 09:31 AM 
Mergence HL7 Integration Engine 1.1
By levent in forum Java SoftwareReplies: 0Last Post: 06062007, 11:20 AM
Bookmarks