generalised polynomials visualised

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

  1. galathaea

    galathaea Guest

    you will fall in love

    !! these are the cutest critters !!

    3-ary polynomial:

    4-ary polynomial:

    5-ary polynomial:

    6-ary polynomial:

    7-ary polynomial:

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

    2 pi i / n
    w = e

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

    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::pow(nthRoot, termIndex) *
    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
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.