# Best way to count outputs for a 2D polynomial function along the curve of an implicit equation

7 views (last 30 days)
David Gillcrist on 8 Sep 2023
Edited: David Gillcrist on 8 Sep 2023
I have a 2D polynomial function given by , I also I have a contour for this function . I would like find what the distribution of outputs are along this curve for a given discretization of the domain. What would be the best approach about doing this? Please note, the polynomial my be very high in degree ( > 12) with losts monomials, though most of the base functions have a coefficient of near zero, so the polynomial could be well approximated with much fewer base terms.

John D'Errico on 8 Sep 2023
Edited: John D'Errico on 8 Sep 2023
Um, good luck at doing it at all well. Even anything in the right ball park would be a success. But you won't know how well you did either.
A big problem is that while yes, you have a contour line. But that contour will be defined by a set of points along a broken curve. And worse, it will have been generated using linear interpolation, and be piecewise linear between those points in (x,y). So what you call a contour line is actually only an approximation to the true contour line. I won't even ask where the contour line came from, or how far you can trust that.
This means, at best, you only know roughly where that contour line actually lies. Regardless, then you have a nasty polynomial function, of high degree, with MANY terms. Tiny perturbations in the contour line will introduce large deviations in the value of that function P(x,y). Do you see where I'm going?
And, of course, how did you generate that multinomial P(x,y)? Odds are, you used regression techniques, itself fraght with problems for high degree polynomials.
Hey, good luck.
Just generate a zillion points along the contour, then evaluate the polynomial P(x,y) at each point. But, as I said, I would not trust the result in the slightest.
David Gillcrist on 8 Sep 2023
The polynomial is a the directional field of Polynomial Chaos Expansion for a differential model. The calculated relative error between the PCE and the model is on the order of . The directional field is calculated very preciely as well. If understand correctly, the a given contour would basically be linear splines. I will note that I am dealing with a high degree polynomial with lots of terms, but most of the term coefficients are near zero. Overall, the polynomial is very "well-behaved" it's just that the expansion is just technically rather long when counting all the trivial base functions. How would I generate points along the contour.

### Categories

Find more on Contour Plots in Help Center and File Exchange

R2022a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!