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

Discussion Overview

The discussion revolves around plotting the function \(y = \dfrac{4}{9}(x-3)(x+3)\) using TikZ in LaTeX. Participants explore issues related to rendering the plot correctly in the forum environment, including syntax and formatting challenges.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant shares a TikZ code snippet for plotting the function but expresses difficulty in getting it to work in the forum.
  • Another participant claims that the plot renders correctly for them, questioning the initial participant's issue.
  • A later post corrects the function representation to \(y = \dfrac{4}{9}(x^2-9)\) and provides an updated TikZ code snippet.
  • Further clarification is provided regarding the forum's treatment of the [right] command, suggesting a workaround to display text correctly.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the plotting issue, as one participant experiences problems while another claims it works fine. The discussion includes multiple attempts to clarify the function and formatting issues without resolving the initial confusion.

Contextual Notes

There are unresolved issues related to the correct syntax for TikZ and the forum's handling of certain commands, which may affect the rendering of the plots.

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