Computer simulation of ray of light passing near massive object

In summary: I'd like to write a computer program that simulates and visualizes the trajectory of a ray of light as it passes near a massive object (e.g., neutron star). In other words, I'd like to model light deflection in space.This sounds like a really fun project! You're going to need to get into linear algebra, which, at least at my school (for some stupid reason) is not required for the CS program. I started out there before I realized physics is cooler =]Linear algebra is definitely something you'll need to know for this, but it's not too bad. I think you could definitely start
  • #1
Curious Progger
1
0
I'd like to write a computer program that simulates and visualizes the trajectory of a ray of light as it passes near a massive object (e.g., neutron star). In other words, I'd like to model light deflection in space.

(FWIW, I have extensive programming experience, but my physics and mathematics understanding is only slightly past what was required of me as a CS undergrad. I understand I'll have to do learn more for this project, and am eager to do so.)

Since the light deflection is a result of spacetime curvature, I understand that the most accurate model would be based on (at least an approximation of) the general theory of relativity. "Linearized gravity" looks like it might be an adequate approximation, though still rather daunting.

I did look over related efforts on the web: http://www.vis.uni-stuttgart.de/en/research/scientific-visualisation/visualization-in-special-and-general-relativity.html (especially their geodesic viewing tools), http://www.spacetimetravel.org/ (especially, their "Light Deflection Near Neutron Stars"). Still rather overwhelmed about how to begin.

I'd be quite happy to start with a very crude approximation (how far off would it be to just use Newton's law to calculate and apply gravitational acceleration at a each position at fine grained moments in time?).

To further simplify, I'm planning to do a 2D version first. Should look similar to several of the diagrams of light deflection on the net (/insert google image search for "light deflection"). But those are almost certainly just artistic approximations, not a result of calculations, which is what I'm after.

To boil this down to a specific question: what's the simplest* formula I can apply to model the trajectory/curvature of spacetime that a ray of light will experience as it passes near a massive object?

(*) Simplest that gives a visually convincing result

(I did see the post "Light ray paths near schwarzschild black hole" that's similar, but that thread didn't come to a conclusion, and it was about black holes, which might be more difficult than say, a star?)
 
Physics news on Phys.org
  • #2
Curious Progger said:
I'd like to write a computer program that simulates and visualizes the trajectory of a ray of light as it passes near a massive object (e.g., neutron star). In other words, I'd like to model light deflection in space.
Sounds like fun
Curious Progger said:
(FWIW, I have extensive programming experience, but my physics and mathematics understanding is only slightly past what was required of me as a CS undergrad. I understand I'll have to do learn more for this project, and am eager to do so.)
Basically you're going to need to get into linear algebra, which, at least at my school (for some stupid reason) is not required for the CS program. I started out there before I realized physics is cooler =]

Curious Progger said:
Since the light deflection is a result of spacetime curvature, I understand that the most accurate model would be based on (at least an approximation of) the general theory of relativity. "Linearized gravity" looks like it might be an adequate approximation, though still rather daunting.
Not so sure about the linearized gravity, as I haven't read much about it, but from what I (literally just no) just read, it seems reasonable for a computational project. Also, GR is the only way to make this happen, seeing as how photons are massless.
Curious Progger said:
I did look over related efforts on the web: http://www.vis.uni-stuttgart.de/en/research/scientific-visualisation/visualization-in-special-and-general-relativity.html (especially their geodesic viewing tools), http://www.spacetimetravel.org/ (especially, their "Light Deflection Near Neutron Stars"). Still rather overwhelmed about how to begin.
I'm not really familiar about these, I'll have to look into them, but basically you'll want to start with an understanding of Einsteins field equations. This is something that I, unfortunately don't have, I wish I did, and have been working on it, but... science is hard.
Curious Progger said:
I'd be quite happy to start with a very crude approximation (how far off would it be to just use Newton's law to calculate and apply gravitational acceleration at a each position at fine grained moments in time?).
I don't think it would be that bad, assuming that what you were actually doing, was using the analogy of acceleration in 3 dimensions, and doing the opposite of collapsing a sub/superscript: extend the acceleration in 3 dimensions to curvature in 4 dimensions.

