Ask Your Question
0

computation limtations in Sage cloud

asked 2013-11-16 06:26:51 +0100

marv gravatar image

updated 2015-01-13 21:16:13 +0100

FrédéricC gravatar image

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 flag offensive close merge delete

Comments

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.

tmonteil gravatar imagetmonteil ( 2013-11-16 06:58:08 +0100 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2013-11-16 07:29:28 +0100

marv gravatar image

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 = [0]
c1 = [0]
c12 = [0]
c2 = [0]
tList = [0]

#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[0]-c123[i])/c123[0]
        print "Selektivität 13:", (c13[i]-c13[0])/(c123[0]-c123[i])
        ausbeute13 = (c13[i]-c13[0])/c123[0]
        print "Ausbeute 13:", ausbeute13
        print "Selektivität 12:", (c12[i]-c12[0])/(c123[0]-c123[i])
        print "Selektivität 1:", (c1[i]-c1[0])/(c123[0]-c123[i])
        print "Selektivität 2:", (c2[i]-c2[0])/(c123[0]-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()
edit flag offensive delete link more

Comments

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

tmonteil gravatar imagetmonteil ( 2013-11-17 06:41:54 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-11-16 06:26:51 +0100

Seen: 433 times

Last updated: Nov 16 '13