{"id":8507,"date":"2021-09-30T11:30:58","date_gmt":"2021-09-30T06:00:58","guid":{"rendered":"https:\/\/python-programs.com\/?p=8507"},"modified":"2021-11-22T18:35:27","modified_gmt":"2021-11-22T13:05:27","slug":"python-program-to-find-the-gravitational-force-acting-between-two-objects","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-find-the-gravitational-force-acting-between-two-objects\/","title":{"rendered":"Python Program to Find the Gravitational Force Acting Between Two Objects"},"content":{"rendered":"
Gravitational Force:<\/strong><\/p>\n The gravitational force is a force that attracts any two mass-bearing objects. The gravitational force is called attractive because it always strives to pull masses together rather than pushing them apart. In reality, every thing in the cosmos, including you, is tugging on every other item! Newton’s Universal Law of Gravitation is the name for this. You don’t have a significant mass, thus you’re not dragging on those other objects very much. Objects that are extremely far apart do not noticeably pull on each other either. However, the force exists and can be calculated.<\/p>\n Gravitational Force Formula :<\/strong><\/p>\n Gravitational Force = ( G *\u00a0 m1 * m2 ) \/ ( r ** 2 )<\/strong><\/p><\/blockquote>\n Given masses of two objects and the radius , the task is to calculate the Gravitational Force acting between the given two particles in Python.<\/p>\n Examples:<\/strong><\/p>\n Example1:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:<\/strong><\/p>\n Example2:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:<\/strong><\/p>\n We will write the code which calculates the gravitational force acting between the particles and print it<\/p>\n Explore more instances related to python concepts from\u00a0Python Programming Examples<\/a>\u00a0Guide and get promoted from beginner to professional programmer level in Python Programming Language.<\/p>\n Approach:<\/strong><\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n Approach:<\/strong><\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n Related Programs<\/strong>:<\/p>\n Gravitational Force: The gravitational force is a force that attracts any two mass-bearing objects. The gravitational force is called attractive because it always strives to pull masses together rather than pushing them apart. In reality, every thing in the cosmos, including you, is tugging on every other item! Newton’s Universal Law of Gravitation is the …<\/p>\nmass1 = 1300012.67\r\nmass2 = 303213455.953\r\nradius = 45.4<\/pre>\n
The gravitational force of objects with masses 1300012.67 kg 303213455.953 kg of radius= 45.4 = 12.761610184592419<\/pre>\n
Enter the first mass of the object =2491855.892 \r\nEnter the second mass of the object =9000872 \r\nEnter the distance\/radius between the objects =50<\/pre>\n
The gravitational force of objects with masses 24918552.892 kg 23145689000872.0 kg of radius= 50.0 = 15394799.86164859<\/pre>\n
Program to Find the Gravitational Force Acting Between Two Objects in Python<\/h2>\n
\n
1)Calculating the Gravitational Force\u00a0 (Static Input)<\/h3>\n
\n
# given first mass\r\nmass1 = 1300012.67\r\n# given second mass\r\nmass2 = 303213455.953\r\n# enter the radius\r\nradius = 45.4\r\n# Given value of Gravitational Constant Gval\r\nGval = 6.673*(10**(-11))\r\n# Calculating the value of the gravitational force Gforce\r\nGforce = (Gval*mass1*mass2)\/(radius**2)\r\n# printing the value of gravitational force\r\nprint(\"The gravitational force of objects with masses\", str(mass1) +\r\n \" kg \"+str(mass2)+\" kg \", \"of radius=\", radius, \"=\", Gforce)\r\n<\/pre>\n
The gravitational force of objects with masses 1300012.67 kg 303213455.953 kg of radius= 45.4 = 12.761610184592419<\/pre>\n
2)Calculating the Gravitational Force\u00a0 (User Input)<\/h3>\n
\n
# scanning first mass as float\r\nmass1 = float(input(\"Enter the first mass of the object =\"))\r\n# given second mass as float\r\nmass2 = float(input(\"Enter the second mass of the object =\"))\r\n# enter the radius as float\r\nradius = float(input(\"Enter the distance\/radius between the objects =\"))\r\n# Given value of Gravitational Constant Gval\r\nGval = 6.673*(10**(-11))\r\n# Calculating the value of the gravitational force Gforce\r\nGforce = (Gval*mass1*mass2)\/(radius**2)\r\n# printing the value of gravitational force\r\nprint(\"The gravitational force of objects with masses\", str(mass1) +\r\n \" kg \"+str(mass2)+\" kg \", \"of radius=\", radius, \"=\", Gforce)\r\n<\/pre>\n
Enter the first mass of the object =2491855.892\r\nEnter the second mass of the object =9000872\r\nEnter the distance\/radius between the objects =50\r\nThe gravitational force of objects with masses 24918552.892 kg 23145689000872.0 kg of radius= 50.0 = 15394799.86164859<\/pre>\n
\n