Ask Your Question

Revision history [back]

the plot of my function EFF is always zero, but print

sage: cnodo=[] sage: cnodo.append(0) sage: cnodo.append(.5) sage: cnodo.append(1.4) sage: cnodo.append(2) sage: def EFF(x,nodo): ....: c1=cnodo[nodo] ....: c2=cnodo[nodo+1] ....: EFF=0 ....: if (x>=c1) and (x <= c2) ....: EFF=(c2-x)/(c2-c1) ....: return EFF

the plot of my function EFF is always zero, but print

sage: cnodo=[] sage: cnodo.append(0) sage: cnodo.append(.5) sage: cnodo.append(1.4) sage: cnodo.append(2) sage: def EFF(x,nodo): ....: c1=cnodo[nodo] ....: c2=cnodo[nodo+1] ....: EFF=0 ....: if (x>=c1) and (x <= c2) ....: EFF=(c2-x)/(c2-c1) ....: return EFF

the plot of my function EFF is always zero, but print

The code:

sage: cnodo=[]
 sage: cnodo.append(0)
 sage: cnodo.append(.5)
 sage: cnodo.append(1.4)
 sage: cnodo.append(2)
 sage: def EFF(x,nodo):
 ....:     c1=cnodo[nodo]
 ....:     c2=cnodo[nodo+1]
 ....:     EFF=0
 ....:     if (x>=c1)  and (x <= c2)
 ....:         EFF=(c2-x)/(c2-c1)
 ....:     return EFF

EFF