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