Math3d—a bit rough around the edges, but works well once you figure out the quirks. From what I can tell it doesn't understand juxtaposition multiplication with variables, i.e. you need to write sin(n⋅θ) instead of sin(nθ).
Graph a torus with major radius K and minor radius k.