MathGroup Archive 2005

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

Search the Archive

Re: boolean function, interpolation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61893] Re: boolean function, interpolation
  • From: Maxim <ab_def at prontomail.com>
  • Date: Thu, 3 Nov 2005 04:59:17 -0500 (EST)
  • References: <dj2719$bgb$1@smc.vnet.net><djcpvk$cao$1@smc.vnet.net> <dk9vpn$6sf$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On Wed, 2 Nov 2005 09:10:15 +0000 (UTC), xxxxyz at abv.bg <xxxxyz at abv.bg>  
wrote:

> But this does not work when the system does not have solution. For  
> example
> boolint[{{{1,1,1},0},{{1,1,1},1}}] returns solution. Any suggestions in
> this case?
>

Sure, if you want a more fool-proof version, it is easy to add the  
necessary checks:

Clear[boolint]
boolint[$Lvecval: {{{(0|1)..}, 0|1}..}] /;
     MatrixQ@ $Lvecval[[All, 1]] :=
   Module[{conj, Lvecval = $Lvecval},
     conj[Lbool_] := Times @@ MapThread[
       If[# == 0, 1 - #2, #2]&,
       {Lbool, Array[Slot, Length@ Lbool]}];
     Lvecval = Union@ Lvecval;
     (Total@ Cases[Lvecval, {v_, 1} :> conj[v]] //
         Evaluate // Function) /;
       !MatchQ[Lvecval, {___, {v_, _}, {v_, _}, ___}]
]

This checks that all the vectors in the input are the same length, all the  
values are 0/1, different values don't correspond to the same vector, and  
can handle inputs with repeated elements.

Maxim Rytin
m.r at inbox.ru


  • Prev by Date: Re: list of options in Plot
  • Next by Date: Re: Re: Exporting notebooks to xml (cnxml)
  • Previous by thread: Re: boolean function, interpolation
  • Next by thread: Re: boolean function, interpolation