我想在C程序中轉換此方程來求解方程,但結果總是錯誤的。我想將所有三個包圍方程轉換爲C代碼。我已經對前兩個代碼進行了編碼,但請檢查是否有問題。將方程轉換爲c程序
代碼第一方程
#include <stdio.h>
#include <math.h>
int main()
{
/* Define temporary variables */
double r1,r2,u;
double upper,lower,value,result;
printf("Enter coefficients r1");
scanf("%f",&r1);
printf("Enter coefficients r2 ");
scanf("%f,&r2);
printf("Enter coefficients u ");
scanf("%f",&u);
/* Assign the value we will find the cosh of */
value = r1*r2;
/* Calculate the Hyperbolic Cosine of value */
upper = acos(value);
lower = sqrt((u*u)+1) - u;
result = upper/lower;
/* Display the result of the calculation */
printf("The spinner rotaiton angle is %f",result);
return 0;
}
代碼第二方程
#include <stdio.h>
#include <math.h>
#include<stdlib.h>
int main()
{
/* Define temporary variables */
double r,w,u;
double a1,result;
printf("Enter coefficients R");
scanf("%f",&r);
printf("Enter coefficients w angular velocity ");
scanf("%f,&w);
printf("Enter coefficients u cofficient of friction");
scanf("%f",&u);
a1 = sqrt((u*u)+1) - u;
a2 = a1*a1;
a3 = sqrt (1 + a2);
result = r * w * a3;
/* Display the result of the calculation */
printf("The departure velocity is %f",result);
scanf(%f);
return 0;
}
也ACOSH即COS雙曲線的示值誤差 – Nitin
你有什麼問題的倒數。 –
'scanf(「%f」,&r1);' - >'scanf(「%lf」,&r1);'etc. – chux