Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

For the input

UnitStep[Interval[{-4, 5}]]

I get

Interval[{0, 1}]

Why is this not Interval[{0,0}, {1,1}]?

share|improve this question
    
Because it is Listable (see Attributes@UnitStep) and can deal with real-valued intervals. This information can be easily found in documentation pages. –  Artes Nov 3 '13 at 14:30
    
I understand that, but your comment is suggesting an answer to my question: UnitStep is merely threading itself over the Interval, and doesn't "know" that it's an Interval that could result in a tighter interval result? Is that correct? –  payne Nov 3 '13 at 15:23
    
@MichaelE2 What do you mean by incorrect interval? UnitStep[Interval[{-Pi, Pi}]] yields Interval[{0, 1}], similarly Sin[Interval[{-Pi, Pi}]] yields Interval[{-1, 1}]. What is your problem? –  Artes Nov 3 '13 at 17:11
1  
@Artes Isn't the range of UnitStep just the set {0, 1}? I thought that's what Interval[{0, 0}, {1, 1}] represents. Perhaps, I'm wrong, but that's how I understood it. Interval[{0,1}] represents all reals between 0 and 1. That's incorrect. –  Michael E2 Nov 3 '13 at 17:23
2  
@Artes I don't think Listable has anything to do with the problem. Tan[Interval[{1, 2}]] returns disjoint intervals Interval[{-Infinity, Tan[2]}, {Tan[1], Infinity}]. If UnitStep worked correctly with Interval, UnitStep[Interval[{a, b}]] would return the range of values of UnitStep over that interval, either Interval[{0,0}], Interval[{1,1}], or Interval[{0,0}, {1,1}] depending on the signs of a and b. –  Michael E2 Nov 3 '13 at 17:55

1 Answer 1

I think there is a bug with Interval. What I find for this moment:

$$ \begin{array} {c|c|c|c} \text{Function} & \text{Interval} & \text{Result} & \text{Should be}\\ \hline \text{UnitStep} & [-4,5] & [0,1] & [0,0],[1,1]\\ \text{Sign} & [0,1] & [-1,1] & [0,0],[1,1]\\ \text{Round} & [0,2] & [0,2] & [0,0],[1,1],[2,2]\\ \text{Floor} & [0,2] & [0,2] & [0,0],[1,1],[2,2]\\ \text{Ceiling} & [0,2] & [0,2] & [0,0],[1,1],[2,2]\\ \end{array} $$

Also almost all polynomials are working incorrectly

ChebyshevT[3, Interval[{-1, 1}]
Interval[{-7, 7}]

It is well known that the Chebyshev polynomials of the first kind $T_n(x)$ have values from $-1$ to $1$ if $-1\le x \le 1$.

 Plot[ChebyshevT[3, x], {x, -1, 1}]

enter image description here

The problem is that the polynomials are expanded first

ChebyshevT[3, x]
-3 x + 4 x^3

And then Interval[{-1, 1}] is substituted

-3 Interval[{-1, 1}] + 4 Interval[{-1, 1}]^3
Interval[{-7, 7}]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.