I have the following function
f[z_] := Piecewise[{{Cos[z] - 17 Sin[z]/z, z > 0}, {Cosh[z] - 17 Sinh[z]/z, z <= 0}}]
I am interested in the regions where $\vert f(z)\vert \leq 1$, I tried to shade that region using Filling
, but my results were not the expected, how should I write the code? Here is my attempt:
Plot[{f[z], -1, 1}, {z, -5, 20}, PlotStyle -> {Automatic, Dashed, Dashed}, Filling -> {1 -> {3}}]
To be more precise: I want to shade the region $D=\{(x,y):\vert f(x) \vert<1\text{ and } \vert y \vert <1 \}$
Filling -> {2 -> {3}}
? $\endgroup$ – Arnoud Buzing Apr 17 '20 at 20:58Plot[{f[z], ConditionalExpression[f[z], -1 < f[z] < 1], -1, 1}, {z, -25, 20}, PlotStyle -> {Automatic, None, Dashed, Dashed}, Filling -> {2 -> {{3}, Cyan}, 2 -> {{4}, Cyan}}, PlotPoints -> 100]
give what you need? $\endgroup$ – kglr Apr 17 '20 at 22:20Plot[{f[z], ConditionalExpression[f[z], -1 < f[z] < 1], -1, 1}, {z, -25, 20}, PlotStyle -> {Automatic, None, Dashed, Dashed}, Filling -> {2 -> {Axis, Cyan}}, PlotPoints -> 100]
? $\endgroup$ – kglr Apr 17 '20 at 22:21