Beispiel #1
0
def test_simplify():
    x, y = R2_r.coord_functions()
    dx, dy = R2_r.base_oneforms()
    ex, ey = R2_r.base_vectors()
    assert simplify(x) == x
    assert simplify(x * y) == x * y
    assert simplify(dx * dy) == dx * dy
    assert simplify(ex * ey) == ex * ey
    assert ((1 - x) * dx) / (1 - x)**2 == dx / (1 - x)
Beispiel #2
0
def test_simplify():
    x, y = R2_r.coord_functions()
    dx, dy = R2_r.base_oneforms()
    ex, ey = R2_r.base_vectors()
    assert simplify(x) == x
    assert simplify(x*y) == x*y
    assert simplify(dx*dy) == dx*dy
    assert simplify(ex*ey) == ex*ey
    assert ((1-x)*dx)/(1-x)**2 == dx/(1-x)
Beispiel #3
0
Rat = sym.Rational
Mat = sym.Matrix
Sym = sym.symbols
Half = Rat(1, 2)
Third = Rat(1, 3)
Quarter = Rat(1, 4)


def Rec(n):
    return Rat(1, n)


from sympy.diffgeom.rn import R2_r
from sympy.diffgeom import WedgeProduct
ex, ey = R2_r.base_vectors()
dx, dy = R2_r.base_oneforms()
print(WedgeProduct(dx, dy))
print(WedgeProduct(dx, dy)(ex, ey))

J = Mat([[Sym("J_{}{}".format(i, j)) for j in range(1, 3)]
         for i in range(1, 4)])
print_matrix(J)
print_matrix(J.T * J)


class k_vector:
    def __init__(self, n):
        self.n = n


def E(n, *vecs):