#1

(15 pts)

For this problem, you’re going to use your initials to construct your own personal, monic cubic. A monic cubic is a cubic polynomial with leading coefficient equal to 1. Thus, it has the form

f(x) = x^3 + cx^2+bx+a.

We just have to figure out what a, b, and c are going to be. Here’s how we’ll do it:
Let F, M, and L denote the positions in the alphabet of your First, Middle, and Last initials. If you happen to be missing your Middle initial, then let M=0. Then, let

\begin{align} a &= \lceil F/5 \rceil - 2 \\ b &= \lceil M/5 \rceil - 2 \\ c &= \lceil L/5 \rceil - 2 \end{align}

Then,

• Use a LaTeX snippet to type out your personal, monic cubic.
• Use a LaTeX snippet to type out the Newton’s method iteration function for your personal, monic cubic.
• Perform two Newton steps from x_0=1 to find x_1=N(x_0) and x_2=N(x_1).
• Use software to graph your personal, monic cubic and include it in your post.
• Using the graph, find some good initial seed x_0 that is strictly larger than the largest real root of your personal, monic cubic and use Python to compute 10 Newton steps to approximate the root.

Newton's method for your personal monic cubic
#2

That sounds cool!

My initials are AEM, so (for me)

\begin{array}{lll} F = 1 & \text{which implies} & a=-1\\ M = 5 & \text{which implies} & b=-1\\ L = 13 & \text{which implies} & c=1. \end{array}

Thus, my personal cubic polynomials f(x) = x^3+x^2-x-1.

#3

Mikhail Nekhemyevich Tal means my initials are M, N, and T, so respectively 13, 14, and 20.

\begin{array}{c} F=13 \ \text{ implies that } \ a=1. \\ M=14 \ \text{ implies that } \ b=1. \\ L=20 \ \text{ implies that } \ c=2. \\ \text{Thus, my personal cubic is }x^3 + 2x^2 + x + 1. \end{array}
\begin{array}{c} \text{Since Newton's Method is } N(x) = x-\frac{f(x)}{f'(x)}: \\ f(x) := x^3 + 2x^2 + x + 1 \\ f'(x) := 3x^2 + 4 x + 1 \\ \text{So, } N(x) \text{ is } x-\frac{x^3 + 2x^2 + x + 1}{3x^2 + 4x + 1} \end{array}

Starting with x_0=1, x_1 = N(x_0) = \frac{3}{8} and x_2 = N(x_1) = -\frac{157}{748}.

Here’s what the graph looks like.

Here’s my Python code. The initial seed is x_0=1,since this is strictly larger than the largest real root, as is shown by the graph. The code suggests that there is a root at around -1.75, which is supported by direct calculation using Cardano’s, which gives about -1.75488 as the only real solution.

def f(x):
return x**3 + 2*x**2 + x + 1
def dfdx(x):
return 3*x**2 + 4*x + 1

runs = 0
x = 1
while runs < 10:
x = x - float(f(x))/dfdx(x)
print(x)
runs += 1


The output is below

0.375
-0.2098930481283422
-3.17978649347084
-2.421826234430211
-1.984494087877696
-1.7951378906140794
-1.7564326126011414
-1.7548801127848945
-1.7548776662527625
-1.7548776662466927

#4

My initials are WSF. Therefore, I have

a= 3
b = 2
c = 0

This yields the monic cubic polynomial f(x) = x^3+2x+3.

This further yields the following Newton’s method iteration function for f(x), N(x) = x - \dfrac{x^3+2x+3}{3x^2+2}.

Now we will perform two Newton iteration steps using the initial seed x_0=1.

x_1 = N(x_0) = 1- 1.2=-0.2

x_2 = N(x_1) = -0.2 - \dfrac{2.592}{2.12} =-1.42264150943.

Using Mathematica, we can graph f(x) using the following code:

Plot[x^3 + 2 x + 3, {x, -5, 5}]


Which yields the following graph:

I’ve got a boring name so it’s no surprise we have a boring graph. But, it has one nice integer root, x_r = -1.

So now we will pick a seed of x_0 = -0.5 and use the code presented in Professor McClure’s text, augmented to solve for our f(x):

def f(x): return x**3 + 2*x + 3
def fp(x): return 3*x**2 + 2
def N(x): return x-f(x)/fp(x)
xi = -0.5
for i in range(10):
xi = N(xi)
print(xi)


This code yields the following results:

-1.18181818182
-1.01796334507
-1.00019175699
-1.00000002206
-1.0
-1.0
-1.0
-1.0
-1.0
-1.0

#9

My initials are JAG, so

\begin{array}{c} F=10 \ \text{ which implies } \ a=0. \\ M=1 \ \text{ which implies } \ b=-1. \\ L=7 \ \text{ implies that } \ c=0.\end{array}

Thus, my personal cubic is x^3 - x.

Using Newton’s method, we find that

