File:Omega-exp-omega-normal.pdf

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Omega-exp-omega-normal.pdf(647 × 560 pixels, file size: 95 KB, MIME type: application/pdf)

Captions

Captions

Add a one-line explanation of what this file represents

Summary[edit]

Description
English: Matchstick representation of ordinal numbers up to . To save horizontal space, the number line has been coiled up to a spiral. One turn corresponds to the mapping . Since has as a (least) fixed point, larger ordinal numbers cannot be represented in this image.
Date
Source Own work, inspired by File:Omega-exp-omega-labeled.svg
Author Jochen Burghardt
Other versions File:Omega-exp-omega-normal.pdf * File:Omega-exp-omega-normal svg.svg
LaTeX source code
\documentclass[12pt]{article}
\usepackage{pstricks}
\usepackage[paperwidth=110mm,paperheight=95mm,textwidth=110mm,textheight=95mm]{geometry}
\setlength{\parindent}{0cm}
\psset{unit=1mm}
\pagestyle{empty}

\makeatletter
\def\ite#1#2#3{\setbox\@tempboxa\hbox{#1}%
\ifdim\wd\@tempboxa=0cm#3\else#2\fi\relax}
\makeatother

%         1      2    3    4         5        6      7
% \spiral{ALPHA}{BOT}{TOP}{RGBspoke}{RGBtext}{ALIGN}{TEXT}
\newcommand{\spiral}[7]{%
        \definecolor{JBspoke}{rgb}{#4}%
        \definecolor{JBtext}{rgb}{#5}%
        \psline[linecolor=JBspoke](#2;#1)(#3;#1)%
        \ite{#7}{\rput[#6](#3;#1){\textcolor{JBtext}{#7}}}{}%
}

%         1      2   3    4    5   6            7        8      9
% \Spiral{ALPHA}{AL}{MID}{TOP}{WH}{RGBtriangle}{RGBtext}{ALIGN}{TEXT}
\newcommand{\Spiral}[9]{%
        \definecolor{JBspoke}{rgb}{#6}%
        \definecolor{JBtext}{rgb}{#7}%
        \pstriangle*[gangle=#2,linecolor=JBspoke](#3;#1)(#5)%
        \ite{#9}{\rput[#8](#4;#1){\textcolor{JBtext}{#9}}}{}%
}%

\begin{document}
\begin{pspicture}(-50,45)(60,50)%
\psset{linewidth=0.1pt}
        %\rput(-50,-45){$+$}
        %\rput(60,50){$+$}

% !}texfractal -spiral 50.000 0.650
%%%%% output of C program "texfractal" omitted, for now %%%%%

\rput(0,0){$\scriptscriptstyle\omega^\omega$}
\end{pspicture}
\end{document}
C source code
#include <stdio.h>
#include <math.h>
#include <string.h>

#define Path            "texfractal"

/* ***************************************************************** */
/* ***** matchstick spiral **************************************@@* */
/* ***************************************************************** */

/* return y such that y0 : y : y1 corresponds to x0 : x : x1 */
static inline double intpl(
    double y0, 
    double y1, 
    double x,
    double x0, 
    double x1) 
{
    double const y = ((x-x0) * y1 + (x1-x) * y0) / (x1-x0);
    return y;
}

static inline const char * angle2align(
    double a)
{
    return   a <= -22.5 ? "<?"
           : a <=  22.5 ? " l"
           : a <=  67.5 ? "bl"
           : a <= 112.5 ? "b "
           : a <= 157.5 ? "br"
           : a <= 202.5 ? " r"
           : a <= 247.5 ? "tr"
           : a <= 292.5 ? "t "
           : a <= 337.5 ? "tl"
           : a <= 382.5 ? " l"
           :              ">?";
}

static inline void normalizeAngle(
    double *a) 
{
    while (*a < 0)
        *a += 360;
    while (360 < *a) 
        *a -= 360;
}

/* segment of matchsticks */
static inline void mSeg(
    double *r0,         /* spiral start/end radius (in/out) */
    double qr,          /* spiral radius quotient per 360 deg */
    double *a0,         /* start/end angle (in/out) */
    double da,          /* angle increment (for 1) */
    double af,          /* total angle incrment (for infty) */
    double h0,          /* start spoke height */
    double qh,          /* height quotient */
    int m,              /* label count */
    char * lb[m],       /* spoke labels */
    double R0,
    double G0,
    double B0,
    double R360,
    double G360,
    double B360,
    int n,              /* spoke count */
    double aSpoke[n])   /* spoke angle (output only) */
{
    int i;

    double const qa = (af - da) / af;
    long double const lnr0 = logl(*r0);
    long double const lnqr = logl(qr);
    double a = *a0;
    double h = h0;
    double sda = 0.0;
    printf("%% mSeg");
    printf("  %5.3f %5.3f",*r0,qr);
    printf("  %5.3f %5.3f %5.3f",*a0,da,af);
    printf("  %5.3f %5.3f",h0,qh);
    printf("  %d\n",n);
    for (i=0; i<n; ++i) {
        if (aSpoke != NULL)
            aSpoke[i] = da;
        long double const r = expl(lnr0 + lnqr * sda / 360.0);
        double const Rs = intpl(R0,R360,a,0,360);
        double const Gs = intpl(G0,G360,a,0,360);
        double const Bs = intpl(B0,B360,a,0,360);
        double const Rt = intpl(Rs,1,i,0,m+1);
        double const Gt = intpl(Gs,1,i,0,m+1);
        double const Bt = intpl(Bs,1,i,0,m+1);
        const char * const align = angle2align(a);
        printf("\\spiral");
        printf("{%7.3f}",a);
        printf("{%7.3Lf}",r-h/2);
        printf("{%7.3Lf}",r+h/2);
        printf("{%4.2f,%4.2f,%4.2f}",Rs,Gs,Bs);
        printf("{%4.2f,%4.2f,%4.2f}",Rt,Gt,Bt);
        printf("{%s}",align);
        if (i < m)
            printf("{$%s$}",lb[i]);
        else
            printf("{}");
        printf("%%\n");
        h *= qh;
        a += da;
        sda += da;
        normalizeAngle(&a);
        da *= qa;
    }
    long double const r = expl(lnr0 + lnqr * sda / 360.0);
    *r0 = r;
    *a0 = *a0 + af;
    normalizeAngle(a0);
}

/* segment of triangles */
static inline void tSeg(
    double *r0,         /* spiral start radius */
    double qr,          /* spiral radius quotient per 360 deg */
    double a0,          /* start angle */
    double h0,          /* start spoke height */
    double qh,          /* height quotient */
    int m,              /* label count */
    char * lb[m],       /* labels */
    double R0,
    double G0,
    double B0,
    double R360,
    double G360,
    double B360,
    int n,              /* triangle count */
    double const aSpoke[n])
{
    int i;

    long double const lnr0 = logl(*r0);
    long double const lnqr = logl(qr);
    double h = h0;
    double a = a0;
    double sda = 0.0;
    printf("%% tSeg");
    printf("  %5.3f %5.3f",*r0,qr);
    printf("  %5.3f %5.3f",h0,qh);
    printf("  %d\n",n);
    for (i=0; i<n; ++i) {
        long double const r = expl(lnr0 + lnqr * sda / 360.0);
        double const Rs = intpl(R0,R360,a,0,360);
        double const Gs = intpl(G0,G360,a,0,360);
        double const Bs = intpl(B0,B360,a,0,360);
        double const Rt = intpl(Rs,1,i,0,m+1);
        double const Gt = intpl(Gs,1,i,0,m+1);
        double const Bt = intpl(Bs,1,i,0,m+1);
        const char * const align = angle2align(a);
        printf("\\Spiral");
        printf("{%7.3f}",a);
        printf("{%7.3f}",a+aSpoke[i]/2);
        printf("{%7.3Lf}",r);
        printf("{%7.3Lf}",r+h/2);
        printf("{%7.3f,%7.3Lf}",h,r*sin(aSpoke[i]*2*M_PI/360));
        printf("{%4.2f,%4.2f,%4.2f}",Rs,Gs,Bs);
        printf("{%4.2f,%4.2f,%4.2f}",Rt,Gt,Bt);
        printf("{%s}",align);
        if (i < m)
            printf("{$%s$}",lb[i]);
        else
            printf("{}");
        printf("%%\n");
        h *= qh;
        a += aSpoke[i];
        sda += aSpoke[i];
    }
    long double const r = expl(lnr0 + lnqr * sda / 360.0);
    *r0 = r;
}

static inline void matchstickSpiral(
    double r0,          /* spiral start radius */
    double qr)          /* spiral radius quotient per 360 deg */
{
    double da;
    double a0 = 0.0;
    double h0;
    double aSpoke0[220];
    double aSpoke1[25][220];
    int i;

    printf("%% !}" Path " -spiral %5.3f %5.3f\n",r0,qr);

    /* ------------------------------------------------------------- */
    printf("%% 0 ... omega\n");
    char * lb0[] = { "0", "1", "2", "3", "4",
                     "5", "6", "7", "8", "9"};
    mSeg(&r0,qr,
         &a0,70,360.000,
         8,0.90,
         10,
         lb0,
         0.0,0.0,0.0, 0.8,0.0,0.0,
         40,aSpoke0);

    /* ------------------------------------------------------------- */
    printf("%% omega ... omega^2\n");
    char * lb11[] = { "\\omega",
                      "\\omega\\!\\!+\\!\\!1",
                      "\\omega\\!\\!+\\!\\!2",
                      "\\omega\\!\\!+\\!\\!3",
                      "\\omega\\!\\!+\\!\\!4"};
    char * lb14[] = { "\\omega\\!\\cdot\\! 4",
                      "\\omega\\!\\cdot\\! 4\\!\\!+\\!\\!1",
                      "\\omega\\!\\cdot\\! 4\\!\\!+\\!\\!2",
                      "\\omega\\!\\cdot\\! 4\\!\\!+\\!\\!3",
                      "\\omega\\!\\cdot\\! 4\\!\\!+\\!\\!4"};
    char lb1buf[64];
    char * lb1[] = { lb1buf };
    h0 = 6.0;
    a0 = 0;
    da = 15;
    for (i=0; i<25; ++i) {
        sprintf(lb1buf,"\\omega\\!\\cdot\\! %d",i+1);
        mSeg(&r0,qr,
             &a0,da,aSpoke0[i],
             h0,0.90,
             (i==0 ?5    :i==3 ?2    :i<7 ?1   :0),
             (i==0 ?lb11 :i==3 ?lb14 :i<7 ?lb1 :NULL),
             0.8,0.0,0.0, 0.5,0.5,0.0,
             25-i/2,aSpoke1[i]);
        da *= 0.80;
        h0 *= 0.90;
    }
    mSeg(&r0,qr,
         &a0,da,360.0-a0,
         h0,0.98,
         0,
         NULL,
         0.8,0.0,0.0, 0.5,0.5,0.0,
         30,NULL);

    /* ------------------------------------------------------------- */
    printf("%% omega^2 ... omega^3\n");
    char * lb21[] = { "\\scriptstyle\\omega^2",
                     "\\scriptstyle\\omega^2\\!+\\!\\omega",
                     "\\scriptstyle\\omega^2\\!+\\!\\omega\\cdot 2",
                     "\\scriptstyle\\omega^2\\!+\\!\\omega\\cdot 3" };
    char lb2buf[64];
    char * lb2[] = { lb2buf };
    a0 = 0;
    h0 = 4.0;
    for (i=0; i<25; ++i) {
        sprintf(lb2buf,"\\scriptstyle\\omega^2\\!\\cdot %d",i+1);
        tSeg(&r0,qr,
             a0,
             h0,0.90,
             (i==0 ?4    :i<7 ?1   :0),
             (i==0 ?lb21 :i<7 ?lb2 :NULL),
             0.5,0.5,0.0, 0.0,0.8,0.0,
             20,aSpoke1[i]);
        a0 += aSpoke0[i];
        h0 *= 0.80;
    }

    /* ------------------------------------------------------------- */
    printf("%% omega^3 ... omega^4\n");
    char * lb31[] = { "\\scriptstyle\\omega^3" };
    char lb3buf[64];
    char * lb3[] = { lb3buf };
    a0 = 0;
    h0 = 3.0;
    for (i=0; i<25; ++i) {
        sprintf(lb3buf,"\\scriptscriptstyle\\omega^3\\!\\cdot %d\\!",i+1);
        tSeg(&r0,qr,
             a0,
             h0,0.90,
             (i==0 ?1    :i<7 ?1   :0),
             (i==0 ?lb31 :i<7 ?lb3 :NULL),
             0.0,0.8,0.0, 0.0,0.5,0.5,
             20,aSpoke1[i]);
        a0 += aSpoke0[i];
        h0 *= 0.80;
    }

    /* ------------------------------------------------------------- */
    printf("%% omega^4 ... omega^5\n");
    char * lb41[] = { "\\scriptscriptstyle\\!\\omega^4" };
    a0 = 0;
    h0 = 2.0;
    for (i=0; i<25; ++i) {
        tSeg(&r0,qr,
             a0,
             h0,0.90,
             (i==0 ?1    :0),
             (i==0 ?lb41 :NULL),
             0.0,0.5,0.5, 0.0,0.0,0.8,
             20,aSpoke1[i]);
        a0 += aSpoke0[i];
        h0 *= 0.90;
    }

    /* ------------------------------------------------------------- */
    printf("%% omega^5 ... omega^6\n");
    a0 = 0;
    h0 = 1.5;
    for (i=0; i<25; ++i) {
        tSeg(&r0,qr,
             a0,
             h0,0.90,
             0,
             NULL,
             0.0,0.0,0.8, 0.5,0.0,0.5,
             20,aSpoke1[i]);
        a0 += aSpoke0[i];
        h0 *= 0.90;
    }

    /* ------------------------------------------------------------- */
    printf("%% omega^6 ... omega^7\n");
    a0 = 0;
    h0 = 1.0;
    for (i=0; i<25; ++i) {
        tSeg(&r0,qr,
             a0,
             h0,0.90,
             0,
             NULL,
             0.5,0.0,0.5, 0.0,0.0,0.0,
             20,aSpoke1[i]);
        a0 += aSpoke0[i];
        h0 *= 0.90;
    }

    /* ------------------------------------------------------------- */
    printf("%% omega^7 ... omega^8\n");
    a0 = 0;
    h0 = 0.5;
    for (i=0; i<25; ++i) {
        tSeg(&r0,qr,
             a0,
             h0,0.90,
             0,
             NULL,
             0.0,0.0,0.0, 1.0,1.0,1.0,
             20,aSpoke1[i]);
        a0 += aSpoke0[i];
        h0 *= 0.90;
    }

    /* ------------------------------------------------------------- */
    printf("%% done\n");
}

/* ***************************************************************** */
/* ***** main ***************************************************@@* */
/* ***************************************************************** */

int main(
    int argc,
    const char * const argv[argc])
{
    int i;

    for (i=1; i<argc; ++i) {
        if (strcmp(argv[i],"-spiral") == 0) {
            double r0;
            double qr;
            sscanf(argv[i+1]," %lf",&r0);
            sscanf(argv[i+2]," %lf",&qr);
            i += 2;
            matchstickSpiral(r0,qr);
        } else {
            fprintf(stderr,"illegal argument '%s'",argv[i]);
            return 1;
        }
    }
    return 0;
}

Licensing[edit]

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current11:55, 9 February 2023Thumbnail for version as of 11:55, 9 February 2023647 × 560 (95 KB)Jochen Burghardt (talk | contribs)fixed mult opnds; darker colors
18:03, 8 February 2023Thumbnail for version as of 18:03, 8 February 2023647 × 560 (93 KB)Jochen Burghardt (talk | contribs)Uploaded own work with UploadWizard

There are no pages that use this file.

Metadata