MathGroup Archive 2008

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

Search the Archive

Re: Mathematica Help Urgent (Very New Beginner)


Derek wrote:
> 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}]

A bit of advice here: it's better to enter rational numbers as 
fractions, not decimals. Mathematica treats decimal numbers as 
approximate (fractions are exact).

Table[{x,f[x]},{x,-5,5,1/2}]

or if you want decimal approximations for f[x]:

Table[{x,N[f[x]]},{x,-5,5,1/2}]

You can specify the number of significant digits you want.

Table[{x,N[f[x],10]},{x,-5,5,1/2}]


> 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?

Do it like this.

Table[{x, f[x]}, {x, {-3, 1/2, 3, 10, 104}}]

Note the curly braces around the list of x-values.

You might like to display it as a Grid.

Grid[Table[{x, f[x]}, {x, {-3, 1/2, 3, 10, 104}}],Frame->All]

-- 
Helen Read
University of Vermont


  • Prev by Date: Re: Constructing a Label
  • 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)