# computation limtations in Sage cloud Hi everybody

I'm working on an exercise in technical chemistry and try to find concentration progresses by numerical calculation. Note that im pretty new to Sage and Python.

The problem i encounter is that as soon as i want to use more than 20 iterations, Sage cloud doesn't finish. I was able to have more iterations when my loop was smaller.

Is there a limitation on the computional power, that is provided by Sage cloud? If you think the problem is with my code, I will post it.

Greetings, marv

edit retag close merge delete

I am not a user of the cloud, but you can provide your code and we can check wether it works on standard Sage installations.

Sort by » oldest newest most voted

Ok, I think i figured it out. The problem is, that i filled many lists with exact expressions and i exeeded the memmory available. Take the following lines from the loop:

c123.append(c123[i] - k1*step - k2*step)


After changing them all to something like:

c123.append(n(c123[i] - k1*step - k2*step))


everything works fine.

Thanks for tmonteil for your offering. If you want you can still take the code and have a look at your system memory. Maybe it would be good, if sage cloud tells if too much memory is used.

k1=2*10^(-4)
k1s=2*10^(-4)
k2=10^(-4)
k2s=10^(-4)
k3=5*10^(-5)
k4=10^(-4)
k5=5*10^(-5)

c123 = [2.5]
c13 = 
c1 = 
c12 = 
c2 = 
tList = 

#stepsize in seconds
step = 100
maxFound = False

for i in range(200):
#beginnt mit 0 beechnungen fü nächsten zeitschitt
t=step*i
tList.append(t)

#zwei geschwindigkeitsgesetze, beechnung fü n+1
if c123[i] > 0.5 :
c123.append(c123[i] - k1*step - k2*step)
c13.append(c13[i] + k1*step - k3*step*c13[i])
c12.append(c12[i] + k2*step - k4*step*c12[i] - k5*step*c12[i]^2)
else:
c123.append(c123[i] - k1s*step*c123[i] - k2*step*c123[i])
c13.append(c13[i] + k1s*step*c123[i] - k3*step*c13[i])
c12.append(c12[i] + k2s*step*c123[i] - k4*step*c12[i] - k5*step*c12[i]^2)
#unabhängig von dem zeitpunkt
c1.append(c1[i] + k3*step*c13[i] + k4*step*c12[i])
c2.append(c2[i] + k5*step*c12[i]^2 )

if (c13[i+1]<c13[i]) and (not maxFound):
print "Maximum found for c13 found at", t, "s, bzw. ", n(t/3600), "h"
print "Umsatz:", (c123-c123[i])/c123
print "Selektivität 13:", (c13[i]-c13)/(c123-c123[i])
ausbeute13 = (c13[i]-c13)/c123
print "Ausbeute 13:", ausbeute13
print "Selektivität 12:", (c12[i]-c12)/(c123-c123[i])
print "Selektivität 1:", (c1[i]-c1)/(c123-c123[i])
print "Selektivität 2:", (c2[i]-c2)/(c123-c123[i])
maxFound = True
#pint t, "s"
#pint c123[i], n(c13[i]), n(c1[i])
plotObject = list_plot(zip(tList,c123),plotjoined=True)
plotObject += list_plot(zip(tList,c13),plotjoined=True,color='red')
plotObject += list_plot(zip(tList,c12),plotjoined=True,color='green')
plotObject += list_plot(zip(tList,c1),plotjoined=True,color='orange')
plotObject += list_plot(zip(tList,c2),plotjoined=True,color='yellow')
plotObject.show()

more

I didn't read the code carefully, but i confirm that this is also lagging around i=25 on a standard installation.