coding for this problem

Dec 4, 2016 at 11:15pm
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 :)
Dec 4, 2016 at 11:25pm
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 Dec 4, 2016 at 11:25pm
Topic archived. No new replies allowed.