Programmeren in TI-Basic/Vierkantsvergelijking

Uit Wikibooks

We bepalen a,b en c, de coëfficiënten van de vierkantsvergelijking .

:Prompt A,B,C

Een eerste stap is de bepaling van de discriminant . Er zijn drie mogelijke waarden van deze discriminant:

  1. Groter dan nul: twee oplossingen
  2. Gelijk aan 0: één oplossing
  3. Kleiner dan nul: nul (reële) oplossingen

Op deze pagina zullen we twee vierkantsvergelijkingsoplossers geven: een oplosser die enkel de reële oplossingen geeft, en een oplosser die ook de complexe oplossingen kan vinden.

Reële oplosser[bewerken]

:B²-4AC→D
:(-B+sqrt(D))/(2A)→X
:(-B-sqrt(D))/(2A)→Y
:Disp"De oplossingen:",X,Y

Complexe oplosser[bewerken]

We moeten de rekenmachine wel eerst in "complexe modus" brengen. Eventueel kan je na de uitvoer van het programma deze instelling weer op de normale instelling zetten.

:Complex
:B²-4AC→D
:(-B+sqrt(D))/(2A)→X
:(-B-sqrt(D))/(2A)→Y
:Disp"De oplossingen:",X,Y

Uitgebreidere oplosser[bewerken]

ABC-formule[bewerken]

PROGRAM:ABC
:Disp "AX²+BX+C=0
:Prompt A,B,C
:If A=0
:Goto 2
:B²-4AC→D
:PlotsOff :FnOff :ClrDraw:AxesOff:ZStandard
:If B≥0 AND C≥0
:Text(1,1,A,"X²+",B,"X+",C,"=0
:If B<0 and C≥0
:Text(1,1,A,"X²-",-B,"X+",C,"=0
:If B≥0 and C<0
:Text(1,1,A,"X²+",B,"X-",-C,"=0
:If B<0 and C<0
:Text(1,1,A,"X²-",-B,"X-",-C,"=0
:Text(9,1,"D=B²-4AC =
:Text(15,7,"(",B,")²-4*",A,"*",C,"=",D
:If D>0
:Text(28,15,"OPLOSSINGEN:
:If D=0
:Text(28,15,"OPLOSSING:
:If D<0
:Then
:Text(28,1,"GEEN OPLOSSINGEN
:Goto 1
:End
:(-B-√(D))/(2A→E
:(-B+√(D))/(2A→F
:Text(47,1,"X=
:Text(41,6,-B,"-√(",D,")
:Line(-7.5,-5.4,-3,-5.4
:Text(49,20,2A
:Text(57,1,"X=",E
:If D=0
:Then
:Goto 1
:Else
:Text(47,38,"OF
:Text(47,50,"X=
:Text(41,55,-B,"+√(",D,")
:Line(3,-5.4,7.5,-5.4
:Text(49,70,2A
:Text(57,50,"X=",F
:End
:Lbl 1
:Pause
:ClrDraw:ZPrevious:AxesOn:ClrHome:FnOn
:Lbl 2
:Menu("TEKEN GRAFIEK?","YES",3,"NO",4
:Lbl 3
:prgmGRAPH
:Goto 6
:Lbl 4
:Menu("DEL VARS?","YES",5,"NO",6
:Lbl 5
:prgmDELVARS
:Lbl 6
:ClrHome
:Stop

Grafiek tekenen[bewerken]

PROGRAM:GRAPH
:ZStandard
:Menu("SET WINDOW","YES",9,"NO",1
:Lbl 1
:Menu("DRAW GRAPH ON?","Y1",2,"Y2",3,"Y3",
4,"Y4",5,"Y5",6,"Y6",7,"GRAPH-SCREEN",8
:Lbl 2
:"AX²+BX+C→Y1
:Goto 8
:Lbl 3
:"AX²+BX+C→Y2
:Goto 8
:Lbl 4
:"AX²+BX+C→Y3
:Goto 8
:Lbl 5
:"AX²+BX+C→Y4
:Goto 8
:Lbl 6
:"AX²+BX+C→Y5
:Goto 8
:Lbl 7
:"AX²+BX+C→Y6
:Goto 8
:Lbl 8
:DispGraph
:Pause
:Stop
:Lbl 9
:Input "XMIN",Xmin
:Input "XMAX",Xmax  <- om deze variabelen te vinden druk je op vars en kies dan voor window. Ze staan niet in de catalog.
:Input "YMIN",Ymin
:Input "YMAX",Ymax
:Goto 1

Variabelen verwijderen[bewerken]

PROGRAM:DELVARS
:DelVar A
:DelVar B
:DelVar C
:DelVar D
:DelVar E
:DelVar F
:Stop
Informatie afkomstig van https://nl.wikibooks.org Wikibooks NL.
Wikibooks NL is onderdeel van de wikimediafoundation.