Create Line Curves for Specified Equations in R Programming – curve() Function

function in R Language is used to draw a curve for the equation specified in the argument.**curve()**

Syntax:curve(expression, to, from, col)

Parameters:expression:To be curvedto, from:range of curve plottingcol:color of curve

**Example 1:**

`# R program to create a curve` ` ` `# Creating curve using curve() function` `curve(x ^ ` `2` `+` `x ` `+` `5` `, ` `-` `4` `, ` `4` `, col ` `=` `"green"` `, ylab ` `=` `"y"` `)` |

**Output:**

**Example 2:**

`# R program to create a curve` ` ` `# Creating curve using function` `fun <` `-` `function(x) {x ^ ` `3` `+` `4` `}` `curve(fun, ` `-` `4` `, ` `4` `, col ` `=` `"red"` `, ylab ` `=` `"y"` `)` |

**Output:**