File:DiscreteGraph.svg

Summary

Description The graph of function from natural numbers to natural numbers.
Source Own work
Author 0xjdb
SVG development
InfoField
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

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.
Category:License migration redundant#DiscreteGraph.svgCategory:GFDL#DiscreteGraph.svg
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons 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.
Category:CC-BY-SA-4.0,3.0,2.5,2.0,1.0#DiscreteGraph.svg
You may select the license of your choice.
Category:Self-published work Category:Discrete mathematics
Category:CC-BY-SA-4.0,3.0,2.5,2.0,1.0 Category:Discrete mathematics Category:GFDL Category:License migration redundant Category:Self-published work Category:Valid SVG created with MetaPost code