How could you graph a polar equation on a material?

I’m trying to create a material that can display an arbitrary polar equation, for instance a rose pattern using the equation “r = a sin nθ”. Ideally I could just switch out the “Active Function” node to create a new pattern.

I saw this thread here, but it seems to be more for modifying texture UVs:

Here’s an image of my material, the custom cosine node just returns the result of cos(CoordX):

The custom “Draw Graph” node may messing things up too but I don’t know. (Function shown in image)

Any help would be massively appreciated, thanks!

Hello! Yo can just express radial equation with X, Y and after that use if node that will check equation with some accuracy level. if node is very simple: you give it A and B and diffrent values for A > B, A == B, A < B cases…