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

MathGroup Archive 2011

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

Search the Archive

Re: Problem with "Which"

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122258] Re: Problem with "Which"
  • From: Tutor <alfred.muehlleitner at gmx.at>
  • Date: Sat, 22 Oct 2011 06:09:15 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <j7p1t7$5ks$1@smc.vnet.net> <j7rh96$haq$1@smc.vnet.net>

On 21 Okt., 12:24, Rui <rui.r... at gmail.com> wrote:
> Which tries it's arguments in turn until one yields true, AS LONG AS they yield false. If a condition yields neither True nor False, it returns the Which expression only partially evaluated, expecting that some day that expression might start yielding True or False. In your case, for example, if you ever assign x a value that makes -6+6 x be negative, then that Which will be resolved. Not sure what you expected...

As you can see: {Which[f2 > 0, "T", f2 < 0, "H", f2 == 0, "S" ], x,
f} /. ew] this expression is evaluated and it yields true for each x
in ew.

I think, he is expecting someting like {{H,0,0},{T,2,-4}}



  • Prev by Date: Re: count the number of sub-list in a list
  • Next by Date: Defining a variable from an error message (NDSolve::ndsz)
  • Previous by thread: Re: Problem with "Which"
  • Next by thread: Simplifying radicals