Code: Alles auswählen
Procedure.f Function(x.f)
ProcedureReturn (((x - 2) * x + 3) * x - 1)
EndProcedure
Procedure.f Diff(*Function, x.f, eps.f)
Protected h.f, m.f, y.f, m_old.f
h = 1
Repeat
m_old = m
;folgende Zeile sollte das selbe machen
;m = (CallFunctionFast(*Function, x + h) - CallFunctionFast(*Function, x - h)) / (2 * h)
;wie diese:
m = (Function(x + h) - Function(x - h)) / (2 * h)
h * 0.5
Until Abs(m_old - m) < eps
ProcedureReturn m
EndProcedure
s.s = ""
For a.l = -10 To 10
s + StrF(Diff(@Function(), a / 10, 0.001)) + #CRLF$
Next
MessageRequester("Ableitung", s)
richtig zurecht.