こんにちは、いくつかのデータがあります。これらのデータをポリノムに適合させたいと思います。まず、次のようにすべきだと思います: ax^2 +bx+c および x+x1=-b/a ;x*x1=c/a そして、私はこれを書きましたコード:
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
void createfunction(double x,double x1)
{
int a,b,c;
double x2 = 1.0;
a=1;
b=(-a)*(x+x1);
c=a*(x*x1);
// int denklem=a*x2*x2+b*x2+c;
cout<<a<<"x^2+"<<b<<"x+"<<c<<endl;
// cout<<denklem;
//derive(a)
}
int main(int argc, char** argv) {
createfunction(100,101);
return 0;
}
それはうまくいっていますが、私はこの方法が完全に間違っていることを理解できます:(これらを読んだ後http://mathbitsnotebook.com/Algebra1/StatisticsReg/ST2FittingFunctions.html https://en.wikipedia.org/wiki/Polynomial_regression
しかし、私はこのコードをcでどのように書くことができるかわかりません.