Exemplo n.º 1
0
def test_get_labels():
    X = ADnum(1, der=1)
    Y = ADmath.sin(X) + 3
    labs = ADgraph.get_labels(Y)
    assert labs[X] == 'X0'
    assert labs[Y] == 'X2'
    assert len(labs) == 4
Exemplo n.º 2
0
def test_get_colorsandsizes():
    X = ADnum(1, der=1)
    Y = ADmath.sin(X) + 3
    labs = ADgraph.get_labels(Y)
    G = ADgraph.gen_graph(Y)
    cols = ADgraph.get_colors(G, Y)
    sizes = ADgraph.get_sizes(G, Y, labs)
    assert len(cols) == 4
    assert len(sizes) == 4
Exemplo n.º 3
0
 def Y(x):
     return ADmath.sin(x)
Exemplo n.º 4
0
def test_gen_table():
    X = ADnum(1, der=1)
    Y = ADmath.sin(X) + 3
    dat = ADgraph.gen_table(Y)
    assert type(dat) == pandas.core.frame.DataFrame
Exemplo n.º 5
0
def test_draw_graph():
    X = ADnum(1, der=1)
    Y = ADmath.sin(X) + 3
    fig = ADgraph.draw_graph(Y)
    assert type(fig) == matplotlib.figure.Figure
Exemplo n.º 6
0
def test_sinxcosx():
    x = ADnum(0, der=1)
    f = ADmath.sin(x) * ADmath.cos(x)
    assert f.val == np.sin(0) * np.cos(0)
    assert f.der == -(np.sin(0)**2) + np.cos(0)**2
Exemplo n.º 7
0
def test_ADmath_sinr():
    X = np.pi
    Y = ADmath.sin(X)
    assert Y == np.sin(np.pi)
Exemplo n.º 8
0
def test_ADmath_sin():
    X = ADnum(np.pi, der=1)
    Y = ADmath.sin(X)
    assert Y.val == np.sin(np.pi)
    assert Y.der == np.cos(np.pi)
    assert len(Y.graph) == 1