Re: function IF with several equality conditions
- To: mathgroup at smc.vnet.net
- Subject: [mg49096] Re: function IF with several equality conditions
- From: "Mark Westwood [EPCC]" <markw at epcc.ed.ac.uk>
- Date: Thu, 1 Jul 2004 05:25:42 -0400 (EDT)
- Organization: Edinburgh University
- References: <cbu37q$5m7$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Mukhtar
(1) do you mean If[ And[x1>a , x2<a], 0, 1] ? That is, are you trying
to express a single compound condition ? If so, you should also see the
help files for Or, Not, and so on. Note too that And[x1>a , x2<a] can
be written as x1>a && x2<a .
(2) If does accept equality conditions, but x=a is not an equality
condition - it is an assignment statement, rather like a=1. I think
that you mean x==a, or perhaps x===a.
Hope this helps
Mark
Mukhtar Bekkali wrote:
> I have two questions that HELP file of Mathematica does not address:
>
> (1) How do I implement IF with several conditions. I tried something like this
>
> a=1;
> Table[If[{x1>a,x2<a},0,1],{x1,0,2},{x2,0,2}]
>
> and get no results.
>
> Also, (2) IF does not accept equality conditions either, say
>
> a=1;
> Table[If[x=a,0,1],{x,0,2}]
>
> I am surprised that such simple things are not covered by help file.
>
> Thank you in advance, Mukhtar
>