Changeset 8038:b49f4a637a6f
- Timestamp:
- 01/09/08 15:27:02 (5 years ago)
- Branch:
- default
- File:
-
- 1 edited
-
sage/plot/plot.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sage/plot/plot.py
r8037 r8038 2320 2320 1 2321 2321 sage: len(P[0]) # how many points were computed 2322 20 12322 200i 2323 2323 sage: P # render 2324 2324 … … 2430 2430 G = Graphics() 2431 2431 for i in range(0, len(funcs)): 2432 G += plot(funcs[i], xmin=xmin, xmax=xmax, polar=polar, **kwds)2432 G += plot(funcs[i], (xmin, xmax), polar=polar, **kwds) 2433 2433 return G 2434 2434 … … 2437 2437 2438 2438 exceptions = 0; msg='' 2439 for i in range(plot_points +1):2439 for i in range(plot_points): 2440 2440 xi = xmin + i*delta 2441 2441 if i < plot_points: … … 3046 3046 else: 3047 3047 raise ValueError, "parametric value range must be a list of 2 or 3-tuple." 3048 3049 a = float(a) 3050 b = float(b) 3048 3051 if plot_points == 2: 3049 3052 return var, [a, b] 3050 3053 else: 3051 rng = float_range(a,b, float(b-a)/(plot_points)) 3052 rng.append(float(b)) 3053 return var, rng 3054 3055 def float_range(a, b, step): 3056 """ 3057 Returns the 3058 """ 3059 (a,b,step) = (float(a),float(b),float(step)) 3060 v = [a] 3061 w = a + step 3062 while w < b: 3063 v.append(w) 3064 w += step 3065 if w <= b: 3066 v.append(b) 3067 return v 3054 step = (b-a)/float(plot_points) 3055 values = [a + step*i for i in xrange(plot_points)] 3056 # want to make sure that we plot exactly as many points as requested 3057 # rng.append(b) 3058 return var, values 3059 3060 # def float_range(a, b, step): 3061 # """ 3062 # Returns a list of floating point numbers from a to b with the 3063 # given step 3064 # """ 3065 # (a,b,step) = (float(a),float(b),float(step)) 3066 # v = [a] 3067 # w = a + step 3068 # while w < b: 3069 # v.append(w) 3070 # w += step 3071 # if w < b: 3072 # v.append(b) 3073 # return v
Note: See TracChangeset
for help on using the changeset viewer.
