Changing the Universal Gravitational Constant: A Java Applet

In summary: But if you're trying to minimize the error in your simulation, then averaging the force at the beginning and end of each time interval should be a good start.
  • #1
tag2020
6
2
TL;DR Summary
How to speed up an orbital mechanics model by changing parameters like the universal gravitational constant
Hello folks,

I am working on Java program just for fun to model an n-body problem using 3-dimension graphics. I'm looking for a way to speed up the model.
Suppose for example that I decide to increase the speeds of all objects by a factor of, say, 2. To compensate, I would also increase the universal gravitational constant by 2 squared = 4. Clearly the model would run faster, but would the behavior be the same? (i.e. Would orbits that were stable before remain stable?)
 
Last edited by a moderator:
Technology news on Phys.org
  • #2
Ashley Gates said:
I'm looking for a way to speed up the model.

Meaning, to make it run faster? Or to make it simulate faster moving objects? They're not the same.

Ashley Gates said:
Suppose for example that I decide to increase the speeds of all objects by a factor of, say, 2.

If you wanted to simulate objects moving twice as fast, then yes, this is what you would do.

Ashley Gates said:
To compensate, I would also increase the universal gravitational constant by 2 squared = 4.

Why would you want to do this? I assume you want your model to simulate the correct laws of physics, not wrong ones.

Ashley Gates said:
Clearly the model would run faster

No, it wouldn't. It would simulate faster moving objects, but that's not the same as the model itself running faster. To run the model faster, you need a faster computer or a faster algorithm; how fast the model runs is not the same as how fast objects within the model move.
 
  • #3
Hi Peter,

Thank-you for you reply, and sorry if my question was a bit vague.

Ideally I would be using a supercomputer to run my model, but sadly I am on a limited budget. As an alternative, I'm wondering if I can simulate faster behavior by introducing parameters to speed up the bodies without destabilizing orbits that would otherwise have been stable.
 
  • #4
Ashley Gates said:
I'm wondering if I can simulate faster behavior by introducing parameters to speed up the bodies without destabilizing orbits that would otherwise have been stable.

First, as I said, you can simulate objects with faster speeds, but you can't just arbitrarily adjust any parameters you like, at least not if you want your model to be consistent with the laws of physics.

Second, as I said, simulating objects that are moving faster doesn't make the simulation itself run any faster.

Third, if what you actually want is to be able to simulate more time within the model in the same amount of computer time (for example, you want a 1 hour run to cover, say, two years of simulated time within the model instead of one), simulating objects that are moving faster is irrelevant--you will just be simulating one year's worth of faster moving objects. The only way to increase the amount of simulated time vs. computer time, if your computer power is fixed, is to increase the size of the time steps in your model. That makes the model able to simulate more model time in the same computer time, but it also decreases the model's accuracy. That is always a tradeoff that modelers have to make, of time vs. accuracy.
 
  • #5
Thanks again for your reply. I'd like to focus on your 3rd paragraph which I believe captures what is being asked. You wrote: "The only way to increase the amount of simulated time vs. computer time, if your computer power is fixed, is to increase the size of the time steps." I'd like to play devil's advocate and challenge your assertion that it is the only way. Are there possibly other creative ways that involve changing other variables besides the time step?

By the way, I agree about the time vs. accuracy tradeoff. I also agree that your recommended approach will work. I just wanted to explore some other alternatives to see if they are feasible (i.e. like adding multipliers to other variables like speed, etc.).
 
  • #6
Ashley Gates said:
Are there possibly other creative ways that involve changing other variables besides the time step?

Not if you want your simulation to be correct. As I said, you can't just arbitrarily change parameters if you want to be simulating the correct laws of physics.
 
  • Like
Likes Dragrath
  • #7
I'm not sure what the benefit would be getting the wrong answer faster than the right answer.
 
  • Like
Likes Dragrath
  • #8
