MathGroup Archive 2001

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

Search the Archive

Re: how applicate a function to a list??

  • To: mathgroup at smc.vnet.net
  • Subject: [mg28386] Re: [mg28368] how applicate a function to a list??
  • From: BobHanlon at aol.com
  • Date: Sun, 15 Apr 2001 00:13:37 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Not sure that I understand the question.  Giving examples would help.  
However, this may be what you want

ans = Flatten[Solve[t-3 == 0, t]]

{t -> 3}

If your function expects a number then you cannot give it a rule or a list of 
rules

{f[ans], f /@ ans, f[ans[[1, 2]]]}

{f[{t -> 3}], {f[t -> 3]}, f[3]}

Use ReplaceAll

f[t] /. ans

f[3]

Or you can apply the rule earlier in the process

ans = t /. Flatten[Solve[t-3 == 0, t]]

3

f[ans]

f[3]


Bob Hanlon

In a message dated 2001/4/14 2:23:08 AM, gioacchinofabio.pellerit at tin.it 
writes:

>i know my problem is trivial but i would to know why a function applied
>to a
>list give as result:
>f(t->a number obtained before).....while i need to evaluate the function
>in
>the value not as symbol.
>what instruction i need to use???


  • Prev by Date: Mapping a scalar against a list
  • Next by Date: RE: Nested Lists
  • Previous by thread: Re: how applicate a function to a list??
  • Next by thread: Re: log x > x - proof?