Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #15619 > unrolled thread

Help with Delete cases

Started byKenR <ramsey2879@msn.com>
First post2011-02-07 11:05 +0000
Last post2011-02-08 10:03 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Help with Delete cases KenR <ramsey2879@msn.com> - 2011-02-07 11:05 +0000
    Re: Help with Delete cases "Sjoerd C. de Vries" <sjoerd.c.devries@gmail.com> - 2011-02-08 10:03 +0000

#15619 — Help with Delete cases

FromKenR <ramsey2879@msn.com>
Date2011-02-07 11:05 +0000
SubjectHelp with Delete cases
Message-ID<iiojml$gip$1@smc.vnet.net>
I have a list= Range[3003]  I want to delete cases of n = m(m+1) mod P
from the list, but Delete cases only deletes cases matching a pattern,
i.e.

list = DeleteCases[list,Mod[N - m(m+1)/2,P] = 0] will definitely not
work.  I want to keep list, as the same identifier, throughout since
this is within a looping process. Any suggestions?

[toc] | [next] | [standalone]


#15650

From"Sjoerd C. de Vries" <sjoerd.c.devries@gmail.com>
Date2011-02-08 10:03 +0000
Message-ID<iir4dp$6go$1@smc.vnet.net>
In reply to#15619
You can use PatternTest (abbreviated as ?) to add a logical test to a
pattern.

You pattern is not really clear to me. You don't specify what your n
and m are supposed to be, but assuming that m is the number in the
table and p and n (don't use a capital N !) are provided somewhere
else the following would work:

n=0;
p=10;
DeleteCases[list, _?(Mod[# (# + 1)/2, p] == n &)]

Cheers -- Sjoerd

On Feb 7, 12:05 pm, KenR <ramsey2...@msn.com> wrote:
> I have a list= Range[3003]  I want to delete cases of n = m(m+1) mod P
> from the list, but Delete cases only deletes cases matching a pattern,
> i.e.
>
> list = DeleteCases[list,Mod[N - m(m+1)/2,P] = 0] will definitely not
> work.  I want to keep list, as the same identifier, throughout since
> this is within a looping process. Any suggestions?

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web