# unexpected behavior of a variable (slider) becoming undefined

Niek Sprakel shared this question 5 years ago

Hello.

When I have multiple sliders to represent interacting variables, sometimes they take on an undefined state, causing graphical elements related to that variable to disappear.

For instance, in the attached geogebra file, there are 5 variables for angles, alpha, beta, gamma, delta and epsilon. The idea is that some of these variables depend on the other ones (imposing restrictions on their range and sometimes limiting it to a single value).

When I set the gamma variable to 45 degrees and I gradually increase the value of the beta variable, sometimes this causes the delta variable to become undefined (for many values of beta between 30 and 60 degrees and gamma at the upper limit of its range). Is there any way to prevent this from happening?

Here are two screenshots to illustrate the problem visually (one just before the problem occurs and one as the problem occurs):

https://i.imgur.com/olTw7er.png

1

I advice you the max and min limits of slider was calculated as min(γ/2,γ/2-β/2) and max(γ/2,γ/2-β/2) then use this calculus for limits of delta. same way for betha, etc.

1

Thanks, I'll give that a try.

One other trick that seemed to work was to add a tiny fraction of an angle to the upper limit for the one that occasionally becomes undefined. Like pi/100000 or something like that.

1

Yes, as mathmagic says the slider becomes undefined when max is less than (or equal to) min

eg

``` γ / 2
π / 3 - γ / 2 - β / 2```

1

Not always. The behavior seems a bit unpredictable. Sometimes the slider remains visible and it's just fixed because

the min value equals the max value. Sometimes the slider doesn't remain visible, but the variable for the slider doesn't

become undefined and sometimes the variable becomes undefined and all other graphics related to it disappear.

Like in the following screenshot:

The slider for gamma is no longer visible, but gamma is still defined (with the min value of gamma equal to the max value).

The slider for delta is still visible, even though the min value for delta is equal to the max value.