Jump to content

File:Rational Representation.svg

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia

Original file (SVG file, nominally 629 × 629 pixels, file size: 132 KB)

Summary

Description
English: Representation of rational numbers (Q) as pairs of integers, equivalent pairs on the same line.
Français : Représentation des nombres rationnels comme des paires de nombres entiers, les paires équivalentes sur le même ligne.
Date
Source Own work
Author TomT0m
Other versions File:RationalRepresentation.pdf

Source of the file, in the en:asymptote graphic programming language: fr:Utilisateur:TomT0m/RationalRepresentation.asy

import settings;
import graph;
import math;
 
 
pdfviewer="/usr/bin/evince";
psviewer="evince";
 

// parameters

int num=10;
 
 
int gcd(int a,int b){
	if(b==0){
		return a;
	}else{
		return gcd(b,a-quotient(a,b)*b);
	}
}
bool isPrimeWith(int a,int b){
	return gcd(a,b)==1;
}

 
pen color_rational(int x,int y){

	if(y==0){
		return white;
	}else{
		real ratio = x
/y;
		return rgb(0.5*(1+ratio),0.7*(1+ratio),0.3*(1-ratio));
	}
}
unitsize(2,2);
 
picture damier;
// unitsize(damier,1,1);
size(damier,5000,5000,(-100,-100),(100,100));
 
dot(damier,(0,0));
dot(damier,(-num,-num),invisible);
dot(damier,(num,num),invisible);
 
 
 
for(int x=-num; x<=num;++x){	
 
	for(int y=-num; y<=num;++y){
 
		
		pen p=color_rational(x,y);
 
		if(y>0){
			pair far;
			if(isPrimeWith(abs(x),abs(y)) ){
				far=(x*100,y*100);
				drawline(damier,(0,0),far,p);
			}
		}

		if(y==0){
 
			dot(damier,(x,y));
			dot(damier,(x,y),rgb(0.9,0.9,0.9));

		}else
			dot(damier,(x,y),p);
 
	}
}

dot(damier,(0,0));
dot(damier,(0,0),rgb(0.9,0.9,0.9));
add(damier.fit(),(0,0));
// drawing the equivalent classes

Licensing

Public domain I, the copyright holder of this work, release this work into the public domain. This applies worldwide.
In some countries this may not be legally possible; if so:
I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law.

Licensing

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.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

1 April 2015

image/svg+xml

27f7909ba9da6ac4be20766f9fa4e983dd901431

134,922 byte

629 pixel

629 pixel

File history

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

Date/TimeThumbnailDimensionsUserComment
current20:55, 1 April 2015Thumbnail for version as of 20:55, 1 April 2015629 × 629 (132 KB)TomT0mUser created page with UploadWizard

The following page uses this file:

Global file usage

The following other wikis use this file:

Metadata