Título de la ventana "Linearer Fit, Quadradischer, kubischer, quartischer y quintischer "+\
"Parabel-Fit después de Método Tandon-Vieta: SCHEINT ZU KLAPPEN!"
'Q: Q5L1 de DrJames Tanton
'(CL) 2016-07 CopyLeft by P.Pájaro carpintero, Wien. No Warranty whatsoever! Ohne jede Gewähr!
Ventana de Estilo 24:Ventana 0,0-%maxx,%maxy
var xh&=width(%hwnd)\2:var yh&=height(%hwnd)\2
declarar 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 para x,y y Granularity
'Testpunkte (1. a n+1. Punkt), el de los Polynomen n. Orden a treffen son:
caso 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
Weiter:
proc funk1 :parámetros x! ,x1!,y1!,x2!,y2!
volver y1!*(x!-x2!)/(x1!-x2!) \
+ y2!*(x!-x1!)/(x2!-x1!)
ENDPROC
proc funk2 :parámetros x! ,x1!,y1!,x2!,y2!,x3!,y3!
volver 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 :parámetros x! ,x1!,y1!,x2!,y2!,x3!,y3!,x4!,y4!
volver \
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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(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!)
caso &Loop=-1000:moveto xh&+u!*x!,(yh&-v!*y!)
lineto xh&+u!*x!,(yh&-v!*y!)
endwhile
sound 2000,50
waitinput