Using arrays in Python - problems.

attackwarningred attackwarningred at yahoo.co.uk
Tue Oct 23 18:44:20 EDT 2007


Dear All,
         Hello! I've just started to use Python and its a lovely 
language! I've previously programmed in Fortran 95 and have just began 
to use numpy. I'm having a few problems with arrays in Python though and 
wondered if someone could offer me some advice?
    I wrote the following Fortran code to randomly generate numbers from 
a log-normal distribution for use in a Monte Carlo model:

do n=1,shotcount
	F(n)=G05DEF(F_mean,F_sd)
enddo

The array F(n) is dynamically allocated earlier on and is sized with 
reference to shotcount, the number of iterations the model performs. The 
problem is I can't get something like this to run in Python using numpy, 
and for the size of the array to be sized dynamically with reference to 
the variable shotcount. I acknowledge that my knowledge of Python is 
still really basic (I only started learning it a few days ago) and I'm 
trying to get out of the Fortran programming mindset but I'm stuck and 
don't seem to be able to get any further. If anyone could help I'd be 
really grateful. Thanks very much in advance.

Best wishes,
Gareth.

-- 

attackwarningred at yahoo.co.uk

665.9238429876 - Number of the Pentium Beast



More information about the Python-list mailing list