I'm trying to graph a rational function in tikz
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I'm attempting to graph the function y=[(x-2)(x+2)]/[(x-3)(x+3)]. However, I get bizarre output, which consists of straight lines. Any idea what's wrong?
Thanks!
documentclassarticle
usepackagetikz
begindocument
begintikzpicture
draw[gray,very thin] (-5,-5) grid (5,5);
draw[black, very thick,<->](-5,0) -- (5,0);
draw[black,very thick,<->](0,-5) -- (0,5);
draw[very thick,domain=-5:-3.20156] plot (x,((x-2)(x+2))/((x-3)(x+3)));
draw[very thick,domain=-2.8577:2.8577] plot (x,((x-2)(x+2))/((x-3)(x+3)));
draw[very thick,domain=3.20156:5] plot (x,((x-2)(x+2))/((x-3)(x+3)));
endtikzpicture
enddocument
tikz-pgf graphs
add a comment |Â
up vote
2
down vote
favorite
I'm attempting to graph the function y=[(x-2)(x+2)]/[(x-3)(x+3)]. However, I get bizarre output, which consists of straight lines. Any idea what's wrong?
Thanks!
documentclassarticle
usepackagetikz
begindocument
begintikzpicture
draw[gray,very thin] (-5,-5) grid (5,5);
draw[black, very thick,<->](-5,0) -- (5,0);
draw[black,very thick,<->](0,-5) -- (0,5);
draw[very thick,domain=-5:-3.20156] plot (x,((x-2)(x+2))/((x-3)(x+3)));
draw[very thick,domain=-2.8577:2.8577] plot (x,((x-2)(x+2))/((x-3)(x+3)));
draw[very thick,domain=3.20156:5] plot (x,((x-2)(x+2))/((x-3)(x+3)));
endtikzpicture
enddocument
tikz-pgf graphs
You get what you ask for, I think. What fixes the domains you're using?
– marmot
34 mins ago
The domain is determined by the bounds -5<y<5.
– Ben W
32 mins ago
Yes, but you also forgot the multiplication signs.
– marmot
30 mins ago
Oops! That fixed it, thank you!
– Ben W
28 mins ago
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I'm attempting to graph the function y=[(x-2)(x+2)]/[(x-3)(x+3)]. However, I get bizarre output, which consists of straight lines. Any idea what's wrong?
Thanks!
documentclassarticle
usepackagetikz
begindocument
begintikzpicture
draw[gray,very thin] (-5,-5) grid (5,5);
draw[black, very thick,<->](-5,0) -- (5,0);
draw[black,very thick,<->](0,-5) -- (0,5);
draw[very thick,domain=-5:-3.20156] plot (x,((x-2)(x+2))/((x-3)(x+3)));
draw[very thick,domain=-2.8577:2.8577] plot (x,((x-2)(x+2))/((x-3)(x+3)));
draw[very thick,domain=3.20156:5] plot (x,((x-2)(x+2))/((x-3)(x+3)));
endtikzpicture
enddocument
tikz-pgf graphs
I'm attempting to graph the function y=[(x-2)(x+2)]/[(x-3)(x+3)]. However, I get bizarre output, which consists of straight lines. Any idea what's wrong?
Thanks!
documentclassarticle
usepackagetikz
begindocument
begintikzpicture
draw[gray,very thin] (-5,-5) grid (5,5);
draw[black, very thick,<->](-5,0) -- (5,0);
draw[black,very thick,<->](0,-5) -- (0,5);
draw[very thick,domain=-5:-3.20156] plot (x,((x-2)(x+2))/((x-3)(x+3)));
draw[very thick,domain=-2.8577:2.8577] plot (x,((x-2)(x+2))/((x-3)(x+3)));
draw[very thick,domain=3.20156:5] plot (x,((x-2)(x+2))/((x-3)(x+3)));
endtikzpicture
enddocument
tikz-pgf graphs
tikz-pgf graphs
edited 35 mins ago


