Professional Documents
Culture Documents
Bài tập chương 2
Bài tập chương 2
Bài làm:
- Xét a=b=c=0,001
| |
−1
4
a 4 2
- ln y 1=¿ ¿ 3
.a + .b+ . c =2,074. 10−3
|b| |c|
4
a + 16
y 1=| y 1|. y 1=0,451
#include<stdio.h>
#include<math.h>
int main()
{
float a=16.08,b=2.005,c=34.202,y1;
float delta=0.001;
float abserror, relerror;
y1=((pow(a,0.75)+16)*pow(c,2))/(8*pow(b,4));
relerror=((pow(a,-0.25)/(pow(a,0.75)+16))+(4/b)+(2/c))*delta;
abserror=relerror*y1;
printf("Sai so tuong doi: %.3f\n", relerror);
printf("Sai so tuyet doi: %.3f", abserror);
}
Bài 2:
Cho hàm số f(x)=16 x 5+8 x 4 +2 x 3+ 5 x 2 +3 x+ 4
Horner đơn giản:
a) Tính f(4),f(-3)
- f(4):
Áp dụng sơ đồ Horner ta có:
16 8 2 5 3 4
64 288 1160 4660 18652
16 72 290 1165 4663 18656
Bài 3:
Tìm khai triển Maclaurin của hàm số f(x)=ln(1+x)
2 3 4 n
Ta có ln(x+1)= x− x2 + x3 − x4 + …+ (−1 )n−1 xn
Với x=0.2, tính ln(x+1) có kết quả là 0.182với độ chính xác là 0,001
#include<stdio.h>
#include<math.h>
double Mac(double);
int main(){
double x;
int n;
printf("nhap x: ");
scanf("%lf",&x);
printf("ln(1+%.3lf)=%.3lf",x,Mac(x));
return 0;
}
double Mac(double x)
{
double result = 0;
for(int i=1;i<=4;i++){
result += pow(-1,i+1)*pow(x,i)/i;
}
return result;
}