MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Finding bounds of the domain of a Piecewise function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg72866] Finding bounds of the domain of a Piecewise function
  • From: "." <ggroup at sarj.ca>
  • Date: Tue, 23 Jan 2007 04:55:15 -0500 (EST)

Hi All,

I have a routine that builds up a complicated Piecewise function, f[x].
 All the pieces in the piecewise are restricted to some finite range
(the ranges for each piece may be very different).  I want to find the
absolute extreme x values which will give me a non-zero f[x].

So have something along the lines of:

f[x_]:=Piecewise[{
            {f1[x], a <= x <= b},
            {f2[x], c <= x <= d},
            {f3[x], e <= x <= g}
}]

We can assume that a < b, c < d and e < g (all bounds are real and have
a numeric value).  We can also assume that the ranges are
non-overlapping (it seems PiecewiseExpand takes care of that).
However, we can *not* assume that the segments are sorted by the x
range. Note also that the real problem will have many more segments
than just 3.

For the purposes of discussion, assume that Max[b,d,g] == b.  I want to
find a robust and reasonably fast way of extracting b.

One idea is:
Max[
  Reap[
    f[x][[1,All,2]]/.{r_?NumericQ :> Sow[r]}
  ][[2]]
]

However, this seems like a bit of a hack (it is very much limited to
the details of this particular problem).  Is there a better way which
doesn't require quite so many assumptions?

Thanks!


  • Prev by Date: Re: how to quickly read a >10MB big file
  • Next by Date: FourierTransform help
  • Previous by thread: Re: Numerical Integrate
  • Next by thread: Re: Finding bounds of the domain of a Piecewise function