Fichier:Pi archi approx.svg

Le contenu de la page n’est pas pris en charge dans d’autres langues.
Cha vient éd Wikipedia

Fichier d’origine(Fichié SVG, résoluchon éd 1 000 × 180 picsels, diminchon: 6 kio)

Ch'fichié i vient éd Wikimedia Commons. I put ète uzé pèr d’eutes prodjés. Vir l'pache édseur Commons.

Résumè

Décripchon
English: Approximation to Pi by Archimedes' method
Français : Approximation de Pi par la méthode d'Archimède
Polski: Metoda Archimedesa aproksymacji Pi
Español: Método de aproximación del número π de Arquímedes.
Date
Source Traval parsonnel
Auteu Guillaume Jacquenot
Autres versions

Œuvres dérivées de ce fichier :  Pi archi approx inter.svg

Archimedes_pi.svg

Licince

Moi, en tant que détenteur des droits d’auteur sur cette œuvre, je la publie sous les licences suivantes :
GNU head Os avez l' pérmission d' copier, distribuer pi modifier chol documint slon chés térmes del GNU Free Documentation License vérsion 1.2 obin toute vérsion ultérieure publièe pèr el Free Software Foundation, sans sékcions inaltérabes, sans teske d' prumière pache d' couvérture pi sans teske ed darène pache d' couvérture. Un egzimploère del licince est inclus dins l' sékcion intitulée GNU Free Documentation License.
w:fr:Creative Commons
patérnitè partage à l’idintique
Ce fichier est sous licence Creative Commons Attribution – Partage dans les Mêmes Conditions 3.0 (non transposée), 2.5 Générique, 2.0 Générique et 1.0 Générique.
Os ètes libe :
  • éd partager – éd copier, distribuer pi transmète chole euve
  • d’adapter – éd modifier chole euve
Dsous chés condicions suivantes :
  • patérnitè – Os d'vez donner chés informacions appropriées concernant l'auteu, fournir un loyen vers el licince, et indiquer si des modificacions ont tè foaites. Os povez foaire cha pèr tout moéyin raisonnabe, mais poin d'eune manière qui suggérerait qu’il vos soutienne o approuve l'utilisacion éq vos in foaites.
  • partage à l’idintique – Si os modifiez, transformez, o os basez édseur chole euve, os d'vez distribuer vote contérbuchon dsous el meume licince o eune licince compatibe aveuc chole éd l'original.
Vous pouvez choisir l’une de ces licences.
 
W3C-validity not checked.

Source code (C)

/* Compilation  instructions */
/* gcc -Wall -ansi -pedantic -o Pi_archi_approx Pi_archi_approx.c */

/* This program generates an SVG image, showing Archimede's technique to */
/* approximate pi */
/* One argument can be provided, as the maximum number of approximations desired */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define PI 3.14159265358979

int main(int argc, char **argv)
{
    int i,j,n;
    double id,coeff;
    FILE *fpt;
    double *x, *y;
    double R = 40.0;
    /* Angle values*/
    double alpha, alpha_offset;

    int    fontsize    = 10;
    double strokewidth = 0.8;
    if (argc == 2)
        n = (int)atof(argv[1]);
    else
    {
        n = 10;
    }
    if (n<3)
    {
        printf("\n");
        fflush(stdout);
        exit(1);
    }
    /* Opening result file*/
    fpt = fopen("Pi_archi_approx.svg","w");
    fprintf(fpt,"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n");
    fprintf(fpt,"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd \">\n");
    fprintf(fpt,"<svg\n");
    fprintf(fpt,"   xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" \n");
    fprintf(fpt,"   xmlns:svg=\"http://www.w3.org/2000/svg\" \n");
    fprintf(fpt,"   xmlns=\"http://www.w3.org/2000/svg\" \n");
    fprintf(fpt,"   width=\"%dpx\" \n",(int)(((n-2)*3+1)*R));
    fprintf(fpt,"   height=\"%dpx\" \n",(int)(4.5*R));
    fprintf(fpt,"   >\n");
    for (i=3;i<=n;i++)
    {
        id = (double) i;
        x  = (double *)malloc(i*sizeof(double));
        y  = (double *)malloc(i*sizeof(double));
        fprintf(fpt,"   <g>\n");
        fprintf(fpt,"    <circle cx=\"%f\" cy=\"%f\" r=\"%f\" ",((id-2)*3-0.75)*R,2.5*R,R);
        fprintf(fpt,"stroke=\"black\" stroke-width=\"%f\" fill=\"none\"/>\n",strokewidth);
        fprintf(fpt,"    <polygon points=\"");
        alpha_offset = -PI/2 + ((i%2)==0) * PI/id;
        for (j=0;j<i;j++)
        {
            alpha = alpha_offset + 2*j*PI/id;
            x[j]  = cos(alpha);
            y[j]  = sin(alpha);
            fprintf(fpt,"%f,%f ",R*x[j]+((id-2)*3-0.75)*R,R*(y[j]+2.5));
        }
        fprintf(fpt,"\" fill=\"none\" stroke=\"black\" stroke-width=\"%f\"/>\n",strokewidth);
        coeff = 2.0/sqrt((x[0]+x[1])*(x[0]+x[1]) + (y[0]+y[1])*(y[0]+y[1]));
        fprintf(fpt,"    <polygon points=\"");
        for (j=0;j<i;j++)
        {
            fprintf(fpt,"%f,%f ",R*coeff*x[j]+((id-2)*3-0.75)*R,R*(coeff*y[j]+2.5));
        }
        fprintf(fpt,"\" fill=\"none\" stroke=\"black\" stroke-width=\"%f\"/>\n",strokewidth);
        free(x);
        free(y);
        fprintf(fpt,"    <text x = \"%f\" y = \"%f\" text-anchor=\"middle\" fill = \"black\" font-size = \"%d\">\n",
                    ((id-2)*3-0.75)*R,4*R,fontsize);
        fprintf(fpt,"      n = %d\n",i);
        fprintf(fpt,"    </text>\n");
        fprintf(fpt,"  </g>\n");
    }
    fprintf(fpt,"</svg>\n");
    fclose(fpt);
    return (0);
}

Légendes

Ajoutez en une ligne la description de ce que représente ce fichier

Éléments décrits dans ce fichier

dépeint français

créé par français

Valeur sans élément de Wikidata

22 ed Marche 2009

Histoère dech fichié

Buke su eune date/heure pou vir ch'fichié conme il étoait ach momint-lo.

Date/TansTiote imageDiminsionsUzeuFichié éd chés conmints
courant22 ed Marche 2009 à 12:21Image pou l'vérchon éd 22 ed Marche 2009 à 12:211 000 × 180 (6 kio)Gjacquenot{{Information |Description={{en|1=Archimedes' Pi aproximation}} {{fr|1=Approximation de pi par la méthode d'Archimède}} |Source=travail personnel (own work) |Author=Guillaume Jacquenot |Date=2009-03-22 |Permission= |other_versions=fi

L'pache d'apreu est loyée à ch'fichié-lo :

Usage global du fichier

Chés eutes wikis suivants uzette chole fichier :