Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

Problem with conditional definitions

  • To: mathgroup at
  • Subject: [mg19464] Problem with conditional definitions
  • From: "Kevin J. McCann" <kevin.mccann at>
  • Date: Sat, 28 Aug 1999 15:52:59 -0400
  • Organization: Johns Hopkins University Applied Physics Lab, Laurel, MD, USA
  • Sender: owner-wri-mathgroup at

I have recently uncovered a problem with conditional definitions of
functions.  The following is a simple example


f[x_ /; x <= 0] := x^2
f[x_ /; 0 < x < 1] := x^3
f[x_ /; x >= 1] := x^4

{f[1.], f'[1.],f''[1.]}


Clearly incorrect. Or


             {1.4641, 5.28974, 8.77428}
Correct: {1.4641, 5.324,  14.52}

So it is not that the function was evaluated at a boundary.

Also, if I use exact arguments:



None of the function definitions lead to the answers I got. Did I miss

Kevin J. McCann
Johns Hopkins University APL

  • Prev by Date: Re: Please help me! (Warnings and Messages...)
  • Next by Date: Freeing memory in Mathematica
  • Previous by thread: Ctrl-space no good (ver 3 or 4, Windows 98)
  • Next by thread: Re: Problem with conditional definitions