(* You should be able to copy and paste this text file directly into Mathematica. These notes will be interpreted as commented code. *) (* For problem 1 *) f[x_] := 3/4 x + x^3 x0 := 0 N[Reduce[-1 < (f[x] - x0)/(x - x0) < 1]] (* This computes numerically the solution to |(f[x]-x0) / (x-x0)| < 1, used for item (iv) in problem 1 *) (* Basic implementation of Newton's method *) f[x_] := Cos[x] nif[x_] := x - f[x] / f'[x] (* This computes the Newton iterating function nif[x] for the given function f[x]. Changing the definition of f[x] above and rerunning both lines of code will automatically update nif[x] *) NestList[nif, 0.1`10, 10] (* This computes the first ten iterates of the Newton iterating function applied to 0.1, where 0.1 starts with 10 decimal places of precision. *) (* Note that the quote mark is the angle quote `, which on most keyboards is to the left of the 1 key, above the Tab key. The notation a`b tells Mathematica that the number a is given to b digits of precision. *) (* Mathematica's internal system will keep track of precision losses during computations and display fewer digits accordingly -- exceedingly useful in numerical computation. *) list := NestList[nif, 0.1`10, 101] {list[[11]], list[[101]], list[[102]]} (* This will compute a list of first 101 iterates of 0.1 under the Newton iterating function above, and then pull out the 10th, 100th, and 101st iterates. Note that because NestList returns the initial value x0 in the first entry of the list, the indexing is shifted by 1: thus the 10th iterate is the 11th element of the list *) (* For problem 5c *) alpha := 1/3 * (CubeRoot[27 + 3 Sqrt[57]] + CubeRoot[27 - 3 Sqrt[57]]) (* This is the expression appearing in problem 5c *)