Changeset 8038:b49f4a637a6f


Ignore:
Timestamp:
01/09/08 15:27:02 (5 years ago)
Author:
Bobby Moretti <bobmoretti@…>
Branch:
default
Message:

Fixed plot.py so all doctests passed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sage/plot/plot.py

    r8037 r8038  
    23202320        1 
    23212321        sage: len(P[0])  # how many points were computed 
    2322         201 
     2322        200i 
    23232323        sage: P          # render 
    23242324         
     
    24302430            G = Graphics() 
    24312431            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) 
    24332433            return G 
    24342434 
     
    24372437 
    24382438        exceptions = 0; msg='' 
    2439         for i in range(plot_points+1): 
     2439        for i in range(plot_points): 
    24402440            xi = xmin + i*delta 
    24412441            if i < plot_points: 
     
    30463046    else: 
    30473047        raise ValueError, "parametric value range must be a list of 2 or 3-tuple." 
     3048 
     3049    a = float(a) 
     3050    b = float(b) 
    30483051    if plot_points == 2: 
    30493052        return var, [a, b] 
    30503053    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.