Curious Progger said:
To further simplify, I'm planning to do a 2D version first. Should look similar to several of the diagrams of light deflection on the net (/insert google image search for "light deflection"). But those are almost certainly just artistic approximations, not a result of calculations, which is what I'm after.
Always a good start, the 2D, that is.
Curious Progger said:
To boil this down to a specific question: what's the simplest* formula I can apply to model the trajectory/curvature of spacetime that a ray of light will experience as it passes near a massive object?

(*) Simplest that gives a visually convincing result

(I did see the post "Light ray paths near schwarzschild black hole" that's similar, but that thread didn't come to a conclusion, and it was about black holes, which might be more difficult than say, a star?)
I think the simplest would be to get into Linear algebra, a little bit to understand matrices, study different vector spaces, look into curvilinear coordinates and learn how projections work in space time. Then go through and use the acceleration from Newtons gravity around your object to reverse engineer the spacetime curvature. I think that would be easier than trying to get a solution to Einstein's Field Equations from scratch.

I hope that helped, GR is something I've been looking into a lot lately, but for probably different reasons.
 
  • Like
Likes Curious Progger
  • #3
Just one comment about
GR is the only way to make this happen, seeing as how photons are massless.
I would rather say, GR is the only way to get a correct result. Massless particles are deflected also under Newtonian gravity since the trajectory of a test particle is independent of it mass - but the result is just wrong, half the correct one : http://en.wikipedia.org/wiki/Tests_of_general_relativity#Deflection_of_light_by_the_Sun
 
  • Like
Likes Curious Progger and BiGyElLoWhAt
  • #4
Touché wabbit
 
  • #5
wabbit said:
Massless particles are deflected also under Newtonian gravity since the trajectory of a test particle is independent of it mass

This is a little bit problematic because, first of all, in Newtonian mechanics it's not clear that "massless" particles can exist, and second, if they could, it's not clear that they would be affected by gravity, since while the acceleration due to gravity in Newtonian gravity is independent of the object's mass, the presence of the force of gravity to begin with requires the object to have mass.

The root problem here is that Newtonian physics didn't include a good theory of what light was and how it worked, and when a good theory for that was discovered (Maxwell's Equations), it proved to be inconsistent with Newtonian mechanics (because the latter is Galilean invariant but the former is Lorentz invariant). So we can't really say that Newtonian physics even includes a consistent prediction for how light will behave under gravity, since that would require a consistent underlying theory that does not in fact exist.
 
  • Like
Likes Curious Progger
  • #6
Agreed, light is problematic in Newtonian gravity, but this particular case has a clear limit which I would think still qualifies as a prediction of Newtonian gravity.
Another take would be to say that under NG light (or massless particles) should travel at infinite speed - i.e. in space but not in time, and this would give a consistent theory - I think this is true, and the spatial path should still be the limit of small-mass paths so that prediction would hold.

But the NG prediction is the same without taking any limit for a low mass particle given enough kinetic energy to be traveling at close to c, and just as wrong I suspect, I think its incorrectness results from the incompatibility of NG with the finite-speed relativity we observe.
 
  • Like
Likes Curious Progger
  • #7
wabbit said:
the NG prediction is the same without taking any limit for a low mass particle given enough kinetic energy to be traveling at close to c, and just as wrong I suspect

Yes, this is true; the Newtonian prediction is 1/2 of the GR prediction, and there are no issues with theoretical consistency for this case.
 
  • Like
Likes Curious Progger
  • #8
