Re: Mathematica Help Urgent (Very New Beginner)
- To: mathgroup at smc.vnet.net
- Subject: [mg93390] Re: Mathematica Help Urgent (Very New Beginner)
- From: Helen Read <hpr at together.net>
- Date: Wed, 5 Nov 2008 04:57:46 -0500 (EST)
- References: <gepavq$se3$1@smc.vnet.net>
- Reply-to: HPR <read at math.uvm.edu>
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