Ask Your Question

Revision history [back]

The answers by @dazedANDconfused and @tmonteil are correct.

To save time if you were doing computations on a larger scale, you could also

  • use a numerical value for pi instead of the symbolic version of pi,
  • calculate $mrw^2$ once and for all,
  • calculate the ratio pi/180 once and for all,
  • use a lambda function instead of a symbolic function.

Combining those, you could write:

sage: m, r, w = 5, 3, 6
sage: mrw2 = m * r * w^2
sage: deg_rad = RDF.pi() / 180    # degree to radian conversion factor
sage: ff = lambda t: mrw2 * cos(t * deg_rad)
sage: plot(ff, 0, 360)

Of course, this is a bit pointless here: who cares if it takes 4 ms or 40 ms for computing the plot, when displaying the plot takes much longer than that.