Re: Mathematica Help Urgent (Very New Beginner)
- To: mathgroup at smc.vnet.net
- Subject: [mg93387] Re: Mathematica Help Urgent (Very New Beginner)
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Wed, 5 Nov 2008 04:57:13 -0500 (EST)
On 11/4/08 at 6:17 AM, derekcashel at yahoo.com (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}] >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? Easily done using Map and a pure function. For example, generate some data In[41]:= RandomInteger[10, {5}] Out[41]= {1,9,3,10,5} and In[42]:= {#, f[#]} & /@ Sort[%] Out[42]= {{1, f[1]}, {3, f[3]}, {5, f[5]}, {9, f[9]}, {10, f[10]}} gives the desired table