Mathematica – Day 5

I did not have time to do anything with Mathematica. Evaluation time quickly runs out, but I have other stuff on my list including my family.

So I tried only some Newton method with a handmade iteration. The functions is f, and the Jacobian is computed by Grad.  Then g is the evaluated Newton step in symbolic form. The command NestList seems to be able to apply g to the start values 10 times.

f = {x^2 + y^2 - 10, x + y - 2}
Df = Grad[{-10 + x^2 + y^2, -5 + x + y},{x, y}]
g[{x_, y_}] = {x, y} - Inverse[Df].f
NestList[g, {4.0, 5.0}, 10] // N

Here is the result.

{{4., 5.}, {-15.5, 17.5}, {-7.37121, 9.37121}, {-3.42452,
5.42452}, {-1.66429, 3.66429}, {-1.08281, 3.08281}, {-1.00165,
3.00165}, {-1., 3.}, {-1., 3.}, {-1., 3.}, {-1., 3.}}

I would have loved to do this in a program, but did not have the time to look into the programming language of Mathematica.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.