Skew with Sgn(x) yields unwanted signed line segments

54 Views Asked by At

I'm using Desmos to visualize a concept, but I'm not getting what I expect.

  • Assume we start with a morphed circle, in green, focusing only on the positive y values.
  • We want to skew the green equal to its height (i.e. purple), from the center. To do this I used sgn(x).
  • In red is a sample point on the green shape, of {-.5, 1.9365}. The sample point is correctly mapped to the purple by subtracting the height from -.5: -2.4365.

graph1 equations1

However, I don't want to pull the data from positive x into negative x. That is, if you think of the green graph as having 2 horns, one positive and one negative, how do you prevent having both horns on each side (like in purple)?

I want something like this, in orange, where I've removed unwanted segments of the line, scratched out in black. Note: I put a bounds to remove anything below |x|<1, since I wouldn't expect any values there.

You might say that it opens up like crab pincers, or a gate.

graph2 equations2

Is there a way to do this? To exclude positive x from the negative, and vice versa? I don't want to hide those segments, like with bounds. I desire a way to change the equation so those overlapping values go away.

I assume it has something to do with utilizing the x values from the green equation, instead of the x value from the purple, but I don't know how this is accomplished. I tried using x_1 and x_2, green and purple respectively, but Desmos didn't like that, or I was doing it wrong. Specifically, sgn(x_1) would be green's x sign values, not purple's x sign values.

1

There are 1 best solutions below

0
On BEST ANSWER

I realized one of my assumptions was wrong.

I don't want to hide those segments, like with bounds.

I actually do have to use bounds, because I'm creating a discontinuity in the line. To do this, the line has to be bounded at its limits.

  1. First, I split the original shape into 2 sides (positive and negative x). It's not necessary, but allowed me to think of both sides as being independent from one another (in green). I knew the break occurs at x = 0. While this isn't a removable discontinuity, it is the last valid point before a jump discontinuity is created.
  2. If I set the bounds correctly, in orange @ y and -y, the undesired parts of the graph go away because they are outside the valid range of values. I also had to use 2 equations here to represent each side of the jump discontinuity.
  3. Next, I made a dotted orange line that spans the newly created jump discontinuity. This isn't necessary, but helps illustrate the gap.
  4. Finally, I created 2 orange points to label each end of the jump discontinuity.

graph1 equations1