# generalised polynomials visualised

Discussion in 'C++' started by galathaea, Dec 21, 2006.

1. ### galathaeaGuest

you will fall in love

!! these are the cutest critters !!

3-ary polynomial:
http://i10.tinypic.com/2hwlir6.png

4-ary polynomial:
full
http://i13.tinypic.com/47u0yfm.png
close
http://i14.tinypic.com/2heajo5.png

5-ary polynomial:
full
http://i18.tinypic.com/2cifxja.png
close
http://i16.tinypic.com/2wcr9js.png

6-ary polynomial:
full
http://i14.tinypic.com/4fy3wd3.png
close
http://i17.tinypic.com/48zmlbl.png

7-ary polynomial:
full
http://i18.tinypic.com/2dalt9l.png
close
http://i10.tinypic.com/2j4rc7o.png

these are plots
of the class of generalised polynomials
i have been playing with

2 pi i / n
w = e
n

2 3 n-1
w_n w_n w_n w_n
y = x + x + x + x + ... + x
n

i coded the poynomials
in my openGL simulations engine
and color mapped the absolute value
over a part of the complex plane centered at the origin
x axis real positive to right
y axis imaginary positive up

there are a lot of immediate conjectures to make
but they are also tantalisingly difficult to prove

the zeroes (black) appear to have
some interesting number theoretic information

but above all they are adorable

the surfaces are fascinating
with the symmetries of their ripples
and the intricacies of their "mouths"

has their tale already been told?
or is this one those stories
that still needs to be written?

-+-+-

for those interested in the simulation
the behavior is coded as c++ or OCaml
( this particular class of functions in c++ )

first i define omega (w above)
or pull it from my library
something like

std::complex<double> const nthRoot(std::exp(2. * pi * i /
std::complex<double>(n, 0.)));

now i was using runtime variation of arity
but i also have a compiletime version as well
to unroll the loops
remove loop counter
and other optimisations

but it didn't make much a difference in time
having to compile so often

std::complex<double> rootOfUnityGeneralisedPolynomial(unsigned n,
std::complex<double> const& z)
{
std::complex<double> sum(0., 0.);

for (unsigned termIndex(0); termIndex < n; ++termIndex)
{
std::complex<double> term(std::exp(std:ow(nthRoot, termIndex) *
std::log(z)));
sum += term;

//std::cout << "current term: " << term << std::endl;
//std::cout << "running sum: " << sum << std::endl;
}

return sum;
}

the simulator has visualisers for the complex plane

so i ran these through the engine
and colored it pretty!

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
galathaea: prankster, fablist, magician, liar

galathaea, Dec 21, 2006