Ok, I wrote a program to calculate a taylor series, but I'm getting a compiler error. "expected constructor, destructor, or type conversion before 'int'." Any ideas? I apologize, I realize I asked a similar question yesterday, but I needed to write this program a specific way and I'm running into another issue. Thanks.
void setup()
{
Serial.begin(9600);
loop_a();
}
void loop_a()
{
int phi=0;
float PHI=0;
for (phi=0; phi<=90; phi=phi+5)
{
Serial.print(phi);
Serial.print("\t");
PHI=phi*M_PI/180;
Serial.print(cos(PHI));
Serial.print("\t");
Serial.println(cos(PHI));
}
float Cos(float theta);
{
int i=0;
int N=7;
float Ans=0;
for (i=0; i<=N; i++)
{
float Cos(float x)
{
float y=0;
for (m=0; m<=13; m++)
{
fact=factorial(2+m);
Ans=Ans+(pow(-1,i)*(pow(x,2*i))/(factorial(2*i))
}
return Ans;
}
Long int factorial(Long N)
{
long int i;
for (i=0; i<=N; i++)
{
Serial.print(i);
Serial.print("\t");
Serial.println(factorial(i));
}
}
}
}
void loop(){}
I'm not going to spend more time on this. Indent your code properly. If you don't have time: well you must have time, because you have time trying to get rid of the error message. The error message you wouldn't have if you coded neatly.
I apologize. I'm very new. Thanks for the help that you gave me, though. My professor was the one that stuck in the Long int thing. After I took that out, I'm getting somewhere.