Answer to Question #193700 in Quantitative Methods for Kaushik K

Question #193700

Find the real root of the equation π‘₯𝑒 π‘₯ = 𝑠𝑖𝑛π‘₯ correct to three decimal places by regula-falsi method


1
Expert's answer
2021-05-18T05:51:02-0400

this equation has an infinite number of roots

#include <iostream>
#include <math.h>
using namespace std;
double f(double x)
{
    return (x*pow(M_E,x)-sin(x));
}
int main()
{
    double left=-3,right=-2.5;//not zero roots
    double fl=f(left),fr=f(right);
    double epsilon=5e-4;
    double x=(left*fr-right*fl)/(fr-fl);
    while(abs(f(x))>epsilon)
    {
        if(f(x)*fl>=0.0)
        {
            left=x;
            fl=f(left);
        }
        else
        {
           right=x;
           fr=f(right);
        }
        x=(left*fr-right*fl)/(fr-fl);


    }
    cout<<x;
    return 0;
}

Answer:-2.99073


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS