Can someone help me with this code?
The equations I wrote are in the image
Appear the error:
"unkown type name Calculo"
"too few arguments to function pow"
Calculo de Alfa_min
Calculo de Alfa_max
Calculo de Delta_alfa
alfa = Alfa_min;
while(j<=n_alfa)
{
cos_gama = (Ll*sen(alfa))/(pow((pow((Ll*cos(alfa)-OB),2) + ((pow(Ll,2))*(pow(sen(alfa),2))))),0,5);
sen_gama = (Ll*cos(alfa)-OB)/(pow((pow((Ll*cos(alfa)-OB),2) + ((pow(Ll,2))*(pow(sen(alfa),2))))),0,5);
cos_beta = (OC*sen(alfa))/(pow((pow((OC*cos(alfa)-OA),2) + ((pow(OC,2))*(pow(sen(alfa),2))))),0,5);
sen_beta = (OC*cos(alfa)-OA)/(pow((pow((OC*cos(alfa)-OA),2) + ((pow(OC,2))*(pow(sen(alfa),2))))),0,5);
ps; disregard the "sen", I alread change to "sin"
>>324748
Why do you have ,0,5 at the end of pow?
>>324756
because I thought is the same as 1/2 but isn't
in C I have to write 1.0/2
right?
>>324772
no i meant you have pow(x,0,5)
pow only accepts two arguments. if you're trying to do a square root, it would be 0.5
you should use sqrt instead of raising it to the power of 0.5
>>324779
Thank you very much anon
I did not realize that I could use sqrt in this situation.
But I still with the problem with "too few/many arguments"
probably is something connected with the code's header . I'll try to fix that.
Thanks, again
>>324756
Because Euro-monkeys use commas for the decimal point and period points for spacers.
>>324748
cos_gama =
(Ll*sen(alfa))
/
(
>pow(
>>(
>>>pow(
>>>>(
>>>>>Ll*cos(alfa)-OB
>>>>)
>>>,2)
>>+ (
>>>(
>>>>pow(Ll,2)
>>>)*(
>>>>pow(sen(alfa),2)
>>>)
>>)
>)
),0,5
);
you have an extra )) before the 0.5
>Protip: avoid recomputing the same thing over and over
double ls = Ll*sen(alfa);
double lc_ob=Ll*cos(alfa)-OB;
cos_gama = ls/sqrt(lc_ob*lc_ob + lc_ob*lc_ob);
sen_gama = lc_ob/sqrt(lc_ob*lc_ob + lc_ob*lc_ob);
double ocs=OC*sen(alfa);
double occ_oa=OC*cos(alfa)-OA;
cos_beta = ocs/(pow(occ_oa*occ_oa + ocs*ocs, 0.5);
sen_beta = occ_oa/(pow(occ_oa*occ_oa + ocs*ocs, 0.5);
>>324772
>because I thought is the same as 1/2 but isn't
Because 1 is an int and 2 is an int so 1/2 is integer division that will return an int (0)
>>324904
Thank you very much.
I'm using sqrt now
Can someone explain other thing? I don't want create a new thread.
How can I insert a function in this code?
Look, I have:
Alfamin = PI/D1 <= ALFA
Alfamax = P1/D2 >= ALFA
I have to put a condition:
The first alfa value returned have to be equal PI/D1 and the last value returned have to be equal PI/D2.
And my code is:
Calculo de Alfa_min
Calculo de Alfa_max
Calculo de Delta_alfa
alfa = Alfa_min;
how I do that?
why the hell would you use local naming for a standard function, it is fucking sin not sen
>>325083
>Calculo de Alfa_min
>Calculo de Alfa_max
>Calculo de Delta_alfa
This isn't code, it's what you're supposed to do in the assignment. Are you legit retarded?
double Alfa_min = PI/D1;
double Alfa_max = P1/D2;
double Delta_alfa = (Alfa_max - Alfa_min)/1024; // replace 1024 by how many increments you want
for(alfa = Alfa_min; alfa <= Alfa_max; alfa = alfa + Delta_alfa)
{
...