JuliaApproximation / DomainSets.jl

A Julia package for describing domains as continuous sets of elements
MIT License
72 stars 12 forks source link

support level sets #75

Closed daanhb closed 3 years ago

daanhb commented 3 years ago

The level set of a function satisfies f(x)=0, the in function could be defined as f(x) <= 0. An approximate approx_in could then be defined as f(x) <= epsilon.

dlfivefifty commented 3 years ago

What are the use cases for approx_in? I imagine that most use cases one knows that the point is already on the domain, so it would be more useful to have a custom type to enforce being in the domain, a la SphericalCoordinate:

https://github.com/JuliaApproximation/HarmonicOrthogonalPolynomials.jl/blob/e3df9fd175562d069e89f47ab4158a89d912c3c3/src/coordinates.jl#L42

Using f(x) to determine approx_in won't be very robust for "bad" f. One would ideally use the hausdorff distance but that is hard to compute. So perhaps it's fine since I don't think it needs to be used much.

daanhb commented 3 years ago

Well, at least the domain abs(f(x)) < epsilon can be generically defined. It does require some assumptions on f for it to be called approx_in in any intuitive way, so it may not be a good idea. It could be useful for an approximate plot of the domain, for example, if a bounding box is known. If we can't do anything with a level set generically in DomainSets except defining it, is that worth it?

If possible, then something like SphericalCoordinate is better, but of course that is not generic. Should we include that inside DomainSets?

daanhb commented 3 years ago

Currently, I did not implement approx_in, because it is not generically true. The functionality is in the pseudolevel function, which is not exported. We can decide what to do with it later.