1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] Python: only length-1 arrays can be converted to python scalars error when trying to...

Discussão em 'Python' iniciado por Stack, Outubro 1, 2024 às 01:12.

  1. Stack

    Stack Membro Participativo

    I am new to python and am attempting to graph an equation using the following code.

    import math
    import matplotlib.pyplot as plt
    import numpy as np
    # Data for plotting
    L = 0.0001
    b = 0.0079
    h = 0.405
    t = np.arange(0, 1, 0.01)
    y = 1/(b+(h*L))*[(h*L)+b*math.exp((-h+(b/L)*t))]
    plt.plot(t,y)
    plt.grid()
    plt.show()


    It returns TypeError: only length-1 arrays can be converted to Python scalars when ran. Any help would be appreciated.

    Continue reading...

Compartilhe esta Página