PJ:二次函数三点式

已知二次函数过三个点 $(x1,y1)$ , $(x2,y2)$ , $(x3,y3)$ 求函数的解析式。

你还在 高斯消元 ?!

二次函数的三点式表示法,让你远离 $EPS$ 蒙不对的烦恼。

$f(x)$ $=$ $\frac{(x-x_{2})(x-x_{3})}{(x_{1}-x_{2})(x_{1}-x_{3})}*y_{1}$ $+$ $\frac{(x-x_{1})(x-x_{3})}{(x_{2}-x_{1})(x_{2}-x_{3})}*y_{2}$ $+$ $\frac{(x-x_{1})(x-x_{2})}{(x_{3}-x_{1})(x_{3}-x_{2})}*y_{3}$

$f(x)$ $=$ $\frac{x^{2}-(x_{2}+x_{3})x+x_{2}x_{3}}{(x_{1}-x_{2})(x_{1}-x_{3})}*y_{1}$ $+$ $\frac{x^{2}-(x_{1}+x_{3})x+x_{1}x_{3}}{(x_{2}-x_{1})(x_{2}-x_{3})}*y_{2}$ $+$ $\frac{x^{2}-(x1+x2)x+x_{1}x_{2}}{(x_{3}-x_{1})(x_{3}-x_{2})}*y_{3}$

我们发现,分母通分的话,拆分后在以 $x^{n}$ 为关键字合并同类项可得。

ps:懒得打LATEX,所以部分过程省略。

$(x_{1}-x_{2})(x_{1}-x_{3})(x_{2}-x_{3})f(x)$ $=$ $[x_{1}(y_{3}-y_{2})+x_{2}(y_{1}-y_{3})+x_{3}(y_{2}-y{1})]*x^{2}$ $+$ $[x_{1}^{2}(y_{2}-y_{3})+x_{2}^{2}(y_{3}-y_{1})+x_{3}^{2}(y_{1}-y{2})]*x$ $+$ $x_{2}x_{3}y_{1}*(x_{2}-x_{3})+x_{1}x_{3}y_{2}*(x_{3}-x_{1})+x_{1}x_{2}y_{3}*(x_{1}-x_{2})$

这样的话,各个系数就直接出来了嘛。。。如果我们让 $x_{1}>=x_{2}>=x_{3}$ 的话就更好了。

二次项系数:

$\frac{[x_{1}(y_{3}-y_{2})+x_{2}(y_{1}-y_{3})+x_{3}(y_{2}-y{1})]}{(x_{1}-x_{2})(x_{1}-x_{3})(x_{2}-x_{3})}$

一次项系数:

$\frac{[x_{1}^{2}(y_{2}-y_{3})+x_{2}^{2}(y_{3}-y_{1})+x_{3}^{2}(y_{1}-y{2})]}{(x_{1}-x_{2})(x_{1}-x_{3})(x_{2}-x_{3})}$

常数项:

$\frac{x_{2}x_{3}y_{1}*(x_{2}-x_{3})+x_{1}x_{3}y_{2}*(x_{3}-x_{1})+x_{1}x_{2}y_{3}*(x_{1}-x_{2})}{(x_{1}-x_{2})(x_{1}-x_{3})(x_{2}-x_{3})}$

好了。就解到这里吧。剩下的东西就交给 $DEVC++$ 来做了。


发表于 2018-03-19 21:46:36 in 未分类