freedom_razor

03-12-2009, 09:29 PM

I'm trying to construct parametric equations for butterfly curve in Javascript, but it's been a long time since my math classes and I don't really remember the stuff.

Anyway, I've got this:

x=Math.sin(t)*( (Math.exp(Math.cos(t))) - (2*Math.cos(4*t)) - (Math.sin(t/12)^5) )

y=Math.cos(t)*( (Math.exp(Math.cos(t))) - (2*Math.cos(4*t)) - (Math.sin(t/12)^5) )

Assuming that equations are right [I don't really know, I've tried to translate them to Javascript from some articles - corrections most welcome], what exactly I have to do with t?

I'm not sure what value should it have. I think it should be some kind of range of values, but I don't know exactly what range.

I've tried just slowly incrementing value [from 0, by .01], but the curve does not look like butterfly curve, similar maybe, but certainly it isn't butterfly.

Anyway, I've got this:

x=Math.sin(t)*( (Math.exp(Math.cos(t))) - (2*Math.cos(4*t)) - (Math.sin(t/12)^5) )

y=Math.cos(t)*( (Math.exp(Math.cos(t))) - (2*Math.cos(4*t)) - (Math.sin(t/12)^5) )

Assuming that equations are right [I don't really know, I've tried to translate them to Javascript from some articles - corrections most welcome], what exactly I have to do with t?

I'm not sure what value should it have. I think it should be some kind of range of values, but I don't know exactly what range.

I've tried just slowly incrementing value [from 0, by .01], but the curve does not look like butterfly curve, similar maybe, but certainly it isn't butterfly.