What is the simplest method to get a vector result?

fl rxjwg98 at gmail.com
Thu Jul 24 08:53:12 EDT 2014


Hi,
I have read a lot about Python, but it still has a problem now on a simple
exercise. For example, I want to generate a sine curve. First, I get a time 
sequence: 

index=range(100)

I import math module, try to calculate sine with

math.sin(index*math.pi/2)

but it fails.

It is possible to use a for loop, but I don't know how to save each result to an
array.

I have gone through several tutorial, but they are all about using print right
away. I want to get an array, or a series, then plot it with 

import matplotlib.pyplot as plt

I have installed plot module and it works already. I am a little hurry for an 
project interview and would like to ask here besides I continue search on 
tutorial.


Thanks,



More information about the Python-list mailing list