marmot
71.5k476152
71.5k476152
asked 43 mins ago
Ben W
1214
1214
You get what you ask for, I think. What fixes the domains you're using?
– marmot
34 mins ago
The domain is determined by the bounds -5<y<5.
– Ben W
32 mins ago
Yes, but you also forgot the multiplication signs.
– marmot
30 mins ago
Oops! That fixed it, thank you!
– Ben W
28 mins ago
add a comment |Â
You get what you ask for, I think. What fixes the domains you're using?
– marmot
34 mins ago
The domain is determined by the bounds -5<y<5.
– Ben W
32 mins ago
Yes, but you also forgot the multiplication signs.
– marmot
30 mins ago
Oops! That fixed it, thank you!
– Ben W
28 mins ago
You get what you ask for, I think. What fixes the domains you're using?
– marmot
34 mins ago
You get what you ask for, I think. What fixes the domains you're using?
– marmot
34 mins ago
The domain is determined by the bounds -5<y<5.
– Ben W
32 mins ago
The domain is determined by the bounds -5<y<5.
– Ben W
32 mins ago
Yes, but you also forgot the multiplication signs.
– marmot
30 mins ago
Yes, but you also forgot the multiplication signs.
– marmot
30 mins ago
Oops! That fixed it, thank you!
– Ben W
28 mins ago
Oops! That fixed it, thank you!
– Ben W
28 mins ago
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
2
down vote
accepted
You simply forgot multiplication signs and can make your life much more comfortable if you use declare function
. And even even simpler with pgfplots because then you can just "jump" over singularities.
documentclassarticle
usepackagetikz
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture[declare function=f(x)=((x-2)*(x+2))/((x-3)*(x+3));,
samples=101]
draw[gray,very thin] (-5,-5) grid (5,5);
draw[black, very thick,<->](-5,0) -- (5,0);
draw[black,very thick,<->](0,-5) -- (0,5);
draw[very thick,domain=-5:-3.20156] plot (x,f(x));
draw[very thick,domain=-2.8577:2.8577] plot (x,f(x));
draw[very thick,domain=3.20156:5] plot (x,f(x));
endtikzpicture
begintikzpicture[declare function=f(x)=((x-2)*(x+2))/((x-3)*(x+3));]
beginaxis[grid=major,axis lines=middle,xtick=empty,ytick=empty,
unbounded coords=jump,samples=101]
addplot[domain=-5:5] f(x);
endaxis
endtikzpicture
enddocument
add a comment |Â
up vote
0
down vote
run with xelatex
documentclassarticle
usepackagepst-plot
begindocument
beginpspicture*[showgrid](-5,-5)(5,5)
psaxes[labels=none,ticks=none,arrowscale=1.5]<->(0,0)(-5,-5)(5,5)
psplot[algebraic,plotpoints=501,yMaxValue=5.5,
linewidth=1.5pt]-55(x-2)*(x+2)/((x-3)*(x+3))
endpspicture*
enddocument
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
You simply forgot multiplication signs and can make your life much more comfortable if you use declare function
. And even even simpler with pgfplots because then you can just "jump" over singularities.
documentclassarticle
usepackagetikz
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture[declare function=f(x)=((x-2)*(x+2))/((x-3)*(x+3));,
samples=101]
draw[gray,very thin] (-5,-5) grid (5,5);
draw[black, very thick,<->](-5,0) -- (5,0);
draw[black,very thick,<->](0,-5) -- (0,5);
draw[very thick,domain=-5:-3.20156] plot (x,f(x));
draw[very thick,domain=-2.8577:2.8577] plot (x,f(x));
draw[very thick,domain=3.20156:5] plot (x,f(x));
endtikzpicture
begintikzpicture[declare function=f(x)=((x-2)*(x+2))/((x-3)*(x+3));]
beginaxis[grid=major,axis lines=middle,xtick=empty,ytick=empty,
unbounded coords=jump,samples=101]
addplot[domain=-5:5] f(x);
endaxis
endtikzpicture
enddocument
add a comment |Â
up vote
2
down vote
accepted
You simply forgot multiplication signs and can make your life much more comfortable if you use declare function
. And even even simpler with pgfplots because then you can just "jump" over singularities.
documentclassarticle
usepackagetikz
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture[declare function=f(x)=((x-2)*(x+2))/((x-3)*(x+3));,
samples=101]
draw[gray,very thin] (-5,-5) grid (5,5);
draw[black, very thick,<->](-5,0) -- (5,0);
draw[black,very thick,<->](0,-5) -- (0,5);
draw[very thick,domain=-5:-3.20156] plot (x,f(x));
draw[very thick,domain=-2.8577:2.8577] plot (x,f(x));
draw[very thick,domain=3.20156:5] plot (x,f(x));
endtikzpicture
begintikzpicture[declare function=f(x)=((x-2)*(x+2))/((x-3)*(x+3));]
beginaxis[grid=major,axis lines=middle,xtick=empty,ytick=empty,
unbounded coords=jump,samples=101]
addplot[domain=-5:5] f(x);
endaxis
endtikzpicture
enddocument
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
You simply forgot multiplication signs and can make your life much more comfortable if you use declare function
. And even even simpler with pgfplots because then you can just "jump" over singularities.
documentclassarticle
usepackagetikz
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture[declare function=f(x)=((x-2)*(x+2))/((x-3)*(x+3));,
samples=101]
draw[gray,very thin] (-5,-5) grid (5,5);
draw[black, very thick,<->](-5,0) -- (5,0);
draw[black,very thick,<->](0,-5) -- (0,5);
draw[very thick,domain=-5:-3.20156] plot (x,f(x));
draw[very thick,domain=-2.8577:2.8577] plot (x,f(x));
draw[very thick,domain=3.20156:5] plot (x,f(x));
endtikzpicture
begintikzpicture[declare function=f(x)=((x-2)*(x+2))/((x-3)*(x+3));]
beginaxis[grid=major,axis lines=middle,xtick=empty,ytick=empty,
unbounded coords=jump,samples=101]
addplot[domain=-5:5] f(x);
endaxis
endtikzpicture
enddocument
You simply forgot multiplication signs and can make your life much more comfortable if you use declare function
. And even even simpler with pgfplots because then you can just "jump" over singularities.
documentclassarticle
usepackagetikz
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture[declare function=f(x)=((x-2)*(x+2))/((x-3)*(x+3));,
samples=101]
draw[gray,very thin] (-5,-5) grid (5,5);
draw[black, very thick,<->](-5,0) -- (5,0);
draw[black,very thick,<->](0,-5) -- (0,5);
draw[very thick,domain=-5:-3.20156] plot (x,f(x));
draw[very thick,domain=-2.8577:2.8577] plot (x,f(x));
draw[very thick,domain=3.20156:5] plot (x,f(x));
endtikzpicture
begintikzpicture[declare function=f(x)=((x-2)*(x+2))/((x-3)*(x+3));]
beginaxis[grid=major,axis lines=middle,xtick=empty,ytick=empty,
unbounded coords=jump,samples=101]
addplot[domain=-5:5] f(x);
endaxis
endtikzpicture
enddocument
answered 28 mins ago


