coding for this problem

Equation : -0.87 sin (4x) - 0.56 log (4x) + 1.32 ln (5x) Range of x : 8<= x <18 Step of x : 0.100
Generate value of f(x)?
Convert to rad?
Could the code be more flexible in selecting which sin, cos, tan, or cosine, log or even ln to be used on any equation? If could not, just according to the equation is good enought. thank you :)
1
2
3
4
5
6
7
8
double func( double x )
{
    return -0.87*sin( 4*x ) - 0.56*log10( 4*x ) + 1.32*log( 5*x );
}

for( double x{ 8.0 }; x < 18.0; x += 0.1 ) {
    cout << func( x ) << '\n';
}


Could the code be more flexible in selecting which sin, cos, tan, or cosine, log or even ln to be used on any equation?

What do you mean by this?
Last edited on
Topic archived. No new replies allowed.