Problem with plotting Sign[ ]: unexpected output

Posted 2 months ago
489 Views
|
4 Replies
|
3 Total Likes
|
 Hello,1) I want to plot the sign of the square root of some function. One expects to obtain values {1} and {0} in the domain where the expression under the square root is positive or zero respectively. In addition to that, I have several pieces on the plot with values continuously ranging from -1 to 1. What is it and how can one avoid that?The second question is similar.2) I want to plot the sign of a quite complicated function. But in addition to domains with values {-1,0,1} I have a contribution with value continuously ranging from -1 to 1. What is it and how can one avoid that?The notebook is enclosed. Attachments:
4 Replies
Sort By:
Posted 2 months ago
Posted 2 months ago
 Thank you a lot! RegionFunction works perfectly for the square root case. In the second case, I added PlotPoints -> 70 and achieved the desired result.
 And the function Sqrt[((1 - 2 y Cos[x])/(1 - y Cos[x])) is complex for parts of the range plotted. RealSign does not work for complex numbers.
 The sign seems to be zero only in a meager set. I would plot directly the value 1 with a RegionFunction: Plot3D[1, {x, 0, 2 \[Pi]}, {y, 1, 5}, RegionFunction -> Function[{x, y}, (1 - 2 y Cos[x])/(1 - y Cos[x]) > 0], PlotPoints -> 50]