You are on page 1of 1

## Program for Gauss Lagranges 2 point formula ##

x0=input('enter the value of x0:');

xn=input('enter the value of xn:');

c=(xn-x0)/2;

d=(xn+x0)/2;

x1=(c*sqrt(1/3)+d);

x2=(-c*sqrt(1/3)+d);

y1=x1*x1*x1+x1-1;

y2=x2*x2*x2+x2-1;

area=y1+y2;

area=area*c;

fprintf('total area =%f',area);

Output

enter the value of x0:1

enter the value of xn:4

total area =68.250000>>

You might also like