Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

%bai tap 5

a=input('a')
b=input('b')
c=input('c')
n=input('n')
for i=1:n
if(a==0)
disp("phuong trinh co nghiem duy nhat")
x=c/b
s=exp(x)+pi-((x+i)/(i+1))
else
delta=b*b-4*a*(-c)
if(delta==0)
disp('phuong trinh co nghiem kep')
x=((-b)/(2*a))
s12=exp(x)+pi-((x+i)/(i+1))
else
disp('phuong trinh co 2 nghiem pham biet ')
x1=(((-b)+sqrt(delta))/(2*a))
s1=exp(x1)+pi-((x1+i)/(i+1))
x2=(((-b)-sqrt(delta))/(2*a))
s2=exp(x2)+pi-((x2+i)/(i+1))
end
end
end
%finish

%Bai tap 6
clc
clear
a=input("nhap a=")
b=input("nhap b=")
c=input("nhap c=")
if a==0
disp("Phuong trinh co nghiem duy nhat")
x=log(-c/b)
S=sqrt(x^3-sin(x))+(tan(x))^3-3*cos(x)+2-cot(x)
else
delta= b^2-4*a*c
if (delta==0)
disp("Phuong trinh co nghiem kep")
x1= log(-b/(2*a))
S= sqrt(x^3-sin(x))+tan(x)^3-3*cos(x)+2-cot(x)
else
if(delta>0)
disp("Phuong trinh co 2 nghiem phan biet")
x1=log((-b+sqrt(delta))/(2*a))
x2=log((-b-sqrt(delta))/(2*a))
S1=sqrt((x1)^3-sin(x1))+tan(x1)^3-3*cos(x1)+2-cot(x1)
S2=sqrt((x2)^3-sin(x2))+tan(x2)^3-3*cos(x2)+2-cot(x2)
else
disp("phuong trinh vo nghiem")
end
end
end
%finish

You might also like