Example #1
0
def rounding_numerical_components():
    Print_Function()
    (ex,ey,ez) = MV.setup('e_x e_y e_z',metric='[1,1,1]')

    X = 1.2*ex+2.34*ey+0.555*ez
    Y = 0.333*ex+4*ey+5.3*ez

    print('X =',X)
    print('Nga(X,2) =',Nga(X,2))
    print('X*Y =',X*Y)
    print('Nga(X*Y,2) =',Nga(X*Y,2))
    return
Example #2
0
def rounding_numerical_components():
    Print_Function()
    o3d = Ga('e_x e_y e_z', g=[1, 1, 1])
    (ex, ey, ez) = o3d.mv()

    X = 1.2 * ex + 2.34 * ey + 0.555 * ez
    Y = 0.333 * ex + 4 * ey + 5.3 * ez

    print('X =', X)
    print('Nga(X,2) =', Nga(X, 2))
    print('X*Y =', X * Y)
    print('Nga(X*Y,2) =', Nga(X * Y, 2))
    return
Example #3
0
    def test_rounding_numerical_components(self):

        o3d = Ga('e_x e_y e_z', g=[1, 1, 1])
        (ex, ey, ez) = o3d.mv()

        X = 1.2*ex+2.34*ey+0.555*ez
        Y = 0.333*ex+4*ey+5.3*ez

        assert str(X) == '1.2*e_x + 2.34*e_y + 0.555*e_z'
        assert str(Nga(X,2)) == '1.2*e_x + 2.3*e_y + 0.55*e_z'
        assert str(X*Y) == '12.7011000000000 + 4.02078*e_x^e_y + 6.175185*e_x^e_z + 10.182*e_y^e_z'
        assert str(Nga(X*Y,2)) == '13. + 4.0*e_x^e_y + 6.2*e_x^e_z + 10.0*e_y^e_z'

        return