All Samples(6995) | Call(6445) | Derive(0) | Import(550)
arange([start,] stop[, step,], dtype=None)
Return evenly spaced values within a given interval.
Values are generated within the half-open interval ``[start, stop)``
(in other words, the interval including `start` but excluding `stop`).
For integer arguments the function is equivalent to the Python built-in
`range <http://docs.python.org/lib/built-in-funcs.html>`_ function,
but returns a ndarray rather than a list.
Parameters
----------
start : number, optional
Start of interval. The interval includes this value. The default
start value is 0.
stop : number
End of interval. The interval does not include this value.
step : number, optional
Spacing between values. For any output `out`, this is the distance
between two adjacent values, ``out[i+1] - out[i]``. The default
step size is 1. If `step` is specified, `start` must also be given.
dtype : dtype
The type of the output array. If `dtype` is not given, infer the data
type from the other input arguments.
Returns
-------
out : ndarray
Array of evenly spaced values.
For floating point arguments, the length of the result is
``ceil((stop - start)/step)``. Because of floating point overflow,
this rule may result in the last element of `out` being greater
than `stop`.
See Also
--------
linspace : Evenly spaced numbers with careful handling of endpoints.
ogrid: Arrays of evenly spaced numbers in N-dimensions
mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions
Examples
--------
>>> np.arange(3)
array([0, 1, 2])
>>> np.arange(3.0)
array([ 0., 1., 2.])
>>> np.arange(3,7)
array([3, 4, 5, 6])
>>> np.arange(3,7,2)
array([3, 5])src/p/y/pydy-HEAD/examples/rollingdisc/plot_rollingdisc.py pydy(Download)
#!/usr/bin/env python import rollingdisc_lib as rd from scipy.integrate import odeint from numpy import array, arange, zeros, roots, sin, cos, tan, pi, complex import matplotlib.pyplot as plt # Dimensions of a quarter
def plot_eval():
#### Eigenvalue plot #####
u2 = arange(-30, 30.01, 0.01, dtype=complex)
n = len(u1)
eval = zeros((n,3), dtype=complex)
for i, u in enumerate(u1):
eval[i] = rd.evals(u, (g, r))
ti = 0.0 ts = 0.001 tf = 1.0 t = arange(ti, tf+ts, ts) n = len(t) # Integrate the differential equations x = odeint(rd.eoms, xi, t, args=(params,))
src/m/a/matplotlib-HEAD/matplotlib/examples/pylab_examples/vline_demo.py matplotlib(Download)
#!/usr/bin/env python
from matplotlib.pyplot import *
from numpy import sin, exp, absolute, pi, arange
from numpy.random import normal
def f(t):
s1 = sin(2*pi*t)
e1 = exp(-t)
return absolute((s1*e1))+.05
t = arange(0.0, 5.0, 0.1)
src/m/a/matplotlib-HEAD/matplotlib/examples/pylab_examples/color_by_yvalue.py matplotlib(Download)
# use masked arrays to plot a line with different colors by y-value from numpy import logical_or, arange, sin, pi from numpy import ma from matplotlib.pyplot import plot, show t = arange(0.0, 2.0, 0.01) s = sin(2*pi*t)
src/m/a/matplotlib-HEAD/examples/pylab_examples/vline_demo.py matplotlib(Download)
#!/usr/bin/env python
from matplotlib.pyplot import *
from numpy import sin, exp, absolute, pi, arange
from numpy.random import normal
def f(t):
s1 = sin(2*pi*t)
e1 = exp(-t)
return absolute((s1*e1))+.05
t = arange(0.0, 5.0, 0.1)
src/m/a/matplotlib-HEAD/examples/pylab_examples/color_by_yvalue.py matplotlib(Download)
# use masked arrays to plot a line with different colors by y-value from numpy import logical_or, arange, sin, pi from numpy import ma from matplotlib.pyplot import plot, show t = arange(0.0, 2.0, 0.01) s = sin(2*pi*t)
src/o/p/openrave-HEAD/trunk/python/examples/hanoi.py openrave(Download)
from openravepy import Environment, IkParameterization, planning_error, raveLogInfo, raveLogWarn, OpenRAVEGlobalArguments, RaveDestroy from openravepy.interfaces import BaseManipulation, TaskManipulation from openravepy.databases import inversekinematics from numpy import array, arange, linalg, pi, dot, vstack, cos, sin, cross, r_, c_ from optparse import OptionParser class HanoiPuzzle:
Tdiff = dot(linalg.inv(Tdisk), Thand)
# iterate across all possible orientations the destination peg can be in
for ang in arange(-pi,pi,0.3):
# find the dest position
p = Tpeg[0:3,3:4] + height * dest_upvec
R = dot(Tpeg[0:3,0:3], array(((cos(ang),-sin(ang),0),(sin(ang),cos(ang),0),(0,0,1))))
def hanoimove(self, disk, srcpeg, destpeg, height):
"""Moves the arm and manipulator to grasp a peg and place it on a different peg"""
openhandfn = lambda: self.MoveToPosition([-0.7],self.robot.GetActiveManipulator().GetGripperIndices())
openhandfn()
Tdisk = disk.GetTransform()
for ang2 in arange(-pi/2,1.5*pi,0.4):
for ang1 in arange(-0.8,0,0.2):
src/o/p/openrave-HEAD/python/examples/hanoi.py openrave(Download)
from openravepy import Environment, IkParameterization, planning_error, raveLogInfo, raveLogWarn, OpenRAVEGlobalArguments from openravepy.interfaces import BaseManipulation, TaskManipulation from openravepy.databases import inversekinematics from numpy import array, arange, linalg, pi, dot, vstack, cos, sin, cross, r_, c_ from optparse import OptionParser class HanoiPuzzle:
Tdiff = dot(linalg.inv(Tdisk), Thand)
# iterate across all possible orientations the destination peg can be in
for ang in arange(-pi,pi,0.3):
# find the dest position
p = Tpeg[0:3,3:4] + height * dest_upvec
R = dot(Tpeg[0:3,0:3], array(((cos(ang),-sin(ang),0),(sin(ang),cos(ang),0),(0,0,1))))
def hanoimove(self, disk, srcpeg, destpeg, height):
"""Moves the arm and manipulator to grasp a peg and place it on a different peg"""
openhandfn = lambda: self.MoveToPosition([-0.7],self.robot.GetActiveManipulator().GetGripperIndices())
openhandfn()
Tdisk = disk.GetTransform()
for ang2 in arange(-pi/2,1.5*pi,0.4):
for ang1 in arange(-0.8,0,0.2):
src/m/a/Matplotlib--JJ-s-dev-HEAD/examples/pylab_examples/vline_demo.py Matplotlib--JJ-s-dev(Download)
#!/usr/bin/env python
from matplotlib.pyplot import *
from numpy import sin, exp, absolute, pi, arange
from numpy.random import normal
def f(t):
s1 = sin(2*pi*t)
e1 = exp(-t)
return absolute((s1*e1))+.05
t = arange(0.0, 5.0, 0.1)
src/m/a/matplotlib-HEAD/matplotlib/examples/pylab_examples/scatter_custom_symbol.py matplotlib(Download)
from matplotlib.pyplot import figure, show from numpy import arange, pi, cos, sin, pi from numpy.random import rand # unit area ellipse rx, ry = 3., 1. area = rx * ry * pi theta = arange(0, 2*pi+0.01, 0.1)
src/m/a/Matplotlib--JJ-s-dev-HEAD/examples/pylab_examples/color_by_yvalue.py Matplotlib--JJ-s-dev(Download)
# use masked arrays to plot a line with different colors by y-value from numpy import logical_or, arange, sin, pi from numpy import ma from matplotlib.pyplot import plot, show t = arange(0.0, 2.0, 0.01) s = sin(2*pi*t)
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next