RE: A rule with condition for the elements of a list

• To: mathgroup at smc.vnet.net
• Subject: [mg33197] RE: [mg33132] A rule with condition for the elements of a list
• From: "Higinio Ramos" <higra at usal.es>
• Date: Thu, 7 Mar 2002 02:24:13 -0500 (EST)
• References: <200203050808.DAA17066@smc.vnet.net>
• Reply-to: "Higinio Ramos" <higra at usal.es>
• Sender: owner-wri-mathgroup at wolfram.com

```This does the task:

Map[If[FreeQ[#,t],#*t,#]&,{a, b, c*t, r*s, 2*t, 3, 0}]

Higinio

----- Original Message -----
From: Guillermo Sanchez <guillerm at usal.es>
To: mathgroup at smc.vnet.net
Subject: [mg33197] [mg33132] A rule with condition for the elements of a list

> Given a list like this :
>
> lst = {a, b, c*t, r*s, 2*t, 3, 0};
>
> I would like build a rule (c -> c t) for each elements c of the list
> that are not function of t  that give like solution :
>
> Out[] := {a t, b t, c t, r s t, 2 t, 3 t, 0}
>
> I have tested the following way but they are not work
>
> lst /. (c_ /; FreeQ[c, t]) -> c*t
>
> and
>
> integrate[c_, t_] := c t /; FreeQ[c, t]
> lst /. c_ -> integrate[c, t]
>
> I will appreciate your held
>
> Guillermo Sanchez
>
>

```

• Prev by Date: Re: training book for mathematica
• Next by Date: Stokes integral transformation with Mathematica ?
• Previous by thread: Re: A rule with condition for the elements of a list
• Next by thread: Re: A rule with condition for the elements of a list