Exemple #1
0
def test_P():

    g = Grid_1D.periodic(11)

    f = form(0, c, (sin(x), ))
    assert f.P(g, True) == g.P(f.degree, True, f.lambdify)
    assert f.P(g, False) == g.P(f.degree, False, f.lambdify)

    f = form(1, c, (cos(x), ))
    assert f.P(g, True) == g.P(f.degree, True, f.lambdify)
    assert f.P(g, False) == g.P(f.degree, False, f.lambdify)

    g = Grid_1D.regular(11)

    f = form(0, c, (x, ))
    assert f.P(g, True) == g.P(f.degree, True, f.lambdify)
    assert f.P(g, False) == g.P(f.degree, False, f.lambdify)

    f = form(1, c, (x**3, ))
    assert f.P(g, True) == g.P(f.degree, True, f.lambdify)
    assert f.P(g, False) == g.P(f.degree, False, f.lambdify)

    g = Grid_1D.chebyshev(11)

    f = form(0, c, (x, ))
    assert f.P(g, True) == g.P(f.degree, True, f.lambdify)
    assert f.P(g, False) == g.P(f.degree, False, f.lambdify)

    f = form(1, c, (x**3, ))
    assert f.P(g, True) == g.P(f.degree, True, f.lambdify)
    assert f.P(g, False) == g.P(f.degree, False, f.lambdify)
Exemple #2
0
def test_P():

    g = Grid_1D.periodic(11)
    
    f = form(0, c, (sin(x),))
    assert f.P(g, True) == g.P(f.degree, True, f.lambdify)
    assert f.P(g, False) == g.P(f.degree, False, f.lambdify)
    
    f = form(1, c, (cos(x),))
    assert f.P(g, True) == g.P(f.degree, True, f.lambdify)
    assert f.P(g, False) == g.P(f.degree, False, f.lambdify)

    g = Grid_1D.regular(11)
    
    f = form(0, c, (x,))
    assert f.P(g, True) == g.P(f.degree, True, f.lambdify)
    assert f.P(g, False) == g.P(f.degree, False, f.lambdify)
    
    f = form(1, c, (x**3,))
    assert f.P(g, True) == g.P(f.degree, True, f.lambdify)
    assert f.P(g, False) == g.P(f.degree, False, f.lambdify)

    g = Grid_1D.chebyshev(11)
    
    f = form(0, c, (x,))
    assert f.P(g, True) == g.P(f.degree, True, f.lambdify)
    assert f.P(g, False) == g.P(f.degree, False, f.lambdify)
    
    f = form(1, c, (x**3,))
    assert f.P(g, True) == g.P(f.degree, True, f.lambdify)
    assert f.P(g, False) == g.P(f.degree, False, f.lambdify)
Exemple #3
0
def test_D():

    g = Grid_1D.periodic(11)
    f = form(0, c, (cos(x), ))
    assert f.D.P(g, True) == f.P(g, True).D
    assert f.D.P(g, False) == f.P(g, False).D

    g = Grid_1D.regular(11)
    f = form(0, c, (x, ))
    assert f.D.P(g, True) == f.P(g, True).D
    bc = g.boundary_condition(f.lambdify)
    assert f.D.P(g, False) == f.P(g, False).D + bc
    f = form(0, c, (x**3, ))
    assert f.D.P(g, True) == f.P(g, True).D
    bc = g.boundary_condition(f.lambdify)
    assert f.D.P(g, False) == f.P(g, False).D + bc

    g = Grid_1D.chebyshev(11)
    f = form(0, c, (x, ))
    assert f.D.P(g, True) == f.P(g, True).D
    bc = g.boundary_condition(f.lambdify)
    assert f.D.P(g, False) == f.P(g, False).D + bc
    f = form(0, c, (x**3, ))
    assert f.D.P(g, True) == f.P(g, True).D
    bc = g.boundary_condition(f.lambdify)
    assert f.D.P(g, False) == f.P(g, False).D + bc
Exemple #4
0
def test_D():
    
    g = Grid_1D.periodic(11)
    f = form(0, c, (cos(x),))    
    assert f.D.P(g, True) == f.P(g, True).D
    assert f.D.P(g, False) == f.P(g, False).D

    g = Grid_1D.regular(11)
    f = form(0, c, (x,))
    assert f.D.P(g, True) == f.P(g, True).D
    bc = g.boundary_condition(f.lambdify)
    assert f.D.P(g, False) == f.P(g, False).D + bc
    f = form(0, c, (x**3,))
    assert f.D.P(g, True) == f.P(g, True).D
    bc = g.boundary_condition(f.lambdify)
    assert f.D.P(g, False) == f.P(g, False).D + bc

    g = Grid_1D.chebyshev(11)
    f = form(0, c, (x,))
    assert f.D.P(g, True) == f.P(g, True).D
    bc = g.boundary_condition(f.lambdify)
    assert f.D.P(g, False) == f.P(g, False).D + bc
    f = form(0, c, (x**3,))
    assert f.D.P(g, True) == f.P(g, True).D
    bc = g.boundary_condition(f.lambdify)
    assert f.D.P(g, False) == f.P(g, False).D + bc