procedure TTaylor.PerformDif(const Instr : word);

var k, L : integer; s : extended;

begin with DifInstructions[Instr] do

 try

 case ty of

. . . . . . . . .

 cv : case op of {Operand1 is constant, Operand2 is variable}

 nop: AuxVars[i3,N] := AuxVars[i1,N]; {nop means assignment}

 '*': AuxVars[i3,N] := AuxVars[i1,0] * AuxVars[i2,N];

 '+': AuxVars[i3,N] := AuxVars[i2,N];

 '-': AuxVars[i3,N] := - AuxVars[i2,N];

 '/': begin s := 0.0;

 for k := 0 to Pred(N) do s := s - AuxVars[i3,k]*AuxVars[i2, N-k];

 AuxVars[i3,N] := s/AuxVars[i2,0]

 end

 else raise Exception.CreateFmt(msg, [Instr, op])

 end;

 vc : case op of {Operand1 is variable, Operand2 is constant}

 #6 : begin s := 0.0; { exp : Operand2 ignored }

 for k := 0 to Pred(N) do s := s + C1[N,k]*AuxVars[i3,k]*AuxVars[i1, N-k];

 AuxVars[i3,N] := s

 end;

 #7 : begin s := AuxVars[i1,N]; { ln : Operand2 ignored }

 for k := 1 to Pred(N) do s := s - C1[N,k]*AuxVars[i3, N-k]*AuxVars[i1,k];

 AuxVars[i3,N] := s/AuxVars[i1,0]

 end;

. . . . . . . .

 #9 : begin s := 0.0; { sqrt : Operand2 ignored }

 for k := 0 to Pred(N) do s := s + C05[N,k]*AuxVars[i3,k]*AuxVars[i1, N-k];

 AuxVars[i3,N] := s/AuxVars[i1,0]

 end;

 nop: AuxVars[i3,N] := AuxVars[i1,N]; {nop means assignment}

 '*': AuxVars[i3,N] := AuxVars[i1,N] * AuxVars[i2,0];

 '+': AuxVars[i3,N] := AuxVars[i1,N];

 '-': AuxVars[i3,N] := AuxVars[i1,N];

 '/': AuxVars[i3,N] := AuxVars[i1,N] / AuxVars[i2,0];

 '^': begin s := 0.0;

 for k := 0 to Pred(N) do

 s := s + (AuxVars[i2,0]*C1[N,k] - C[N,k])*AuxVars[i3,k]*AuxVars[i1, N-k];

 AuxVars[i3,N] := s/AuxVars[i1,0]

 end

 else raise Exception.CreateFmt(msg, [Instr, op])

 end;

 vv : case op of {both operands are variables}

 nop: AuxVars[i3,N] := AuxVars[i1,N]; {nop means assignment}

 '2': begin s := 0.0; L := Pred(N) div 2; {Square is twice faster than *}

 for k := 0 to L do s := s + AuxVars[i1,k]*AuxVars[i2, N-k];

 if N mod 2 = 0 then AuxVars[i3,N] := 2.0*s + sqr(AuxVars[i1,Succ(L)])

 else AuxVars[i3,N] := 2.0*s

 end;

 '*': begin s := 0.0;

 for k := 0 to N do s := s + AuxVars[i1,k]*AuxVars[i2, N-k];

 AuxVars[i3,N] := s

 end;

 '+': AuxVars[i3,N] := AuxVars[i1,N] + AuxVars[i2,N];

 '-': AuxVars[i3,N] := AuxVars[i1,N] - AuxVars[i2,N];

 '/': begin s := AuxVars[i1,N];

 for k := 0 to Pred(N) do s := s - AuxVars[i3,k]*AuxVars[i2, N-k];

 AuxVars[i3,N] := s/AuxVars[i2,0]

 end;

 else raise Exception.CreateFmt(msg, [Instr, op])

 end

 end

 except

 raise Exception.CreateFmt(msg, [Instr, op])

 end

end;

Code Sample 1.

procedure TGraphForm.FillResultArrayOneStep(const cur : integer);

var k, i : integer; x1, y1, t, dt, dtMin, step : extended; q1, q2, tQuant : Int64;

begin t := 0.0;

with CurveSet, MyTaylor do

 begin step := Results[Succ(cur), tInd, 0] - Results[cur, tInd, 0];

 for i := 0 to PxLimitPerStep do

 begin dtMin := step; QueryPerformanceCounter(q1);

 for k := 1 to Count do with Curve[k] do

 begin

 x1 := Poly1(t, Results[cur, xInd-MainStart]);

 y1 := Poly1(t, Results[cur, yInd-MainStart]);

 if Abs(x1) > Abs(y1) then dt := ds/Abs(x1)

 else if Abs(y1) > 0 then dt := ds/Abs(y1)

 else dt := step; {here dt actually must be infinitely big}

 if dt > 0.0 then dtMin := Min(dtMin, dt);

 CnvSetPixels(Poly(t, Results[cur, xInd-MainStart]),

 Poly(t, Results[cur, yInd-MainStart]), Clr);

 end;

 t := t + dtMin;

 if t > step then Exit; {normally it exits here!}

 tQuant := Round(dtMin/tSpan*nSec*HardwereFr);

 if QueryPerformanceCounter(q2) then

 while q2 - q1 < tQuant do QueryPerformanceCounter(q2)

 else Sleep(Round(dtMin/tSpan*nSec*1000))

 end

 end

end;

Code Sample 2.