| |
|
|
p.specht
| Interpolation supply always exakte values on whom Stützstellen. the distinguish tappt im dunkeln from the Approximation, The attempts, so-called Ausgleichskurven between many Messdaten with geringstem Error einzupassen.
an Interpolation through konvergente Kettenbruch-development has following strength: Rationale functions can already on Base of few Stützstellen so develops go, that good Näherungen existieren; a excellently Variant the undertow. Thiele'sche Kettenbruch. The here found (in the wahrsten senses the Wortes) "Bruchstücke" go outputted, subsequently can x-values association go, circa Zwischenwerte between whom Stützstellen abzufragen. as demonstration watts on File-I/O waived. without each Gewähr:
Window Title "Interpolation through konvergente Kettenbruchentwicklung"
Window Style 24:randomize:font 2:set("decimals",17)
'{ Interpolation through Kettenbruchentwicklung
'*************************************************************
'* Interpolate a function F(x) by continuous fractions *
'* --------------------------------------------------------- *
'* SAMPLE RUN: *
'* (Interpolate function e(x) between x=0 and x=2) *
'* *
'* Number of points: 3 *
'* X, Y: 0,1 *
'* X, Y: 1,2.71828 *
'* X, Y: 2,7.38906 *
'* *
'* Coefficients D(k): *
'* D(0) = 1.000000 *
'* D(1) = 0.581977 *
'* D(2) = -3.718271 *
'* *
'* X = 1.5 *
'* *
'* For X = 1.5 Y = 4.351909 *
'* *
'* --------------------------------------------------------- *
'* Ref.: "Methodes de calcul numerique, Tome 2 By Claude *
'* Nowakowski, PSI Edition, 1984" [BIBLI 04]. *
'* *
'* Basic Release By J-P Moreau, Paris. *
'* (www.jpmoreau.fr) *
'*************************************************************
'* *
'* XProfan-Version by 2014-10 by P.woodpecker, Wien *
'* *
'}************************************************************
CLS rnd(8^8)
Declare n1&,n&,m&,K&,L&,xxx!,yyy!,DD!,DL!,XX!,s!
PRINT "\n amount Stützwerte: ";:INPUT n1& :print
N&=n1&-1
Declare X![N&],Y![N&],D![N&]
'Read data from screen
whileloop 0,n&:k&=&Loop
print " X("+st$(k&)+") = ";
input xxx!
X![K&]=xxx!
print tab(20);" Y("+st$(k&)+") = ";
input yyy!
Y![K&]=yyy!
endwhile
'Calculate coefficients D(k)
whileloop 0,n&:k&=&Loop
D![K&] = Y![K&]
endwhile
M&=N&
whileloop m&:L&=&Loop
whileloop L&,N&:K&=&Loop
DD! = (X![K&]-X![L&-1])/(D![K&]-D![L&-1])
IF K&<>L&
D![K&]=DD!
ELSE
DL!=DD!
ENDIF
endwhile
D![L&]=DL!
endwhile
'print coefficients
PRINT
PRINT " Koeffizienten D(k):"
whileloop 0,n&:k&=&Loop
PRINT " D[";K&; "] = ";
PRINT stature$("%g",D![K&])
endwhile
REPEAT
'Interpolate for X=XX
PRINT
print " X = ",:Input XX!
'Evaluate continuous fraction
s!=(XX!-X![N&-1])/D![N&]
whileloop n&-1,1,-1:k&=&Loop
s!=(XX!-X![K&-1])/(D![K&]+s!)
endwhile
s!=s!+D![0]
case %csrlin>23:cls rnd(8^8)
PRINT
PRINT " for the inputted X=";stature$("%g",XX!);" is (your Stützwerte zugrunde- "
print " laid) the interpolation Funktionswert Y =";stature$("%g",s!)
print "---------------------------------------------------------------------"
waitinput
UNTIL 0
|
|
|
| XProfan 11Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 05/16/21 ▲ |
|
|
|