marmot
71.5k476152
71.5k476152
add a comment |Â
add a comment |Â
up vote
0
down vote
run with xelatex
documentclassarticle
usepackagepst-plot
begindocument
beginpspicture*[showgrid](-5,-5)(5,5)
psaxes[labels=none,ticks=none,arrowscale=1.5]<->(0,0)(-5,-5)(5,5)
psplot[algebraic,plotpoints=501,yMaxValue=5.5,
linewidth=1.5pt]-55(x-2)*(x+2)/((x-3)*(x+3))
endpspicture*
enddocument
add a comment |Â
up vote
0
down vote
run with xelatex
documentclassarticle
usepackagepst-plot
begindocument
beginpspicture*[showgrid](-5,-5)(5,5)
psaxes[labels=none,ticks=none,arrowscale=1.5]<->(0,0)(-5,-5)(5,5)
psplot[algebraic,plotpoints=501,yMaxValue=5.5,
linewidth=1.5pt]-55(x-2)*(x+2)/((x-3)*(x+3))
endpspicture*
enddocument
add a comment |Â
up vote
0
down vote
up vote
0
down vote
run with xelatex
documentclassarticle
usepackagepst-plot
begindocument
beginpspicture*[showgrid](-5,-5)(5,5)
psaxes[labels=none,ticks=none,arrowscale=1.5]<->(0,0)(-5,-5)(5,5)
psplot[algebraic,plotpoints=501,yMaxValue=5.5,
linewidth=1.5pt]-55(x-2)*(x+2)/((x-3)*(x+3))
endpspicture*
enddocument
run with xelatex
documentclassarticle
usepackagepst-plot
begindocument
beginpspicture*[showgrid](-5,-5)(5,5)
psaxes[labels=none,ticks=none,arrowscale=1.5]<->(0,0)(-5,-5)(5,5)
psplot[algebraic,plotpoints=501,yMaxValue=5.5,
linewidth=1.5pt]-55(x-2)*(x+2)/((x-3)*(x+3))
endpspicture*
enddocument
answered 9 mins ago


Herbert
264k23399710
264k23399710
add a comment |Â
add a comment |Â
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f458348%2fim-trying-to-graph-a-rational-function-in-tikz%23new-answer', 'question_page');
);
Post as a guest
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
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
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
You get what you ask for, I think. What fixes the domains you're using?
– marmot
34 mins ago
The domain is determined by the bounds -5<y<5.
– Ben W
32 mins ago
Yes, but you also forgot the multiplication signs.
– marmot
30 mins ago
Oops! That fixed it, thank you!
– Ben W
28 mins ago