[Numpy-discussion] quadratic function
Robert Kern
robert.kern at gmail.com
Thu Oct 28 09:34:18 EDT 2010
On Thu, Oct 28, 2010 at 06:38, Brennan Williams
<brennan.williams at visualreservoir.com> wrote:
> I have used both linear least squares and radial basis functions as a
> proxy equation, calculated from the results of computer simulations
> which are calculating some objective function value based on a number of
> varied input parameters.
>
> As an alternative option I want to add a quadratic function so if there
> are parameters/variables x,y,z then rather than just having a linear
> function f=a+bx+cy+dz I'll have f=a+bx+cx**2 + dxy + .... I'd like to
> have the option not to include all the different second order terms.
A = np.column_stack([
np.ones_like(x),
x, y, z,
x*x, y*y, z*z,
x*y, y*z, x*z,
])
x, res, rank, s = np.linalg.lstsq(A, f)
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the NumPy-Discussion
mailing list