tags:

views:

119

answers:

1

I'm trying to pass the values that I want numpy.arange to use.

The code is:

for x in numpy.arange(argument)

where argument is:

argument = (.1,6.3,.1) (tuple)

TypeError: arange: scaler arguements expected instead of a tuple

arguement = [.1,6.3,.1] (list)

TypeError: unsupported operand type(s) for -: 'str' and 'int'

arguement = '.1,6.3,.1' (string)

TypeError: unsupported operand type(s) for -: 'str' and 'int'

and I've tried putting the tuple and list in a string. None of these have worked.

I've searched the literature and can find no reference to this.

Any insights would be appreciated.

+2  A: 

arange is like python's range function.

Perhaps you were looking for numpy.array?

Or maybe you really did want the range to be from 0.1 to 6.3 in steps of 0.1. In that case, use Python's argument unpacking syntax:

arguments = (.1, 6.3, .1)
numpy.arange(*arguments)
kwatford
I had to change 'argument =...' to 'arguments =...' and then it worked. I'll have to read up on Python's argument unpacking sytax.Thanks
Peter Stewart