Download or view XtotheXbetter.frink in plain text format
// More detailed example of graphing x^x
nmin = -300
nmax = 180
denom = 101
g = new graphics
g.line[nmin/denom,0,nmax/denom,0] // Draw x axis
g.line[0,-3,0,2] // Draw y axis
// Draw negative section with points
for n=nmin to 0
{
x = n/denom
if (n mod 2 == 0)
g.color[0,1,0] // Draw green for even numerator
else
g.color[1,0,0] // Draw red for odd numerator
g.fillRectCenter[x,-x^x,1/100,1/100]
}
// Draw positive section with continuous line
line = new polyline
for n = 0 to nmax
{
x = n/denom
line.addPoint[x,-x^x]
}
g.color[0,0,1]
g.add[line]
g.show[]
//g.write["xbetter.svg",400,400]
Download or view XtotheXbetter.frink in plain text format
This is a program written in the programming language Frink.
For more information, view the Frink
Documentation or see More Sample Frink Programs.
Alan Eliasen was born 20217 days, 23 hours, 49 minutes ago.