Re: [Tutor] ploting of a square well

2012-02-05 Thread Asokan Pichai
On Sun, Feb 5, 2012 at 11:16 PM, Asokan Pichai wrote: > Try changing > plot(x, v) > to > plot(x, v(x)) > > Asokan Pichai But your v(x) is probably in need of changing. I am answering from a machine with a small screen and no python Hence no definite statements. Asokan Pichai

Re: [Tutor] ploting of a square well

2012-02-05 Thread Asokan Pichai
Try changing plot(x, v) to plot(x, v(x)) Asokan Pichai We are all atheists about most of the gods that societies have ever believed in. Some of us just go one god further. – Richard Dawkins ___ Tutor maillist - Tutor@python.org To unsubscribe or chang

Re: [Tutor] ploting of a square well

2012-02-05 Thread Peter Otten
Debashish Saha wrote: > from pylab import * > x=linspace(1,1000,1) > a,b = 10,20 > def v(x): > i=5;v0=2 > for n in range(1,1+i): > if x>(n-1)*(a+b) and x return 0 > elif x>a+(n-1)*(a+b) and x<(n)*(a+b) : > return v0 > #v=vectorize(v) > plot(x,v)

[Tutor] ploting of a square well

2012-02-05 Thread Debashish Saha
-- Forwarded message -- From: Debashish Saha Date: Sun, Feb 5, 2012 at 7:08 PM Subject: ploting of a square well To: tutor@python.org from pylab import * x=linspace(1,1000,1) a,b = 10,20 def v(x):    i=5;v0=2    for n in range(1,1+i):        if x>(n-1)*(a+b) and xa+(n-1)*(a+b

Re: [Tutor] ploting of a square well

2012-02-05 Thread Alan Gauld
On 05/02/12 13:38, Debashish Saha wrote: Error: x and y must have same first dimension Please send the complete error message not just the last line or a summary. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tuto

[Tutor] ploting of a square well

2012-02-05 Thread Debashish Saha
from pylab import * x=linspace(1,1000,1) a,b = 10,20 def v(x): i=5;v0=2 for n in range(1,1+i): if x>(n-1)*(a+b) and xa+(n-1)*(a+b) and x<(n)*(a+b) : return v0 #v=vectorize(v) plot(x,v) show() Error: x and y must have same first dimension Question: what is to be edit