-3

enter image description here

Can you help me with this function?

  • 5
    Have you an exam of LaTeX? – Sebastiano Jul 10 '21 at 20:33
  • 5
    Please show what you've tried. E.g., an example showing you can already draw the function, but not the shadow. – muzimuzhi Z Jul 10 '21 at 20:57
  • please help me with tikz – Juliperezor Jul 11 '21 at 04:37
  • What is the problem? How to draw a function or how to insert shadow between some function and left side of diagram? – Zarko Jul 11 '21 at 05:42
  • 8
    You asked 10 questions, non of them has an accepted answer. Most most of them show just an image and not a single line of code, i.e. "just do this graphic for me" questions. These are really not reasonable questions to ask on the site. Please post a minimal compilable document showing that you've tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. – Stefan Pinnow Jul 11 '21 at 06:20
  • Duplicates: https://tex.stackexchange.com/q/573863/95441, https://tex.stackexchange.com/q/385738/95441. – Stefan Pinnow Jul 11 '21 at 18:11

3 Answers3

3

It is not clear, what is your problem: fill area where y>f(x) or definition of the function f(x) (the later is actually math problem).

In any case it is simpler to use pgfplots package (which is based on tikz package) than pure tikz package, where you need to draw axis, labels, etc. yourself.

Let me focused on shading. Using pgfplots package it can be done by use of fill between function defined in the pgfplotslibrary library:

\documentclass[border=3.141592]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usepgfplotslibrary{fillbetween}

\begin{document} \begin{tikzpicture} \begin{axis}[ declare function = {f(\x) = 3*(\x-1)+3;}, % here you define own function, % for example f(\x) = (\x-1)^3+1;, etc axis lines=center, xtick=\empty, ytick=\empty, axis on top, % label style={anchor=north east}, xlabel=$x$, ylabel=$y$, % domain=-3:3, samples=101, no marks, xmin=-2, xmax=3, ymin=-3, ymax=3, % every axis plot post/.append style={line width=1pt}, ] \addplot +[name path=F] {f(x)}; \path [name path=Y] (\pgfkeysvalueof{/pgfplots/xmin},0\pgfkeysvalueof{/pgfplots/ymin}) -- (\pgfkeysvalueof{/pgfplots/xmin},\pgfkeysvalueof{/pgfplots/ymax}) node[text=blue, below right=3mm] {$y\geq f(x)$}; \addplot [fill=blue!10] fill between [of = F and Y]; % end of fillbetween \end{axis} \end{tikzpicture} \end{document}

enter image description here

In the case, that in above MWE you consider for function @Sebastiano suggestion, i.e. f(\x) = (\x-1)^3 +1 and change definition and observation domain to:

    domain=-2:3,  samples=101, no marks,
    xmin=-2, xmax=4,
    ymin=-2, ymax=3,

the obtained image is:

enter image description here

Zarko
  • 296,517
2

For fun, I propose this easy short code with pstricks:

\documentclass[11pt,svgnames, border=3pt]{standalone}
\usepackage{pst-plot}
\usepackage{sansmath}

\begin{document}

\begin{pspicture}(-3 ,-3)(3.5,3.2) \sansmath \psset{algebraic, plotpoints=500, labelsep=2pt} \pscustom[fillstyle=solid, fillcolor=Lavender, linestyle=none]% {\psline(-3,-3)(-1.442,-3)\psplot{-1.442}{1.442}{x^3} \psline(1.442,3)(-3,3)(-3,-3)} \psplot[linewidth=1.2pt, linecolor=RoyalBlue,]{-1.442}{1.442}{x^3} \psaxes[ticks=none, labels=none, showorigin=false, arrows=->,arrowinset=0.12, linecolor=black] % (-1,-1)(-3,-3)(3.2,3)[$x$, 0][$y$,180] \rput(0,2.5){$\color{RoyalBlue}y\ge f(x)$} \end{pspicture}

\end{document}

enter image description here

Bernard
  • 271,350
1

My idea it is simple if you have a lot of difficulty to plot in TikZ: plot the function (x-1)^{3}+1 using Geogebra and you can define a shadow zone with a inequality. With Geogebra you can put all the labels in sans-serif font and export in TikZ, eventually making some corrections. At the end changed the tips with the classic arrow of tikz-cd.

Sebastiano
  • 54,118
  • 1
    I have errors: Undefined control sequence. ...{$ x^{3} $} \psline(1.442,3)(-3,3)(-3,-3)} Undefined control sequence. ...linecolor=blue,]{-1.442}{1.442}{$ x^{3} $} Undefined control sequence. ...linecolor=blue,]{-1.442}{1.442}{$ x^{3} $} – Juliperezor Jul 11 '21 at 00:07
  • 1
    @Juliperezor, please edit your question and add the code what you try so far! – Zarko Jul 11 '21 at 05:43
  • @Zarko Hi, I have not understood the comment of the OP. :-) I see a lot of confusion. – Sebastiano Jul 11 '21 at 08:16
  • @Sebastiano, me either. As you can see from my comments and answer, I didn't figured out, what actually is OP's problem. – Zarko Jul 11 '21 at 08:22