Just sqrt(x) with 1,2,3,4 ticks

  • MHB
  • Thread starter karush
  • Start date
In summary, we can shade the curve up to $x=4$ by adding \addplot[fill=cyan!30, draw=none, domain=0:4] {sqrt(x)} \closedcycle; and remove the arrows on the axis by using axis lines*=middle with a star (*). The axis ends at $x=5$ because of the specified xmax=5 and we can draw ticks using xtick={1,2,3,4} and ytick=\empty.
  • #1
karush
Gold Member
MHB
3,269
5
\begin{tikzpicture}[scale=1]
%preamble \usepackage{pgfplots}
\begin{axis}[xmin=-1, xmax=5, ymin=-1, ymax=3, axis lines=middle, ticks=none]
\addplot[
draw = blue, smooth, ultra thick,
domain=0:4,
] {sqrt(x)}
foreach \x in {1,2,3,4} { (axis cs:{\x},0) node[below left] {\x} };
\end{axis}
\end{tikzpicture}

1. how do I shade between the curve and x-axis on [0,4]
2. I don't need the arrows on the axis
3 where does \end{axis} actually end?
4. suggestions...

looked at various samples but there was a lot of versions
going to post this with a problem on LinkedIn so trying to make it look the best
however don't think they render tikz and probably not script ,,,, maybe
its all new to me
thanks ahead...
 
Physics news on Phys.org
  • #2
karush said:
1. how do I shade between the curve and x-axis on [0,4]
2. I don't need the arrows on the axis
3 where does \end{axis} actually end?
4. suggestions...
1. We can add \addplot[fill=cyan!30, draw=none, domain=0:4] {sqrt(x)} \closedcycle; to shade the curve up to $x=4$.
2. If we specify axis lines*=middle with a star (*) then the arrows are omitted.
3. The axis ends at $x=5$ because that was specified with xmax=5.
4. We can use xtick={1,2,3,4}, ytick=\empty instead of ticks=none and a foreach to draw ticks.

\begin{tikzpicture}[scale=1]
%preamble \usepackage{pgfplots}
\begin{axis}[xmin=-1, xmax=5, ymin=-1, ymax=3, axis lines*=middle, xtick={1,2,3,4}, ytick=\empty]
\addplot[fill=cyan!30, draw=none, domain=0:4] {sqrt(x)} \closedcycle;
\addplot[
draw = blue, smooth, ultra thick,
domain=0:4,
] {sqrt(x)};
\end{axis}
\end{tikzpicture}
 

1. What is the purpose of using 1,2,3,4 ticks in a sqrt(x) function?

The use of 1,2,3,4 ticks in a sqrt(x) function allows for a more precise and accurate calculation of the square root of a given number. These ticks represent smaller increments on the number line, allowing for a more detailed measurement of the square root.

2. How does the number of ticks affect the accuracy of the sqrt(x) calculation?

The more ticks that are used in the sqrt(x) calculation, the more accurate the result will be. This is because the smaller increments represented by the ticks allow for a more precise measurement of the square root.

3. Can the sqrt(x) function be used with any number of ticks?

Yes, the sqrt(x) function can be used with any number of ticks. However, using a larger number of ticks will result in a more accurate calculation.

4. Are there any limitations to using 1,2,3,4 ticks in a sqrt(x) function?

There are no limitations to using 1,2,3,4 ticks in a sqrt(x) function. However, if a very large number is being calculated, a larger number of ticks may be necessary to ensure accuracy.

5. How does the use of 1,2,3,4 ticks compare to other methods of calculating the square root?

The use of 1,2,3,4 ticks in a sqrt(x) function is a more accurate method compared to other methods such as estimation or using a calculator. This is because it allows for a more detailed measurement of the square root, resulting in a more precise calculation.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
876
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
957
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
733
  • Poll
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
937
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
1K
Back
Top