Action:
|
Computes where a law is the minimum over a given interval.
|
|
Filename:
|
kern/kern_scm/law_scm.cxx
|
|
Syntax:
|
(law:nmin law low-lim up-lim)
|
|
Arg Types:
|
law
|
law | string | real | position |
|
|
|
par-pos | gvector
|
|
low-lim
|
real
|
|
up-lim
|
real
|
|
Returns:
|
real
|
|
Description:
|
law:nmin computes where a law is the minimum over a given interval.
|
|
|
law can be a defined law, a law string, or a constant number.
|
|
|
low-lim and
up-lim are two real values that specify the interval.
|
|
Example:
|
; law:nmin
|
|
; Define a simple law to find minimum.
|
|
(law:nmin "x^2+x" -1 1)
|
|
;; -0.5
|
|
|
; Another Example.
|
|
; Create the points for a test curve.
|
|
(define plist (list (position 0 0 0)
|
|
|
(position 20 20 20) (position -20 20 20)
|
|
|
(position 0 0 0)))
|
|
;; plist
|
|
(define start (gvector 1 1 1))
|
|
;; start
|
|
(define end (gvector 1 1 1))
|
|
;; end
|
|
(define testcur (edge:spline plist start end))
|
|
;; testcur
|
|
; Create a curve law.
|
|
(define curlaw
|
|
|
(law "map(term(cur(edge1),1),edge1)"
|
|
|
testcur))
|
|
;; curlaw
|
|
; Find its minimum.
|
|
(define min (law:nmin curlaw 0 1))
|
|
;; min
|
|
; Plot and mark that point.
|
|
(define minpoint (dl-item:point
|
|
|
(curve:eval-pos testcur min)))
|
|
;; minpoint
|
|
(dl-item:display minpoint)
|
|
;; ()
|
|
; OUTPUT Result
|
|
|
|
|
Figure 14-2. law:nmin - Minimum Point on a Test Curve
|