Re: How to find the Max of a Piecewise function
- To: mathgroup at smc.vnet.net
- Subject: [mg90440] Re: How to find the Max of a Piecewise function
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Wed, 9 Jul 2008 04:55:35 -0400 (EDT)
On 7/8/08 at 7:48 AM, aaronfude at gmail.com (Aaron Fude) wrote: >If f is deined according to >f[x_] := Piecewise[{{1, x < 1}, {2, x > 1}}] >then >Max[f[Range[0, 1, .001]]] >does not yield the desired result. What's the proper way to approach >this? To find maxima of functions use Maximize or NMaximize For example, Maximize[{f[x], 0 < x < 1}, x] gives: {1,{x->1/2}} The first value is the function maximum and the second is the value of x where that maximum occurs. In your particular example, the point at which the maximum occurs is not well defined since you have defined the function to have a constant value for 0 < x < 1