RE: Mathematica Help Urgent (Very New Beginner)
- To: mathgroup at smc.vnet.net
- Subject: [mg93363] RE: [mg93332] Mathematica Help Urgent (Very New Beginner)
- From: "David Park" <djmpark at comcast.net>
- Date: Wed, 5 Nov 2008 04:52:52 -0500 (EST)
- References: <12027390.1225797491944.JavaMail.root@m02>
Here is a sample function:
f[x_] := x^2 Sin[x]
Assuming you have Version 6, you can make a table simply by listing the set
of values you want.
(values =
Table[{x, f[x], f'[x], f''[x]} //
N, {x, {0, 1, 1.5, 2, 5, 10}}]) // TableForm
If you don't have Version 6 you can use MapThread with a pure function. (But
for a beginner this take a little study. You would have to look up Function
and MapThread in Help.)
Going back to Version 6, we can add a heading row and then display a
formatted grid.
(gridarray =
Join[{{x, HoldForm[f[x]], HoldForm[f'[x]], HoldForm[f''[x]]}},
values]) // TableForm
Grid[gridarray,
Frame -> True,
Dividers -> {{2 -> Black}, {2 -> Black}}]
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark
From: Derek [mailto:derekcashel at yahoo.com]
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?
Any help would be greatly, greatly appreciated. Thanks.