/*
求解n阶多项式的值,多项式公式如下:
Pn(x) = 1 n=0;
= x n = 1;
= (2n - 1)xPn-1(x) - (n - 1)Pn-2(x) n>=2
*/
#include <stdio.h>
#include <stdlib.h> float Pn(int n,float x)
{
if(n == 0)
return 1;
else if(n == 1)
return x;
else
return (2 * (n-1) + 1) * x * Pn(n-1,x) - (n - 1) * Pn((n -1 ) - 1,x);
//return (2 * n - 1) * x * Pn(n-1,x) - (n - 1) * Pn(n - 2,x);
} int main()
{
int n;
float x;
printf("Enter n:");
scanf("%d", &n);
printf("Enter x:");
scanf("%f", &x);
printf("%f", Pn(n,x));
return 0;
}

最新文章

  1. Linux 部署 nginx服务代理
  2. WindowsForm--Bubble User Control
  3. XMPP客户端开发(2)--发送接收消息
  4. CodeForces 478C Table Decorations
  5. SQL Server 一些关键字详解(二)
  6. redundant 行记录格式
  7. 理解 backbone.js 中的 bind 和 bindAll 方法,关于如何在方法中指定其中的 this,包含apply方法的说明[转载]
  8. JavaScript之arguments.callee
  9. Java消息服务初步学习(基于Spring In Action的整理)
  10. 升级python(linux)
  11. BZOJ 2726: [SDOI2012]任务安排 [斜率优化DP 二分 提前计算代价]
  12. 【树莓派】GSM900模块
  13. Redis安装系统服务1073错误
  14. (转载)Javascript异步编程的4种方法
  15. mysql 理解索引,添加索引,使用索引(哪些情况会导致索引失效)
  16. ZThread::ThreadLocal:ERROR C4716 must return a value的解决
  17. JAVA三框架工作原理是什么?
  18. Android滑动删除功能
  19. Linux中的awk命令
  20. Data Structure Binary Tree: Construct Full Binary Tree from given preorder and postorder traversals

热门文章

  1. 面试~jvm(JVM内存结构、类加载、双亲委派机制、对象分配,了解垃圾回收)
  2. KingbaseES R6 集群repmgr.conf参数&#39;recovery&#39;测试案例(一)
  3. 二进制redis集群部署
  4. 华南理工大学 Python第7章课后小测-1
  5. Elasticsearch6.2服务器升配后的bug
  6. ProxySQL(5):线程、线程池、连接池
  7. 分布式安装部署MinIO
  8. 新版本中的hits.total匹配数说明
  9. GitLab 之 PlantUML 的配置及使用
  10. 记录一次Bitbucket鉴权的坑