Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: Function defined with If

  • To: mathgroup at smc.vnet.net
  • Subject: [mg71386] Re: Function defined with If
  • From: "ben" <benjamin.friedrich at gmail.com>
  • Date: Thu, 16 Nov 2006 00:53:45 -0500 (EST)
  • References: <ejevq7$216$1@smc.vnet.net>

Hi

Be careful with = and :=

f[ x_, y_ ] := If[ a < b, a, b ]

Bye
Ben

Julian Aguirre schrieb:

> Dear group,
>
> I am trying to define a function of the variables x, y through other
> quantities depending on x and y and the function If. A minimal example
> is
>
> In[1]:=
> a = x;
> b = y;
> f[ x_, y_ ] = If[ a < b, a, b ]
> Out[3]=
> If[ x < y, a, b ]
>
> How can I force Mathematica to return If[ x < y, x, y ], as I thought
> it would?
> 
> Thaks in advance,
> 
> Julián Aguirre


  • Prev by Date: mouse drage listener!
  • Next by Date: Re: comparing finite fields elements with == or != doesn't work?!?!
  • Previous by thread: Function defined with If
  • Next by thread: Re: Function defined with If