# [✓] Plot rational functions?

1000 Views
|
3 Replies
|
6 Total Likes
|
 Please, could any body help me? I want to plot graphics of elementary rational functions like f(x)=1/x, or g(x)= (x^2+1)/(x^2-4), what I got is not correct. I have tried to indicate the intervals of the domain of the function with inequalities but it does not work, for instance for g(x): -6 Directive[RGBColor[1, 0, 0], AbsoluteThickness[2.25], Arrowheads[{-.05, .05}]], GridLines -> {Range[-6, 6, 1], Range[-6, 6, 1]}, Ticks -> {Range[-6, 6, 1], Range[-6, 6, 1]}] /. Line -> Arrow  Plot[f[x] = (1 + x^2)/(-4 + x^2), {x, -6, 6}, PlotStyle -> Directive[RGBColor[1, 0, 0], AbsoluteThickness[2.25], Arrowheads[{-.05, .05}]], GridLines -> {Range[-6, 6, 1], Range[-6, 6, 1]}, Ticks -> {Range[-6, 6, 1], Range[-6, 6, 1]}] /. Line -> Arrow  Attachments:
3 Replies
Sort By:
Posted 1 year ago
 You can use Exclusions: Plot[(1 + x^2)/(-4 + x^2), {x, -6, 6}, PlotStyle -> Directive[RGBColor[1, 0, 0], AbsoluteThickness[2.25], Arrowheads[{-.05, .05}]], Exclusions -> (-4 + x^2) == 0] /. Line -> Arrow 
Posted 1 year ago
 The problem is the f[x]= in the function to be plotted. Try it with a plain expression or define the function outside Plot. (Plot analyzes the expression passed for discontinuities, but it apparently does not handle the case when the expression is of the form Set[f[x], expr].)Either Plot[(1 + x^2)/(-4 + x^2), {x, -6, 6}, PlotStyle -> Directive[RGBColor[1, 0, 0], AbsoluteThickness[2.25], Arrowheads[{-.05, .05}]], GridLines -> {Range[-6, 6, 1], Range[-6, 6, 1]}, Ticks -> {Range[-6, 6, 1], Range[-6, 6, 1]}] /. Line -> Arrow or ClearAll[f]; f[x_] = (1 + x^2)/(-4 + x^2); Plot[f[x], {x, -6, 6}, PlotStyle -> Directive[RGBColor[1, 0, 0], AbsoluteThickness[2.25], Arrowheads[{-.05, .05}]], GridLines -> {Range[-6, 6, 1], Range[-6, 6, 1]}, Ticks -> {Range[-6, 6, 1], Range[-6, 6, 1]}] /. Line -> Arrow `
 Thank you very much friends Gianluca Gorni and Michael Rogers, your sugestions worked quite well.
Community posts can be styled and formatted using the Markdown syntax.