Supertoroid - Plotting Code

Plotting Code

The following GNU Octave code generates plots of a supertorus:

function supertoroid(epsilon,a) n=50; d=.1; etamax=pi; etamin=-pi; wmax=pi; wmin=-pi; deta=(etamax-etamin)/n; dw=(wmax-wmin)/n; k=0; l=0; for i=1:n+1 eta(i)=etamin+(i-1)*deta; for j=1:n+1 w(j)=wmin+(j-1)*dw; x(i,j)=a(1)*(a(4)+sign(cos(eta(i)))*abs(cos(eta(i)))^epsilon(1))*sign(cos(w(j)))*abs(cos(w(j)))^epsilon(2); y(i,j)=a(2)*(a(4)+sign(cos(eta(i)))*abs(cos(eta(i)))^epsilon(1))*sign(sin(w(j)))*abs(sin(w(j)))^epsilon(2); z(i,j)=a(3)*sign(sin(eta(i)))*abs(sin(eta(i)))^epsilon(1); endfor; endfor; mesh(x,y,z); endfunction;

Read more about this topic:  Supertoroid

Famous quotes containing the words plotting and/or code:

    I’m plotting revolution against this lie that the majority has a monopoly of the truth. What are these truths that always bring the majority rallying round? Truths so elderly they are practically senile. And when a truth is as old as that, gentlemen, you can hardly tell it from a lie.
    Henrik Ibsen (1828–1906)

    ...I had grown up in a world that was dominated by immature age. Not by vigorous immaturity, but by immaturity that was old and tired and prudent, that loved ritual and rubric, and was utterly wanting in curiosity about the new and the strange. Its era has passed away, and the world it made has crumbled around us. Its finest creation, a code of manners, has been ridiculed and discarded.
    Ellen Glasgow (1873–1945)