File:DiscreteGraph.svg

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

Original file(SVG file, nominally 179 × 155 pixels, file size: 11 KB)

Captions

Captions

Add a one-line explanation of what this file represents

Summary[edit]

Description The graph of function from natural numbers to natural numbers.
Source Own work
Author 0xjdb
SVG development
InfoField
 
The SVG code is valid.
 
This vector image was created with MetaPost.
Source code
InfoField

PostScript code

metapost-source
outputformat := "svg";

beginfig(1);
u := 1cm;

% Axes
drawarrow (0,0) -- (0,5u);
for i=1 upto 4: label.lft(decimal i,(0,i*u)); endfor
label.rt("f", (0,5u));
drawarrow (0,0) -- (6u,0);
for i=1 upto 5: label.bot(decimal i,(i*u,0)); endfor
label.top("i", (6u,0));

% A macro to draw a vertical line at x-coordinate n and of height h.
def draw_with_points (expr n, h) =
    begingroup
        pickup defaultpen;
        draw (n*u,0) -- (n*u,h*u);
        pickup pencircle scaled 4pt;
        for i=1 upto h:
            drawdot (n*u,i*u);
        endfor
    endgroup
enddef;

% The graph.
draw_with_points(1,3);
draw_with_points(2,1);
draw_with_points(3,3);
draw_with_points(4,4);
draw_with_points(5,3);

% The horizontal lines
pickup defaultpen;
for i=1 upto 4:
    draw (0,i*u) -- (6u,i*u) dashed evenly;
endfor
endfig;

Licensing[edit]

I, the copyright holder of this work, hereby publish it under the following licenses:
GNU head 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. A copy of the license is included in the section entitled GNU Free Documentation License.
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike Attribution-Share Alike 4.0 International, 3.0 Unported, 2.5 Generic, 2.0 Generic and 1.0 Generic 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.
You may select the license of your choice.

File history

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

Date/TimeThumbnailDimensionsUserComment
current17:21, 23 April 2010Thumbnail for version as of 17:21, 23 April 2010179 × 155 (11 KB)0xjdb (talk | contribs){{Information |Description=The graph of function from natural numbers to natural numbers. |Source={{own}} |Date= |Author= 0xjdb |Permission= |other_versions= }}

There are no pages that use this file.

File usage on other wikis

The following other wikis use this file: