ValueAt()
the value alone -- no tape walk, which is what a line search wants
Exemples de base (2)
oF = new stzMathFunction("x^3 - 2*x", [ "x" ])
? oF.ValueAt([ 2 ])4
exécuté le 2026-10-02 04:25 dans la bibliothèque au commit 0e72e2e2c ; tiré de 14-the-derivative-that-checks.en.md(s'ouvre dans un nouvel onglet)
oG = new stzMathFunction("x*y + y^2", [ "x", "y" ])
? oG.ValueAt([ 2, 3 ])
? @@( oG.GradientAt([ 2, 3 ]) )15 [ 3, 8 ]
exécuté le 2026-10-02 04:25 dans la bibliothèque au commit 0e72e2e2c ; tiré de 14-the-derivative-that-checks.en.md(s'ouvre dans un nouvel onglet)
Portée (2)
oF = new stzMathFunction("x*x + x*x", [ "x" ])
# f(3) = 18
? oF.ValueAt([3])
# f'(3) = 12, not 6
? oF.DerivativeAt("x", [3])
oG = new stzMathFunction("(x+y)*(x+y)", [ "x", "y" ])
# both operands of a shared node get their share
? oG.DerivativeAt("x", [2,3])
# ...and so does the other
? oG.DerivativeAt("y", [2,3])18 12 10 10
exécuté le 2026-10-02 04:23 dans la bibliothèque au commit 0e72e2e2c ; tiré de numeric_autodiff_narrated.ring(s'ouvre dans un nouvel onglet)
acV = [ "a", "b", "c", "d", "e1", "f", "g1", "h", "i", "j" ]
oF = new stzMathFunction("a+2*b+3*c+4*d+5*e1+6*f+7*g1+8*h+9*i+10*j", acV)
aP = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
# the value
? oF.ValueAt(aP)
aG = oF.GradientAt(aP)
# ten gradients came back
? len(aG)
# the first is 1
? aG[1]
# the fifth is 5
? aG[5]
# the tenth is 10
? aG[10]385 10 1 5 10
exécuté le 2026-10-02 04:23 dans la bibliothèque au commit 0e72e2e2c ; tiré de numeric_autodiff_narrated.ring(s'ouvre dans un nouvel onglet)
Les extensions de cette méthode
Chaque extension, et si elle existe pour cette méthode ; une extension qui existe se compose avec les autres (FindSTCS).
Chaque exemple est un fichier de test de la bibliothèque, exécuté dans la bibliothèque pour cette page ; seuls ceux dont la sortie a tenu toutes les promesses écrites par leur fichier sont montrés. Les explications, les titres et le code sont ceux de la bibliothèque, en anglais.
Voir aussi
- La classe stzMathFunction
- La référence du domaine : Numérique et optimisation
- Les autres méthodes de ces exemples : stzMathFunction.DerivativeAt · stzMathFunction.GradientAt