@BiGyElLoWhAt, one good news is that once you've handled the 2D case, you've handled them all: any trajectory lies in a plane passing through the center of the star, and the equations are the same regardless of orientation.
One assumption you probably want to stick to though, is that the star is not rotating, for the rotating case is more complex in GR. The non-rotating case corresponds to "null geodesics in Schwarzschild geometry" (Schwarzschild geometry describes spacetime around a non-rotating mass, geodesics are free particle trajectories, and null corresponds to the massless case relevant for light).
The treatment arriving at the equations (e.g. http://en.wikipedia.org/wiki/Schwarzschild_geodesics) is complex, not to say daunting, but if you are familiar with the Newtonian case, in a way it's not so different: the "geodesic equation" (http://en.wikipedia.org/wiki/Schwarzschild_geodesics#Geodesic_equation - this simplifies a bit, since the path is in a plane you can take ##\theta=\text{constant}=\pi/2;(r,\phi) ## are then polar coordinates in the plane of the trajectory) gives you the acceleration as a function of position and velocity, and you can integrate this numerically. While this may not be the best solution it has the advantage of not involving further complex maths.
Those equations are ugly, but with care you should be able to program them. I am sure there must be some guides as to how to do that but unfortunately I don't have one I could point to.
This is not particularly easy to navigate, but perhaps this is a possible route for your project? Others may have better suggestions though.
 
Last edited:
  • Like
Likes Curious Progger
  • #9
PeterDonis said:
This is a little bit problematic because, first of all, in Newtonian mechanics it's not clear that "massless" particles can exist

As photons wouldn't be massless in Newtonian mechanics this is actually not an issue.

PeterDonis said:
and second, if they could, it's not clear that they would be affected by gravity, since while the acceleration due to gravity in Newtonian gravity is independent of the object's mass, the presence of the force of gravity to begin with requires the object to have mass.

This is just a philosophical problem. The singularity of m/m is removable and a particle with infinitesimal small mass can't be distinguished from a massless particle.

The real problem is the classical theory of gravitation itself. In the far field it's results differ by a factor of 2 from the correct values (as already mentioned) and in the near field it must not even be used for the approximation of the gravitational potential. Thus the simulation of trajectories close to neutron stars must be based on pure general relativity.
 
  • #10
DrStupid said:
photons wouldn't be massless in Newtonian mechanics

Really? You have a consistent theory of light as massive photons in Newtonian mechanics?

Yes, I know Newton believed that light was "corpuscles". But he never built that concept into a consistent theory that accounted for the data on light that was available to him.

DrStupid said:
The singularity of m/m is removable

What singularity? The force equation is ##F = G M m / r^2##. If ##m = 0##, then ##F = 0##. The fact that ##F = ma## allows you to write the equation as ##a = GM / r^2## is irrelevant; Newtonian mechanics treats the force as primary, not the acceleration.
 
  • #11
PeterDonis said:
Really? You have a consistent theory of light as massive photons in Newtonian mechanics?

We have a consistent theory of light in quantum mechanics. That's sufficient. Photons have momentum. In classical mechanics momentum is defined as p=m·v. Therefore m must not be zero. (Don't forget that this "m" is not rest mass!)

PeterDonis said:
What singularity?

Newtons's second law for constant mass

[itex]F = m \cdot a[/itex]

and Newton's law of gravitation

[itex]F = - \frac{{G \cdot M \cdot m \cdot r}}{{\left| r \right|^3 }}[/itex]

result in

[itex]a = - \frac{{G \cdot M \cdot r}}{{\left| r \right|^3 }} \cdot \frac{m}{m}[/itex]

This equation has a removable singularity for m=0:

[itex]\mathop {\lim }\limits_{m \to 0} \;a = - \frac{{G \cdot M \cdot r}}{{\left| r \right|^3 }}[/itex]

There is no reason not to use it for massless particles.
 
  • #12
DrStupid said:
We have a consistent theory of light in quantum mechanics. That's sufficient.

Newtonian mechanics is not a quantum theory. If by "Newtonian mechanics" you really mean "non-relativistic quantum mechanics", then you should use the latter term.

