MathGroup Archive 2008

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

Search the Archive

Re: Mathematica Help Urgent (Very New Beginner)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg93374] Re: Mathematica Help Urgent (Very New Beginner)
  • From: Albert Retey <awnl at gmx-topmail.de>
  • Date: Wed, 5 Nov 2008 04:54:52 -0500 (EST)
  • References: <gepavq$se3$1@smc.vnet.net>

Derek schrieb:
> I am just beginning to learn to use Mathematica, and need to create a table of values. I would like to be able to input x-values and have the table display f(x), f'(x), and possibly f''(x) for a given function. I have already specified the function, and I have found the following input creates tables:
> 
> Table[{x,f[x]},{x,-5,5,.5}]
> 
> My problem is this: I would like to input specifc x-values, rather than use set intervals as defined in {x,-5,5,.5} above. Is there a way to specify a list of specific x values so that Mathematica computes the values of f[x] in table form?

>From version 6 on you can use a list of values in an iterator, e.g.:

Table[{x,f[x]},{x,{-5,-4,-1,0,1,4,5}}]

for older versions or when getting more familiar with Functions, you
might also consider Map:

Map[Function[{#,f[#]}],{-5,-4,-1,0,1,4,5}]

or using some shortcuts:

{#,f[#]}& /@ {-5,-4,-1,0,1,4,5}

(I think the latter is the one you would find used most often in
existing mathematica code...)

hth,

albert


  • Prev by Date: Re: Mathematica 6.0: How to collect data with Manipulate? - not
  • Next by Date: Re: Mathematica Help Urgent (Very New Beginner)
  • Previous by thread: Re: Mathematica Help Urgent (Very New Beginner)
  • Next by thread: Re: Mathematica Help Urgent (Very New Beginner)