Добавил:
student_tipo
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:лабораторные работы / Ньютон
.docx#include "stdafx.h"
#include "stdio.h"
#include "conio.h"
#include "string.h"
#include "math.h"
#include "iostream"
float f(float x)
{
return((2*x*x*x)/(1-x));
}
float fp(float x)
{
return(2*x*x*(3-2*x))/((1-x)*(1-x));
}
void main()
{
float e,x,y,xn;
printf("Vvedite tochnost:");
scanf("%f",&e);
printf("Vvedite x:");
scanf("%f",&x);
y=f(x);
while(abs(y)>e)
{
xn=x-(f(x)/fp(x));
x=xn;
y=f(x);
}
printf("%f",y);
getch();
}
Соседние файлы в папке лабораторные работы