Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: How to find the Max of a Piecewise function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg90435] Re: [mg90411] How to find the Max of a Piecewise function
  • From: DrMajorBob <drmajorbob at att.net>
  • Date: Wed, 9 Jul 2008 04:54:33 -0400 (EDT)
  • References: <17536498.1215560216020.JavaMail.root@m08>
  • Reply-to: drmajorbob at longhorns.com

"Max[f[Range[0, 1, .001]]]

does not yield the desired result."

You haven't told us what the desired result IS, but I'm sure you're right.

Here's one possibility:

f[x_] = Piecewise[{{1, x < 1}, {2, x > 1}}];
Max[f /@ Range[0, 1, .001]]

1

Note that we have

f[1]

0

since 1 is neither < 1 nor > 1.

Bobby

On Tue, 08 Jul 2008 06:48:46 -0500, Aaron Fude <aaronfude at gmail.com> wrote:

> Hi,
>
> 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?
>
> Thanks!
>
> Aaron
>
>



-- 
DrMajorBob at longhorns.com


  • Prev by Date: Re: How to find the Max of a Piecewise function
  • Next by Date: Re: Trouble related to "CSV"
  • Previous by thread: Re: How to find the Max of a Piecewise function
  • Next by thread: Re: How to find the Max of a Piecewise function