Declaring a function
Feb 7, 2014 at 11:19pm UTC
I want to define the following function:
f(x)= sin(a*x/(1+x^2))*atan(bx)+atan(x)
where a,b are constant parameters (e.g 3,2)
1 2 3 4 5 6 7 8 9 10 11 12
#include <iostream>
#include <math.h>
using namespace std;
//Define function f(x)
double f(int a, int b, double x)
{
double r
r=sin((a*x)/(1+x*x))*atan(b*x)+atan(x)
return r
}
would this work?
Thank you.
Last edited on Feb 7, 2014 at 11:59pm UTC
Feb 8, 2014 at 2:04am UTC
Why dont you try compiling it?
I can see missing semi-colon in various places
Feb 8, 2014 at 2:54am UTC
Compiling it to be sure is your best bet, but yes, this looks like it should work (aside from the missing semi-colons)
also beware to compile with the -lm command since you're using math.h
Topic archived. No new replies allowed.