Пример #1
0
    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):
        """
        Get Weyl 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:
            metric_cov = metric.lower_config()
            t_riemann = RiemannCurvatureTensor.from_metric(metric)
            # Riemann Tensor with covariant indices is needed
            t_riemann_cov = t_riemann.change_config("llll", metric=None)
            t_ricci = RicciTensor.from_riemann(t_riemann, parent_metric=None)
            r_scalar = RicciScalar.from_riccitensor(t_ricci, parent_metric=None)
            g = metric_cov
            dims = g.dims
            # Indexing for resultant Weyl Tensor is iklm
            C = np.zeros(shape=(dims, dims, dims, dims), dtype=int).tolist()
            for t in range(dims ** 4):
                i, k, l, m = (
                    t % dims,
                    (int(t / dims)) % (dims),
                    (int(t / (dims ** 2))) % (dims),
                    (int(t / (dims ** 3))) % (dims),
                )
                C[i][k][l][m] = t_riemann_cov[i, k, l, m] + (
                    (
                        (
                            t_ricci[i, m] * g[k, l]
                            - t_ricci[i, l] * g[k, m]
                            + t_ricci[k, l] * g[i, m]
                            - t_ricci[k, m] * g[i, l]
                        )
                        / (dims - 2)
                    )
                    + (
                        r_scalar.expr
                        * (g[i, l] * g[k, m] - g[i, m] * g[k, l])
                        / ((dims - 1) * (dims - 2))
                    )
                )
            C = sympy.simplify(sympy.Array(C))
            return cls(C, metric.syms, config="llll", parent_metric=metric)
        if metric.dims == 3:
            return cls(
                sympy.Array(np.zeros((3, 3), dtype=int)),
                metric.syms,
                config="llll",
                parent_metric=metric,
            )
        raise ValueError("Dimension of the space/space-time should be 3 or more")
Пример #3
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,
     )