\begin{array}{c} N(x) = x-\frac{f(x)}{f'(x)} \\ f(x) = x^3 - x \\ f'(x) = 3x^2 - 1 \\ \end{array}

Thus, N(x) = x - \frac{x^3 - x}{3x^2 -1}.

With this, we can perform the first few iteration of Newton’s method.

\begin{array}{c} x_0 = 1 \\ x_1 = N(x_0) = 1 \\ x_2 = N(x_1) = 1 \end{array}

We can clearly see that, starting with the seed x_0 = 1, Newton’s method will return a value of 1 for any succeeding x_n.

Here is a graph of f(x) from Wolfram Alpha.

Judging by this graph, a better seed value would be, say x_0 = 1.5, since it turns out that x = 1 is largest root of our cubic.

Here is a simple Python program which will calculate the first 10 Newton’s method steps with this new seed to approximate the root x = 1.

def f(x):
return x**3 - x
def f_prime(x):
return 3*x**2 - 1
def N(x):
return x - f(x)/f_prime(x)

x = 1.5

for i in range(10):
x = N(x)
print(x)


Output:

1.17391304348
1.0323071275
1.00145595378
1.00000316894
1.00000000002
1.0
1.0
1.0
1.0
1.0


With this approach, we quickly arrive at the x = 1 root (as far as the specific precision of Python is concerned).

#10

You just gotta wrap your LaTeX inputs in the proper delimiters - a double dollar sign on it’s own line for display math and a single dollar sign for inline math. I went ahead and edited one instance of each in your both so you can see clearly what I’m talking about; you can go ahead and finish the rest.

#12

My full name is Alexandre Teixeira Thorp so,

a=1 -> 2
t=20 -> 2
t=20 -> 2

In python

def f(x): return x3 + 2*x2 + 2x - 2
def d(x): return 3
x**2 + 2*x + 2
def N(x): return x-f(x)/d(x)
xi=1
for i in range(10):
xi=N(xi)
print(xi)

Which gives,

0.5714285714285714
0.5756718528995757
0.5744858986671884
0.5748145230473725
0.5747232420325656
0.5747485799498094
0.5747415453076078
0.5747434982558309
0.5747429560731256
0.5747431065947395

#13

For my name, F=14, M=1, and L=11.

Thus, my a, b, and c are 1, -1, and 1 respectively.

This yields my personal monic polynomial f(x)=x^3=x^2-x+1,
which in turn yields the Newton’s Method iteration function N(x) = x - (x^3+x^2-x+1)/(3x-1).

Iterating from x_0=1, x_1 = 1/2 and x_2 =7/6.

The graph of f(x) looks like this:

It looks like x_0 = -1.5 would be a good value to iterate from to approximate the real root near -2.

I used the following code to iterate from this x_0:

def f(x):
return x **3 + x 2 - x + 1
def dfdx(x):
return 3*x
2 + 2*x - 1

runs = 0
x = -1.5
while runs < 10:
x = x - float(f(x))/dfdx(x)
print(x)
runs += 1

and got the following values from the iteration function:

-2.0
-1.8571428571428572
-1.839544513457557
-1.8392868100680193
-1.8392867552141636
-1.8392867552141612
-1.8392867552141612
-1.8392867552141612
-1.8392867552141612
-1.8392867552141612

Looks like it approximated the root to 16 decimal places after just 5 steps.

#14

@nathan Very nice! Don’t forget to indent your code 4 spaces, though, so that it is typeset as monospaced font on a gray background.

#15

@Athorp614 Good start! Do have a look at both

That will let you know how you can type LaTeX snippets directly into your post and how you can make computer code look like computer code.

#16

F = 1 \text{ which implies }a = -1\\ M = 4 \text{ which implies }b = -1\\ L = 19 \text{ which implies }c = 2.

Hence, my personal monic cubic is

x^3+2x^2-x-1.

Following Newton’s method N(x)=x-\frac{f(x)}{f'(x)}:

f(x) = x^3+2x^2-x-1,\\ f'(x) = 3x^2+4x-1,\\ N(x) = x-\frac{x^3+2x^2-x-1}{3x^2+4x-1}.\\

Starting from zero and performing two Newton iterations

x_0=-1,\\ N(x_0)=-\frac{1}{2},\\ N(x_1)=-\frac{5}{9}.

Here is a graph of f(x)

The graph suggests that there is a root near x=.8. Using x=1 just above the root and iterating using Python.

def f(x):
return x**3 + 2*x**2 - x - 1
def fp(x):
return 3*x**2 + 4*x - 1
def N(x):
return x-f(x)/fp(x)

x = 1
for i in range(10):
x = N(x)
print(x)


Which yields:

0.8333333333333334
0.8029350104821803
0.8019387932022206
0.8019377358060289
0.8019377358048383
0.8019377358048383
0.8019377358048383
0.8019377358048383
0.8019377358048383
0.8019377358048383

#17

My initials are JRM, so
\begin{array}{lll} F = 10 & \text{which implies} & a=0 \\ M = 18 & \text{which implies} & b=2 \\ L = 13 & \text{which implies} & c=1. \end{array}
Thus my personal cubic is f(x)=x^3+x^2+2x
From this I get N(x) = x-\frac{x^3+x^2+2x}{3x^2+2x+2}
Starting with x_0 = 1, x_1 = N(x_0)=\frac{3}{7}, and x_2 = N(x_1)=\frac{117}{1169}
Here’s what my graph looks like:

My python code

f = lambda x: x**3 + x**2 + 2*x
df = lambda x: 3*x**2 + x*2 + 2
x = 100
for i in range(10):
print("x_{} = {}".format(i, x))
x = x - f(x)/df(x)


Which prints:

x_0 = 100
x_1 = 66.5518839811933
x_2 = 44.25131897706734
x_3 = 29.381562745234664
x_4 = 19.464364661518065
x_5 = 12.846953984172675
x_6 = 8.426647570609465
x_7 = 5.467233631870375
x_8 = 3.476673133900025
x_9 = 2.1261503830804056


We can see the numbers heading towards zero.

#18

This topic was automatically closed after 8 days. New replies are no longer allowed.