Regula Falsi Method: Problem 1
Regula Falsi Method: Problem 1
60°
𝑄2 𝑇
=1
𝑔𝐴3
Analytical Solution:
60 60
𝑇 = 2 (𝑦 (𝑡𝑎𝑛 2
))=2 (𝑦 (𝑡𝑎𝑛 2 )) = 1.1547y
60
𝐴 = 𝑦 (𝑦 (𝑡𝑎𝑛 )) = 0.5774 𝑦 2
2
(0.4)2 (1.1547𝑦)
=1
(9.81)(0.5774𝑦 2 )3
60 60 3
Simplifying the equation gives f(x)= (𝑄 2 ) (2(𝑡𝑎𝑛 )) − [(9.81)(𝑦 2 (𝑡𝑎𝑛 ) ]
2 2
package regulafalsi;
import java.util.Scanner;
public class RegulaFalsi {
Domagas|Faycan|Lopez|Umalla|Dacwag|Danigos|Degay,Z.|Gamboa|Piano|Ramos,E. Page 1
Scanner input= new Scanner (System.in);
double Q,a,b,c,fxa,fxb,theta2,xa,xb,fxc,fxd;
int n,i,j;
double weir [][]= new double [10][8];
System.out.println("Input the volumetric flowrate of the fluid passing through the triangular
weir in m^3/second");
Q=input.nextDouble();
theta2=0.5773502692;
fxa=((((Q*Q)*(2*a*theta2))-((9.81*((a*a*theta2)*(a*a*theta2)*(a*a*theta2))))));
fxb=((((Q*Q)*(2*b*theta2))-((9.81*((b*b*theta2)*(b*b*theta2)*(b*b*theta2))))));
xa= a*fxb;
xb=b*fxa;
c=((xa-xb)/(fxb-fxa));
fxc=((((Q*Q)*(2*c*theta2))-((9.81*((c*c*theta2)*(c*c*theta2)*(c*c*theta2))))));
fxd= fxa*fxb;
if (j==0){weir[n][j]=a;}
if (j==1){weir[n][j]=fxa;}
if (j==2){weir[n][j]=b;}
if (j==3){weir[n][j]=fxb;}
if (j==4){weir[n][j]=c;}
if (j==5){weir[n][j]=fxc;}
if (j==6){weir[n][j]=fxd;}
System.out.printf("%.4f", weir[n][j]);
System.out.print(" ");
}
System.out.println(" ");
if(fxa*c>0){a=c;}
Domagas|Faycan|Lopez|Umalla|Dacwag|Danigos|Degay,Z.|Gamboa|Piano|Ramos,E. Page 2
else {b=c;}
}}}
Domagas|Faycan|Lopez|Umalla|Dacwag|Danigos|Degay,Z.|Gamboa|Piano|Ramos,E. Page 3
Problem 2: A high speed subsonic Boeing 707 airline is flying at a pressure altitude of 12 km. A
pitot tube on the vertical tail measures a pressure of 29,600 Pa. At which Mach number is the
airplane flying? ( At 12 km, the pressure in a standard atmosphere is 19320 Pa).
𝑃𝑜 𝑦−1 𝑦−1
=[1+ ( ) (𝑀2 )] 𝑦
𝑃 2
M= Mach number
Analytical Solution:
M= 0.805
package regulafalsi2;
import java.util.Scanner;
double Po,P,y,M,A,a,b,d1,d2,d3,fxa,fxb,c,fxc,fxd,xa,xb;
int n,i,j;
double weir [][]= new double [30][8];
Domagas|Faycan|Lopez|Umalla|Dacwag|Danigos|Degay,Z.|Gamboa|Piano|Ramos,E. Page 4
System.out.println(" At 12km, the pressure in a standard atmosphere is 19320 Pa");
fxa=((Po/P)-(Math.pow(d1,3.5)));
fxb=((Po/P)-(Math.pow(d2,3.5)));
xa= a*fxb;
xb=b*fxa;
c= ((xa-xb)/(fxb-fxa));
d3=(1+((y-1)/2)*c*c);
fxc=((Po/P)-(Math.pow(d3,3.5)));
fxd= fxa*fxb;
if (j==0){weir[n][j]=a;}
if (j==1){weir[n][j]=fxa;}
if (j==2){weir[n][j]=b;}
if (j==3){weir[n][j]=fxb;}
if (j==4){weir[n][j]=c;}
if (j==5){weir[n][j]=fxc;}
if (j==6){weir[n][j]=fxd;}
System.out.printf("%10.4f", weir[n][j]);
System.out.print(" ");
}
System.out.println(" ");
if(fxa*c>0){a=c;}
else {b=c;}
}}}
Domagas|Faycan|Lopez|Umalla|Dacwag|Danigos|Degay,Z.|Gamboa|Piano|Ramos,E. Page 5
The result of the program is:
Domagas|Faycan|Lopez|Umalla|Dacwag|Danigos|Degay,Z.|Gamboa|Piano|Ramos,E. Page 6