# Newtonian Position

Page 1 of 1

## 4 Replies - 432 Views - Last Post: 05 May 2009 - 09:13 PM

### #1 computerfox

• straight vegetarian kid

Reputation: 50
• Posts: 3,772
• Joined: 29-January 09

# Newtonian Position

Posted 03 May 2009 - 08:30 PM

Description: a=initial position b=initial speed c=acceleration d=time
```//add this before the main method

public static double newtPos(double a, double b, double c, double d){

double position;

position=a+(b*d)+(.5*c*(d*d));

return position;
}

//enjoy!!!
```

Is This A Good Question/Topic? 0

## Replies To: Newtonian Position

### #2 SciCoder

Reputation: 0
• Posts: 2
• Joined: 05-May 09

## Re: Newtonian Position

Posted 05 May 2009 - 07:49 PM

Depending on context, this sort of function may be called a LOT, so you can optimise a little. At first glance, and with standard physics variable names, could try: /** * @param s0 initial position * @param u initial velocity * @param a acceleration * @param t time at constant acceleration * @return position at t */ public static double newtPos(double s0, double u, double a, double t) { return s0 + (u + .5*a*t)*t; }

### #3 computerfox

• straight vegetarian kid

Reputation: 50
• Posts: 3,772
• Joined: 29-January 09

## Re: Newtonian Position

Posted 05 May 2009 - 07:51 PM

haha yeah i know, i was just too lazy sorry :D

### #4 SciCoder

Reputation: 0
• Posts: 2
• Joined: 05-May 09

## Re: Newtonian Position

Posted 05 May 2009 - 08:49 PM

no problem, it was my first code comment, and i'm trying to gauge what is helpful - i'd better layout my code next time too. ;)

### #5 computerfox

• straight vegetarian kid

Reputation: 50
• Posts: 3,772
• Joined: 29-January 09

## Re: Newtonian Position

Posted 05 May 2009 - 09:13 PM

thank you.