MHB Gravity Calculation: Calculate Accel Gravity

Click For Summary
The discussion focuses on calculating gravitational acceleration using Newton's laws. The gravitational constant (G) and the mass of the Earth (M) are provided, along with the distance from the Earth's center (distCenter). The relevant equations are outlined: Newton's second law (a = F/m) and the universal law of gravitation (F = G(Mm/r^2)). The derived formula for acceleration due to gravity (a = G(M/r^2)) is emphasized as the basis for implementing the calculation in the provided Java code. The goal is to compute and print the gravitational acceleration (accelGravity) using these principles. Participants are encouraged to wrap their code in appropriate tags for better readability.
dcs1953
Messages
3
Reaction score
0
Code:
public class GravityCalculation {
   public static void main (String [] args) {
      double G            = 6.673e-11;
      double M            = 5.98e24;
      double accelGravity = 0.0;
      double distCenter   = 0.0;

      distCenter = 6.38e6;

      /* Your solution goes here  */

      System.out.println("accelGravity: " + accelGravity);
      return;
   }
}
 
Last edited by a moderator:
Technology news on Phys.org
Please wrap your code in [CODE][/CODE] tags...it will preserve the whitespace and make your code easier to read.

One form of Newton's second Law of Motion is:

$$a=\frac{F}{m}$$

where $a$ is acceleration, $F$is the applied force, and $m$ is the mass of the object in motion.

And, Newton's Universal Law of Gravitation states:

$$F=G\frac{Mm}{r^2}$$

Where $F$ is the resulting force, $G$ is the gravitational constant, $M$ and $m$ are the masses of the two objects attracting one another, and $r$ is the distance separating their centers of mass. And so, we find the resulting acceleration of the object having mass $m$ to be:

$$a=\frac{F}{m}=\frac{G\dfrac{Mm}{r^2}}{m}=G\frac{M}{r^2}$$

Can you now use this to construct the needed statement?
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

  • · Replies 7 ·
Replies
7
Views
17K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 2 ·
Replies
2
Views
12K
Replies
3
Views
3K
Replies
8
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 0 ·
Replies
0
Views
519
  • · Replies 3 ·
Replies
3
Views
3K
Replies
1
Views
8K