Re: Coding for Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg100610] Re: Coding for Mathematica
- From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
- Date: Tue, 9 Jun 2009 03:55:58 -0400 (EDT)
- References: <h0i8dp$j7a$1@smc.vnet.net>
Just to be sure, you didn't enter all these In[ ] parts of your code
yourself did you? Mathematica generates them automatically and they
should not be typed by the user.
After typing in, a command can be evaluated with shift-enter.
If you continue to use Mathematica I'd urge you to read a bit of
documentation. There are several overviews, and quick start tutorials
in the documentation centre.
Cheers -- Sjoerd
On Jun 8, 7:43 am, FAQneeds <thegodfather7... at aol.com> wrote:
> Im a first time user of Mathematica. So im trying to put in a command rel=
ated to Newton's Method. I would just like to know if once im done typing t=
his command in am i suppose to see the results immediately or do i have go =
to something in the program to see the results of my command. Here is the C=
ode please can anyone tell me what im doing wrong i will be really grateful=
:
>
> In[1] :=(*your name,06/06/09*)
> In[2] :=(*Newton's Method*)
> In[3] := f[x_] := x^2 - 2
> In[4] := x[1] = 1.0
> In[5] := For[n = 1, n < 10, n++,
> {x[n + 1] = x[n] - f[x[n]]/f'[x[n]];
> Print[n + 1, " ", N[x[n + 1], 10]];}]
> In[6] := Plot[f[x], {x, 0, 2}]