MathGroup Archive 2003

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

Search the Archive

RE: Convert list into function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg41542] RE: [mg41523] Convert list into function
  • From: "David Park" <djmp at earthlink.net>
  • Date: Mon, 26 May 2003 05:46:21 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

You don't really give enough information about what kind of function your
want and what the requirements are. In any case, the following is one
approach (with a more interesting sequence of values). Lookup Interpolation
in Help.

L[x_] = Interpolation[{1, 3, 2, 4}, InterpolationOrder -> 1][x]
InterpolatingFunction[{{1, 4}}, "<>"][x]

Plot[L[x], {x, 1, 4}];

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/


From: rbhatnagar [mailto:rajb at stanford.edu]
To: mathgroup at smc.vnet.net

Hi,

A simple question: What is the correct way of converting a list into a
function?

For instance, lets say I have some list
L = {1, 2, 3, 4}

and I want a function such that FuncL[1] would return 1, FuncL[2] would
return 2 and so on.  So what is the syntax for FuncL?

I need the function for some further manipulation in a situation in which
simply using L[[1]] would not be appropriate.

Thanks,
R. Bhatnagar





  • Prev by Date: Re: reading variable names and values from a file
  • Next by Date: Plots and scaling
  • Previous by thread: Re: Convert list into function
  • Next by thread: Re: Convert list into function