English
Source / code snippets

Polynom up to 5. Order on Meßpunkte adjust: Tanton-Vieta method

 

p.specht


Window Title "Linearer Fit, Quadradischer, kubischer, quartischer and quintischer "+\
"Parabel-Fit to method Tandon-Vieta: SCHEINT ZU KLAPPEN!"
'Q: Q5L1 of DrJames Tanton
'(CL) 2016-07 CopyLeft by P.woodpecker, Wien. No Warranty whatsoever! without each Gewähr!
Window Style 24:Window 0,0-%maxx,%maxy
var xh&=width(%hwnd)\2:var yh&=height(%hwnd)\2
declare x!,y!, x1!,y1!,x2!,y2!,x3!,y3!,x4!,y4!,x5!,y5!,x6!,y6!
var u!=20:var v!=20:var w!=30'Maßstäbe for x,y and Granularity
'Testpunkte (1. To n+1. point), The from the Polynomen n. Order To meet are:
case 0:goto "TestSet2"
x1!=0:y1!=5
x2!=10:y2!=2
x3!=3:y3!=7
x4!=8:y4!=4
x5!=-10:y5!=4
x6!=-5:y6!=-6
goto "Weiter"
Testset2:
x1!=0:y1!=5
x2!=-10:y2!=2
x3!=-3:y3!=7
x4!=-8:y4!=4
x5!=10:y5!=4
x6!=-5:y6!=-6
moreover:

proc funk1 :parameters x! ,x1!,y1!,x2!,y2!

    return y1!*(x!-x2!)/(x1!-x2!) \
    + y2!*(x!-x1!)/(x2!-x1!)

endproc

proc funk2 :parameters x! ,x1!,y1!,x2!,y2!,x3!,y3!

    return y1!*(x!-x2!)*(x!-x3!)/((x1!-x2!)*(x1!-x3!)) \
    + y2!*(x!-x1!)*(x!-x3!)/((x2!-x1!)*(x2!-x3!)) \
    + y3!*(x!-x1!)*(x!-x2!)/((x3!-x1!)*(x3!-x2!))

endproc

proc funk3 :parameters x! ,x1!,y1!,x2!,y2!,x3!,y3!,x4!,y4!

    return \
    y1!*(x!-x2!)*(x!-x3!)*(x!-x4!)/((x1!-x2!)*(x1!-x3!)*(x1!-x4!)) \
    + y2!*(x!-x1!)*(x!-x3!)*(x!-x4!)/((x2!-x1!)*(x2!-x3!)*(x2!-x4!)) \
    + y3!*(x!-x1!)*(x!-x2!)*(x!-x4!)/((x3!-x1!)*(x3!-x2!)*(x3!-x4!)) \
    + y4!*(x!-x1!)*(x!-x2!)*(x!-x3!)/((x4!-x1!)*(x4!-x2!)*(x4!-x3!))

endproc

proc funk4 :parameters x! ,x1!,y1!,x2!,y2!,x3!,y3!,x4!,y4!,x5!,y5!

    return y1!*(x!-x2!)*(x!-x3!)*(x!-x4!)*(x!-x5!)/((x1!-x2!)*(x1!-x3!)*(x1!-x4!)*(x1!-x5!)) \
    + y2!*(x!-x1!)*(x!-x3!)*(x!-x4!)*(x!-x5!)/((x2!-x1!)*(x2!-x3!)*(x2!-x4!)*(x2!-x5!)) \
    + y3!*(x!-x1!)*(x!-x2!)*(x!-x4!)*(x!-x5!)/((x3!-x1!)*(x3!-x2!)*(x3!-x4!)*(x3!-x5!)) \
    + y4!*(x!-x1!)*(x!-x2!)*(x!-x3!)*(x!-x5!)/((x4!-x1!)*(x4!-x2!)*(x4!-x3!)*(x4!-x5!)) \
    + y5!*(x!-x1!)*(x!-x2!)*(x!-x3!)*(x!-x4!)/((x5!-x1!)*(x5!-x2!)*(x5!-x3!)*(x5!-x4!))

endproc

