HW #03
Due: 09/17/2025

1.

    (a) Determine whether the following series converges or diverges.


    n=2 

    2 + n  ln 
    n − 1

    n + 1



    (b) If the series converges, numerically sum the series (take, say, first 1,000 terms). If the series is divergent, you can say so and skip this problem.
2. Find a set of roots for the following simultaneous equations using the Newton-Raphson method.

21 x + ex  sin y = 3
(1)
x2 + 1 7 y = 6.
(2)
Start with (x0, y0) = (1, 1) as an initial guess and mention the number of iterations to reach convergence1. You have to show the formulas you derived to implement the Newton-Raphson method. You can attach a code that you wrote but it's not necessary.
Solution
1.

    (1)
    ln
    n − 1

    n + 1

    =
    ln



    1 − 1

    n

    1 + 1

    n




    (3)
    =
    ln
    1− 1

    n

    − ln
    1+ 1

    n

    (4)
    =

    −1

    n
    1

    2

    −1

    n

    2

     
    1

    3

    −1

    n

    3

     
    − …

    1

    n
    1

    2

    1

    n

    2

     
    + 1

    3

    1

    n

    3

     
    − …
    (5)
     ∼ 
    2

    n
    2

    3
    1

    n3
    − ...
    (6)
    Hence,

    2 + n  ln
    n −1

    n + 1

    =
    2 − 2 − 2

    3
    1

    n2
    − …
    (7)
     ∼ 
    2

    3
    1

    n2
    .
    (8)
    This is convergent as p = 2.
    (2)
    Matlab code:
    sum=0;
    for i=2:1000
     sum=sum+2+i*log((i-1)/(i+1));
    end;
    fprintf('%f\n', sum);
    
    
    octave-3.2.4.exe:7> junk
    -0.468309
    
    
    C code:
    #include <stdio.h>
    #include <math.h>
    int main()
    {
    double sum=0; int i;
    for (i=2;i<=1000;i++) sum=sum+2+i*log((i-1.0)/(i+1.0));
    printf("%f\n", sum);
    return 0;
    }
    
    
    [C:\tmp]gcc -lm junk.c
    
    [C:\tmp]a
    -0.468309
    
    
    Mathematica code:
    In[1]:= NSum[ 2 + n Log[(n-1)/(n+1)], {n, 2, 1000}]
    
    Out[1]= -0.468309
    
    
2.
Let

f(x, y) ≡ ex sin(y)+21 x−3,     g(x, y) ≡ −x2+17 y−6,

J
=






f

x
f

y
g

x
g

y






(9)
=



ex sin(y)+21
ex cos(y)
−2 x
17



.
(10)

J−1 =





17

2 ex x cos(y)+17 ex sin(y)+357
ex cos (y)

2 ex x cos(y)+17 ex sin(y)+357
2 x

2 ex x cos(y)+17 ex sin(y)+357
ex sin (y)+21

2 ex x cos(y)+17 ex sin(y)+357







J−1


f
g



=





17 (ex sin(y)+21 x−3)

17 ex sin(y)+2 ex x cos(y)+357
ex (−x2+17 y−6) cos (y)

17 ex sin(y)+2 ex x cos(y)+357
(−x2+17 y−6) (ex sin(y)+21)

17 ex sin(y)+2 ex x cos(y)+357
+ 2 x (ex sin(y)+21 x−3)

17 ex sin(y)+2 ex x cos(y)+357






Therefore the Newton-Raphson iteration scheme is expressed as

xn + 1
=
xn 17 (exn sin(yn)+21 xn−3)

17 exn sin(yn)+2 exn xn cos(yn)+357
exn (−xn2+17 yn−6) cos (yn)

17 exn sin(yn)+2 exn xn cos(yn)+357
(11)
yn+1
=
yn (−xn2+17 yn−6) (exn sin(yn)+21)

17 exn sin(yn)+2 exn xn cos(yn)+357
+ 2 xn (exn sin(yn)+21 xn−3)

17 exn sin(yn)+2 exn xn cos(yn)+357
(12)
C code:
#include <stdio.h>
#include <math.h>
int main()
{
	double x=1, y=1; int i;
	
	for (i=0;i<10;i++)
	{
	x=x + (exp(x)*(-6 - pow(x,2) + 17*y)*cos(y))/
    (357 + 2*exp(x)*x*cos(y) + 17*exp(x)*sin(y)) - 
   (17*(-3 + 21*x + exp(x)*sin(y)))/
    (357 + 2*exp(x)*x*cos(y) + 17*exp(x)*sin(y));
    
    y=y - ((-6 - pow(x,2) + 17*y)*(21 + exp(x)*sin(y)))/
    (357 + 2*exp(x)*x*cos(y) + 17*exp(x)*sin(y)) - 
   (2*x*(-3 + 21*x + exp(x)*sin(y)))/
    (357 + 2*exp(x)*x*cos(y) + 17*exp(x)*sin(y));
	}
	
	printf("%f %f\n", x, y);
	return 0;
}

[C:\tmp]gcc -lm junk.c

[C:\tmp]a
0.124175 0.353848

Matlab code:
x=1; y=1;
for i=0:10
 eqs=[ exp(x)*sin(y)+21*x-3; -x^2+17*y-6];
 jacob=[ exp(x)*sin(y)+21, exp(x)*cos(y); -2*x, 17];
 right=inv(jacob)*eqs;
 x=x-right(1);
 y=y-right(2);
end;

fprintf('%f %f\n', x, y);

octave-3.2.4.exe:13> junk
0.124175 0.353848

One-liner (Wolfram Alpha and Mathematica)
FindRoot[{21 x + E^x Sin[y] == 3, -x^2 + 17 y == 6}, {{x, 1}, {y, 1}}]

{x -> 0.124175, y -> 0.353848}

Actually convergence is attained after only three iterations.

Footnotes:

1



a
b
c
d



−1



 
= 1

a db c



d
b
c
a






File translated from TEX by TTH, version 4.03.
On 24 Sep 2025, 14:24.