Ver Mensaje Individual
  #2 (permalink)  
Antiguo 14/01/2016, 15:23
Avatar de razpeitia
razpeitia
Moderador
 
Fecha de Ingreso: marzo-2005
Ubicación: Monterrey, México
Mensajes: 7.321
Antigüedad: 19 años, 9 meses
Puntos: 1360
Respuesta: Problem with python syntax error

You missed an parenthesis one line before.

Código Python:
Ver original
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3. ki=222.2*10**3
  4. km=62.5*10**3
  5. mui=166.67*10**3
  6. mum=28.85*10**3
  7. fi=0.25
  8. J=np.matrix([[1./3.,1./3.,1./3.,0,0,0],[1./3.,1./3.,1./3.,0,0,0],[1./3.,1./3.,1./3.,0,0,0],[0,0,0,0,0,0],[0,0,0,0,0,0],[0,0,0,0,0,0]])
  9. I=np.identity(6)
  10. K=I-J
  11. x=1.
  12. sigmaeqold=0.
  13. mumsec=mum
  14. STRESS=[]
  15. STRAIN=[]
  16. E=1*10**5
  17. for a in range (401): #from 0 to 400
  18.     sigma0=np.matrix([[a],[0.],[0.],[0.],[0.],[0.]])
  19.     STRESS.append(a)#en Mpa
  20.     while x< E :
  21.         k=km+fi*(ki-km)/(1.+(1.-fi)*(ki-km)/((3.*km+4.*mumsec)/3.))
  22.         mu=mumsec+fi*(mui-mumsec)/(1.+(1.-fi)*(mui-mumsec)/((5./3.*(3.*km+4*mumsec)/(km*2*mumsec)/2)))
  23.         Msecm=(1./(3.*km))*J+(1./(2.*mum))*K  #<--(HERE IS THE SYNTAX ERROR)
  24.         Msec=(1./(3.*k))*J+(1./(2.*mu))*K
  25.         Mi=(1./(3.*ki))*J+(1./(2.*ki))*K
  26.         INV=np.linalg.inv(Msecm-Mi)
  27.         Bsecm=(1./(1-fi))*(INV-(Msec-Mi))
  28.         sigmam=Bsecm*sigma0
  29.         matrixnumber=sigmam.T*sigmam
  30.         number=float(matrixnumber)# just for making a float number from a matrix 1x1
  31.         sigmaeq= (3./2.)*(number)**0.5
  32.         mu_msec=sigmaeq/((sigmaeq/mum)+3.*(sigmaeq/400.)**(1./0.15))
  33.         x=sigmaeq-sigmaeqold
  34.         sigmaeqold=sigmaeq
  35.         strain=Msec*sigma0
  36. strainlist=list(strain)
  37. strainpop=strain.pop(1)
  38. strainvalue=float(strainpop)
  39. STRAIN.append(strainvalue)
  40. plt.plot(STRAIN,STRESS)