Jump to content
Fórum Script Brasil
  • 0

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


Question

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 to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      148871
    • Total Posts
      644871
×
×
  • Create New...