Image:Pythagoras.png

From Wikipedia, the free encyclopedia

No higher resolution available.

Pythagoras.png (176 × 176 pixel, file size: 2 KB, MIME type: image/png)

Diagram illustrating Pythagoras theorem proof.

Produced by user Trainspotter using a program he wrote in the IDL language.

Program is listed below in case a modified version needs to be produced. (Program below is public domain, but IDL package itself is payware.)


a=100. ; side A
b=70.  ; side B
m=3.   ; margin around plot
s=2*m+a+b ; length of side of image
r=(a+b)/2 ; offset (in each of x,y) from centre of 
          ;     image to corner of triangle
c=m+(a+b)/2 ; position (in each of x,y) of centre of image
set_plot,'z'
device,set_res=[s,s]
tek_color
erase,1 ; white bg
c1=15. ; distance to offset characters to centre
c2=5.  ; extra y-offset for characters
d=[[0,0,a,0],[0,b,0,0]]  ; vectors to triangle vertices
d1=[[a,c1,a],[c1,b,b+1.5*c1]]/2  ; vectors to text labels
lab=['a','b','c']
cols=[0,2,4,8] ; predefined indices in tek_color
rot=[[0,-1],[1,0]] ; 90deg rotation matrix
ori=[[1,0],[0,1]]  ; current rotation matrix
for i=0,3 do begin ; loop over triangles
    pos=[c,c]+ori##[-r,-r]  ; corner of triangle (use as plot offset)
    draw=ori##d     ; relative vectors allowing for rotation
    label=ori##d1   ; (likewise)
    plots,pos[0]+draw[*,0],pos[1]+draw[*,1],/device,col=cols[i]
    xyouts,pos[0]+label[*,0],pos[1]+label[*,1]-c2,/device,col=cols[i],lab, $
      align=0.5,charsize=1.2   
    ori=rot##ori
endfor
image=tvrd()
tvlct,rr,gg,bb,/get
write_png,'pythagoras.png',image,rr,gg,bb
end


GFDL

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
Subject to disclaimers.

File history

Legend: (cur) = this is the current file, (del) = delete this old version, (rev) = revert to this old version.
Click on date to download the file or see the image uploaded on that date.


The following pages on the English Wikipedia link to this file (pages on other projects are not listed):