当前位置:网站首页>让代码解决《线性代数》系列 - 多项式求和
让代码解决《线性代数》系列 - 多项式求和
2022-07-21 05:04:00 【十里坡小白】
C语言实现: 
#include <stdio.h>
//实数域多项式求和
double Polynomial(double *COE, int N, double X) // 系数数组 最高次幂 未知数的值
{
double Qua = 1;
double Sum = 0;
for (int i = 0; i <= N; i++) // X的n次项
{
Qua = 1;
for (int j = 1; j <= N - i; j++) // 求X的n次方
{
Qua *= X;
}
Sum += *(COE + i) * Qua; // 多项式求和
}
return Sum;
}
int main()
{
int N = 0; // 最高次幂
double X = 0; // 未知数
double COE[20] = {0.0}; // 各项系数
double ret = 0; // 结果
printf("请输入最高次幂:>");
scanf("%d", &N);
for (int i = 0; i <= N; i++)
{
printf("请输入%d次幂的系数:>", N - i);
scanf("%lf", COE + i);
}
printf("请输入X的值:>");
scanf("%lf", &X);
ret = Polynomial(COE, N, X);
printf("%.3f", ret);
return 0;
}
边栏推荐
- BERT模型调用源码分析
- Yum install GCC error
- OLED(经典0.96英寸)--4SPI--SSD1306控制原理(含常用芯片_oled例程)
- UNET reproduction and environment configuration (including dataset)
- Web. Config custom class reading
- Pytorch foundation module and Practice
- Kingbase conversion time
- Overview of Bert principle
- El radio value cannot be echoed
- Exclusive locking of this profile failed. Another running VMware process may be using a profile.
猜你喜欢
使用Arduino搭建基于阿里云平台的物联网智能家居
[record] the operation of optisystem is stuck, and it is unable to click to close, input variable values and other solutions
Initializing libiomp5. dylib, but found libomp. dylib already initialized
pytorch的安装
PyTorch基础模块和实践
Amy-Tabb机器人世界手眼标定(2、实验结果)
(笔记)吴恩达深度学习L4卷积神经网络W1
Tensorflow GPU environment configuration
mask rcnn 加载权重报错
Analysis of Nacos registry principle
随机推荐
Es aggregate statistical syntax
Data consistency of Nacos registry cluster
Exclusive locking of this profile failed. Another running VMware process may be using a profile.
目标检测任务输出坐标为小数
Initializing libiomp5. dylib, but found libomp. dylib already initialized
图的邻接表及其深度优先(DFS)、广度优先(BFS)遍历
使用MATLAB GUI 设计工具开发小项目
Training and acquisition of Chinese wiki corpus
MySQL installation failed
合泰HT32 & 淘晶驰TJC--T0串口屏学习笔记
[PCB] 3.7V lithium battery -- 5V charge / discharge control circuit -- ip5306 -- drawing board notes
Onenote插件,云扩容
pycharm专业版创建flask项目|下载flask包|以及一些例子
Self attention principle
Codeforces-479A
Amy-Tabb机器人世界手眼标定(2、实验结果)
猫狗图片资源
self-attention注意力原理
cv2的相关函数
Checkpoint in the deep learning source code project