.


:




:

































 

 

 

 


.

1.

.

 

4181

:


:

, .

 

:

1. , .

2. .

3. () . .

4. . : ; ; .

5. .

 

:

3.

[-1; 0]

 

 

C++:

#include <stdio.h>

#include <math.h>

#define func(x) exp(4*x)+x //

#define funp(x) 4*exp(4*x)+1 //

 

int main()

{

//

int n = 0;

float x, y, z, c = -0.1; //eps1 = 0.001, eps2 = 0.01;

printf (" Hello Enter x0 fo Method of simple iteration please ");

float x0;

scanf ("%f", &x0);

x = x0;

printf ("\n Please enter EPS1 for Method of simple iteration ");

float eps1;

scanf ("%f", & eps1);

printf ("\n Please enter EPS2 for Method of simple iteration ");

float eps2;

scanf ("%f", & eps2);

printf ("\n\nMethod simple iterations with an accuracy of %4f %4f \n\n",eps1, eps2);

do

{

y = x+c*(func(x)); //

z = x;

printf("%d %.6f %.6f %.6f %.4f\n",n++, x, y, fabs(y-x), fabs(func(y)));

x = y;

}

while(fabs(z-x) >= eps1 || fabs(func(x)) >= eps2);

printf (" end of cycle\n\n\n");

 

//

 

int k = 0;

float x1, y1, z1, c1 = -0.1;// eps3 = 0.001, eps4 = 0.01;

printf (" Hello entet x0 for Newton s method ");

float x10;

scanf ("%f", &x10);

x1 = x10;

printf ("\n Please enter EPS1 for Newton method ");

float eps3;

scanf ("%f", & eps3);

printf ("\n Please enter EPS2 for Newton method ");

float eps4;

scanf ("%f", & eps4);

printf ("\n\n Newton s method with an accuracy of %4f %4f \n\n",eps3, eps4);

do

{

y1 = x1-(func(x1))/(funp(x1)); //

z1 = x1;

printf("%d %.6f %.6f %.6f %.4f\n",k++, x1, y1, fabs(y1-x1), fabs(func(y1)));

x1 = y1;

}

while(fabs(z1-x1) >= eps3 || fabs(func(x1)) >= eps4);

printf (" end of cycle\n\n\n");

 

//

 

int m = 0;

float x2, y2, z2, c2 = -0.1;// eps5 = 0.001, eps6 = 0.01;

printf (" Entet x0 for Modifiend Newton s method ");

float x20;

scanf ("%f", &x20);

x2 = x20;

printf ("\n Please enter EPS1 for Modifiend Newton method ");

float eps5;

scanf ("%f", & eps5);

printf ("\n Please enter EPS2 for Modifiend Newton method ");

float eps6;

scanf ("%f", & eps6); // ()

printf ("Modifiend Newton method with an accuracy of %4f %4f \n\n",eps5, eps6);

do

{

 

y2 = x2-(func(x2))/(funp(x20)); //

z2 = x2;

printf("%d %.6f %.6f %.6f %.4f\n",m++, x2, y2, fabs(y2-x2), fabs(func(y2)));

x2 = y2;

}

while(fabs(z2-x2) >= eps5 || fabs(func(x1)) >= eps6);

printf (" end of cycle\n\n\n");

 

getchar();

return 0;

}

 

 

:

0
  ε x= x= x=
δ n= n= n=
  ε x= x= x=
δ n= n= n=
  ε x= x= x=
δ n= n= n=
  ε x= x= x=
δ n= n= n=
  ε x= x= x=
δ n= n= n=
  ε x= x= x=
δ n= n= n=
  ε x= x= x=
δ n= n= n=
  ε x= x= x=
δ n= n= n=

 

:

__________________________________________________________________________________________________________________________________________________________________________________________________________



<== | ==>
ә қ ә ұ | 
:


: 2017-04-04; !; : 256 |


:

:

80% - .
==> ...

1503 - | 1338 -


© 2015-2024 lektsii.org - -

: 0.014 .