Assuming I go with the time-step approach, are there ways to mitigate the time-accuracy trade-off? (e.g. Take the average of the force at the beginning and end of the time interval)
 
  • #9
Hi Vanadium 50,
It's just a visual simulation. There's no question that I'm trying to answer. Nobody will mark this wrong. :smile:
 
  • #10
Ashley Gates said:
Assuming I go with the time-step approach, are there ways to mitigate the time-accuracy trade-off? (e.g. Take the average of the force at the beginning and end of the time interval)

There are various different possible algorithms, which have different properties. I don't know that there is any general rule.
 
  • #11
Ashley Gates said:
It's just a visual simulation.

If you don't care whether it's correct or not, obviously there are lots of ways to make it faster. But that would be off topic for a discussion in a physics forum. Here we only discuss correct ways of doing physics simulations, not "it looks plausible visually but isn't based on correct physics" ways.
 
  • Like
Likes Dragrath
  • #12
PeterDonis said:
The only way to increase the amount of simulated time vs. computer time, if your computer power is fixed, is to increase the size of the time steps in your model.
I think what @Ashley Gates is proposing is identical to increasing the time step.
 
  • #13
I hope I haven't violated the terms of this forum. If so, perhaps I should reframe the problem as occurring in an alternate universe where G is some other value than 6.674e-11, and hence not violating any laws of physics in that universe. :smile:
 
  • #14
Keith_McClary said:
I think what @Ashley Gates is proposing is identical to increasing the time step.

That's what he means by "the time step approach", yes. But that's not the only approach he's proposed.
 
  • #15
Ashley Gates said:
perhaps I should reframe the problem as occurring in an alternate universe where G is some other value than 6.674e-11, and hence not violating any laws of physics in that universe.

We don't discuss hypothetical universes with hypothetical other laws of physics here (except possibly in the context of string theory "multiverse" discussions in the Beyond the Standard Model forum--but even those require actual references, not just personal speculations). We only discuss the actual universe with the actual laws of physics. I think we've covered that case sufficiently.

Thread closed.
 

1. What is a universal gravitational constant?

A universal gravitational constant is a numerical value that represents the strength of the gravitational force between two objects in the universe. It is denoted by the symbol G and its value is approximately 6.674 x 10^-11 m^3/kg*s^2.

2. Why would someone want to change the universal gravitational constant?

Changing the universal gravitational constant can help scientists better understand the behavior of objects in space, such as planets and stars. By adjusting this constant, we can simulate different gravitational forces and observe the effects they have on the motion of objects.

3. How does the Java Applet work to change the universal gravitational constant?

The Java Applet allows users to input a new value for the universal gravitational constant and then calculates and displays the resulting changes in the motion of two simulated objects. This is done using the formula F = (G*m1*m2)/r^2, where F is the gravitational force, G is the constant, m1 and m2 are the masses of the two objects, and r is the distance between them.

4. Can changing the universal gravitational constant have real-world implications?

Yes, changing the universal gravitational constant can have real-world implications in fields such as astrophysics and space exploration. By studying the effects of different gravitational constants, scientists can gain a better understanding of the universe and potentially make new discoveries.

5. Is the Java Applet accurate in simulating the effects of changing the universal gravitational constant?

The Java Applet provides a simplified and accurate simulation of the effects of changing the universal gravitational constant. However, it should be noted that this is a simplified model and does not account for other factors that may affect the gravitational force, such as the curvature of space-time or the presence of other objects in the universe.

Similar threads

  • Programming and Computer Science
Replies
4
Views
1K
  • Programming and Computer Science
Replies
4
Views
4K
  • Programming and Computer Science
Replies
4
Views
2K
Replies
3
Views
955
Replies
8
Views
822
  • Special and General Relativity
Replies
29
Views
1K
  • Programming and Computer Science
Replies
12
Views
4K
Replies
5
Views
1K
  • Programming and Computer Science
Replies
2
Views
2K
Replies
4
Views
3K
Back
Top