Re: How to find the Max of a Piecewise function
- To: mathgroup at smc.vnet.net
- Subject: [mg90447] Re: How to find the Max of a Piecewise function
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Wed, 9 Jul 2008 04:56:58 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <g4vk81$9pv$1@smc.vnet.net>
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?
f[x_] := Piecewise[{{1, x < 1}, {2, x > 1}}]
SetAttributes[f, Listable]
Max[f[Range[0, 1, .001]]]
1
Regards,
-- Jean-Marc
- Follow-Ups:
- Re: Re: How to find the Max of a Piecewise function
- From: "Jean-Marc Gulliet" <jeanmarc.gulliet@gmail.com>
- Re: Re: How to find the Max of a Piecewise function