コード例 #1
0
ファイル: schouten.py プロジェクト: vineetg3/einsteinpy
    def from_metric(cls, metric):
        """
        Get Schouten tensor calculated from a metric tensor

        Parameters
        ----------
        metric : ~einsteinpy.symbolic.metric.MetricTensor
            Space-time Metric from which Christoffel Symbols are to be calculated

        Raises
        ------
        ValueError
            Raised when the dimension of the tensor is less than 3

        """
        if metric.dims >= 3:
            t_ricci = RicciTensor.from_metric(metric)
            r_scalar = RicciScalar.from_riccitensor(t_ricci,
                                                    parent_metric=None)
            dims = metric.dims
            t_schouten = (t_ricci.tensor() -
                          (r_scalar.expr * metric.lower_config().tensor() /
                           (2 * (dims - 1)))) / (dims - 2)
            return cls(t_schouten,
                       metric.syms,
                       config="ll",
                       parent_metric=metric)
        raise ValueError(
            "Dimension of the space/space-time should be 3 or more")
コード例 #2
0
 def from_metric(cls, metric):
     t_ricci = RicciTensor.from_metric(metric)
     r_scalar = RicciScalar.from_riccitensor(t_ricci, t_ricci.parent_metric)
     einstein_tensor = t_ricci.tensor() - (1 / 2) * metric.tensor() * r_scalar.expr
     return cls(
         einstein_tensor,
         metric.syms,
         config="ll",
         parent_metric=t_ricci.parent_metric,
     )