逆数補間の計算方法について

このQ&Aのポイント
  • 逆数補間(Inverse Interpolation)とは、逆関数を近似するために使用される方法です。
  • 逆数補間を使うと、与えられた関数の根やゼロを求めることができます。
  • 逆数補間の計算方法は、与えられた値のテーブルから補間多項式を作り、逆補間を行うことで求めることができます。
回答を見る
  • ベストアンサー

逆数補間の計算方法について

こんにちは。前にも書かせてもらいましたが、どうしても計算ができないので、もう一度質問させてもらいました。 以下のような、洋書を読んで、最後にあるP(y)を出したいのですが、計算方法がわかりません。 ---------------------------------------------------------------- [Inverse Interpolation] A process called inverse interpolation is often used to approximate an inverse function. Suppose that values {Yi}=f({Xi}) have been computed at X0,X1,...,Xn. Using table Y ; Y0 Y1 Y2 ......Yn X ; X0 X1 X2 ......Xn we form the interpolation polynomial p(y)=Σ(i=1→n)CiΠ(j=0→i-1){Y-Yj} The orijinal relationship, y=f(x), has an inverse, under certain conditions. This inverse is being approximated by x=p(y). Procedures Coef and Eval can be used to carry out the inverse interpolation by reversing the arguments x and y in the calling sequence for Coef. Inverse interpolation can be used to find where a given functuin f has a root or zero. This means inverting the equation f(x)=0. We propose to do this by creating a table of values (f(Xi),Xi) and interpolating with a polynomial,p. Thus, p(Yi)=Xi. The points Xi should be chosen near the unknown root,r. The approximate root is then given by r ~p(0). For a concrete case, let the table of known values be Y;-0.5789200,-0.3626370,-0.1849160,-0.0340642,0.0969858 X; 1.0 , 2.0 , 3.0 , 4.0 , 5.0 The nodes in this problem are the points in the row of the table headed y, and the function values being interpolated are in the x row. The resulting polynomial is p(Y)=0.25Y^4+1.2Y^3+3.69Y^2+7.39Y+4.247470086 and p(0)=4.247470086. Only the last coefficient is shown with all the digits carried in the calculation, for it is the only one needed for the problem at hand. ---------------------------------------------------------------- <補足>CoefとEvalについて 「 procedure; Coef(n,{Xi},{Yi},{Ai}) real array; {Xi}0:n, {Yi}0:n, {Ai}0:n integer; i,j,n for i=0 to n do {Ai}←{Yi} end for for j=1 to n do for i=n to j step -1 do Ai←({Ai}-{Ai-1})/({Xi}-{Xi-j}) end for end for end procedure Coef 」 「 real function; Eval(n,{Xi},{Yi},{Ai}) real array; {Xi}0:n, {Ai}0:n integer; i,n real;t,temp temp←An for i=n-1 to 0 step -1 do temp←(temp)(t-{Xi})+{Ai} end for Eval←temp end function Eval」 ------------------------------------------------------------- XとYを扱い方がよくわかっていないので、計算できないのかなあと思います。分かる方、アドバイスお願いします(泣)

質問者が選んだベストアンサー

  • ベストアンサー
noname#101087
noname#101087
回答No.4

