3
$\begingroup$

A (k) =the closed interval [-10+Sin [k], 10+Sin [k]] How do I can create a list of the first 20 of such interval The find the intersection of the first 14 of them

$\endgroup$
2
  • $\begingroup$ Is k integer? Use Range and IntervalIntersetcion[] $\endgroup$ Commented Dec 1, 2013 at 17:01
  • $\begingroup$ Yes k is an integer number $\endgroup$
    – mais
    Commented Dec 1, 2013 at 17:07

4 Answers 4

2
$\begingroup$
c = IntervalIntersection @@ (Array[ Interval[{-10 + Sin[#], 10 + Sin[#]}] &, {20}][[;; 14]])

Graphics[{Array[Line[{{-10 + Sin[#], #}, {10 + Sin[#], #}}] &, {14}], 
         Red, c /. Interval[{x_, y_}] -> Line@{{x, 0}, {y, 0}}}]

Mathematica graphics

$\endgroup$
2
$\begingroup$

The code

ak = N[Table[Interval[{-10 + Sin[k], 10 + Sin[k]}], {k, 1, 20}]];

computes the first 20 as intervals. Remove the N[ ] wrapper for the exact values. You can then compute the intersection of the first 14 as closed intervals with

IntervalIntersection @@ ak[[1;;14]]

Finally this is the correct intersection: Interval[{-9.00939, 9.00001}]

$\endgroup$
8
  • $\begingroup$ What's @ means? ? $\endgroup$
    – mais
    Commented Dec 1, 2013 at 17:14
  • $\begingroup$ @Nana @@ -Apply. Difference between @ and @@. $\endgroup$
    – Kuba
    Commented Dec 1, 2013 at 17:14
  • $\begingroup$ .. thank you :-) $\endgroup$
    – mais
    Commented Dec 1, 2013 at 17:18
  • $\begingroup$ I see the problem 1 sec $\endgroup$ Commented Dec 1, 2013 at 17:20
  • $\begingroup$ I'm really confuse now... what is the corect code in this case? $\endgroup$
    – mais
    Commented Dec 1, 2013 at 17:21
1
$\begingroup$

We can use properties of Interval earlier:

f = Sin[#] + Interval[{-10, 10}]&;
IntervalIntersection @@ Array[f, 14] // N
Interval[{-9.00939, 9.00001}]
$\endgroup$
0
$\begingroup$

You can answer this question without knowing anything about interval functions: the intersection of all the intervals is the interval between (10-largest value of Sin) and (10+smallest value of Sin). With Sin assuming integer values between 1 and 14, this is:

{10 - Max[Sin[Range[14]]], 10 + Min[Sin[Range[14]]]}
{10 - Sin[14], 10 + Sin[11]}//N
{9.00939, 9.00001}
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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