Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: ListCorrelate and functions on it with an extra condition

  • To: mathgroup at smc.vnet.net
  • Subject: [mg86344] Re: [mg86322] ListCorrelate and functions on it with an extra condition
  • From: Carl Woll <carlw at wolfram.com>
  • Date: Sun, 9 Mar 2008 05:00:22 -0500 (EST)
  • References: <200803081043.FAA13470@smc.vnet.net>

P_ter wrote:

>Hello,
>I have a question about the function p in the following:
>ListCorrelate[{{1, 1}, {1, 1}}, {{a1, b1, c1, d1}, {a2, b2, c2,d2}}, {1, -1}, {}, Times, p]
>The outcome is:
>{{p[p[a1, b1], p[a2, b2]], p[p[b1, c1], p[b2, c2]],p[p[c1, d1], p[c2, d2]]}}
>I have the following problem with p[p[a1, b1], p[a2, b2]].
>If a1!=b1 then the "outer"p should give False,
>if a1==b1 and a2==b2 then the outer p should give True,
>if a1==b1 and a2!=b2 but Length[a2] < Length[b2], the outer p should give True,
>for the rest the outer p should give False.
>Any idea?
>with friendly greetings,
>P_ter
>  
>
What's wrong with:

p[p[a1_, a1_], p[a2_, a2_]] = True
p[p[a1_, a1_], p[a2_, b2_]] := Length[a2] < Length[b2]
p[_p, _p] = False

?

Carl Woll
Wolfram Research


  • Prev by Date: Re: Re: Assignment problem
  • Next by Date: Re: exclusions
  • Previous by thread: ListCorrelate and functions on it with an extra condition
  • Next by thread: processing notebook selections with buttons