切れぎれですみません。 >Y;-0.5789200,-0.3626370,-0.1849160,-0.0340642,0.0969858 >X; 1.0 , 2.0 , 3.0 , 4.0 , 5.0 > ......... >p(Y)=0.25Y^4+1.2Y^3+3.69Y^2+7.39Y+4.247470086 >---------------------------------------------------------------- ><補足>CoefとEvalについて >.......... >------------------------------------------------------------- >XとYを扱い方がよくわかっていないので、計算できないのかなあと思います。.... Coef と Eval は良さそうにみえます。 ただ、Coef で求めているのは、  P4(x) = A0 + A1(x - x0) + A2(x - x0)(x - x1) + A3(x - x0)(x - x1)(x - x2) + A4(x - x0)(x - x1)(x - x2)(x - x3) の係数{A0, A1, .... , A4}ですね。(Eval を見ても明らかです) つまり、[Inverse Interpolation]の例である  p(Y)=0.25Y^4+1.2Y^3+3.69Y^2+7.39Y+4.247470086 の係数が Coef の結果と違うのは当然なのです。  (1) [Inverse Interpolation]に例示された対応表 {Xi,Yi} の X,Y を入れ替え  (2) 上記の P4(x) を算出  (3) P4(x) をふつうの多項式に展開 すれば、引用の p(Y) になるでしょう。 そこまでやらずとも、Coef で求めた係数{A0, A1, .... , A4} を使い Eval で計算してみれば、対応表 {Xi,Yi} と合っているか否か はわかるはずですが....。

その他の回答 (3)

noname#101087
noname#101087
回答No.3

>procedure; Coef(n, {Xi}, {Yi}, {Ai}) >...... >for i=0 to n do >{Ai}←{Yi} >end for >for j=1 to n do >for i=n to j step -1 do >Ai←({Ai}-{Ai-1})/({Xi}-{Xi-j}) >end for >...... ------------------- 参考までに Coef における{Ai}(差分商表)の書き換えをスケッチしてみます。 「多分」OK だと思います。 (1) 係数は、小文字(ai)が計算途中、大文字(Ai)が計算結果、と区別。 (2) Xn-Xm=dnm と略記。 j =0  j =1             j =2 ---  ---             --- Y0  Y0=A0 Y1  (Y1-Y0)/d10=A1 Y2  (Y2-Y1)/d21=a2       (a2-A1)/d20=A2 ....... Yn  (Yn-Y<n-1>)/dn<n-1>=an

noname#101087
noname#101087
回答No.2

Newton 補間の書き忘れです。 下記ページなど、参考になりませんか? ------------------------------------  http://www.activebasic.com/aba/wiki.cgi?Newton%28%a5%cb%a5%e5%a1%bc%a5%c8%a5%f3%29%ca%e4%b4%d6 >Newton(ニュートン)補間

noname#101087
noname#101087
回答No.1

>最後にあるP(y)を出したいのですが、計算方法がわかりません。 引っかかりポイントか P(Y) の作り方らしいので、まとめてみましょう。 (QNo.2980931 & QNo.2980811 の繰り返しですが.... ) (0) 補間表。   Y0=-0.5789200, Y1=-0.3626370, Y2=-0.1849160, Y3=-0.0340642, Y4=0.0969858   X0=1.0, X1=2.0, X2=3.0, X3=4.0, X4=5.0 (1) 補間多項式の作成。   X=P4(Y)=0.2504105*Y^4+1.2156411*Y^3+3.6940309*Y^2+7.3892454*Y+4.2474700  当方は、EXCEL シートで作りました。  Lagrange 補間公式をそのまま使ってます。(記号 X, Y は入れ替わってます)  一例。Y0 にてX0 になり、ほかの{X1, X2, X3, X4}では零になる多項式は   Q0(Y)=A0*(X-X1)*(X-X2)*(X-X3)*(X-X4)  です。A0 は、Q0(Y0)=X0 となるように算定します。  同様に、Q1(Y), Q2(Y), Q3(Y), Q4(Y) を求め、すべてを合計したのが上記の P(Y) です。  EXCEL シートだと、Q0(Y)用の式をコピーして{Q1(Y), Q2(Y), Q3(Y), Q4(Y)} を楽に作れるのです。  (EXCEL シートは、一覧性が良くミスを見つけ易い)  シーケンシャルなプログラムの場合は、Newton 補間公式のほうがコンパクトになるでしよう。(結果は同じになります)

