Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #5737

Problem with "Which"

From mbmb <sb@9y.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Problem with "Which"
Date 2011-10-20 11:49 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j7p1t7$5ks$1@smc.vnet.net> (permalink)

Show all headers | View raw


Who can check my module?

KD[f0_, a0_, b0_] := Module[{f = f0, a = a0, b = b0},
f2 = D[f, {x, 2}];
ew = Solve[D[f, x] == 0, x, Reals];
Print["Extremwerte: ", {Which[f2 > 0, "T", f2 < 0, "H", f2 = 0, "S" ], x, f} /. ew];
Print["Extremwerte: ", {If[f2 > 0, "T", "H" ], x, f} /. ew];
]

When I enter: KD[x^3 - 3 x^2, -1, 4] the output is

Extremwerte: {{Which[-6+6 x<0,H,f2=0,S],0,0},{T,2,-4}}

whereas the IF-line gives

Extremwerte: {{H,0,0},{T,2,-4}}

Why can't I use Which in this case. Why doesn't Mathematica evaluate f2 in all cases?

Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Problem with "Which" mbmb <sb@9y.com> - 2011-10-20 11:49 +0000
  Re: Problem with "Which" Rui <rui.rojo@gmail.com> - 2011-10-21 10:24 +0000
    Re: Problem with "Which" Tutor <alfred.muehlleitner@gmx.at> - 2011-10-22 10:17 +0000
  Re: Problem with "Which" "Dr. Wolfgang Hintze" <weh@snafu.de> - 2011-10-21 10:25 +0000
  Re: Problem with "Which" "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-10-21 11:28 +0000

csiph-web