canvas_recaman {aRtsy}R Documentation

Draw Recaman's Sequence

Description

This function draws Recaman's sequence on a canvas. The algorithm takes increasingly large steps backward on the positive number line, but if it is unable to it takes a step forward.

Usage

canvas_recaman(colors, background = "#fafafa", iterations = 100, start = 0,
               increment = 1, curvature = 1, angle = 0, size = 0.1,
               closed = FALSE)

Arguments

colors

a string or character vector specifying the color(s) used for the artwork.

background

a character specifying the color used for the background.

iterations

the number of iterations of the algorithm.

start

the starting point of the algorithm.

increment

the increment of each step.

curvature

the curvature of each line.

angle

the angle at which to place the artwork.

size

the size of the lines.

closed

logical. Whether to plot a curve from the end of the sequence back to the starting point.

Value

A ggplot object containing the artwork.

Author(s)

Koen Derks, koen-derks@hotmail.com

References

https://mathworld.wolfram.com/RecamansSequence.html

See Also

colorPalette

Examples


set.seed(1)

# Simple example
canvas_recaman(colors = colorPalette("tuscany1"))



[Package aRtsy version 0.1.8 Index]