関連するQ&A

  • 逆関数の補間について

    こんにちは。前に質問させてもらい、計算については 理解できました。しかし、以下の文章のある部分の意味がわかりません。まず、文章は、 [Inverse Interpolation] A process called inverse interpolation is often used to approximate an inverse function. Suppose that values {Yi}=f({Xi}) have been computed at X0,X1,...,Xn. Using table Y ; Y0 Y1 Y2 ......Yn X ; X0 X1 X2 ......Xn we form the interpolation polynomial p(y)=Σ(i=1→n)CiΠ(j=0→i-1){Y-Yj} The orijinal relationship, y=f(x), has an inverse, under certain conditions. This inverse is being approximated by x=p(y). Procedures Coef and Eval can be used to carry out the inverse interpolation by reversing the arguments x and y in the calling sequence for Coef. Inverse interpolation can be used to find where a given functuin f has a root or zero. This means inverting the equation f(x)=0. We propose to do this by creating a table of values (f(Xi),Xi) and interpolating with a polynomial,p. Thus, p(Yi)=Xi. The points Xi should be chosen near the unknown root,r. The approximate root is then given by r ~p(0). For a concrete case, let the table of known values be Y;-0.5789200,-0.3626370,-0.1849160,-0.0340642,0.0969858 X; 1.0 , 2.0 , 3.0 , 4.0 , 5.0 The nodes in this problem are the points in the row of the table headed y, and the function values being interpolated are in the x row. The resulting polynomial is p(Y)=0.25Y^4+1.2Y^3+3.69Y^2+7.39Y+4.247470086 and p(0)=4.247470086. Only the last coefficient is shown with all the digits carried in the calculation, for it is the only one needed for the problem at hand. ---------------------------------------------------------------- <補足>CoefとEvalについて 「 procedure; Coef(n,{Xi},{Yi},{Ai}) real array; {Xi}0:n, {Yi}0:n, {Ai}0:n integer; i,j,n for i=0 to n do {Ai}←{Yi} end for for j=1 to n do for i=n to j step -1 do Ai←({Ai}-{Ai-1})/({Xi}-{Xi-j}) end for end for end procedure Coef 」 「 real function; Eval(n,{Xi},{Yi},{Ai}) real array; {Xi}0:n, {Ai}0:n integer; i,n real;t,temp temp←An for i=n-1 to 0 step -1 do temp←(temp)(t-{Xi})+{Ai} end for Eval←temp end function Eval」 ------------------------------------------------------------- です。この文章の 「The orijinal relationship, y=f(x), has an inverse, under certain conditions. This inverse is being approximated by x=p(y). Procedures Coef and Eval can be used to carry out the inverse interpolation by reversing the arguments x and y in the calling sequence for Coef. Inverse interpolation can be used to find where a given functuin f has a root or zero. This means inverting the equation f(x)=0. We propose to do this by creating a table of values (f(Xi),Xi) and interpolating with a polynomial,p. Thus, p(Yi)=Xi. The points Xi should be chosen near the unknown root,r. The approximate root is then given by r ~p(0).」 という部分が理解できません。わかる方アドバイスお願いします(泣)

  • 逆数補間についての内容です。

    こんにちは。 私は、大学生で、補間についての勉強をしているものです。今回、始めて、洋書を読むことになり苦戦しております。以下の内容はどういったものなのでしょうか?アドバイスをいただきたいと思い、書かせてもらいました。 _______________________________________________________________ [Inverse Interpolation] A process called inverse interpolation is often used to approximate an inverse function. Suppose that values {Yi}=f({Xi}) have been computed at X0,X1,...,Xn. Using table Y ; Y0 Y1 Y2 ......Yn X ; X0 X1 X2 ......Xn we form the interpolation polynomial p(y)=Σ(i=1→n)CiΠ(j=0→i-1){Y-Yj} The orijinal relationship, y=f(x), has an inverse, under certain conditions. This inverse is being approximated by x=p(y). Procedures Coef and Eval can be used to carry out the inverse interpolation by reversing the arguments x and y in the calling sequence for Coef. Inverse interpolation can be used to find where a given functuin f has a root or zero. This means inverting the equation f(x)=0. We propose to do this by creating a table of values (f(Xi),Xi) and interpolating with a polynomial,p. Thus, p(Yi)=Xi. The points Xi should be chosen near the unknown root,r. The approximate root is then given by r ~p(0). For a concrete case, let the table of known values be Y;-0.5789200,-0.3626370,-0.1849160,-0.0340642,0.0969858 X; 1.0 , 2.0 , 3.0 , 4.0 , 5.0 The nodes in this problem are the points in the row of the table headed y, and the function values being interpolated are in the x row. The resulting polynomial is p(Y)=0.25Y^4+1.2Y^3+3.69Y^2+7.39Y+4.247470086 and p(0)=4.247470086. Only the last coefficient is shown with all the digits carried in the calculation, for it is the only one needed for the problem at hand. ________________________________________________________________ 自分で計算しても、p(Y)=0.25Y^4+1.2Y^3+3.69Y^2+7.39Y+4.247470086 となりません(泣) 

  • 補間についてのプログラム。

    こんにちは。補間についての本を読んでいての質問なのですが、 ---------------------------------------------------------- program: Main integer parameter: n ←9 real array: {Xi}0;n , {Yi}0;n , {Ai}0;n integer: j,k,n real: e,h,p h←1.6875/n for; k=0 to n do Xk←k×h Yk←sin(Xk) end for call; Coef(n,{Xi},{Yi},{Ai}) output; {Ai} for; j=0 to 4×n do t←(j×h)/4 p←Eval(n,{Xi}(n),{Ai}(n), t) e←| sin(t)-p | output; j,t,p,e end for: end proguram Main ---------------------------------------------- とあったのですが、どのように訳していけばよいのでしょうか??アドバイスお願いします!

  • ニュートンの補間多項式と差分商の計算について

    こんにちは。下のようなプログラムについての質問です。 ---------------------------------------------------------------- program: Main  (1)integer parameter: n ←9   real array: {Xi}0;n , {Yi}0;n , {Ai}0;n   integer: j,k,n   real: e,h,p   h←1.6875/n   for; k=0 to n do   Xk←k×h   Yk←sin(Xk)   end for  (2)call; Coef(n,{Xi},{Yi},{Ai})   output; {Ai}  (3)for; j=0 to 4×n do   t←(j×h)/4   p←Eval(n,{Xi}(n),{Ai}(n), t)   e←| sin(t)-p |   output; j,t,p,e   end for:  end proguram Main --------------------------------------------------------------- 自分で調べた結果、 (1)について、  Y,Xの点を表に書いて表した。 (2)について、  Coefというのは、差分商計算(ニュートン補間公式の係数)をしなさいという意味。 (3)について、  Evalというのは、値を求めること。 ---------------------------------------------------------------- このプログラムについて質問があります。    1つ目は、(2)の差分商の計算は、全て求める必要はありますか??計算が莫大なので、できるのか不安です。 2つ目は、(3)は、最終的には、[0,1,6875]の範囲にある等間隔の10個の点についてと37個の点についてのニュートンの補間多項式p(x)として、sin(x)とP(x)の誤差を求めているとおもいますが、実際の計算がわかりません。アドバイスお願いします。  

  • プログラムに内容と計算の質問です。

    こんにちは。 補間多項式についての、コンピュータのプログラムの解読に困っています。内容は、 「For the numerical experiments suggested in the computer problems, the following two procedures should be satisfactory. The first is called Coef. It requires as input the number n and tabular values in the array {Xi} and {Yi}. Remember that the number of points in the table is n+1. The procedure then computes the coefficients required in the Newton interpolating polynomial, storing them in the array{Ai}. -------------------------------------------------------- procedure; Coef(n,{Xi},{Yi},{Ai}) real array; {Xi}0:n, {Yi}0:n, {Ai}0:n integer; i,j,n for i=0 to n do {Ai}←{Yi} end for for j=1 to n do for i=n to j step -1 do Ai←({Ai}-{Ai-1})/({Xi}-{Xi-j}) end for end for end procedure Coef --------------------------------------------------------- このプログラムのn=3の時を考えるとき、  (1)j=1のとき、i=3,2,1 <j=1,i=1> {A1}=({A1}-{A0})/({X1}-{X0}) =({Y1}-{Y0})/({X1}-{X0}) <i=1,i=2> {A2}=({A2}-{A1})/({X2}-{X1}) =({Y2}-{Y1})/({X2}-{X1}) <i=1,i=3> {A3}=({A3}-{A2})/({X3}-{X2}) =({Y3}-{Y2})/({X3}-{X2}) (2)j=2のとき、i=3,2 <j=2,i=1> A1=({A2}-{A1})/({X2}-{X0})          ={[({Y2}-{Y1})/({X2}-{X1})]-[({Y1}-{Y0})/({X1}-{X0})]}/({X2}-{X0}) =この式変形をしたいのですが、どのように         すれば良いのかわかりません。ラグランジェ         型になりそうでなりません(泣)         (1)で求めた{A1},{A2},{A3}を使って求めな         いといけないみたいです。 見にくい表し方で申し訳ありません。 アドバイスお願いします!!

  • ラグランジェとエルミート補間についての質問です。

    こんにちは。質問の内容は、以下の文章についてです。 「Lagrange Form In principle, formulas akin to the Lagrange interpolation formula can be developed for Hermite interpolation. We shall present one such formula that pertains to an important special case. As before, let the nodes be X1,X2,...,Xn, and let us assume that at each node a function value and the first derivative have been prescribed. The polynomial p that we seek must satisfy these equation: p(Xi)=Ci0 p'(Xi)=Ci1 (0=<i<=n) ・・・・(1) In analogy with the Lagrange formula, we write p(X)=Σ(i=0→n)Ci0×Ai(X)+Σ(i=0→n)Ci1×Bi(X)・・・・(2)」 という文章なのですが、Σ(i=0→n)Ci1×Bi(X)がよく理解できません>< エルミート補間が理解できていないからでしょうか??アドバイスお願いします。

  • 三次補間を使った近似値の求め方

    三次補間でf(x) = sinh(x)の近似を求めたいです。 f(0) = 0.0000、f(1) = 1.1752 f′(0) = 1.0000 、f′(1) = 1.15431 の値が与えられている状態です。 この場合、f(0.5)は三次補間(cubic interpolation)の求め方はこれで正しいのでしょうか? p(x_i) = y_iとp(x_i + h) = y_i + h*y_i'より f(0.5) = f(0+0.5) = y_0 + (0.5)*y_0' = 0.000 + 0.5*1.000 = 0.5 よってf(0.5) = 0.5 補間の手法が沢山あって少しこんがらがっています。 ただ、sinh(0.5) =0.522・・・なので有っていそうなのですが 間違っていたら教えてください><お願いします><

  • VBAで、複素数の多項式展開がしたい

    はじめまして 初めて質問させていただきます。 私は、VBAにて10次程度の多項式 (X-A-Bi)(X-C-Di)…   (1) を α10*x^10+α9*x^9…    (2) に展開したく、プログラムを製作しています。 (1)の解が実数のみ(A、C)の場合の 展開は製作することができました。 ----------------------------------------- Sub tenkai() Dim ji As Integer Dim A(10) As Double Dim X(11) As Double ji = Cells(1, 2).Value '次数の入力 For i = 0 To ji A(i) = Cells(3, 12 - i) '解の入力 X(i) = 1 Next i X(0) = A(1) For n = 2 To ji X(n) = X(n - 1) X(n) = X(n - 1) For i = n - 1 To 1 Step -1 X(i) = X(i - 1) + A(n) * X(i) Next i X(0) = A(n) * X(0) Next n For i = 0 To ji Cells(8, 12 - i) = X(i) Next i End Sub ------------------------------------- 上記は、正負は逆になるのですが、一応の答えは出ます。 しかし、これに複素数を考慮したところ、 まったく間違った解が出てきてしまいます。 ------------------------------------- Sub tenkai2() Dim ji As Integer Dim Ar(10) As Double Dim Ai(10) As Double Dim Xr(11) As Double Dim Xi(11) As Double ji = Cells(1, 2).Value '次数の入力 For i = 0 To ji Ar(i) = Cells(3, 12 - i) '解の入力(実数) Ai(i) = Cells(4, 12 - i) '解の入力(複素数) Xr(i) = 1 Xi(i) = 0 Next i Xr(0) = Ar(1) Xi(0) = Ai(1) For n = 2 To ji Xr(n) = Xr(n - 1) Xi(n) = Xi(n - 1) For i = n - 1 To 1 Step -1 Xr(i) = Xr(i - 1) + Ar(n) * Xr(i) - Ai(n) * Xi(i) Xi(i) = Xi(i - 1) + Ar(n) * Xi(i) + Ai(i) * Xr(i) Next i Xr(0) = Ar(n) * Xr(0) - Ai(n) * Xi(0) Xi(0) = Ar(n) * Xi(0) + Ai(n) * Xr(0) Next n For i = 0 To ji Cells(8, 12 - i) = Xr(i) Cells(9, 12 - i) = Xi(i) Next i End Sub -------------------------------------- 式の解はあっても、展開については解説サイトがなく、 どうしても、正解にたどりつくことができず困っています。 どなたか問題を指摘していただく事はできませんでしょうか? もしわかれば、 正負の逆転の仕方についても、教えて頂ければと思います。 C言語の解説サイトなどでも理解ができます。

  • log が入った不等式の証明

     log( Σ(xi yi) ) ≧ Σ( xi log(yi) ) (i = 1, 2, ..., n、 xi, yi ∈[0, 1] かつ Σxi = 1, Σyi = 1 ) という不等式が成り立ちますが、証明はどうすれば良いのでしょうか? たとえば、「 log(x1 y1 + x2 y2) ≧ x1 log(y1) + x2 log(y2) 」を x1, y1 に、[0,1]の範囲でいろいろな数値を当てはめて電卓で計算すると、確かにかならず正になります。[0,1]を超えると成立しません。 左辺ー右辺 = log(x1 y1 + x2 y2) ー (x1 log(y1) + x2 log(y2)) をやろうとしたのですが、これ以上前に進めないんですよね。特に、i = 1,2, ..., n ですし。 よろしくお願いいたします。

  • BASIC言語  分散の出し方

    BASIC言語の問題が分からないので、教えてください。 分散がうまく出せません(+o+) 下に問題と自分の回答を張り付けたので、お願いしますm(__)m <演習問題2> 最小二乗法(直線のあてはめ)を用いて回帰式と相関係数を算出する。 作成手順:   1. READ~DATA 文によるデータの配列変数への読み込み   2. Xi の和、Yi の和、Xi の平均値 (Xav) 、Yi の平均値 (Yav) の算出   3. (Xi -Xav)^2 の和、(Yi -Yav)^2 の和、(Xi -Xav)(Yi -Yav) の和の算出   4. y=a*x+bのa, b, r(相関係数) の算出 テストデータと計算結果  データ数:4    X Y    Xの平均 2.5    1 5    Yの平均 8     傾き a=1.6    2 8    Xの分散 1.25   切片 b=4    3 9    Yの分散 3.5   相関係数 r=0.956    4 10    共分散  2 下が自分の回答です。 5 READ n > DIM A(2,N) > 10 FOR i=1 TO 2 > 15 LET S=0 > 20 FOR j=1 TO n > 30 READ A(i,j) > 40 LET s=s+a(i,j) > 50 NEXT j > 60 LET h=s/n > 70 IF i=1 THEN > PRINT h,bunsan > ELSEIF i=2 THEN > PRINT h,bunsan > END if > 75 NEXT i > 80 DATA 4 > 90 DATA 1,2,3,4 > DATA 5,8,9,10 > END