Softanza
StartFrançais
Softanza
The library documents itself · Numeric & optimization

stzMathFunction

9 own methods · 0 forms written with extensions, listed under their method

the source: base/number/stzMathFunction.ring(opens in a new tab) · All classes · The area reference: Numeric & optimization

Under each method, its extensions (Q CS XT Z ZZ IB W U): bold and ticked, it exists; struck, it does not. The extensions and what they mean

Examples: 3 come from the library's tests; 4 were composed from each method's signature and run for this page, on a fresh object, for example o1 = new stzMathFunction("x^2 + 3*x*y", [ "x", "y" ]). 2 methods have none yet. Examples run on 2026-10-03 12:54 inside the library at commit 0e72e2e2c.

Method
Explanation, as the source carries it
init
(no comment in the source: the name reads as a sentence) initno extension
Expression
(no comment in the source: the name reads as a sentence) expression
composed example
o1 = new stzMathFunction("x^2 + 3*x*y", [ "x", "y" ])
? o1.Expression()
#--> x^2 + 3*x*y
composed from the signature, run for this page
no extension
Variables
(no comment in the source: the name reads as a sentence) variables
composed example
o1 = new stzMathFunction("x^2 + 3*x*y", [ "x", "y" ])
? @@( o1.Variables() )
#--> [ "x", "y" ]
composed from the signature, run for this page
no extension
NumberOfVariables
(no comment in the source: the name reads as a sentence) number of variables
composed example
o1 = new stzMathFunction("x^2 + 3*x*y", [ "x", "y" ])
? o1.NumberOfVariables()
#--> 2
composed from the signature, run for this page
no extension
the value alone -- no tape walk, which is what a line search wants 4 examples run
oF = new stzMathFunction("x^3 - 2*x", [ "x" ])
? oF.ValueAt([ 2 ])
#--> 4
library testno extension
the gradient: one entry per variable, in the order they were named 1 examples run
oG = new stzMathFunction("x*y + y^2", [ "x", "y" ])
? oG.ValueAt([ 2, 3 ])
? @@( oG.GradientAt([ 2, 3 ]) )
#--> 15
#--> [ 3, 8 ]
library testno extension
ValueAndGradientAt
value and gradient together, because the backward pass computes both and asking for them separately evaluates the expression twice
composed example
o1 = new stzMathFunction("x^2 + 3*x*y", [ "x", "y" ])
? @@( o1.ValueAndGradientAt([ "an", "a" ]) )
#--> [ [ "value", 0 ], [ "gradient", [ 0.00, 0.00 ] ] ]
composed from the signature, run for this page
no extension
the partial derivative with respect to one named variable 4 examples run
oQ = new stzMathFunction("x^2 - 2", [ "x" ])
? oQ.DerivativeAt("x", [ 0 ])
? oQ.DerivativeAt("x", [ 1 ])
#--> 0
#--> 2
library testno extension
Free
(no comment in the source: the name reads as a sentence) freeno extension