Ask Your Question

Revision history [back]

It's because in parametric_plot(f(t), (t, 0, 4*r + 2*pi*r)), the Python function f is evaluated with the symbolic variable t as an input, prior to giving any concrete value to t:

sage: f(t)
(-4*pi + t - 8, -2)

To get the expected plot, you must split f in two by defining

sage: def f0(x): return f(x)[0]
sage: def f1(x): return f(x)[1]

Then

sage: parametric_plot([f0, f1], (t, 0, 4*r + 2*pi*r))

gives the plot that you want. Note that in the above command, one must write [f0,f1] and not [f0(t),f1(t)]: the latter would reproduce the incorrect behavior, by first evaluating f0 and f1 on the symbolic variable t.