superformula, generators

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

superformula, generators

Gregor Lingl-2
Hi all,

recently I stumbled (once more) over a posting by our friend
Daniel Ajoy about the superformula (I think it was in a Logo-Forum):

http://en.wikipedia.org/wiki/Superformula

On the other side Kirby wrote interesting suggestions
about using generators.

Now, weekend, bad weather, some sparetime, I
assembled an implementation of a superformula-viewer
using pygame. It runs with Python 2.6 or higher, also
3.x, of course

You'll find it here for download:

http://dl.dropbox.com/u/2016850/superformula.py

or appended (which sometimes / for some of you)
doesn't work well depending on the browser or whatever.

The script uses generators for generating the pointlists
of the graph of the superformula and also for generating
colors for the segments of the graph-area.

Morover I've prepared a q&d slider class, which possibly
doesn't use the canonical way of processing events in
pygame but works fine for this application.

Critical comments and feedback and also questions, of course,
are welcome.

Perhaps someone is willing to amend the docstrings,
which suffer from my clumsy English and could well
be more clear.

Amendments of the code, espercially ones, which make it
more readable and easier to understand, also.

Useful for classroom use? Perhaps to difficult?

Best regards,
Gregor



_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig

superformula.py (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: superformula, generators

Mokurai
There are a great many such parametric formulae, such as
hypergeometric sequences and their sums. You can get very interesting
results by plotting the roots of a polynomial as the coefficients
vary, without ever letting two roots coincide. It is possible to
generate all knots and links in this way, by letting the graph wrap
around.

Given

* A parameter t in the range [0,1]
* A polynomial P = Σaᵢxⁱ for i in the range from 0 to n
* Continuous but not necessarily differentiable complex-valued
functions aᵢ(t), with aᵢ(0) = aᵢ(1)

for which P has no repeated roots at any value of t, we can take the
graphs of the n complex roots of P for each t, graph them in three
dimensions, and then topologically wrap the whole thing around into a
donut, joining t = 0 and t = 1, where the roots are the same, but may
be permuted.

The following diagram must be viewed in a monospace font in order to make sense.

_______  _____
       \/
_______/\_____

On Sat, May 21, 2011 at 17:11, Gregor Lingl <[hidden email]> wrote:

> Hi all,
>
> recently I stumbled (once more) over a posting by our friend
> Daniel Ajoy about the superformula (I think it was in a Logo-Forum):
>
> http://en.wikipedia.org/wiki/Superformula
>
> On the other side Kirby wrote interesting suggestions
> about using generators.
>
> Now, weekend, bad weather, some sparetime, I
> assembled an implementation of a superformula-viewer
> using pygame. It runs with Python 2.6 or higher, also
> 3.x, of course
>
> You'll find it here for download:
>
> http://dl.dropbox.com/u/2016850/superformula.py
>
> or appended (which sometimes / for some of you)
> doesn't work well depending on the browser or whatever.
>
> The script uses generators for generating the pointlists
> of the graph of the superformula and also for generating
> colors for the segments of the graph-area.
>
> Morover I've prepared a q&d slider class, which possibly
> doesn't use the canonical way of processing events in
> pygame but works fine for this application.
>
> Critical comments and feedback and also questions, of course,
> are welcome.
>
> Perhaps someone is willing to amend the docstrings,
> which suffer from my clumsy English and could well
> be more clear.
>
> Amendments of the code, espercially ones, which make it
> more readable and easier to understand, also.
>
> Useful for classroom use? Perhaps to difficult?
>
> Best regards,
> Gregor
>
>
>
> _______________________________________________
> Edu-sig mailing list
> [hidden email]
> http://mail.python.org/mailman/listinfo/edu-sig
>
>



--
Edward Mokurai (默雷/धर्ममेघशब्दगर्ज/دھرممیگھشبدگر ج) Cherlin
Silent Thunder is my name, and Children are my nation.
The Cosmos is my dwelling place, the Truth my destination.
_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig