Ejemplo n.º 1
0
    def d_a(self, k: float = 0.5, pretty=False):
        if not self.properties.geometry.solved:
            self.solvegeometry()
        d_a = 3.4 * math.pow(
            self.M_b() /
            ((1 - math.pow(k, 4)) * self.properties.material.sigma_bWN),
            1 / 3) * ureg.meter

        if pretty:
            formArray = [
                [self.M_b(pretty=True)[1].data[1:-1]],
                [
                    r"d_{a} = \approx 3.4 " + Latex.sqrt(
                        Latex.frac(r"M_{b}",
                                   r"\left(1 - k^4 \right) \sigma_{bWN}"), 3) +
                    r" \rightarrow 3.4 [m] " + Latex.sqrt(
                        Latex.frac(
                            self.M_b(),
                            r"\left(1 - " + str(k) + r"^{4} " + r"\right)" +
                            Latex.toStr(self.properties.material.sigma_bWN)),
                        3) + r" \approx " + Latex.toStr(d_a)
                ]
            ]
            pr = Latex.display(Latex.array(formArray))
            return [d_a, pr]
        else:
            return d_a
Ejemplo n.º 2
0
 def test_combined(self):
     test_unit_n = 0.666 * ureg.N**2
     test_unit_a = 3.333 * ureg.mm**200
     test_unit_p = test_unit_n / test_unit_a
     test_result = math.sqrt(test_unit_p.magnitude) * ureg.Pa * ureg.m**-98
     self.assertEqual(
         r'$\sqrt{\frac{6.66 \cdot 10^{-1} \left[N^{2}\right]}{3.33 \left[mm^{200}\right]}} = 4.47 \cdot 10^{-1} \left[\frac{Pa}{m^{98}}\right]$',
         Latex.formulaprint(
             Latex.sqrt(Latex.frac(test_unit_n, test_unit_a)) + r" = " +
             Latex.toStr(test_result)))
Ejemplo n.º 3
0
    def d_prime(self, pretty=False):
        if not self.properties.geometry.solved:
            self.solvegeometry()
        d_prime = 3.4 * math.pow(
            self.M_b() / self.properties.material.sigma_bWN,
            1 / 3) * ureg.meter

        if pretty:
            formArray = [
                [self.M_b(pretty=True)[1].data[1:-1]],
                [
                    r"d^{'} = \approx 3.4 " +
                    Latex.sqrt(Latex.frac(r"M_{b}", r"\sigma_{bWN}"), 3) +
                    r" \rightarrow 3.4 [m] " + Latex.sqrt(
                        Latex.frac(self.M_b(),
                                   self.properties.material.sigma_bWN), 3) +
                    r" \approx " + Latex.toStr(d_prime)
                ]
            ]
            pr = Latex.display(Latex.array(formArray))
            return [d_prime, pr]
        else:
            return d_prime
Ejemplo n.º 4
0
 def test_sqrt(self):
     self.assertEqual(Latex.sqrt(5), '\\sqrt{5.00}')
     self.assertEqual(Latex.sqrt(5, 3), '\\sqrt[3]{5.00}')