Wondering Could Get Help Flowchart Program Confused Past Couple Hours Helps Formula Used Q37089723

I was wondering if I could get help with a flowchart for thisprogram. Have been very confused for the past couple of hours. Ifit helps here is the formula we used to.
tan(theta)=2cot(beta)*(M12sin2(beta))-1/M12(+cos(2beta))+2

#include

#include
#include

using namespace std;

double fun(double beta,double M,double angle)
{
return((2/tan(beta))*(pow(M,2)*pow(sin(beta),2)-1)/(pow(M,2)*(1.4+cos(2*beta))+2)-tan(angle));
}

const double TOL=1e-5;

int main()
{
double x3,x1,x2,xs,f1,f2,f3,M1,theta;
int iter=0;
cout << “Please enter the Mach number, followed by thedeflection angle (in degrees).” << endl;
cin>>M1>>theta;
theta = theta*M_PI/180;
   x1=.5*M_PI/180;
   x2=64*M_PI/180;
f1=fun(x1,M1,theta);
f2=fun(x2,M1,theta);

if((f1*f2)>0)
{
cout<<“nThis combination of mach number and angle ofdeflection produce a detached shock. Please try again with a highermach number or a lower angle of deflection.n”;
}
else
{
do
{
  
           xs=x3;
x3=x1-(f1*(x2-x1))/(f2-f1);
f3=fun(x3,M1,theta);
iter++;

  

if((f1*f3)<0)

x2=x3;
else
x1=x3;
f1=fun(x1,M1,theta);
f2=fun(x2,M1,theta);
}while(fabs(fun(x3,M1,theta))>=TOL);//Terminating case
}
   double Mn1=M1*sin(x3);
   doubleMn2=sqrt((1+(.2*(pow(Mn1,2))))/((1.4*(pow(Mn1,2)))-.2));
   double M2=Mn2/sin(x3-theta);
   cout<<“n”;
   cout<<“The exit mach number is:

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.