Fichier:OppositeAddition.png

De testwiki
Aller à la navigation Aller à la recherche
    Fichier d’origine (362 × 396 pixels, taille du fichier : 30 kio, type MIME : image/png)

    Ce fichier provient de Wikimedia Commons et peut être utilisé par d'autres projets. Sa description sur sa page de description est affichée ci-dessous.

    Description

    Description
    English: Several variations on 2+-2 = -2+2 = 0 with integers constructed as pair of natural numbers
    Français : Variations sur le thème 2+-2 = -2+2 = 0 avec les entiers relatifs construits comme des pairs d'entiers naturels
    Date
    Source Travail personnel
    Auteur ou autrice TomT0m
    PNG information
    InfoField
     Cette image matricielle PNG a été créée avec Asymptote
    Code source
    InfoField

    Asymptote code

    import settings;
    import graph;
    
    
    pdfviewer="evince";
     psviewer="evince";
    
    
    
    // returns a pair representation of a relative number of the equivalent class
    pair pairRepresentation(int n){
    	if(n>0){
    		return(n,0);
    	}else{
    		return(0,-n);
    	}
    }
    
    string nullString(real r){
    	return "";
    }
    
    string pairToString(pair point){
    	return "("+string(point.x)+","+string(point.y)+")";
    }
    
    void drawCoordinates(pair point, align align=NoAlign){
    	label("$"+pairToString(point)+"$",point,align,mediumgray+opacity(0.2)+fontsize(8));
    }
    
    string latexBold(real r){
    	return "$\mathbf{"+string(r)+"}$";
    }
    
    string latexBold(string s){
    	return "$\mathbf{"+s+"}$";
    }
    
    // schema representing the addition of N1 + N2
    
    int N1=-2 ;
    int N2= 2 ;
    int num = 5; // size of the grid, num * num
    
    pen[] Colors=new pen[2*num+1];
    Colors.cyclic=true;
    int i;
    
    for (i=-1*num ; i<=num ; ++i) {
    	Colors[i] = blue;
    }
    
    Colors[N1]=brown;
    Colors[N2]=green;
    Colors[N1+N2]=orange;
    
    unitsize(50,50);
    
    
    
    
    // drawing the equivalent classes
    
    
    
    for (i=-1*num ; i<=num ; ++i) {
    	pair point = pairRepresentation(i) ;
    	dot(point,red);
    
    	// choosing the color of the numbers, blue by default
    	pen numberColor = Colors[i];
    
    	// equivalence classes labelled with usual names, in blue
    	label(latexBold(i),point,5SW,fontsize(17)+numberColor);
    
    	int j;
    	for(j=abs(i);j<num;++j) {
    		drawCoordinates(point,E);
    		pair nextpoint = point + (1,1);
    
    		draw(point -- nextpoint,numberColor+Dotted+linewidth(2));
    		dot(point,red+linewidth(5));
    
    		point=nextpoint;
    	}
    	dot(point,red);
    	draw(point -- point+(0.5,0.5),numberColor+Dotted+linewidth(2));
    	dot(point,red+linewidth(5));
    	drawCoordinates(point,E);
    }
    
    
    void drawAdd(int n1, int n2, pair decalN1, pair decalN2, align alignN1=NoAlign,align alignN2=NoAlign){
    	pair n1pair = pairRepresentation(n1);
    	pair n2pair = pairRepresentation(n2);
    
    	pair n1rep = n1pair + decalN1;
    	pair n2rep = n2pair + decalN2;
    
    	draw (/*pairToString(n2rep),*/n1rep -- n1rep+n2rep,alignN1,Colors[N2],Arrow,Margins);
    	draw (/*pairToString(n1rep),*/n2rep -- n1rep+n2rep,alignN2,Colors[N1],Arrow,Margins);
    
    }
    
    
    for(int decalage=0; decalage<4;++decalage){
    	for(int i=decalage;i+decalage<4;++i){
    		drawAdd(N1,N2,(i,i),(decalage,decalage),alignN1=3SW,alignN2=4SW);
    		drawAdd(N1,N2,(decalage,decalage),(i,i),alignN1=5W,alignN2=3E);
    	}
    }
    // Vectors
    
    
    
    // axes 
    
    real decay=-0.2;
    
    ticks tick=RightTicks(N=0,n=1,end=false,nullString);
    xaxis("$n_1$",YEquals(decay),decay,num+1.0,tick,Arrow);
    yaxis("$n_2$",XEquals(decay),decay,num+1.0,LeftTicks(N=0,n=1,end=false,nullString),Arrow);
    
    
    path legend = (num * .1, -1) -- (num*.9, -1);
    
    
    label( Label(latexBold(N1),position=Relative(0.1)), Colors[N1]+fontsize(17),g=legend);
    label( Label(latexBold("+"),position=Relative(0.2)) ,fontsize(17),g=legend);
    label( Label(latexBold(N2),position=Relative(0.3)),Colors[N2]+fontsize(17),g=legend);
    label( shift(0,-3.5)*Label(latexBold("{=}"),position=Relative(0.4)),fontsize(17),g=legend);
    label( Label(latexBold(N2),position=Relative(0.5)),Colors[N2]+fontsize(17),g=legend);
    label( Label(latexBold("+"),position=Relative(0.6)) ,fontsize(17),g=legend);
    label( Label(latexBold(N1),position=Relative(0.7)),Colors[N1]+fontsize(17),g=legend);
    label( shift(0,-3.5)*Label(latexBold("="),position=Relative(0.8)),fontsize(17),g=legend);
    label( Label(latexBold(N1+N2),position=Relative(0.9)),Colors[N1+N2]+fontsize(17),g=legend);
    

    Conditions d’utilisation

    Public domain Moi, propriétaire des droits d’auteur sur cette œuvre, la place dans le domaine public. Ceci s'applique dans le monde entier.
    Dans certains pays, ceci peut ne pas être possible ; dans ce cas :
    J’accorde à toute personne le droit d’utiliser cette œuvre dans n’importe quel but, sans aucune condition, sauf celles requises par la loi.

    Légendes

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

    Éléments décrits dans ce fichier

    dépeint

    Historique du fichier

    Cliquer sur une date et heure pour voir le fichier tel qu'il était à ce moment-là.

    Date et heureVignetteDimensionsUtilisateurCommentaire
    actuel27 novembre 2009 à 15:48Vignette pour la version du 27 novembre 2009 à 15:48362 × 396 (30 kio)wikimediacommons>TomT0mReduced size from 5 to 4

    Aucune page n’utilise ce fichier.