Ir para conteúdo
Fórum Script Brasil
  • 0

Erro = ' UFuncTypeError: ufunc 'multiply' did not contain a loop with signature matching types (dtype('<U32'), dtype('<U32')) -> dtype('<U32')'


Lucass Zek

Pergunta

Estou com o seguinte programa para rodar

 

N_0 = input('Give initial population size N_0: ')
r   = input('Give net growth rate r: ')
dt  = input('Give time step size: ')
N_t = input('Give number of steps: ')
t = np.linspace(0, (int(N_t)+1)*int(dt), int(N_t)+2)
N = np.zeros(int(N_t)+2)

N[0] = N_0
for n in range(int(N_t)+1):
    N[int(n)+1] = N[int(n)] + int(r)*int(dt)*N[int(n)]

import matplotlib.pyplot as plt
numerical_sol = 'bo' if int(N_t) < 70 else 'b-'
plt.plot(t, N, numerical_sol, t, N_0*np.exp(r*t), 'r-')
plt.legend(['numerical', 'exact'], loc='upper left')
plt.xlabel('t'); plt.ylabel('N(t)')
filestem = 'growth1_%dsteps' % N_t
plt.savefig('%s.png' % filestem); plt.savefig('%s.pdf' % filestem)

e está dando o seguinte erro:

 

---> 14 plt.plot(t, N, numerical_sol, t, N_0*np.exp(r*t), 'r-')
     15 plt.legend(['numerical', 'exact'], loc='upper left')
     16 plt.xlabel('t'); plt.ylabel('N(t)')

UFuncTypeError: ufunc 'multiply' did not contain a loop with signature matching types (dtype('<U32'), dtype('<U32')) -> dtype('<U32')

alguém sabe como solucionar
Link para o comentário
Compartilhar em outros sites

0 respostass a esta questão

Posts Recomendados

Até agora não há respostas para essa pergunta

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152k
    • Posts
      651,8k
×
×
  • Criar Novo...