MHB Plot of y = \dfrac{4}{9}(x-3)(x+3)

  • Thread starter Thread starter karush
  • Start date Start date
  • Tags Tags
    Plot
AI Thread Summary
The discussion revolves around the plotting of the quadratic function y = (4/9)(x-3)(x+3) using TikZ in LaTeX. Users are attempting to create a visual representation of the function but encounter issues with the code not displaying correctly in the forum environment. They share various snippets of TikZ code, highlighting the importance of proper syntax and the need for adjustments to avoid formatting errors, such as the misinterpretation of the "[right]" command. The conversation emphasizes troubleshooting techniques and the correct implementation of the TikZ package to achieve the desired plot, including marking key points on the graph.
karush
Gold Member
MHB
Messages
3,240
Reaction score
5
$y = \dfrac{4}{9}(x-3)(x+3)$

ok I can't seem to write tikz to plot this

\begin{tikzpicture}[scale=0.50]
%preamble \usepackage{pgfplots}
\begin{axis}[xmin=-3.5, xmax=3.5, ymin=-5, ymax=5, axis lines=middle, ticks=none]
\addplot[
draw = black, smooth, ultra thick,
domain=-4:4,
] {exp((4/9)*(x^2-9)}
foreach \x in {-3,3} { (axis cs:{\x},0) node[below left] {\x} };
\end{axis}
\end{tikzpicture}
$y = \dfrac{4}{9}(x-3)(x+3)$
 
Physics news on Phys.org
this plots in overleaf but not here?ut\begin{tikzpicture}[xscale=1,yscale=1]
%preamble \usepackage{pgfplots}
\begin{axis}[xmin=-4, xmax=4, ymin=-5, ymax=5, axis lines=middle, ticks=none]
\addplot[draw = blue, smooth, ultra thick,domain=-4:4,] {(4/9)*(x^2-9))};
\draw[thin][fill][red] (-3,0) circle (.2);\node [below] at (-3.2,-.5) {(-3,0)};
\draw[thin][fill][red] (3,0) circle (.2);\node [below] at (3.2,-.5) {(3,0)};
\draw[thin][fill][red] (0,-4) circle (.2);\node
at (.3,-4.3) {(0,-4)};
\end{axis}
\end{tikzpicture}
$\boxed{y=\dfrac{4}{9}(x^2-9)}$​
 
It seems to plot just fine for me. What is the problem?
 
sorry actually its this one...

$\boxed{y=\dfrac{4}{9}(x^2-9)}$
\begin{tikzpicture}[xscale=1,yscale=1]
%preamble \usepackage{pgfplots}
\begin{axis}[xmin=-4, xmax=4, ymin=-5, ymax=3, axis lines=middle, ticks=none]
\addplot[draw = blue, smooth, ultra thick,domain=-4:4,] {(4/9)*(x^2-9))};
\draw[thin][fill][red] (-3,0) circle (.2);\node [below] at (-3.2,-.5) {(-3,0)};
\draw[thin][fill][red] (3,0) circle (.2);\node [below] at (3.2,-.5) {(3,0)};
\draw[thin][fill][red] (0,-4) circle (.2);\node
at (.3,-4.3) {(0,-4)};
\end{axis}
\end{tikzpicture}​
 
karush said:
sorry actually its this one...

Unfortunately this forum treats [right] as a special code to align text to the right.
A work around is to use extra spaces and make it [ right ].
Then we get:

\begin{tikzpicture}[xscale=1,yscale=1]
%preamble \usepackage{pgfplots}
\begin{axis}[xmin=-4, xmax=4, ymin=-5, ymax=3, axis lines=middle, ticks=none]
\addplot[draw = blue, smooth, ultra thick,domain=-4:4,] {(4/9)*(x^2-9))};
\draw[thin][fill][red] (-3,0) circle (.2);\node [below] at (-3.2,-.5) {(-3,0)};
\draw[thin][fill][red] (3,0) circle (.2);\node [below] at (3.2,-.5) {(3,0)};
\draw[thin][fill][red] (0,-4) circle (.2);\node [ right ] at (.3,-4.3) {(0,-4)};
\end{axis}
\end{tikzpicture}
 

Similar threads

Replies
1
Views
2K
Replies
8
Views
2K
Replies
2
Views
2K
Replies
2
Views
1K
Replies
7
Views
2K
Replies
0
Views
5K
Replies
5
Views
4K
Back
Top