# Revision history [back]

The error " list index out of range" means you are trying to index a list beyond it's boundary.

In the code:

for i in (1,4):
phi[i]=1


you are iterating over the tuple (1,4), this means i will take the values 1 and 4 in the loop. Perhaps you want to replace (1,4) by range(1,4) like you have in loops above. This will cause i to take the values 1,2,3.

Another comment, probably unrelated to your error, in the definition:

It = lambda f: integral(f,t,0,t)


represents a very common Calculus I student error. You are trying to use t as both the integration variable and the limit of integration. This does not make sense mathematically. If you want the resulting function to be a function of t (the variable that you want to assume is > 0), use a dummy variable in your integration, e.g.

var('s')
It = lambda f: integral(f(s),s,0,t) 2 No.2 Revision

The error " list index out of range" means you are trying to index a list beyond it's its boundary.

In the code:

for i in (1,4):
phi[i]=1


you are iterating over the tuple (1,4), this means i will take the values 1 and 4 in the loop. Perhaps you want to replace (1,4) by range(1,4) like you have in loops above. This will cause i to take the values 1,2,3.

Another comment, probably unrelated to your error, in the definition:

It = lambda f: integral(f,t,0,t)


represents a very common Calculus I student error. You are trying to use t as both the integration variable and the limit of integration. This does not make sense mathematically. If you want the resulting function to be a function of t (the variable that you want to assume is > 0), use a dummy variable in your integration, e.g.

var('s')
It = lambda f: integral(f(s),s,0,t)