5 added 308 characters in body edited Jan 5 '17 at 7:21 Shaz 16411 silver badge1212 bronze badges I am trying to calculate Ricci tensor numerically for arbitrary metric. I think my code looks okay and when I try to calculate the metric tensor of flat Minkowski space-time in Cartesian coordinate it gives zero Ricci tensor and Ricci scalar as it should for a flat space-time. Because of constant components of the metric tensor this is very trivial. But an equivalent description of the metric tensor in Spherical coordinates should give an identically zero Ricci tensor and scalar. However, my code does not give an identical zero answer. I tried to probe the situation in a bit more detail and I think the problem stems from the finite difference method of numerical differentiation and the non-linearity of the contravariant component of the metric tensor in Christopher symbol ($$\Gamma^i_{jk}=\frac{1}{2}g^{il}(g_{jl,k}+g_{kl,j}-g_{jk,l})$$. As the coordinates come close to the origin the finite difference method progressively fails because the function becomes more and more non-linear. So my question is: How do I go about solving this situation? How do I deal with the problem of numerically differentiating a non-linear function to get the correct value for Ricci tensor and hence Ricci scalar. I have tried both forward finite difference method and the central finite difference method but both these methods give the same inconsistencies for small values of the coordinates. One possible solution that I figure is to use variable grid spacing and asymptotically increase the number of points near the origin. My real concern is that I don't have a way to check if my code is correct since I cant check the answer on a known case of Minkowski metric. Update: I used non-uniform spacing and as expect it significantly reduced the errors in the Ricci tensor which is now zero upto 5 decimal places at least. I will however continue to look for better methods to differential non-linear functions numerically. I am trying to calculate Ricci tensor numerically for arbitrary metric. I think my code looks okay and when I try to calculate the metric tensor of flat Minkowski space-time in Cartesian coordinate it gives zero Ricci tensor and Ricci scalar as it should for a flat space-time. Because of constant components of the metric tensor this is very trivial. But an equivalent description of the metric tensor in Spherical coordinates should give an identically zero Ricci tensor and scalar. However, my code does not give an identical zero answer. I tried to probe the situation in a bit more detail and I think the problem stems from the finite difference method of numerical differentiation and the non-linearity of the contravariant component of the metric tensor in Christopher symbol ($$\Gamma^i_{jk}=\frac{1}{2}g^{il}(g_{jl,k}+g_{kl,j}-g_{jk,l})$$. As the coordinates come close to the origin the finite difference method progressively fails because the function becomes more and more non-linear. So my question is: How do I go about solving this situation? How do I deal with the problem of numerically differentiating a non-linear function to get the correct value for Ricci tensor and hence Ricci scalar. I have tried both forward finite difference method and the central finite difference method but both these methods give the same inconsistencies for small values of the coordinates. One possible solution that I figure is to use variable grid spacing and asymptotically increase the number of points near the origin. My real concern is that I don't have a way to check if my code is correct since I cant check the answer on a known case of Minkowski metric. I am trying to calculate Ricci tensor numerically for arbitrary metric. I think my code looks okay and when I try to calculate the metric tensor of flat Minkowski space-time in Cartesian coordinate it gives zero Ricci tensor and Ricci scalar as it should for a flat space-time. Because of constant components of the metric tensor this is very trivial. But an equivalent description of the metric tensor in Spherical coordinates should give an identically zero Ricci tensor and scalar. However, my code does not give an identical zero answer. I tried to probe the situation in a bit more detail and I think the problem stems from the finite difference method of numerical differentiation and the non-linearity of the contravariant component of the metric tensor in Christopher symbol ($$\Gamma^i_{jk}=\frac{1}{2}g^{il}(g_{jl,k}+g_{kl,j}-g_{jk,l})$$. As the coordinates come close to the origin the finite difference method progressively fails because the function becomes more and more non-linear. So my question is: How do I go about solving this situation? How do I deal with the problem of numerically differentiating a non-linear function to get the correct value for Ricci tensor and hence Ricci scalar. I have tried both forward finite difference method and the central finite difference method but both these methods give the same inconsistencies for small values of the coordinates. One possible solution that I figure is to use variable grid spacing and asymptotically increase the number of points near the origin. My real concern is that I don't have a way to check if my code is correct since I cant check the answer on a known case of Minkowski metric. Update: I used non-uniform spacing and as expect it significantly reduced the errors in the Ricci tensor which is now zero upto 5 decimal places at least. I will however continue to look for better methods to differential non-linear functions numerically. 4 added 141 characters in body edited Jan 4 '17 at 10:46 Shaz 16411 silver badge1212 bronze badges I am trying to calculate Ricci tensor numerically for arbitrary metric. I think my code looks okay and when I try to calculate the metric tensor of flat Minkowski space-time in Cartesian coordinate it gives zero Ricci tensor and Ricci scalar as it should for a flat space-time. Because of constant components of the metric tensor this is very trivial. But an equivalent description of the metric tensor in Spherical coordinates should give an identically zero Ricci tensor and scalar. However, my code does not give an identical zero answer. I tried to probe the situation in a bit more detail and I think the problem stems from the finite difference method of numerical differentiation and the non-linearity of the contravariant component of the metric tensor in Christopher symbol ($$\Gamma^i_{jk}=\frac{1}{2}g^{il}(g_{jl,k}+g_{kl,j}-g_{jk,l})$$. As the coordinates come close to the origin the finite difference method progressively fails because the function becomes more and more non-linear. So my question is: How do I go about solving this situation? How do I deal with the problem of numerically differentiating a non-linear function to get the correct value for Ricci tensor and hence Ricci scalar. I have tried both forward finite difference method and the central finite difference method but both these methods give the same inconsistencies for small values of the coordinates. One possible solution that I figure is to use variable grid spacing and asymptotically increase the number of points near the origin. My real concern is that I don't have a way to check if my code is correct since I cant check the answer on a known case of Minkowski metric. I am trying to calculate Ricci tensor numerically for arbitrary metric. I think my code looks okay and when I try to calculate the metric tensor of flat Minkowski space-time in Cartesian coordinate it gives zero Ricci tensor and Ricci scalar as it should for a flat space-time. Because of constant components of the metric tensor this is very trivial. But an equivalent description of the metric tensor in Spherical coordinates should give an identically zero Ricci tensor and scalar. However, my code does not give an identical zero answer. I tried to probe the situation in a bit more detail and I think the problem stems from the finite difference method of numerical differentiation and the non-linearity of the contravariant component of the metric tensor in Christopher symbol ($$\Gamma^i_{jk}=\frac{1}{2}g^{il}(g_{jl,k}+g_{kl,j}-g_{jk,l})$$. As the coordinates come close to the origin the finite difference method progressively fails because the function becomes more and more non-linear. So my question is: How do I go about solving this situation? How do I deal with the problem of numerically differentiating a non-linear function to get the correct value for Ricci tensor and hence Ricci scalar. I have tried both forward finite difference method and the central finite difference method but both these methods give the same inconsistencies for small values of the coordinates. One possible solution that I figure is to use variable grid spacing and asymptotically increase the number of points near the origin. I am trying to calculate Ricci tensor numerically for arbitrary metric. I think my code looks okay and when I try to calculate the metric tensor of flat Minkowski space-time in Cartesian coordinate it gives zero Ricci tensor and Ricci scalar as it should for a flat space-time. Because of constant components of the metric tensor this is very trivial. But an equivalent description of the metric tensor in Spherical coordinates should give an identically zero Ricci tensor and scalar. However, my code does not give an identical zero answer. I tried to probe the situation in a bit more detail and I think the problem stems from the finite difference method of numerical differentiation and the non-linearity of the contravariant component of the metric tensor in Christopher symbol ($$\Gamma^i_{jk}=\frac{1}{2}g^{il}(g_{jl,k}+g_{kl,j}-g_{jk,l})$$. As the coordinates come close to the origin the finite difference method progressively fails because the function becomes more and more non-linear. So my question is: How do I go about solving this situation? How do I deal with the problem of numerically differentiating a non-linear function to get the correct value for Ricci tensor and hence Ricci scalar. I have tried both forward finite difference method and the central finite difference method but both these methods give the same inconsistencies for small values of the coordinates. One possible solution that I figure is to use variable grid spacing and asymptotically increase the number of points near the origin. My real concern is that I don't have a way to check if my code is correct since I cant check the answer on a known case of Minkowski metric. 3 deleted 16 characters in body; edited tags edited Jan 4 '17 at 10:00 Qmechanic♦ 111k1212 gold badges214214 silver badges13081308 bronze badges I am trying to calculate Ricci tensor numerically for arbitrary metric. I think my code looks okay and when I try to calculate the metric tensor of flat Minkowski space-time in Cartesian coordinate it gives zero Ricci tensor and Ricci scalar as it should for a flat space-time. Because of constant components of the metric tensor this is very trivial. But an equivalent description of the metric tensor in Spherical coordinates should give an identically zero Ricci tensor and scalar. However, my code does not give an identical zero answer. I tried to probe the situation in a bit more detail and I think the problem stems from the finite difference method of numerical differentiation and the non-linearity of the contravariant component of the metric tensor in Christopher symbol ($$\Gamma^i_{jk}=\frac{1}{2}g^{il}(g_{jl,k}+g_{kl,j}-g_{jk,l})$$. As the coordinates come close to the origin the finite difference method progressively fails because the function becomes more and more non-linear. So my question is:So my question is: How do I go about solving this situation? How do I deal with the problem of numerically differentiating a non-linear function to get the correct value for Ricci tensor and hence Ricci scalar. I have tried both forward finite difference method and the central finite difference method but both these methods give the same inconsistencies for small values of the coordinates. One possible solution that I figure is to use variable grid spacing and asymptotically increase the number of points near the origin. Thanks for your time! I am trying to calculate Ricci tensor numerically for arbitrary metric. I think my code looks okay and when I try to calculate the metric tensor of flat Minkowski space-time in Cartesian coordinate it gives zero Ricci tensor and Ricci scalar as it should for a flat space-time. Because of constant components of the metric tensor this is very trivial. But an equivalent description of the metric tensor in Spherical coordinates should give an identically zero Ricci tensor and scalar. However, my code does not give an identical zero answer. I tried to probe the situation in a bit more detail and I think the problem stems from the finite difference method of numerical differentiation and the non-linearity of the contravariant component of the metric tensor in Christopher symbol ($$\Gamma^i_{jk}=\frac{1}{2}g^{il}(g_{jl,k}+g_{kl,j}-g_{jk,l})$$. As the coordinates come close to the origin the finite difference method progressively fails because the function becomes more and more non-linear. So my question is: How do I go about solving this situation? How do I deal with the problem of numerically differentiating a non-linear function to get the correct value for Ricci tensor and hence Ricci scalar. I have tried both forward finite difference method and the central finite difference method but both these methods give the same inconsistencies for small values of the coordinates. One possible solution that I figure is to use variable grid spacing and asymptotically increase the number of points near the origin. Thanks for your time! I am trying to calculate Ricci tensor numerically for arbitrary metric. I think my code looks okay and when I try to calculate the metric tensor of flat Minkowski space-time in Cartesian coordinate it gives zero Ricci tensor and Ricci scalar as it should for a flat space-time. Because of constant components of the metric tensor this is very trivial. But an equivalent description of the metric tensor in Spherical coordinates should give an identically zero Ricci tensor and scalar. However, my code does not give an identical zero answer. I tried to probe the situation in a bit more detail and I think the problem stems from the finite difference method of numerical differentiation and the non-linearity of the contravariant component of the metric tensor in Christopher symbol ($$\Gamma^i_{jk}=\frac{1}{2}g^{il}(g_{jl,k}+g_{kl,j}-g_{jk,l})$$. As the coordinates come close to the origin the finite difference method progressively fails because the function becomes more and more non-linear. So my question is: How do I go about solving this situation? How do I deal with the problem of numerically differentiating a non-linear function to get the correct value for Ricci tensor and hence Ricci scalar. I have tried both forward finite difference method and the central finite difference method but both these methods give the same inconsistencies for small values of the coordinates. One possible solution that I figure is to use variable grid spacing and asymptotically increase the number of points near the origin. 2 Found a spelling mistake. edited Jan 4 '17 at 9:54 Shaz 16411 silver badge1212 bronze badges 1 asked Jan 4 '17 at 5:36 Shaz 16411 silver badge1212 bronze badges