Skip to main content
deleted 9 characters in body; edited title
Source Link

Finding a maximum of a BezierBézier function

supposeSuppose I have a BezierBézier function $f:\mathbb{R}^2\to\mathbb{R}$ with random coefficients:

coefs = Table[{RandomReal[]}, {i, 0, 3}, {j, 0, 3}];    
f = BezierFunction[coefs];

It seems to behave quite well:

Plot3D[f[s, t], {s, 0, 1}, {t, 0, 1}]

graph of <span class=$f$" />

Now I would like to find the maximum of $f$. However,

NMaxValue[f[s, t], {s, t} \[Element] Rectangle[{0, 0}, {1, 1}]]

only prints strange output What is wrong and how to fix it?

P.S.: Of course, I could implement BezierBézier function by myself using Bernstein polynomials etc. But since MathematicaMathematica provides this BezierFunction construct, I would like to understand it and be able to use it.

Finding a maximum of a Bezier function

suppose I have a Bezier function $f:\mathbb{R}^2\to\mathbb{R}$ with random coefficients:

coefs = Table[{RandomReal[]}, {i, 0, 3}, {j, 0, 3}];    
f = BezierFunction[coefs];

It seems to behave quite well:

Plot3D[f[s, t], {s, 0, 1}, {t, 0, 1}]

graph of <span class=$f$" />

Now I would like to find the maximum of $f$. However,

NMaxValue[f[s, t], {s, t} \[Element] Rectangle[{0, 0}, {1, 1}]]

only prints strange output What is wrong and how to fix it?

P.S.: Of course, I could implement Bezier function by myself using Bernstein polynomials etc. But since Mathematica provides this BezierFunction construct, I would like to understand it and be able to use it.

Finding a maximum of a Bézier function

Suppose I have a Bézier function $f:\mathbb{R}^2\to\mathbb{R}$ with random coefficients:

coefs = Table[{RandomReal[]}, {i, 0, 3}, {j, 0, 3}];    
f = BezierFunction[coefs];

It seems to behave quite well:

Plot3D[f[s, t], {s, 0, 1}, {t, 0, 1}]

graph of <span class=$f$" />

Now I would like to find the maximum of $f$. However,

NMaxValue[f[s, t], {s, t}  Rectangle[{0, 0}, {1, 1}]]

only prints strange output What is wrong and how to fix it?

P.S.: Of course, I could implement Bézier function by myself using Bernstein polynomials etc. But since Mathematica provides this BezierFunction construct, I would like to understand it and be able to use it.

edited tags
Link
Source Link

Finding a maximum of a Bezier function

suppose I have a Bezier function $f:\mathbb{R}^2\to\mathbb{R}$ with random coefficients:

coefs = Table[{RandomReal[]}, {i, 0, 3}, {j, 0, 3}];    
f = BezierFunction[coefs];

It seems to behave quite well:

Plot3D[f[s, t], {s, 0, 1}, {t, 0, 1}]

graph of <span class=$f$" />

Now I would like to find the maximum of $f$. However,

NMaxValue[f[s, t], {s, t} \[Element] Rectangle[{0, 0}, {1, 1}]]

only prints strange output What is wrong and how to fix it?

P.S.: Of course, I could implement Bezier function by myself using Bernstein polynomials etc. But since Mathematica provides this BezierFunction construct, I would like to understand it and be able to use it.