Question: How can I use min(A, B) when one of (A, B) is not a valid number?

I have two equations, and in most cases one of them has solution, another one doesn't. In some cases both equations have solutions, and min() helps.

I have to work with a huge amount of data (in cycles) - so the decision should work in any situation.

Example:

S1 := RootFinding:-NextZero(unapply(rhs(X1)-1, t), 0.);

S2 := RootFinding:-NextZero(unapply(rhs(X1)+1, t), 0.);

SS := min(S1, S2);

The result:

                               0.1002991918
                                    FAIL
                           min(0.1002991918, FAIL)

Instead of this I want to get

0.1002991918

Thanks for help!

Please Wait...