I tried the following:
Am_cor=np.vectorize(Am_cor)
#plt.plot(t, signal, color='blue', label='Original signal')
fig=plt.figure()
plt.xlabel('Time(minute)')
plt.ylabel('$ Re()$')
plt.xlim([t[0], t[-1]])
plt.ylim((-.3*a1-a1,a1+.3*a1))
plt.grid()
plt.plot(t,Am_cor(t),'o-',label='with parallax', marke
In the following you can see data from a ephemeris.txt file. Now I want to
retrieve several columns(say, for example the column starting with 00:00,
27.69 and 44.1) and name the array as x,y,z. What do I have to I tried this
x, y, z = numpy.loadtxt("ephemeris.txt", unpack=True)
And got this error
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
from __future__ import division
import numpy
from enthought.mayavi import mlab
for r in range (1,5):
print r
pi = numpy.pi
cos = numpy.cos
sin = numpy.sin
dphi, dtheta, dz = pi/250.0, pi/250.0, 0.01
[s,theta]=numpy.mgrid[0.01:r+0.015:.01,0:2*pi+dtheta*1.5:dtheta]
x=s*co
import numpy
from enthought.mayavi import mlab
#def test_mesh():
#"""A very pretty picture of spherical harmonics translated from
#the octaviz example."""
for r in range (1,5):
print r
pi = numpy.pi
cos = numpy.cos
sin = numpy.sin
dphi, dtheta, dz = pi/250.0, pi/250.0, 0
suppose i want to print 'hello world' in color blue.so what to do?
i tried
print 'hello world','blue'
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
actually a i ran a progam in python which is sufficiently large . so i
want to stop the execution of the program now . how can i do this?
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman
import numpy as np
import matplotlib.pyplot as plt
E=[81.97400737666324, 322.0939978589591, 694.5766491226185]
V0=1000
a=0.1
def V(x):
if x > -a and x < a:
return 0
return V0
V=np.vectorize(V)
#psi=np.vectorize(psi)
x= np.linspace(-1.5*a,1.5*a,100)
plt.plot(x,V(x))
plt.xlim(-5*a,5
ImportError Traceback (most recent call last)
C:\Python27\lib\site-packages\IPython\utils\py3compat.pyc in
execfile(fname, glob, loc)
166 else:
167 filename = fname
--> 168 exec compile(scripttext, filename, 'exec') in gl
how to change the current working directory path in ipython.
my current directory path is
pwd
Out[2]: u'C:\\Users\\as'
now if i want to take the path to a subfolder of above
'C:\\Users\\as', what do i have to do?
_
for i in range(1, 8):
print(i)
if i==3:
break
else:
print('The for loop is over')
Output:
1
2
3
Question:
but after breaking the for loop why the else loop could not work?
___
Tutor maillist - Tutor@python.org
To unsubscribe or c
for i in range(1, 8):
print(i)
if i==3:
break
else:
print('The for loop is over')
Output:
1
2
3
Question:but after breaking the for loop why the else command could not work?
___
Tutor maillist - Tutor@python.org
To unsubscribe or
what is the basic difference between the commands
import pylab as *
import matplotlib.pyplot as plt
import numpy as np
import numpy as *
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/
-- 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)
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
*input:*
import numpy as np
def f(y):
return (y/5)*2*(np.pi)*0.2
*results:*
f(11)
Out[109]: 2.5132741228718345
f(11.0)
Out[110]: 2.7646015351590183
*question:*
why did i get different values for the same input?
___
Tutor maillist - Tutor@python.
*PROGRAM TO FIND FACTORIAL OF A NUMBER(I HAVE WRITTEN IT ON GEDIT)*
x=1
n=input('enter a positive integer no:')
for i in range(1,1+n):
x=x*i
print x
*ERROR:*
enter a positive integer
no:---
EOFError
INPUT:
*for n in range(2, 1000):*
*for x in range(2, n):*
*if n % x == 0:*
*print n, 'equals', x, '*', n/x*
*break*
*else:*
*# loop fell through without finding a factor*
*print n, 'is a prime number'*
OUTPUT:
2 is a prime number
what is the basic difference between numpy and pylab?
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
20 matches
Mail list logo