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

  • Context: MHB 
  • Thread starter Thread starter karush
  • Start date Start date
  • Tags Tags
    Plot
Click For Summary
SUMMARY

The discussion focuses on plotting the equation $y = \dfrac{4}{9}(x-3)(x+3)$ using TikZ in LaTeX. Users encountered issues with rendering the plot correctly in the forum environment, while it worked seamlessly in Overleaf. The correct syntax for the TikZ code was confirmed, and users provided solutions for formatting issues related to text alignment within the plots. The final working code includes adjustments for axis limits and point annotations.

PREREQUISITES
  • Familiarity with LaTeX and TikZ for creating graphics
  • Understanding of the pgfplots package for plotting functions
  • Knowledge of quadratic functions and their graphical representations
  • Basic troubleshooting skills for LaTeX code formatting
NEXT STEPS
  • Explore advanced features of the pgfplots package in LaTeX
  • Learn about customizing TikZ plots for better visual representation
  • Investigate LaTeX forums for common plotting issues and solutions
  • Practice plotting different types of functions using TikZ
USEFUL FOR

Mathematicians, educators, and students who need to create visual representations of mathematical functions using LaTeX, particularly those interested in using TikZ and pgfplots for their plotting needs.

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 ·
Replies
1
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 0 ·
Replies
0
Views
6K
  • · Replies 5 ·
Replies
5
Views
4K
Replies
6
Views
2K