MathGroup Archive 2007

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

Search the Archive

Re: Finding bounds of the domain of a Piecewise function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg72881] Re: [mg72866] Finding bounds of the domain of a Piecewise function
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Wed, 24 Jan 2007 05:22:02 -0500 (EST)
  • Reply-to: hanlonr at cox.net

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

Max@@f[x][[1,All,2,-1]]

Max[b,d,g]


Bob Hanlon

---- "." <ggroup at sarj.ca> wrote: 
> 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: FourierTransform help
  • Next by Date: re: Databaselink and MySQL
  • Previous by thread: Finding bounds of the domain of a Piecewise function
  • Next by thread: Re: Finding bounds of the domain of a Piecewise function