Numerical Methods Notebook 074105
Numerical Methods Notebook 074105
+1/n*)
m = 10;
Sum[1 / n, {n, 1, m}]
Out[5]=
7381
2520
100
{39, 63, 70, 18, 6, 63, 73, 68, 9, 64, 38, 34, 77, 11, 19, 86, 13, 96, 54,
36, 85, 17, 3, 94, 29, 69, 41, 9, 44, 93, 67, 66, 80, 30, 1, 79, 7, 59, 5, 12,
17, 10, 47, 82, 52, 72, 48, 11, 31, 92, 4, 33, 76, 21, 51, 90, 8, 43, 16, 64,
77, 23, 24, 37, 10, 63, 38, 35, 68, 47, 6, 100, 92, 94, 7, 43, 31, 25, 20, 11,
36, 70, 24, 97, 53, 72, 46, 39, 14, 95, 98, 65, 22, 40, 25, 57, 4, 65, 12, 29}
{1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0,
0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0,
0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0}
{0, 2, 4, 5, 5, 6, 8, 11, 13, 21, 23, 31, 34, 35, 36, 39, 39, 41, 44, 52, 53, 55, 56, 56, 58,
58, 59, 60, 60, 61, 63, 65, 67, 68, 70, 73, 75, 76, 77, 77, 84, 85, 86, 90, 90, 91, 95,
96, 97, 99, 102, 103, 103, 111, 114, 114, 115, 116, 117, 122, 125, 127, 127, 132, 135,
137, 138, 138, 139, 142, 148, 149, 149, 152, 153, 159, 160, 163, 164, 171, 172, 173,
174, 175, 177, 179, 181, 181, 183, 192, 193, 194, 195, 195, 196, 197, 198, 198, 198, 200}
In[11]:=
g[x_] := x ^ 3 + 4 * x ^ 2 - 2 * x + 10;
2
In[12]:=
60
40
20
-4 -2 2 4
In[13]:=
Solve[g[x] ⩵ 0, x]
Out[13]=
In[14]:=
{a, b} = {- 5, - 4};
{y, z} = {g[a], g[b]}
Out[15]=
{- 5, 18}
In[16]:=
In[19]:=
{p, q} = {- 5, - 4};
{y, z} = {g[p], g[q]};
Ify * z < 0, m = ((p + q) / 2), "root is not in this interval";
If[g[m] < 0, p = m, q = m];
{{p, q}, {g[p], g[q]}}
Out[23]=
9 71
- 5, - , - 5,
2 8
In[159]:=
{p, q} = {- 5, - 4};
expression := {y, z} = {g[p], g[q]};
In[115]:=
Do[expression, 1];
Printm, "=", N[m], " is the Approximate Root with the value ", N[g[m]]
9
- =- 4.5 is the Approximate Root with the value 8.875
2
In[119]:=
Do[expression, 2];
Printm, "=", N[m], " is the Approximate Root with the value ", N[g[m]]
19
- =- 4.75 is the Approximate Root with the value 2.57813
4
In[123]:=
Do[expression, 3];
Printm, "=", N[m], " is the Approximate Root with the value ", N[g[m]]
39
- =- 4.875 is the Approximate Root with the value - 1.04492
8
In[127]:=
Do[expression, 4];
Printm, "=", N[m], " is the Approximate Root with the value ", N[g[m]]
77
- =- 4.8125 is the Approximate Root with the value 0.807373
16
In[131]:=
Do[expression, 5];
Printm, "=", N[m], " is the Approximate Root with the value ", N[g[m]]
155
- =- 4.84375 is the Approximate Root with the value - 0.10849
32
4
In[135]:=
Do[expression, 6];
Printm, "=", N[m], " is the Approximate Root with the value ", N[g[m]]
309
- =- 4.82813 is the Approximate Root with the value 0.352001
64
In[139]:=
Do[expression, 7];
Printm, "=", N[m], " is the Approximate Root with the value ", N[g[m]]
619
- =- 4.83594 is the Approximate Root with the value 0.122397
128
In[143]:=
Do[expression, 8];
Printm, "=", N[m], " is the Approximate Root with the value ", N[g[m]]
1239
- =- 4.83984 is the Approximate Root with the value 0.00711399
256
In[149]:=
Do[expression, 9];
Printm, "=", N[m], " is the Approximate Root with the value ", N[g[m]]
2479
- =- 4.8418 is the Approximate Root with the value - 0.0506478
512
In[153]:=
Do[expression, 10];
Printm, "=", N[m], " is the Approximate Root with the value ", N[g[m]]
4957
- =- 4.84082 is the Approximate Root with the value - 0.0217569
1024
In[157]:=
Do[expression, 11];
Printm, "=", N[m], " is the Approximate Root with the value ", N[g[m]]
9913
- =- 4.84033 is the Approximate Root with the value - 0.00731894
2048
In[161]:=
Do[expression, 12];
Printm, "=", N[m], " is the Approximate Root with the value ", N[g[m]]
19 825
- =- 4.84009 is the Approximate Root with the value - 0.000101847
4096
5
In[185]:=
g[x_] := x ^ 3 + 4 * x ^ 2 - 2 * x + 10;
{p, q} = {- 5, - 4};
expression := {y, z} = {g[p], g[q]};
Do[expression, 12];
Printm, "=", N[m], " is the Approximate Root with the value ", N[g[m]]
19 825
- =- 4.84009 is the Approximate Root with the value - 0.000101847
4096
In[183]:=
g[x_] := x ^ 3 + 4 * x ^ 2 - 2 * x + 10;
ResourceFunction["BisectionMethodFindRoot"][g[x] ⩵ 0, {x, - 5, - 4}, 6, 13, "Steps"]
Out[184]=
In[190]:=
{x → - 4.84009}
In[195]:=
In[196]:=
{x → 3.464102}
In[200]:=
{x → 3.437500}
In[207]:=
In[206]:=
{x → 3.468750}
In[208]:=
{x → 3.463867}
In[209]:=
{x → 3.464081}
In[214]:=
{x → 3.464102}
In[215]:=
{x → 3.464102}
In[216]:=
In[2]:= A
Out[2]//MatrixForm=
1 1 1
3 2 3
3 2 1
In[12]:=
In[9]:= MatrixForm[lu]
Out[9]//MatrixForm=
1 1 1
3 2 3
3 2 1
In[10]:=