Newton’s method in Maxima

I’m often surprised by maths teachers complaining, in blogs or online postings, of the lack of a good freeware general purpose computer algebra system. In fact there are several. The topic of this posting is Maxima.
Maxima can do most things, and there is a small army of developers and users constantly extending and upgrading it. As a tiny introduction, here is Newton’s method, done interactively. Maxima uses a singe colon for assigning a variable, and colon-equals for defining a function. First, the function:

(%i1) f(x):=x^5+x^2-1;

Next, Newton’s method applied to this function:

(%i2) nr(t):=subst(t,x,x-f(x)/diff(f(x),x));

Now, with a starting value of 0.7, we can start the iterations (as with Maple, Maxima uses the percentage sign to refer to the results of the previous command):

(%i3) nr(0.7);
(%o3)              0.8314862526437223
(%i4) nr(%);
(%o4)              0.8095730086415593
(%i5) nr(%);
(%o5)              0.8087317874228543
(%i6) nr(%);
(%o6)              0.8087306004817508
(%i7) nr(%);
(%o7)              0.808730600479392
(%i8) nr(%);
(%o8)              0.808730600479392


One Response

  1. Very cool!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The AIM Network

The Australian Independent Media Network


Get every new post delivered to your Inbox.

Join 54 other followers

%d bloggers like this: