P.S. Sorry there is an error in the above post. Of course the counter
should be integer.
This is the best I could do.
x0=0.;xend=2.*pi;n=8.;h=(xend-x0)/n;
y=numpy.ones(n+1)
y=[y[j]*cos(x0+j*h) for j in [0..n]]
y
If anyone knows of an easier or more intuitive way OR how to this array to
print
You can create a numpy array from a list with
numpy.array([cos(x) for x in range(x0, xend, h)])
or if you want to avoid using python lists at al costs, you can do
numpy.cos(arrange(x0, xend, h))
arange is the numpy equivalent to range, creating an array instead of a
list,
and then you can
Thanks indeed Juan, it did help immensely! I couldn't get array to work and
your example finally clicked for me.
In the end, I used: w=numpy.array([cos(x0+j*h) for j in range(n+1)], float)
THANKS. Linda
--
You received this message because you are subscribed to the Google Groups
sage-support
On Monday, December 31, 2012 4:52:37 PM UTC+1, LFS wrote:
Thanks indeed Juan, it did help immensely! I couldn't get array to work
and your example finally clicked for me.
In the end, I used: w=numpy.array([cos(x0+j*h) for j in range(n+1)],
float)
THANKS. Linda
Hi, you line will work,
Thank you Harald. Actually, I think I do need the whole list/array with the
function evaluated - either as a list or an array. (I am working the
TriDiagonal Algorithm.). I am an in-between person. I have found that the
students make no connection between their engineering classes that often
On Mon, Dec 31, 2012 at 7:44 PM, LFS lfahlb...@gmail.com wrote:
Thank you Harald.
np, i'm just heading to a party, so, just a short answer:
I need the simplest most intuitive
format possible with the least number of commands.
ok, then i suggest you to use python lists, nothing else. and tell
Short letter indeed! Full of extremely useful information on so many
levels. Thank-you SO much. Linda
--
You received this message because you are subscribed to the Google Groups
sage-support group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this