Action:
|
Evaluates a given law or law expression with the specified input and returns a gvector.
|
|
Filename:
|
kern/kern_scm/law_scm.cxx
|
|
Syntax:
|
(law:eval-vector law input)
|
|
Arg Types:
|
law
|
law | string | real | position |
|
|
|
par-pos | gvector
|
|
input
|
(entity | entity ...)) | real |
|
|
|
position | par-pos
|
|
Returns:
|
unspecified
|
|
Errors:
|
The law must return 3 values.
|
|
Description:
|
This Scheme extension evaluates the
law at the given input. It is the same as
law:eval except that it returns a
gvector instead of a real or list of reals. The output dimension of
law has to be three (3).
|
|
|
law can be a
law Scheme type or a string enclosed by double quotation marks.
law can be any combination of law functions.
|
|
|
input specifies the value(s) for evaluating the law.
|
|
Example:
|
; law:eval-vector
|
|
; Create a new law.
|
|
(define law1 (law "vec(x,x^2,-cos(x))"))
|
|
;; law1
|
|
; Evaluate the given law at 1.5 radians
|
|
(law:eval-vector law1 2)
|
|
;; #[gvector 2 4 0.416146836547142]
|
|
(define law2 (law "vec(x^2, y, 3 * z)"))
|
|
;; law2
|
|
; Evaluate the second law at some input values.
|
|
(law:eval-vector law2 (list 2 3 4))
|
|
;; #[gvector 4 3 12]
|
|
(define law3 (law "vec(a3^2,a2,a4)"))
|
|
;; law3
|
|
; When evaluating this, the law function has 4 as its
|
|
; highest input index. Thus, the input list has to
|
|
; have at least four items. Input A1 is not used in
|
|
; the law function, so the first element of list
|
|
; is not used.
|
|
; a3=3, a2=2, and a4=4. (a1=1).
|
|
(law:eval-vector law3 (list 1 2 3 4))
|
|
;; #[gvector 9 2 4]
|
|
(law:eval law3 (list 1 2 3 4))
|
|
;; (9 2 4)
|