MHB Gravity Calculation: Calculate Accel Gravity

AI Thread 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?
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...
Back
Top