I'm trying to graph a rational functionplotting two time series with boundsGrouped bar chartHow to define the default vertical distance between nodes?How do i get the x axis on top but keep a line on the bottomHow to prevent rounded and duplicated tick labels in pgfplots with fixed precision?How to hide empty (value 0) ybars with pgfplots?Show mark labels near marks and not centered in ybar interaval graphpgfplots: percentage in matrix plotCenter the axes in the coordinate origin
Where does the tea come from?
Rule of thumb: how far before changing my chain to prevent cassette wear
How can a "proper" function have a vertical slope?
Novel set in the future, children cannot change the class they are born into, one class is made uneducated by associating books with pain
Paper status "Accept with Shepherd". What does it really mean?
Why does b+=(4,) work and b = b + (4,) doesn't work when b is a list?
33 Months on Death Row
Using Terminal` (ASCII plots) in Wolfram 12
Did smallpox emerge in 1580?
How much do sea levels rise due to thermal expansion?
Pass a bash variable to python script
How many integers are there that are not divisible by any prime larger than 20 and not divisible by the square of any prime?
Why are KDFs slow? Is using a KDF more secure than using the original secret?
What do you call a document which has no content?
Can you take an Immortal Phoenix out of the game?
Why does 1.1.1.1 not resolve archive.is?
What is it called when you use wrong but smart arguments?
What happens if a geocentric model of the world were correct?
How to get the SMILES of all compounds on PubChem?
What is the fastest algorithm for finding the natural logarithm of a big number?
SuperTuxKart 0.9.3-2 has no online multiplayer?
How should I tell a professor the answer to something he doesn't know?
They say I should work on bigger things
How to give a rationality-inducing drug to an entire software company?
I'm trying to graph a rational function
plotting two time series with boundsGrouped bar chartHow to define the default vertical distance between nodes?How do i get the x axis on top but keep a line on the bottomHow to prevent rounded and duplicated tick labels in pgfplots with fixed precision?How to hide empty (value 0) ybars with pgfplots?Show mark labels near marks and not centered in ybar interaval graphpgfplots: percentage in matrix plotCenter the axes in the coordinate origin
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
The function I am trying to plot is y = frac6x^2-3x+42x^2-8
documentclassarticle
usepackage[utf8]inputenc
usepackagetitling
usepackageamssymb
usepackagepgfplots
begintikzpicture
beginaxis
[
title = Graph of $frac6x^2-3x+42x^2-8$,
axis lines = center,
xlabel = $x$,
ylabel = $y$,
]
addplot[color=red]y = frac6x^2-3x+42x^2-8;
endaxis
endtikzpicture
I am new to LaTex and I've been trying to follow other answers on here, but I'm still a bit confused. Apologies for posting a duplicate.
Edit: Sorry if I wasn't clear, here is how it's supposed to look.
tikz-pgf pgfplots graphs
New contributor
add a comment
|
The function I am trying to plot is y = frac6x^2-3x+42x^2-8
documentclassarticle
usepackage[utf8]inputenc
usepackagetitling
usepackageamssymb
usepackagepgfplots
begintikzpicture
beginaxis
[
title = Graph of $frac6x^2-3x+42x^2-8$,
axis lines = center,
xlabel = $x$,
ylabel = $y$,
]
addplot[color=red]y = frac6x^2-3x+42x^2-8;
endaxis
endtikzpicture
I am new to LaTex and I've been trying to follow other answers on here, but I'm still a bit confused. Apologies for posting a duplicate.
Edit: Sorry if I wasn't clear, here is how it's supposed to look.
tikz-pgf pgfplots graphs
New contributor
1
Hello and welcome! Try replacing y=frac6x^2-3x+42x^2-8 with (6*x^2-3*x+4)(2*x^2-8) as a starting point
– cmhughes
9 hours ago
In addition, useunbounded coords=jump,
to make the plot jump at the poles.
– Schrödinger's cat
9 hours ago
add a comment
|
The function I am trying to plot is y = frac6x^2-3x+42x^2-8
documentclassarticle
usepackage[utf8]inputenc
usepackagetitling
usepackageamssymb
usepackagepgfplots
begintikzpicture
beginaxis
[
title = Graph of $frac6x^2-3x+42x^2-8$,
axis lines = center,
xlabel = $x$,
ylabel = $y$,
]
addplot[color=red]y = frac6x^2-3x+42x^2-8;
endaxis
endtikzpicture
I am new to LaTex and I've been trying to follow other answers on here, but I'm still a bit confused. Apologies for posting a duplicate.
Edit: Sorry if I wasn't clear, here is how it's supposed to look.
tikz-pgf pgfplots graphs
New contributor
The function I am trying to plot is y = frac6x^2-3x+42x^2-8
documentclassarticle
usepackage[utf8]inputenc
usepackagetitling
usepackageamssymb
usepackagepgfplots
begintikzpicture
beginaxis
[
title = Graph of $frac6x^2-3x+42x^2-8$,
axis lines = center,
xlabel = $x$,
ylabel = $y$,
]
addplot[color=red]y = frac6x^2-3x+42x^2-8;
endaxis
endtikzpicture
I am new to LaTex and I've been trying to follow other answers on here, but I'm still a bit confused. Apologies for posting a duplicate.
Edit: Sorry if I wasn't clear, here is how it's supposed to look.
tikz-pgf pgfplots graphs
tikz-pgf pgfplots graphs
New contributor
New contributor
edited 9 hours ago
maxgonz
New contributor
asked 10 hours ago
maxgonzmaxgonz
184 bronze badges
184 bronze badges
New contributor
New contributor
1
Hello and welcome! Try replacing y=frac6x^2-3x+42x^2-8 with (6*x^2-3*x+4)(2*x^2-8) as a starting point
– cmhughes
9 hours ago
In addition, useunbounded coords=jump,
to make the plot jump at the poles.
– Schrödinger's cat
9 hours ago
add a comment
|
1
Hello and welcome! Try replacing y=frac6x^2-3x+42x^2-8 with (6*x^2-3*x+4)(2*x^2-8) as a starting point
– cmhughes
9 hours ago
In addition, useunbounded coords=jump,
to make the plot jump at the poles.
– Schrödinger's cat
9 hours ago
1
1
Hello and welcome! Try replacing y=frac6x^2-3x+42x^2-8 with (6*x^2-3*x+4)(2*x^2-8) as a starting point
– cmhughes
9 hours ago
Hello and welcome! Try replacing y=frac6x^2-3x+42x^2-8 with (6*x^2-3*x+4)(2*x^2-8) as a starting point
– cmhughes
9 hours ago
In addition, use
unbounded coords=jump,
to make the plot jump at the poles.– Schrödinger's cat
9 hours ago
In addition, use
unbounded coords=jump,
to make the plot jump at the poles.– Schrödinger's cat
9 hours ago
add a comment
|
3 Answers
3
active
oldest
votes
You can try the following, if you want a smoother plot, just increase the number of points.
documentclassarticle
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture
beginaxis
[
title = Graph of $frac6x^2-3x+42x^2-8$,
axis lines = center,
xlabel = $x$,
ylabel = $y$,
]
addplot[color=red] (6*x^2-3*x+4) / (2*x^2-8) ;
endaxis
endtikzpicture
enddocument
Edit:
As I said, you can increase no. points by samples=<..>
and also you can limit ymin
and ymax
because you have two infinite discontinuities at ±2
:
begintikzpicture
beginaxis
[
title = Graph of $frac6x^2-3x+42x^2-8$,
axis lines = center,
xlabel = $x$,
ylabel = $y$,
samples=500,
ymin=-150, ymax=150,
]
addplot[color=red] (6*x^2-3*x+4) / (2*x^2-8) ;
endaxis
endtikzpicture
That's not how the graph should look. Here is how it should look, sorry if I wasn't clear! link to the graph
– maxgonz
9 hours ago
That is exactly how the graph in the provided link looks like, besides that it isn't really smooth, because by default "only" 25 sample points are used. That is why AboAmmar suggested to increasesamples
to a higher number.
– Stefan Pinnow
9 hours ago
@StefanPinnow Oh sorry, thank you!
– maxgonz
9 hours ago
add a comment
|
with plain TikZ:
documentclass[tikz,border=5mm]standalone
begindocument
begintikzpicture[yscale=1/30,xscale=1.2,
declare function=
f(x)=(6*x*x-3*x+4)/(2*x*x-8);
]
defxmin-4 defxmax4
defymin-100 defymax100
draw[->] (xmin,0)--(xmax,0) node[below]$x$;
draw[->] (0,ymin)--(0,ymax) node[right]$y$;
draw (2,ymax)--(2,ymin) (-2,ymax)--(-2,ymin);
draw[magenta,smooth,samples=100]
plot[domain=-1.95:1.97] (x,f(x))
plot[domain=2.03:3.8] (x,f(x))
plot[domain=-3.8:-2.05] (x,f(x));
draw
(0,50)--+(0:1mm)--+(180:1mm) node[left]$50$
(0,-50)--+(0:1mm)--+(180:1mm) node[left]$-50$;
path
(0,0) node[below left]O
(2,0) node[below right]$2$
(-2,0) node[below left]$-2$
(current bounding box.north) node[above]
The graph of $y=frac6x^2-3x+42x^2-8$;
endtikzpicture
enddocument
add a comment
|
Hasty attempt with MetaPost and LuaLaTeX, using an old template of my own.
documentclass[12pt,border=5mm]standalone
usepackageluatex85, luamplib
mplibsetformatmetafun
mplibtextextlabelenable
mplibnumbersystemdouble
begindocument
beginmplibcode
vardef function(expr xmin, xmax, xstep)(text f_x) =
save x; x := xmin;
(x, f_x)
forever: hide(x := x + xstep) exitif x > xmax;
.. (x, f_x)
endfor
if x - xstep < xmax: hide(x := xmax) .. (x, f_x) fi
enddef;
u = v = .5cm;
xmax = -xmin = 15; ymax = -ymin = 20; xstep := .01;
vardef f(expr x) = (6(x**2)-3x+4)/(2(x**2)-8) enddef;
beginfig(1);
drawoptions(withcolor green);
draw (-2u, ymin*v) -- (-2u, ymax*v);
draw (2u, ymin*v) -- (2u, ymax*v);
draw (xmin*u, 3v) -- (xmax*u, 3v);
drawoptions(withcolor red);
draw function(xmin, -2.1, .xstep)(f(x)) xyscaled (u,v);
draw function(-1.9, 1.95, xstep)(f(x)) xyscaled (u,v);
draw function(2.1, xmax, xstep)(f(x)) xyscaled (u,v);
clip currentpicture to ((xmin, ymin) -- (xmax, ymin) -- (xmax, ymax) -- (xmin, ymax) -- cycle) xyscaled (u,v);
drawoptions(withcolor black);
drawarrow (xmin*u, 0) -- (xmax*u, 0);
drawarrow (0, ymin*v) -- (0, ymax*v);
for i = 1 upto floor(xmax.-1):
draw (i*u, -2bp) -- (i*u, 2bp);
draw (-i*u, -2bp) -- (-i*u, 2bp);
endfor;
for j = 1 upto floor(ymax-.1):
draw (2bp, j*v) -- (-2bp, j*v);
draw (2bp, -j*v) -- (-2bp, -j*v);
endfor;
label.bot("$x$", (xmax*u,0)); label.lft("$y$", (0, ymax*v));
labeloffset := 5bp;
label.bot("$-2$", (-2u,0)); label.bot("$2$", (2u, 0));
label.lft("$3$", (0,3v));
endfig;
endmplibcode
enddocument
add a comment
|
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
maxgonz is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f511206%2fim-trying-to-graph-a-rational-function%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can try the following, if you want a smoother plot, just increase the number of points.
documentclassarticle
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture
beginaxis
[
title = Graph of $frac6x^2-3x+42x^2-8$,
axis lines = center,
xlabel = $x$,
ylabel = $y$,
]
addplot[color=red] (6*x^2-3*x+4) / (2*x^2-8) ;
endaxis
endtikzpicture
enddocument
Edit:
As I said, you can increase no. points by samples=<..>
and also you can limit ymin
and ymax
because you have two infinite discontinuities at ±2
:
begintikzpicture
beginaxis
[
title = Graph of $frac6x^2-3x+42x^2-8$,
axis lines = center,
xlabel = $x$,
ylabel = $y$,
samples=500,
ymin=-150, ymax=150,
]
addplot[color=red] (6*x^2-3*x+4) / (2*x^2-8) ;
endaxis
endtikzpicture
That's not how the graph should look. Here is how it should look, sorry if I wasn't clear! link to the graph
– maxgonz
9 hours ago
That is exactly how the graph in the provided link looks like, besides that it isn't really smooth, because by default "only" 25 sample points are used. That is why AboAmmar suggested to increasesamples
to a higher number.
– Stefan Pinnow
9 hours ago
@StefanPinnow Oh sorry, thank you!
– maxgonz
9 hours ago
add a comment
|
You can try the following, if you want a smoother plot, just increase the number of points.
documentclassarticle
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture
beginaxis
[
title = Graph of $frac6x^2-3x+42x^2-8$,
axis lines = center,
xlabel = $x$,
ylabel = $y$,
]
addplot[color=red] (6*x^2-3*x+4) / (2*x^2-8) ;
endaxis
endtikzpicture
enddocument
Edit:
As I said, you can increase no. points by samples=<..>
and also you can limit ymin
and ymax
because you have two infinite discontinuities at ±2
:
begintikzpicture
beginaxis
[
title = Graph of $frac6x^2-3x+42x^2-8$,
axis lines = center,
xlabel = $x$,
ylabel = $y$,
samples=500,
ymin=-150, ymax=150,
]
addplot[color=red] (6*x^2-3*x+4) / (2*x^2-8) ;
endaxis
endtikzpicture
That's not how the graph should look. Here is how it should look, sorry if I wasn't clear! link to the graph
– maxgonz
9 hours ago
That is exactly how the graph in the provided link looks like, besides that it isn't really smooth, because by default "only" 25 sample points are used. That is why AboAmmar suggested to increasesamples
to a higher number.
– Stefan Pinnow
9 hours ago
@StefanPinnow Oh sorry, thank you!
– maxgonz
9 hours ago
add a comment
|
You can try the following, if you want a smoother plot, just increase the number of points.
documentclassarticle
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture
beginaxis
[
title = Graph of $frac6x^2-3x+42x^2-8$,
axis lines = center,
xlabel = $x$,
ylabel = $y$,
]
addplot[color=red] (6*x^2-3*x+4) / (2*x^2-8) ;
endaxis
endtikzpicture
enddocument
Edit:
As I said, you can increase no. points by samples=<..>
and also you can limit ymin
and ymax
because you have two infinite discontinuities at ±2
:
begintikzpicture
beginaxis
[
title = Graph of $frac6x^2-3x+42x^2-8$,
axis lines = center,
xlabel = $x$,
ylabel = $y$,
samples=500,
ymin=-150, ymax=150,
]
addplot[color=red] (6*x^2-3*x+4) / (2*x^2-8) ;
endaxis
endtikzpicture
You can try the following, if you want a smoother plot, just increase the number of points.
documentclassarticle
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture
beginaxis
[
title = Graph of $frac6x^2-3x+42x^2-8$,
axis lines = center,
xlabel = $x$,
ylabel = $y$,
]
addplot[color=red] (6*x^2-3*x+4) / (2*x^2-8) ;
endaxis
endtikzpicture
enddocument
Edit:
As I said, you can increase no. points by samples=<..>
and also you can limit ymin
and ymax
because you have two infinite discontinuities at ±2
:
begintikzpicture
beginaxis
[
title = Graph of $frac6x^2-3x+42x^2-8$,
axis lines = center,
xlabel = $x$,
ylabel = $y$,
samples=500,
ymin=-150, ymax=150,
]
addplot[color=red] (6*x^2-3*x+4) / (2*x^2-8) ;
endaxis
endtikzpicture
edited 9 hours ago
answered 9 hours ago
AboAmmarAboAmmar
37k3 gold badges31 silver badges91 bronze badges
37k3 gold badges31 silver badges91 bronze badges
That's not how the graph should look. Here is how it should look, sorry if I wasn't clear! link to the graph
– maxgonz
9 hours ago
That is exactly how the graph in the provided link looks like, besides that it isn't really smooth, because by default "only" 25 sample points are used. That is why AboAmmar suggested to increasesamples
to a higher number.
– Stefan Pinnow
9 hours ago
@StefanPinnow Oh sorry, thank you!
– maxgonz
9 hours ago
add a comment
|
That's not how the graph should look. Here is how it should look, sorry if I wasn't clear! link to the graph
– maxgonz
9 hours ago
That is exactly how the graph in the provided link looks like, besides that it isn't really smooth, because by default "only" 25 sample points are used. That is why AboAmmar suggested to increasesamples
to a higher number.
– Stefan Pinnow
9 hours ago
@StefanPinnow Oh sorry, thank you!
– maxgonz
9 hours ago
That's not how the graph should look. Here is how it should look, sorry if I wasn't clear! link to the graph
– maxgonz
9 hours ago
That's not how the graph should look. Here is how it should look, sorry if I wasn't clear! link to the graph
– maxgonz
9 hours ago
That is exactly how the graph in the provided link looks like, besides that it isn't really smooth, because by default "only" 25 sample points are used. That is why AboAmmar suggested to increase
samples
to a higher number.– Stefan Pinnow
9 hours ago
That is exactly how the graph in the provided link looks like, besides that it isn't really smooth, because by default "only" 25 sample points are used. That is why AboAmmar suggested to increase
samples
to a higher number.– Stefan Pinnow
9 hours ago
@StefanPinnow Oh sorry, thank you!
– maxgonz
9 hours ago
@StefanPinnow Oh sorry, thank you!
– maxgonz
9 hours ago
add a comment
|
with plain TikZ:
documentclass[tikz,border=5mm]standalone
begindocument
begintikzpicture[yscale=1/30,xscale=1.2,
declare function=
f(x)=(6*x*x-3*x+4)/(2*x*x-8);
]
defxmin-4 defxmax4
defymin-100 defymax100
draw[->] (xmin,0)--(xmax,0) node[below]$x$;
draw[->] (0,ymin)--(0,ymax) node[right]$y$;
draw (2,ymax)--(2,ymin) (-2,ymax)--(-2,ymin);
draw[magenta,smooth,samples=100]
plot[domain=-1.95:1.97] (x,f(x))
plot[domain=2.03:3.8] (x,f(x))
plot[domain=-3.8:-2.05] (x,f(x));
draw
(0,50)--+(0:1mm)--+(180:1mm) node[left]$50$
(0,-50)--+(0:1mm)--+(180:1mm) node[left]$-50$;
path
(0,0) node[below left]O
(2,0) node[below right]$2$
(-2,0) node[below left]$-2$
(current bounding box.north) node[above]
The graph of $y=frac6x^2-3x+42x^2-8$;
endtikzpicture
enddocument
add a comment
|
with plain TikZ:
documentclass[tikz,border=5mm]standalone
begindocument
begintikzpicture[yscale=1/30,xscale=1.2,
declare function=
f(x)=(6*x*x-3*x+4)/(2*x*x-8);
]
defxmin-4 defxmax4
defymin-100 defymax100
draw[->] (xmin,0)--(xmax,0) node[below]$x$;
draw[->] (0,ymin)--(0,ymax) node[right]$y$;
draw (2,ymax)--(2,ymin) (-2,ymax)--(-2,ymin);
draw[magenta,smooth,samples=100]
plot[domain=-1.95:1.97] (x,f(x))
plot[domain=2.03:3.8] (x,f(x))
plot[domain=-3.8:-2.05] (x,f(x));
draw
(0,50)--+(0:1mm)--+(180:1mm) node[left]$50$
(0,-50)--+(0:1mm)--+(180:1mm) node[left]$-50$;
path
(0,0) node[below left]O
(2,0) node[below right]$2$
(-2,0) node[below left]$-2$
(current bounding box.north) node[above]
The graph of $y=frac6x^2-3x+42x^2-8$;
endtikzpicture
enddocument
add a comment
|
with plain TikZ:
documentclass[tikz,border=5mm]standalone
begindocument
begintikzpicture[yscale=1/30,xscale=1.2,
declare function=
f(x)=(6*x*x-3*x+4)/(2*x*x-8);
]
defxmin-4 defxmax4
defymin-100 defymax100
draw[->] (xmin,0)--(xmax,0) node[below]$x$;
draw[->] (0,ymin)--(0,ymax) node[right]$y$;
draw (2,ymax)--(2,ymin) (-2,ymax)--(-2,ymin);
draw[magenta,smooth,samples=100]
plot[domain=-1.95:1.97] (x,f(x))
plot[domain=2.03:3.8] (x,f(x))
plot[domain=-3.8:-2.05] (x,f(x));
draw
(0,50)--+(0:1mm)--+(180:1mm) node[left]$50$
(0,-50)--+(0:1mm)--+(180:1mm) node[left]$-50$;
path
(0,0) node[below left]O
(2,0) node[below right]$2$
(-2,0) node[below left]$-2$
(current bounding box.north) node[above]
The graph of $y=frac6x^2-3x+42x^2-8$;
endtikzpicture
enddocument
with plain TikZ:
documentclass[tikz,border=5mm]standalone
begindocument
begintikzpicture[yscale=1/30,xscale=1.2,
declare function=
f(x)=(6*x*x-3*x+4)/(2*x*x-8);
]
defxmin-4 defxmax4
defymin-100 defymax100
draw[->] (xmin,0)--(xmax,0) node[below]$x$;
draw[->] (0,ymin)--(0,ymax) node[right]$y$;
draw (2,ymax)--(2,ymin) (-2,ymax)--(-2,ymin);
draw[magenta,smooth,samples=100]
plot[domain=-1.95:1.97] (x,f(x))
plot[domain=2.03:3.8] (x,f(x))
plot[domain=-3.8:-2.05] (x,f(x));
draw
(0,50)--+(0:1mm)--+(180:1mm) node[left]$50$
(0,-50)--+(0:1mm)--+(180:1mm) node[left]$-50$;
path
(0,0) node[below left]O
(2,0) node[below right]$2$
(-2,0) node[below left]$-2$
(current bounding box.north) node[above]
The graph of $y=frac6x^2-3x+42x^2-8$;
endtikzpicture
enddocument
answered 8 hours ago
Black MildBlack Mild
2,2539 silver badges16 bronze badges
2,2539 silver badges16 bronze badges
add a comment
|
add a comment
|
Hasty attempt with MetaPost and LuaLaTeX, using an old template of my own.
documentclass[12pt,border=5mm]standalone
usepackageluatex85, luamplib
mplibsetformatmetafun
mplibtextextlabelenable
mplibnumbersystemdouble
begindocument
beginmplibcode
vardef function(expr xmin, xmax, xstep)(text f_x) =
save x; x := xmin;
(x, f_x)
forever: hide(x := x + xstep) exitif x > xmax;
.. (x, f_x)
endfor
if x - xstep < xmax: hide(x := xmax) .. (x, f_x) fi
enddef;
u = v = .5cm;
xmax = -xmin = 15; ymax = -ymin = 20; xstep := .01;
vardef f(expr x) = (6(x**2)-3x+4)/(2(x**2)-8) enddef;
beginfig(1);
drawoptions(withcolor green);
draw (-2u, ymin*v) -- (-2u, ymax*v);
draw (2u, ymin*v) -- (2u, ymax*v);
draw (xmin*u, 3v) -- (xmax*u, 3v);
drawoptions(withcolor red);
draw function(xmin, -2.1, .xstep)(f(x)) xyscaled (u,v);
draw function(-1.9, 1.95, xstep)(f(x)) xyscaled (u,v);
draw function(2.1, xmax, xstep)(f(x)) xyscaled (u,v);
clip currentpicture to ((xmin, ymin) -- (xmax, ymin) -- (xmax, ymax) -- (xmin, ymax) -- cycle) xyscaled (u,v);
drawoptions(withcolor black);
drawarrow (xmin*u, 0) -- (xmax*u, 0);
drawarrow (0, ymin*v) -- (0, ymax*v);
for i = 1 upto floor(xmax.-1):
draw (i*u, -2bp) -- (i*u, 2bp);
draw (-i*u, -2bp) -- (-i*u, 2bp);
endfor;
for j = 1 upto floor(ymax-.1):
draw (2bp, j*v) -- (-2bp, j*v);
draw (2bp, -j*v) -- (-2bp, -j*v);
endfor;
label.bot("$x$", (xmax*u,0)); label.lft("$y$", (0, ymax*v));
labeloffset := 5bp;
label.bot("$-2$", (-2u,0)); label.bot("$2$", (2u, 0));
label.lft("$3$", (0,3v));
endfig;
endmplibcode
enddocument
add a comment
|
Hasty attempt with MetaPost and LuaLaTeX, using an old template of my own.
documentclass[12pt,border=5mm]standalone
usepackageluatex85, luamplib
mplibsetformatmetafun
mplibtextextlabelenable
mplibnumbersystemdouble
begindocument
beginmplibcode
vardef function(expr xmin, xmax, xstep)(text f_x) =
save x; x := xmin;
(x, f_x)
forever: hide(x := x + xstep) exitif x > xmax;
.. (x, f_x)
endfor
if x - xstep < xmax: hide(x := xmax) .. (x, f_x) fi
enddef;
u = v = .5cm;
xmax = -xmin = 15; ymax = -ymin = 20; xstep := .01;
vardef f(expr x) = (6(x**2)-3x+4)/(2(x**2)-8) enddef;
beginfig(1);
drawoptions(withcolor green);
draw (-2u, ymin*v) -- (-2u, ymax*v);
draw (2u, ymin*v) -- (2u, ymax*v);
draw (xmin*u, 3v) -- (xmax*u, 3v);
drawoptions(withcolor red);
draw function(xmin, -2.1, .xstep)(f(x)) xyscaled (u,v);
draw function(-1.9, 1.95, xstep)(f(x)) xyscaled (u,v);
draw function(2.1, xmax, xstep)(f(x)) xyscaled (u,v);
clip currentpicture to ((xmin, ymin) -- (xmax, ymin) -- (xmax, ymax) -- (xmin, ymax) -- cycle) xyscaled (u,v);
drawoptions(withcolor black);
drawarrow (xmin*u, 0) -- (xmax*u, 0);
drawarrow (0, ymin*v) -- (0, ymax*v);
for i = 1 upto floor(xmax.-1):
draw (i*u, -2bp) -- (i*u, 2bp);
draw (-i*u, -2bp) -- (-i*u, 2bp);
endfor;
for j = 1 upto floor(ymax-.1):
draw (2bp, j*v) -- (-2bp, j*v);
draw (2bp, -j*v) -- (-2bp, -j*v);
endfor;
label.bot("$x$", (xmax*u,0)); label.lft("$y$", (0, ymax*v));
labeloffset := 5bp;
label.bot("$-2$", (-2u,0)); label.bot("$2$", (2u, 0));
label.lft("$3$", (0,3v));
endfig;
endmplibcode
enddocument
add a comment
|
Hasty attempt with MetaPost and LuaLaTeX, using an old template of my own.
documentclass[12pt,border=5mm]standalone
usepackageluatex85, luamplib
mplibsetformatmetafun
mplibtextextlabelenable
mplibnumbersystemdouble
begindocument
beginmplibcode
vardef function(expr xmin, xmax, xstep)(text f_x) =
save x; x := xmin;
(x, f_x)
forever: hide(x := x + xstep) exitif x > xmax;
.. (x, f_x)
endfor
if x - xstep < xmax: hide(x := xmax) .. (x, f_x) fi
enddef;
u = v = .5cm;
xmax = -xmin = 15; ymax = -ymin = 20; xstep := .01;
vardef f(expr x) = (6(x**2)-3x+4)/(2(x**2)-8) enddef;
beginfig(1);
drawoptions(withcolor green);
draw (-2u, ymin*v) -- (-2u, ymax*v);
draw (2u, ymin*v) -- (2u, ymax*v);
draw (xmin*u, 3v) -- (xmax*u, 3v);
drawoptions(withcolor red);
draw function(xmin, -2.1, .xstep)(f(x)) xyscaled (u,v);
draw function(-1.9, 1.95, xstep)(f(x)) xyscaled (u,v);
draw function(2.1, xmax, xstep)(f(x)) xyscaled (u,v);
clip currentpicture to ((xmin, ymin) -- (xmax, ymin) -- (xmax, ymax) -- (xmin, ymax) -- cycle) xyscaled (u,v);
drawoptions(withcolor black);
drawarrow (xmin*u, 0) -- (xmax*u, 0);
drawarrow (0, ymin*v) -- (0, ymax*v);
for i = 1 upto floor(xmax.-1):
draw (i*u, -2bp) -- (i*u, 2bp);
draw (-i*u, -2bp) -- (-i*u, 2bp);
endfor;
for j = 1 upto floor(ymax-.1):
draw (2bp, j*v) -- (-2bp, j*v);
draw (2bp, -j*v) -- (-2bp, -j*v);
endfor;
label.bot("$x$", (xmax*u,0)); label.lft("$y$", (0, ymax*v));
labeloffset := 5bp;
label.bot("$-2$", (-2u,0)); label.bot("$2$", (2u, 0));
label.lft("$3$", (0,3v));
endfig;
endmplibcode
enddocument
Hasty attempt with MetaPost and LuaLaTeX, using an old template of my own.
documentclass[12pt,border=5mm]standalone
usepackageluatex85, luamplib
mplibsetformatmetafun
mplibtextextlabelenable
mplibnumbersystemdouble
begindocument
beginmplibcode
vardef function(expr xmin, xmax, xstep)(text f_x) =
save x; x := xmin;
(x, f_x)
forever: hide(x := x + xstep) exitif x > xmax;
.. (x, f_x)
endfor
if x - xstep < xmax: hide(x := xmax) .. (x, f_x) fi
enddef;
u = v = .5cm;
xmax = -xmin = 15; ymax = -ymin = 20; xstep := .01;
vardef f(expr x) = (6(x**2)-3x+4)/(2(x**2)-8) enddef;
beginfig(1);
drawoptions(withcolor green);
draw (-2u, ymin*v) -- (-2u, ymax*v);
draw (2u, ymin*v) -- (2u, ymax*v);
draw (xmin*u, 3v) -- (xmax*u, 3v);
drawoptions(withcolor red);
draw function(xmin, -2.1, .xstep)(f(x)) xyscaled (u,v);
draw function(-1.9, 1.95, xstep)(f(x)) xyscaled (u,v);
draw function(2.1, xmax, xstep)(f(x)) xyscaled (u,v);
clip currentpicture to ((xmin, ymin) -- (xmax, ymin) -- (xmax, ymax) -- (xmin, ymax) -- cycle) xyscaled (u,v);
drawoptions(withcolor black);
drawarrow (xmin*u, 0) -- (xmax*u, 0);
drawarrow (0, ymin*v) -- (0, ymax*v);
for i = 1 upto floor(xmax.-1):
draw (i*u, -2bp) -- (i*u, 2bp);
draw (-i*u, -2bp) -- (-i*u, 2bp);
endfor;
for j = 1 upto floor(ymax-.1):
draw (2bp, j*v) -- (-2bp, j*v);
draw (2bp, -j*v) -- (-2bp, -j*v);
endfor;
label.bot("$x$", (xmax*u,0)); label.lft("$y$", (0, ymax*v));
labeloffset := 5bp;
label.bot("$-2$", (-2u,0)); label.bot("$2$", (2u, 0));
label.lft("$3$", (0,3v));
endfig;
endmplibcode
enddocument
edited 8 hours ago
answered 9 hours ago
Franck PastorFranck Pastor
16k1 gold badge39 silver badges62 bronze badges
16k1 gold badge39 silver badges62 bronze badges
add a comment
|
add a comment
|
maxgonz is a new contributor. Be nice, and check out our Code of Conduct.
maxgonz is a new contributor. Be nice, and check out our Code of Conduct.
maxgonz is a new contributor. Be nice, and check out our Code of Conduct.
maxgonz is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f511206%2fim-trying-to-graph-a-rational-function%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Hello and welcome! Try replacing y=frac6x^2-3x+42x^2-8 with (6*x^2-3*x+4)(2*x^2-8) as a starting point
– cmhughes
9 hours ago
In addition, use
unbounded coords=jump,
to make the plot jump at the poles.– Schrödinger's cat
9 hours ago