Library: | nummath |
See also: | nmbracket |
Quantlet: | nmparabint | |
Description: | Inverse parabolic interpolation: finds the point x that is minimum/maximum of a parabola through three points (a,fa), (b,fb), (c,fc). INF is returned, if the three points are linear dependent (i.e. lying on the same line). |
Usage: | x = nmparabint(a,b,c,fa,fb,fc) | |
Input: | ||
a,b,c | n x 1 vectors; their i-th components contain three points (x coordinates), in which the function value for the i-th parabola is known. | |
fa,fb,fc | n x 1 vectors; their i-th components contain the function values in the points a[i], b[i], c[i] respectively, for the i-th parabola | |
Output: | ||
x | n x 1 vector; parabolas' minima/maxima |
library("nummath") ; nmparabint(0,1,2,2,2,4)
Contents of x [1,] 0.5
library("nummath") ; a=#(0,2,1) b=#(1,1,2) c=#(2,-1,3) fa=#(2,11,5) fb=#(2,5,6) fc=#(4,5,7) ; f1(x) = x^2 - x + 2, f2(x) = 2x^2 + 3, f3(x) = x + 4 nmparabint(a,b,c,fa,fb,fc)
Contents of x [1,] 0.5 [2,] 0 [3,] +INF