doodle_fun: Construct a random function that is smooth

doodle_funR Documentation

Construct a random function that is smooth

Description

Sometimes it's nice to have a simple, smooth but curving function to illustrate some mathematical point or to support an exercise. doodle_fun() generates such functions. The function support tends to be in -10 to 10. For the mathematically adept ... the functions are linear combinations of gaussians with randomly selected centers, widths, and random coefficients. The mosaic::rfun() function is very similar.

Usage

doodle_fun(vars = ~x & y, seed = NULL, n = 0)

Arguments

vars

A right-sided tilde expression (like ~ x & y) that indicates how many inputs there should be and their names.

seed

An integer setting the seed for random number generation.

n

A positive integer. If non-zero, this is a hint about how many local maxes and mins there should be. Just a hint.

Examples

# Two functions of two variables. They are different because the seeds are different.
f <- doodle_fun(~ x & y, seed = 101)
g <- doodle_fun(~ z & u, seed = 121)

ProjectMOSAIC/mosaicCalc documentation built on March 1, 2025, 12:37 a.m.