C中的符号多项式插值 [英] Symbolic Polynomial Interpolator in C

查看:72
本文介绍了C中的符号多项式插值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个快速的C程序,它需要n + 1对值

(整数)(a_i,f(a_i)),i = 0,...,n,生成系数

\ alpha_i,i = 0,...,n,n的多项式拟合这些

点,然后输出不确定的多项式表格

\sum_i = 0 ^ n \alpha_i X ^ i,其中X只是一些不确定的。


任何提示?


谢谢

I am looking for a quick C program that takes n+1 pairs of values
(integers) (a_i, f(a_i)), i=0,...,n, generates the coefficients
\alpha_i, i=0,...,n of the polynomial of degree n that fits these
points and then outputs the polynomial with indeterminant in the form
\sum_i=0^n\alpha_i X^i, where X is just some indeterminant.

Any hints?

Thanks

推荐答案

文章< 11 ************ *********@f14g2000cwb.googlegroups。 com>,

< da ********** @ csfb.com>写道:
In article <11*********************@f14g2000cwb.googlegroups. com>,
<da**********@csfb.com> wrote:
我正在寻找一个快速的C程序,它需要n + 1对值
(整数)(a_i,f(a_i)),i = 0,..., n,生成适合这些点的n次多项式的系数
\ alpha_i,i = 0,...,n,然后以
的形式输出具有不确定性的多项式\sum_i = 0 ^ n \alpha_i X ^ i,其中X只是一些不确定的。
任何提示?
I am looking for a quick C program that takes n+1 pairs of values
(integers) (a_i, f(a_i)), i=0,...,n, generates the coefficients
\alpha_i, i=0,...,n of the polynomial of degree n that fits these
points and then outputs the polynomial with indeterminant in the form
\sum_i=0^n\alpha_i X^i, where X is just some indeterminant. Any hints?




你不需要进行符号操作。

http://mathworld.wolfram.com/Condensation.html
http://mathworld.wolfram.com/Gauss-J...imination.html
http://mathworld.wolfram.com/GaussianElimination.html

-

熵是概率的对数 - Boltzmann



You don''t want a symbolic manipulation for that.

http://mathworld.wolfram.com/Condensation.html
http://mathworld.wolfram.com/Gauss-J...imination.html
http://mathworld.wolfram.com/GaussianElimination.html
--
Entropy is the logarithm of probability -- Boltzmann



da ********** @ csfb.com 写道:
I我正在寻找一个快速的C程序,需要n + 1对值
(整数)(a_i,f(a_i)),i = 0,...,n,生成系数
\ alpha_i,i = 0,...,n为n次多项式的n在这些点上,然后以不确定的形式输出多项式,形式为
\sum_i = 0 ^ n \alpha_i X ^ i,其中X只是一些不确定的。
任何提示?
I am looking for a quick C program that takes n+1 pairs of values
(integers) (a_i, f(a_i)), i=0,...,n, generates the coefficients
\alpha_i, i=0,...,n of the polynomial of degree n that fits these
points and then outputs the polynomial with indeterminant in the form
\sum_i=0^n\alpha_i X^i, where X is just some indeterminant.

Any hints?




这不是一个C问题。


你确定要这样做吗? br />

你确定你想要插值多项式

不是拟合多项式吗?


你知道吗?系数值

非常可能是不精确的,可能毫无意义?


如果是这样,你可以找到执行此操作的代码(例如来自Numerical Recipes in C的常规

polcos(你需要写出

输出位,但这很容易))。


总的来说,我怀疑你真的想要这样做,

但我可能错了。


我建议你在sci中寻求帮助。 num-analysis,但是

一定要问你想做什么,而不是你想要怎么做

来做。


-William Hughes



This is not really a C question.

Are you sure you want to do this?

Are you sure you want the interpolating polynomial
not a fitted polynomial?

Do you know that the calculated values of the coefficients
are very likely to be inexact and may be meaningless?

If so you can find code that does this (e.g. the routine
polcos from Numerical Recipes in C, (you need to write the
output bit but this is easy)).

On the whole I doubt that you really want to do this,
but I could be wrong.

I suggest you ask for help in sci.num-analysis, but be
sure to ask about what you want to do, not how you want
to do it.

-William Hughes


感谢您的链接。我想到了牛顿的分歧差异

方法,或拉格朗日的公式,我不确定如何计算

行列式在这里有用,但我会认为关于它。无论如何,我遇到的主要问题是:b $ b难度正在形成输出。牛顿的方法,其中
似乎是两者中的计算好的,很快给出了

系数\ lambda_i,其中poly适合(a_i, f(a_i))是由\ rada_0 + \ lambda_1(X-a_0)+ \ lambda_2给出的


(X-a_0)(X-a_1)+ ... + \\\\\\\\\\•(X-a_ {0-1})。但要以

的形式获取它的形式\sum_i = 0 ^ n \alpha_i X ^ i我需要通过并简化上面的

。 (对于这个特殊的

例子,我可能会硬编码。但是,一个侧面的问题当然是否有人看到过这样的C代码?b $ b可以象征性地处理这个问题?它是对于这个例子来说可能有点过分了,

但我总体上很好奇。)好的,但是一旦我们拥有了\ alpha_,那么令人尴尬的问题就是

,我们如何格式化它漂亮的所需

表格?我很想看到一些实际的代码。

谢谢。

Thanks for the links. I have in mind Newton''s divided difference
approach, or Lagrange''s formula and I am not sure how calculating the
determinant is useful here but I will think about it. Anyway, the major
difficulty I am having is formating the output. Newton''s method, which
appears to be the computably nicer of the two, quickly gives the
coefficients \lambda_i, where the poly which fits the (a_i,f(a_i)) is
given by \lamda_0+\lambda_1 (X-a_0)+\lambda_2
(X-a_0)(X-a_1)+...+\lambda_n (X-a_0)...(X-a_{n-1}). But to get it in
the form \sum_i=0^n\alpha_i X^i I need to multiply through and simplify
the above. (I would could hard code this in for this particular
example. But, a side question is of course has anyone seen C code that
could handle this symbolically? It is likely overkill for this example,
but I am curious in general.) Okay, but the embarassing question is
once we have the \alpha_i, how to we format it pretty in the desired
form? I would love to see some actual code.
Thanks.


这篇关于C中的符号多项式插值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