HI
Ulrich Eckhardt
ulrich.eckhardt at dominolaser.com
Mon May 2 06:38:55 EDT 2011
anvar wrote:
> Could you please help me with the modeling in Python the following
> problem: (e.g., g_t means g with index t)
Typically, you would use either a list or a dict to simulate something like
that:
# list
g = [1, 2, 4, 8, 16]
print g[3]
# dictionary
h = {}
h[0] = 1
h[1] = 2
h[2] = 4
h[3] = 8
h[4] = 16
print h[3]
The difference is that a list needs elements starting at index 0 and without
any gaps, while a dictionary can contain "holes". Please refer to any
beginners' Python tutorial for info on these types.
Concerning the other formulas you posted, those ended up as completely
illegible here for the complete lack of formatting. Explaining things in
plain English along with the mathematics would be a good idea, IMHO.
Good luck!
Uli
--
Domino Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
More information about the Python-list
mailing list