proc funk5 :parameters x! ,x1!,y1!,x2!,y2!,x3!,y3!,x4!,y4!,x5!,y5!,x6!,y6!

    return \
    y1!*(x!-x2!)*(x!-x3!)*(x!-x4!)*(x!-x5!)*(x!-x6!)/((x1!-x2!)*(x1!-x3!)*(x1!-x4!)*(x1!-x5!)*(x1!-x6!))\
    +y2!*(x!-x1!)*(x!-x3!)*(x!-x4!)*(x!-x5!)*(x!-x6!)/((x2!-x1!)*(x2!-x3!)*(x2!-x4!)*(x2!-x5!)*(x2!-x6!))\
    +y3!*(x!-x1!)*(x!-x2!)*(x!-x4!)*(x!-x5!)*(x!-x6!)/((x3!-x1!)*(x3!-x2!)*(x3!-x4!)*(x3!-x5!)*(x3!-x6!))\
    +y4!*(x!-x1!)*(x!-x2!)*(x!-x3!)*(x!-x5!)*(x!-x6!)/((x4!-x1!)*(x4!-x2!)*(x4!-x3!)*(x4!-x5!)*(x4!-x6!))\
    +y5!*(x!-x1!)*(x!-x2!)*(x!-x3!)*(x!-x4!)*(x!-x6!)/((x5!-x1!)*(x5!-x2!)*(x5!-x3!)*(x5!-x4!)*(x5!-x6!))\
    +y6!*(x!-x1!)*(x!-x2!)*(x!-x3!)*(x!-x4!)*(x!-x5!)/((x6!-x1!)*(x6!-x2!)*(x6!-x3!)*(x6!-x4!)*(x6!-x5!))

endproc

'---------------------------------------------------------
Cls
usepen 0,1,0:line 0,yh& - 2*xh&,yh&:line xh&,0 - xh&,2*yh&
usepen 0,6,rgb(0,0,255)
line xh&+u!*x1!,(yh&-v!*y1!) - xh&+u!*x1!+1,(yh&-v!*y1!):drawtext xh&+u!*x1!,yh&-v!*y1!-26,"1"
line xh&+u!*x2!,(yh&-v!*y2!) - xh&+u!*x2!+1,(yh&-v!*y2!):drawtext xh&+u!*x2!,yh&-v!*y2!-26,"2"
line xh&+u!*x3!,(yh&-v!*y3!) - xh&+u!*x3!+1,(yh&-v!*y3!):drawtext xh&+u!*x3!,yh&-v!*y3!-26,"3"
line xh&+u!*x4!,(yh&-v!*y4!) - xh&+u!*x4!+1,(yh&-v!*y4!):drawtext xh&+u!*x4!,yh&-v!*y4!-26,"4"
line xh&+u!*x5!,(yh&-v!*y5!) - xh&+u!*x5!+1,(yh&-v!*y5!):drawtext xh&+u!*x5!,yh&-v!*y5!-26,"5"
line xh&+u!*x6!,(yh&-v!*y6!) - xh&+u!*x6!+1,(yh&-v!*y6!):drawtext xh&+u!*x6!,yh&-v!*y6!-26,"6"
usepen 0,2,rgb(255,0,0)

whileloop -1000,1000:x!=&Loop/w!

    y!=funk1(x!, x1!,y1!,x2!,y2!)
    line xh&+u!*x!,(yh&-v!*y!) - xh&+u!*x!+1,(yh&-v!*y!)

endwhile

usepen 0,2,rgb(255,200,0)

whileloop -1000,1000:x!=&Loop/w!

    y!=funk2(x!, x1!,y1!,x2!,y2!,x3!,y3!)
    line xh&+u!*x!,(yh&-v!*y!) - xh&+u!*x!+1,(yh&-v!*y!)

endwhile

usepen 0,2,rgb(255,0,200)

whileloop -1000,1000:x!=&Loop/w!

    y!=funk3(x!, x1!,y1!,x2!,y2!,x3!,y3!,x4!,y4!)
    line xh&+u!*x!,(yh&-v!*y!) - xh&+u!*x!+1,(yh&-v!*y!)

endwhile

usepen 0,2,rgb(0,100,250)

whileloop -1000,1000:x!=&Loop/w!

    y!=funk4(x!, x1!,y1!,x2!,y2!,x3!,y3!,x4!,y4!,x5!,y5!)
    line xh&+u!*x!,(yh&-v!*y!) - xh&+u!*x!+1,(yh&-v!*y!)

endwhile

usepen 0,4,rgb(100,100,100)

whileloop -1000,1000:x!=&Loop/w!

    y!=funk5(x!, x1!,y1!,x2!,y2!,x3!,y3!,x4!,y4!,x5!,y5!,x6!,y6!)
    case &Loop=-1000:moveto xh&+u!*x!,(yh&-v!*y!)
    lineto xh&+u!*x!,(yh&-v!*y!)

endwhile

sound 2000,50
waitinput
 
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
05/20/21  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.455 Views

Untitledvor 0 min.
p.specht11/23/21
R.Schneider11/20/21
Uwe Lang11/20/21
Manfred Barei11/19/21
More...

Themeninformationen

this Topic has 1 subscriber:

p.specht (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie