n阶勒让德多项式
#include<stdio.h>
float dera(int n, float x);
void main()
{
int a = 4;
float ret, b = 3;
printf("input a,b:");
scanf("%d,%f\n",&a, &b);
printf("n=%d,x=%f\n", a, b);
ret= dera(a, b);
printf("ret=%f\n", ret);
//return 0;
}
float dera(int n, float x)
{
float i;
if (n == 0)
return 0;
if (n == 1)
i= x;
else if (n >= 1)
i= ((2 * n - 1)*x - dera(n - 1, x) - (n - 1)*dera(n - 2, x)) / n;
return (i);
}
n阶勒让德
最新推荐文章于 2023-10-19 17:34:24 发布