MathGroup Archive 2008

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

Search the Archive

Re: Re: How to find the Max of a Piecewise function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg90459] Re: [mg90447] Re: How to find the Max of a Piecewise function
  • From: Francisco Gutierrez <fgutiers2002 at yahoo.com>
  • Date: Thu, 10 Jul 2008 06:33:54 -0400 (EDT)
  • Reply-to: fgutiers2002 at yahoo.com

Friends:
What are the best references you know for programming genetic algorithms in Mathematica?
Thanks
Francisco

--- On Wed, 7/9/08, Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com> wrote:

From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
Subject: [mg90459] [mg90447] Re: How to find the Max of a Piecewise function
To: mathgroup at smc.vnet.net
Date: Wednesday, July 9, 2008, 3:56 AM

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




  • Prev by Date: Re: Help with 3 dimensional Fourier Integral
  • Next by Date: RE: Solving a DE using Mathematica
  • Previous by thread: Re: How to find the Max of a Piecewise function
  • Next by thread: PlotRange Trouble