DrStupid said:
(Don't forget that this "m" is not rest mass!)

There is nothing in Newtonian mechanics corresponding to the distinction in relativity between "rest mass" and "relativistic mass" (aka energy); there is just "mass".

DrStupid said:
There is no reason not to use it for massless particles.

Mathematically, no. Physically, yes, because in Newtonian mechanics, as I said before, the force is primary, not the acceleration. If by "Newtonian mechanics" you really mean "relativity in the Newtonian limit", then you should use the latter term.
 
  • #13
PeterDonis said:
There is nothing in Newtonian mechanics corresponding to the distinction in relativity between "rest mass" and "relativistic mass" (aka energy); there is just "mass".

What about the classical definition of momentum, conservation of momentum and isotropy? In relativity (that means by replacing Galilean transformation with Lorentz transformation) they result in a difference between Newton's quantity of matter and rest mass.

PeterDonis said:
Physically, yes

What is the physically difference between ##m \to 0## and ##m = 0##? Can it be distinguished experimentally?

PeterDonis said:
because in Newtonian mechanics, as I said before, the force is primary, not the acceleration.

What do you mean with "primary"?
 
  • #14
DrStupid said:
In relativity (that means by replacing Galilean transformation with Lorentz transformation) they result in a difference between Newton's quantity of matter and rest mass.

Yes, in relativity. Newtonian mechanics is not a relativistic theory.

(Also, I'm not sure how Newton's "quantity of matter" would translate into relativity anyway.)

DrStupid said:
What is the physically difference between ##m \to 0## and ##m = 0##?

In Newtonian mechanics, ##m = 0## is not physically possible; an object with zero mass does not exist. Mass is the quantity of matter in an object; ##m = 0## means no matter, i.e., no object.

DrStupid said:
What do you mean with "primary"?

I mean that in order for an acceleration to be present in Newtonian mechanics, a force must exist. If ##m = 0##, there is no force, hence no acceleration. The fact that you can cancel out the ##m## in the mathematical formula for acceleration is irrelevant.
 
  • #15
PeterDonis said:
Yes, in relativity. Newtonian mechanics is not a relativistic theory.

And that's why any object with momentum must have a mass in Newtonian mechanics. For photons this means they have mass in Newtonian mechanics but no mass in relativity. Thus mass in Newtonian mechanics cannot be identical with mass in relativity.

PeterDonis said:
(Also, I'm not sure how Newton's "quantity of matter" would translate into relativity anyway.)

It turns into relativistic mass.

PeterDonis said:
In Newtonian mechanics, ##m = 0## is not physically possible; an object with zero mass does not exist. Mass is the quantity of matter in an object; ##m = 0## means no matter, i.e., no object.

That doesn't answer my question.

PeterDonis said:
If ##m = 0##, there is no force

If m=0 there is a force with the amount of zero. It seems this isn't really physically but rather philosophical.

PeterDonis said:
The fact that you can cancel out the ##m## in the mathematical formula for acceleration is irrelevant.

I didn't cancel it out. I calculated the limit for ##m \to 0## using L'Hôpital's rule. That means m never reaches zero. It just went infinitesimal small and therefore there is also an infinitesimal small force. If you think that this doesn't describe a massless object, you must show that a massless object is physically different from an object with infinitesimal small mass. Can you show that?
 
  • #16
DrStupid, I'm not trying to argue that what I'm calling "Newtonian physics" is a valid physical theory. It isn't. I'm just clarifying what I meant by it: I meant the theory developed by Newton, not the Newtonian limit of relativity, and not Newton's theory plus some ad hoc addition of "massless" objects, which nobody ever actually developed or used.

DrStupid said:
It seems this isn't really physically but rather philosophical.

I would say "historical". I'm not talking about any theory that anyone uses today, even as an approximation.
 
  • #17
I have access to a computer program which runs an algorithm to determine the sum of light incremental deflection angles caused by its passing the Sun over many passes through the algorithm. the final sum of the incremental deflection angles is the deflection angle caused by the Sun. There are two fundamental principles used in the algorithm. One is the deflection of the light which would be expected from Newtonian effects on objects in a gravitational field. The second effect considers the distance the light beam is from the Sun's CG to cause an additional deflection proportional to the magnitude and direction of the escape velocity vector, These two incremental deflection angles are equal and their sums for all passes through the algorithm is the total deflection angle. The program determines the amount of light path deviation in arc-seconds for any star seen at distances from 1 to 1000 solar radii from the sun's limb. Although an equation already exists to calculate the deviation instantly, the purpose of the computer program is to show that the same values can be determined by considering both the Newtonian and the escape velocity effects.
Tracer
 
  • #18
Curious Progger said:
I'd like to write a computer program that simulates and visualizes the trajectory of a ray of light as it passes near a massive object (e.g., neutron star). In other words, I'd like to model light deflection in space.

Google for "orbit of a photon in Schwarzschild geometry". You should find a hit in google books from the textbook "Gravitation", that will give you a differential equation. It will be in geometric units, though. The non-geometrized version would look something like this

[tex]
\left( \frac{1}{r^2} \frac{dr}{d\phi} \right) ^2 + \frac{1 - r_s/r}{r^2} = 1/b^2
[/tex]

where r is the schwarzschild r coordinate, ##r_s## is the Schwarzschild radius of the black hole, ##2GM/c^2##, ##\phi## is the schwarzschild angular coordinate, and b is a constant of motion called the "impact paramter".

Hopefully this is what you want, as the "schwarzschild gemoetry" is the model for the geometry of a black hole or any massive non-rotating object. Note that this differential equation this just gives the spatial trajectory, r as a function of ##\phi##, not the space-time trajectory. For the later you'd have a different equation based off the geodesic equation. Drop a note if the later is what you're looking for.

Note that the above eq. does NOT include the effects of frame dragging which happens when the massive body is rotating. Presumably you don't need this level of acacuracy from your previous comments.
 
  • Like
Likes Curious Progger

1. How does a computer simulate the path of a ray of light passing near a massive object?

A computer uses mathematical equations and algorithms to simulate the path of a ray of light. These calculations take into account the mass and gravitational force of the object, as well as the speed and direction of the light ray.

2. Can a computer simulation accurately predict the behavior of light passing near a massive object?

While a computer simulation can provide a fairly accurate prediction, there are limitations. Small variations in initial conditions or inaccuracies in the simulation model can affect the outcome. Therefore, it is important to run multiple simulations and compare the results to improve accuracy.

3. How does the mass of the object affect the path of the light ray in the simulation?

The mass of the object has a significant impact on the path of the light ray in the simulation. The greater the mass of the object, the stronger its gravitational force, which can cause the light ray to bend more significantly.

4. Is the simulation affected by the speed of the light ray?

Yes, the speed of the light ray is a crucial factor in the simulation. The faster the light ray moves, the less time it spends near the massive object, resulting in a less significant bending of its path. Therefore, the speed of light must be accurately accounted for in the simulation.

5. What applications can computer simulations of light passing near massive objects have in the real world?

Computer simulations of light passing near massive objects have various applications in fields such as astronomy, physics, and engineering. They can help us understand and predict the behavior of light in extreme gravitational fields, which can aid in the development of new technologies and exploration of the universe.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • Special and General Relativity
Replies
6
Views
900
  • Special and General Relativity
Replies
33
Views
3K
  • Special and General Relativity
Replies
27
Views
4K
  • Special and General Relativity
Replies
1
Views
911
  • Special and General Relativity
Replies
8
Views
3K
  • Special and General Relativity
2
Replies
40
Views
2K
  • Astronomy and Astrophysics
Replies
1
Views
1K
  • Special and General Relativity
Replies
32
Views
8K
  • Special and General Relativity
Replies
5
Views
2K
Back
Top