Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi, I really need help finishing this program in C++. I\'m not sure where to go

ID: 671287 • Letter: H

Question

Hi, I really need help finishing this program in C++. I'm not sure where to go from here and this is due within two hours. I've included my progress thus far.

This is the code I have so far:

//
// Created by Abraham Hernandez on 9/30/15.
// Copyright © 2015 Abraham Hernandez. All rights reserved.
//

#include
#include
#include
#include
using namespace std;

double function1 (double X);
double function2 (double xL, double xR);
double x;
double pi = 3.14159265;
double e = pi*(4*atan(1));

double Y1 = 2.5*sin((2*(pow(e,x/2)))/(pow(x,4)+1))-sqrt(log(1.5+4*pow(x,2)));
int main(void)
{
    int xL, xR, Xm, Err;
   
    cout<< "Please choose a left bound for the function ";
    cin>> xL;
   
    cout<< "Please choose a right bound for the function ";
    cin>> xR;
   
    if ((-1000 <= xL)&&(xL <= -9))
        cout<< "There is no solution in this range";
    else if ((1000 >= xR)&&(xR >= 8))
        cout<< "There is no solution in this range ";
   
    Xm = (xL + xR)/(2);
   
    if (Xm <= Err)
        cout<<"Xm ="<< Xm << "/n";
   
    if (Xm >= Err)
        cout<<"Xm ="<< Xm << "/n";
    if (function1*function2 < 0)
        cout<<"xR = Xm"<< "/n";
   
   

   
   
    return 0;

}

   
   /*
   
  
    double xR, xL, R1, R2, yR, yL;
    do
    {
        cout<< "Enter xR, xL";
        cin>> xR>>xL;
        if (xL > xR)
            xR = xL;
        yR = function1 (xR);
        yL = function1 (xL);
    }
    while (yR * yL > 0);
    if (xR < 0 || xL > 0)
        R1 = function2(xL,xR);
    if (xL < 0 && xR > 0)
    {
        R1 = function2(xL,0);
        R2 = function2(0,xR);
    }
    return 0;
    }
   
*/

Explanation / Answer

#include<iostream>
#include<cmath>
//#include<cstring>
//#include<algorithm>
using namespace std;
double function1 (double x)
{
return 2.5*sin((2*(exp(x/2)))/(pow(x,4)+1));
}
double function2 (double x)
{
return sqrt(log(1.5+4*pow(x,2)));
}
double diff(double x)
{
return fabs(2.5*sin((2*(exp(x/2)))/(pow(x,4)+1))-sqrt(log(1.5+4*pow(x,2))));
}
double pi = 3.14159265;

int main(void)
{

long double x=-9,inc=0.001,y1,y2;
int j=0;
while(x<=8)
{

//precision is 0.0001
double val=diff(x);
if(val<0.0001)
{
y1=function1(x);
y2=function2(x);

cout<<" point in function y1: x="<<x<<" y="<<y1;
cout<<" point in function y2: x="<<x<<" y="<<y2;
}


x=x+inc;
}
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote