Foros del Web » Programando para Internet » Python »

Problem with python syntax error

Estas en el tema de Problem with python syntax error en el foro de Python en Foros del Web. ENG: Hi guys I have been doing this code and i dont understad why there is a syntax error in the line of: Msecm=(1./(3.*km))*J+(1./(2.*mum))*K I ...
  #1 (permalink)  
Antiguo 14/01/2016, 13:24
 
Fecha de Ingreso: enero-2016
Mensajes: 1
Antigüedad: 8 años, 3 meses
Puntos: 0
Problem with python syntax error

ENG: Hi guys I have been doing this code and i dont understad why there is a syntax error in the line of: Msecm=(1./(3.*km))*J+(1./(2.*mum))*K
I cannot see the mistake. if anyone of you know the reason please tell me. Im desperate

ESP: Hola a todos, llevo varios días estrujándome los sesos, pero sigue apareciendo el mismo error en la misma linea. Alguno sabría decirme por que ? estoy desesperado necesito ayuda :(

Here is the code:


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)

Última edición por razpeitia; 14/01/2016 a las 15:20
  #2 (permalink)  
Antiguo 14/01/2016, 15:23
Avatar de razpeitia
Moderador
 
Fecha de Ingreso: marzo-2005
Ubicación: Monterrey, México
Mensajes: 7.321
Antigüedad: 19 años, 1 mes
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)

Etiquetas: errores, syntax
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:15.