Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Variable range()

Hello, I have the following code:

def f(a,b,c,x):
    xtemp=a
    for i in range(b,x):
        xtemp=xtemp-xtemp*c
    return xtemp   
var('t')
plot(f(10000000,1,0.01,t),3,20)

and got the error

TypeError: range() integer end argument expected, got
sage.symbolic.expression.Expression.

I understand that range does nor support 'var' object, but how can I have a variable range in this kind of function?