# Curve objects

### Description

This function takes a description of a curve and creates an object displaying the curve, and optionally
it's behavior throughout iterations of the system.
The curve is defined either by the graph of a single function or a pair of parametric
equations. By default, rendered with the `lines`

function.

### Usage

1 2 3 |

### Arguments

`fun` |
A function. If |

`yfun` |
The y-equation of the parameteric equations. See sections describing parametric equations for more info. |

`col` |
The color of the original curve, as a string. |

`image` |
A single color as a string, or a vector of colors as a string. See details for more information. |

`lwd` |
Line width expressed as a double. Only used if |

`n` |
The number of points that will be calculated.
Defaults to the dsrange's |

`iters` |
Determines the number of iterations of the function when making a color gradient.
Use |

`crop` |
If |

`tstart` |
Only used for parametric curves. The minimum input for both functions. Default 0. |

`tend` |
Only used for parametric curves. The maximum input for the functions. Default 1. |

`discretize` |
Set |

`xlim` |
Only used for the graph of a function. Determines the range of x values for which the function is plotted. Defaults to the x limits of the model's dsrange. |

`...` |
Further graphical parameters passed to |

### The graph of a function

If the parameter `fun`

is a function and
the parameter `yfun`

is not provided, then `dscurve`

contains
the curve of points (x,fun(x)). The inputs to `fun`

are `n`

points between the maximum
`dsrange`

's x limits, but can be overwritten with the `xlim`

parameter.

### Parametric equations

If the parameter `fun`

and `yfun`

are both provided,
`dscurve`

contains the parametric curve described by the functions. The function is
calculated at `n`

points ranging from `tmin`

to `tmax`

.

### Images of curves

The `dscurve`

object begins with an initial curve. Images of the curve may be displayed in three ways.
If the `image`

parameter is a single color and `iters`

is not set, then `dscurve`

will calculate and display
the image of the curve under the model's function in that color.

If the `image`

parameter is a vector of k colors, then `dscurve`

calculates and
displays k successive images of the curve using those colors.
The string "NA" may be used to avoid displaying an iteration.

If the `image`

parameter is a single color and `iters`

is defined, then `iters`

successive images are displayed, using a gradient between `col`

and `image`

.

In most cases, rather than specifying `col`

and `image`

separately, they may be
combined into a single vector.

### See Also

`dspoint`

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ```
library(dsmodels)
fun <- function(X,Y) {
list(
X/exp(Y),
Y/exp(X)
)
}
model <- dsmodel(fun, title = "Points on a One-Dimensional Curve")
range <- dsrange(-2:2,-2:2, discretize = 0.5)
# Add a one-dimensional curve and its image in blue.
curve1 <- dscurve(function(x) x^2,
col = "orange",
image = "blue",
discretize = TRUE,
xlim = c(-2,2))
model +
range +
curve1
# Create a parametric curve with image iterations red then green.
curve2 <- dscurve(function(x) x^2,
function(x) x,
image = c("red", "green"),
tstart = -2, tend = 2)
dsmodel(fun, "A Parametric Curve and Iterations of that Curve") +
dsrange(-2:2, -2:2, discretize = 0.5) +
curve2
``` |